Closed ismailarilik closed 5 years ago
We have tests to verify this behavior, so I'm confident that the cited statement is correct.
Which version of Asciidoctor are you using? How are you calling Asciidoctor? It's possible that a default value is being set somewhere in your toolchain.
Output of asciidoctor -v
:
Asciidoctor 1.5.8 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.1p33 (2019-01-30 revision 66950) [x64-mingw32]) (lc:IBM857 fs:Windows-1254 in:IBM857 ex:IBM857)
I use Asciidoctor API with Guard:
require 'asciidoctor'
guard 'shell' do
watch(/^.*\.adoc$/) do
Asciidoctor.convert_file 'index.adoc', safe: :safe
end
end
I wrote this line to index.adoc
file and problem was fixed:
:docinfo: private-head
I removed this line and tried again. But script wasn't injected as I said before. Also with this line, corresponding livereload functionality worked, but without it this functionality didn't work.
You always have to set the docinfo
attribute. It's just that the value can be blank. In other words, your document needs to look like this:
:docinfo:
content of document
That's what we mean when we say that the default value (when blank) is private
. It doesn't mean the attribute is set by default.
The other option is to pass the attribute to the API:
Asciidoctor.convert_file 'index.adoc', safe: :safe, attributes: 'docinfo'
Hmm, sorry. I misunderstood. Thanks... 😄
Here there is a sentence:
But I think it is wrong. I have
index.adoc
andindex-docinfo.html
file in the same directory.index-docinfo.html
file has this content:When I tried to convert the AsciiDoc file to HTML, script was not injected.
Then I added this line to
index.adoc
:Then script was injected and worked successfully.
So I think default value changed for this directive but I don't know what it is so what I can do is opening an issue rather than fixing this and sending a PR; sorry.