Open padupuy opened 9 years ago
I have a similar problem generating one html file from multiple include files with embedded css using
gulp.src('arc42-template.adoc')
.pipe(asciidoctor({
safe: 'unsafe',
doctype: 'book',
header_footer: true,
attributes: ['showtitle', 'toc', 'toc-position=left']
}))
.pipe(gulp.dest('dest'));
Resulted in
node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:11782
ata = (($b = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $b).$read((($b
^
TypeError: Object IO has no method '$read'
at $Stylesheets.def.$primary_stylesheet_data
...
I currently fixed it by changing the asciidoctor-core-min.js file in _node_modules\gulp-asciidoctor\nodemodules\asciidoctor.js\dist\npm\ (first renamed asciidoctor-core.js to asciidoctor-core-min.js):
//return ((($a = self.primary_stylesheet_data) !== false && $a !== nil) ? $a : self.primary_stylesheet_data = (($b = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $b).$read((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$join($scope.STYLESHEETS_DATA_PATH, "asciidoctor.css")).$chomp());
return ((($a = self.primary_stylesheet_data) !== false && $a !== nil) ? $a : self.primary_stylesheet_data = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$read((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$join($scope.STYLESHEETS_DATA_PATH, "asciidoctor.css")).$chomp());
Then I got the next error:
fs.js:438
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'c:\stylesheets\asciidoctor.css'
Fixed it again by changing a line in asciidoctor-core-min.js:
//$opal.cdecl($scope, 'STYLESHEETS_DATA_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join($scope.DATA_PATH, "stylesheets"));
$opal.cdecl($scope, 'STYLESHEETS_DATA_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join("node_modules\\gulp-asciidoctor\\node_modules\\asciidoctor.js\\dist", "css"));
@padupuy , linkcss is a attribute. so it shoud be used as
attributes: ['showtitle', 'linkcss!']
sorry, it's not tested yet.
@dongwq thanks for your answer but I try to add the attribute parameter and it didn't work.
Here is my gulp task
gulp.task('generate-doc', function() {
var destFolder = 'target/doc/';
gulp.src('doc/**/*.adoc')
.pipe(asciidoctor({
attributes: ['showtitle', 'linkcss!']
}))
.pipe(gulp.dest(destFolder));
});
Works for me when setting the "safe" option to 'unsafe' (not false).
.pipe(asciidoctor({
safe: 'unsafe',
attributes: ['showtitle', 'linkcss!']
}))
@patlau when I add the safe argument, I got the same kind of problem as you
\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:9
primary_stylesheet_data=(null==(d=a.Object._scope.IO)?a.cm("IO"):d).$read((nul
^
TypeError: Object IO has no method '$read'
at g.j.$primary_stylesheet_data (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:9:22247)
at g.j.$embed_primary_stylesheet (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:9:22439)
at h.j.$document (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:4:19377)
at h.$opal.defn.TMP_1 (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\node_modules\opal-npm-wrapper\index.js:1793:21)
at h.i.$convert (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:4:8231)
at i.o.$convert (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:6:18069)
at OpalModule.b._proto.$convert (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\node_modules\asciidoctor.js\dist\npm\asciidoctor-core.min.js:10:29517)
at Transform._transform (D:\Ws\Ci_Iznogoud\node_modules\gulp-asciidoctor\index.js:47:30)
at Transform._read (_stream_transform.js:179:10)
at Transform._write (_stream_transform.js:167:12)
This should work now. Use the Asciidoctor option 'standalone'. Please recheck.
Which option can I set to embed asciidoctor css to my generated html ? I try to set linkcss to true, but without success.
I also try to find an option to copy the asciidoctor css in the same destination folder but it still to be "./asciidoctor.css"
Here is my code