asciidoctor / gulp-asciidoctor

gulp-asciidoctor
https://www.npmjs.com/package/@asciidoctor/gulp-asciidoctor
14 stars 8 forks source link

Backend 'docbook5' does not work #29

Closed henriette-einstein closed 3 years ago

henriette-einstein commented 3 years ago

Steve Anderson reported an issue in the mailing list.

Just tested the backend option with docbook5 and still saw html5 output.

const gulp = require('gulp')
//const asciidoctor = require('gulp-asciidoctor')
const asciidoctor = require('@henriette-einstein/gulp-asciidoctor')

function processAdocFiles (cb) {
    gulp.src('./content/**/*.adoc')
        .pipe(asciidoctor({
            backend: 'docbook5'            
        }))
        .pipe(gulp.dest('./output'))
    cb()
             }

    function copyImages(cb) {
        gulp.src('./content/**/*.png')
            .pipe(gulp.dest('./output'))
        cb()
    }

    exports.process = gulp.parallel(processAdocFiles, copyImages)

Is there a step to add a backend and register it?

The first tests have confirmed that error.

henriette-einstein commented 3 years ago

Found a type in index.js

  asciidoctorOptions.backend = options.backed || 'html5' // defaults to html5

The 'n' is missing in options.backed! It should read

  asciidoctorOptions.backend = options.backend || 'html5' // defaults to html5
henriette-einstein commented 3 years ago

Now I get an error from the underlying engine

/Users/arpablo/newgit/gulp-asciidoctor/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:16149
        } else { throw $err; }
                 ^
constructor [NotImplementedError]: asciidoctor: FAILED: missing converter for backend 'docbook5'. Processing aborted.
    at Opal.send (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/asciidoctor-opal-runtime/src/opal.js:1671:19)
    at Function.$exception (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/asciidoctor-opal-runtime/src/opal.js:4962:14)
    at constructor.$raise (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/asciidoctor-opal-runtime/src/opal.js:4650:31)
    at constructor.$update_backend_attributes (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:8954:18)
    at constructor.$initialize (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:7780:16)
    at Object.Opal.send (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/asciidoctor-opal-runtime/src/opal.js:1671:19)
    at Function.$new (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/asciidoctor-opal-runtime/src/opal.js:3607:12)
    at /Users/arpablo/newgit/gulp-asciidoctor/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:16114:43
    at Function.$load (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:16115:26)
    at Function.$convert (/Users/arpablo/newgit/gulp-asciidoctor/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:16255:18)
henriette-einstein commented 3 years ago

Found solution in

https://github.com/asciidoctor/asciidoctor.js/issues/479

henriette-einstein commented 3 years ago

Bug is fixed by including https://github.com/asciidoctor/asciidoctor-docbook.js and by registering the Docbook Converter. If no file extension is given, it defaults to '.xml'

Testcase has been added Doku has been updated