diff options
author | Manolo Carrasco <manolo@apache.org> | 2015-09-30 11:00:48 +0200 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2015-09-30 11:00:48 +0200 |
commit | 64c9a94a470c47e1d4a457c2cb7814f1f824c34f (patch) | |
tree | 4db60f8766345056c950db76823d7c1ffe654f0e /tasks | |
parent | 85404f44f7e5c524b7edb86d2b5bbb4300bb6424 (diff) | |
download | vaadin-core-64c9a94a470c47e1d4a457c2cb7814f1f824c34f.tar.gz vaadin-core-64c9a94a470c47e1d4a457c2cb7814f1f824c34f.zip |
Do not process -embed files. Enclose files in {%raw%} annotations
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/docsite.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tasks/docsite.js b/tasks/docsite.js index e8bee7d..7e08169 100644 --- a/tasks/docsite.js +++ b/tasks/docsite.js @@ -8,7 +8,7 @@ var rsync = require('gulp-rsync'); var gutil = require('gulp-util'); var zip = require('gulp-zip'); var args = require('yargs').argv; - +var addsrc = require('gulp-add-src'); var stagingBasePath = config.paths.staging.cdn; var docPath = config.paths.staging.doc; @@ -32,17 +32,11 @@ config.components.forEach(function (n) { var componentOrg = stagingPath + '/' + n + '/demo/**'; gutil.log('Generating site documentation from ' + componentOrg + ' into ' + componentDoc); fs.mkdirsSync(componentDoc); - return gulp.src(componentOrg) + return gulp.src([componentOrg, '!**/*-embed.html']) // Remove bad tags .pipe(replace(/^.*<(!doctype|\/?html|\/?head|\/?body|meta|title).*>.*\n/img, '')) - // Uncomment metainfo - .pipe(replace(/^.*<!--[ \n]+([\s\S]*?title:[\s\S]*?)[ \n]+-->.*\n/img, '---\n$1\n---\n')) - // Remove Analytics - .pipe(replace(/^.*<script.*?ga\.js[\"'].*?<\/script>\s*?\n?/img, '')) - // Adjust location of the current component in bower_components (..) - .pipe(replace(/(src|href)=("|')\.\.(\/\w)/mg, '$1=$2../bower_components/' + n + '$3')) - // Adjust location of dependencies in bower_components (../..) - .pipe(replace(/(src|href)=("|')(.*?)\.\.\/\.\.\//mg, '$1=$2../bower_components/')) + // Uncomment metainfo, and enclose all the example in {% raw %} ... {% endraw %} to avoid liquid conflicts + .pipe(replace(/^.*<!--[ \n]+([\s\S]*?title:[\s\S]*?)[ \n]+-->.*\n([\s\S]*)/img, '---\n$1\n---\n{% raw %}\n$2\n{% endraw %}')) // Remove the section with table-of-contents .pipe(replace(/^.*<section>[\s\S]*?table-of-contents[\s\S]*?<\/section>.*\n/im, '')) // Add ids to headers, so as site configures permalinks @@ -50,6 +44,14 @@ config.components.forEach(function (n) { var id = $2.trim().toLowerCase().replace(/[^\w]+/g,'_'); return '<h' + $1 + ' id="' + id + '">' + $2 + $3; })) + // embed files are displayed as iframe, we don't remove above fragments like body + .pipe(addsrc(componentOrg + '/*-embed.html')) + // Remove Analytics + .pipe(replace(/^.*<script.*?ga\.js[\"'].*?<\/script>\s*?\n?/img, '')) + // Adjust location of the current component in bower_components (..) + .pipe(replace(/(src|href)=("|')\.\.(\/\w)/mg, '$1=$2../bower_components/' + n + '$3')) + // Adjust location of dependencies in bower_components (../..) + .pipe(replace(/(src|href)=("|')(.*?)\.\.\/\.\.\//mg, '$1=$2../bower_components/')) .pipe(gulp.dest(componentDoc)); }); |