From 64c9a94a470c47e1d4a457c2cb7814f1f824c34f Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Wed, 30 Sep 2015 11:00:48 +0200 Subject: [PATCH] Do not process -embed files. Enclose files in {%raw%} annotations --- tasks/docsite.js | 22 ++++++++++++---------- 1 file 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/img, '---\n$1\n---\n')) - // Remove Analytics - .pipe(replace(/^.*\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]*)/img, '---\n$1\n---\n{% raw %}\n$2\n{% endraw %}')) // Remove the section with table-of-contents .pipe(replace(/^.*
[\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 '' + $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(/^.*\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)); }); -- 2.39.5