Skip to content

Commit 4d307b9

Browse files
committed
resolves #71 do not force a default doctype
1 parent 3d5dbc1 commit 4d307b9

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/options.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ class Options {
9393
this.args = {
9494
'standalone': typeof this.options.standalone !== 'undefined' ? this.options.standalone : true,
9595
'backend': typeof this.options.backend !== 'undefined' ? this.options.backend : 'html5',
96-
'doctype': typeof this.options.doctype !== 'undefined' ? this.options.doctype : 'article',
9796
'safe-mode': typeof this.options.safe !== 'undefined' ? this.options.safe : 'unsafe'
9897
}
9998
if (Array.isArray(this.options.attributes)) {

test/fixtures/doctype.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
= Title
2+
:doctype: book
3+
4+
{doctype}

test/test.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Options converter', () => {
4848
it('should have default options', () => {
4949
const options = defaultOptions.parse('').options
5050
expect(options['backend']).to.equal('html5')
51-
expect(options['doctype']).to.equal('article')
51+
expect(options['doctype']).to.be.undefined()
5252
expect(options['safe']).to.equal('unsafe')
5353
expect(options['standalone']).to.be.true()
5454
expect(options['verbose']).to.equal(1)
@@ -317,3 +317,14 @@ describe('Extend', () => {
317317
expect(opts.options.attributes).to.include('foo=bar')
318318
})
319319
})
320+
321+
describe('Convert', () => {
322+
it('should convert', () => {
323+
const options = new Options().parse(['node', 'asciidoctor', `${__dirname}/fixtures/doctype.adoc`, '-s'])
324+
const asciidoctor = require('@asciidoctor/core')()
325+
let asciidoctorOptions = options.options
326+
Object.assign(asciidoctorOptions, { to_file: false })
327+
const result = asciidoctor.convertFile(`${__dirname}/fixtures/doctype.adoc`, asciidoctorOptions)
328+
expect(result).to.have.string('<p>book</p>')
329+
})
330+
})

0 commit comments

Comments
 (0)