asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.15k stars 500 forks source link

Unset chapter-signifier attribute not working as documented #2328

Closed johny65 closed 2 years ago

johny65 commented 2 years ago

Version: Asciidoctor PDF 2.3.0 using Asciidoctor 2.0.16

I want to remove the chapter signifier but setting :!chapter-signifier: as documentation says does not work.

With this simple document:

= Test
:doctype: book
:sectnums:
:!chapter-signifier:

== First chapter

Hello.

this is the output PDF: test.pdf. I want the output to say "1. First chapter" instead of "Chapter 1. First chapter".

mojavelinux commented 2 years ago

The correct way to turn off the chapter signifier is to set the value to empty. See https://docs.asciidoctor.org/asciidoc/latest/sections/chapters/#chapter-signifier

= Document Title
:chapter-signifier:

It's true that there is some inconsistency in Asciidoctor as to when to unset an attribute versus when to set the value to empty. For now, you'll need to follow the instructions provided by the docs to know which form to use.

johny65 commented 2 years ago

Thanks, setting it to empty works fine. But what I see in the documentation is explicitly this:

To remove the prefix, unset the chapter-signifier attribute in the document header:

:!chapter-signifier:

mojavelinux commented 2 years ago

My confirmation bias was preventing me what was seeing what is actually written. Sorry about that. When the feature got promoted to the AsciiDoc language, it got specified differently, leaving the implementation in Asciidoctor PDF outdated. So this is a bug after all.

I'll go ahead and add support for it being unset while keeping support for an empty value. In other words, I'll make it so it works either way.

Thanks for spotting this inconsistency and cutting through my doubt!

mojavelinux commented 2 years ago

I'll consider back porting this change to 2.3.x if the release of 3.0.0 gets held up.