Skip to content

Commit 84dbfb8

Browse files
authored
Asciidoctor compatibility for part of readme (#640)
Our README.asciidoc file has source listing containing asciidoc code which is rare for our books. Asciidoctor was rendering it incorrectly because of its "automatic comment detection" that it uses with callouts. It saw ``` -- <1> ``` And through "that is a SQL comment preceeding a callout so I will eat the `--`". While *normally* helpful, this is wrong when commenting on asciidoc source. I work around this by writing ``` pass:[--] <1> ``` Which spits out the desired `--` followed by a callout. To get that working I had to poke the language declaration line some, especially because AsciiDoc doesn't support the simpler Asciidoctor syntax for enabling macros inside of listings. This another thing that our `html_diff` based integration tests caught.
1 parent 2782993 commit 84dbfb8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,21 +372,21 @@ Longer `partintro` blocks should be wrapped in an
372372
http://www.methods.co.nz/asciidoc/userguide.html#X29[_open block_]
373373
which starts and ends with two dashes: `--`:
374374

375-
[source,asciidoc]
375+
["source","asciidoc",subs="attributes,callouts,macros"]
376376
----------------------------------
377377
= Part two # level 0
378378
379379
[partintro]
380380
.A partintro title
381-
-- <1>
381+
pass:[--] <1>
382382
This section may contain multiple paragraphs.
383383
384384
[float]
385-
== A header should use `[float]`
385+
== A header should use [float]
386386
387387
Everything up to the closing -- marker
388388
will be considered part of the partintro.
389-
-- <1>
389+
pass:[--] <1>
390390
391391
== Chapter title # level 2
392392

integtest/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ readme_expected_files: /tmp/readme_asciidoc
4646
<(cd /tmp/$*_asciidoctor && find * -type f | sort)
4747
# The grep -v below are for known issues with asciidoctor
4848
for file in $$(cd /tmp/$*_asciidoc && find * -type f -name '*.html' \
49-
| grep -v 'blocks\|changes\|experimental\|multi-part'); do \
49+
| grep -v 'blocks\|changes\|experimental'); do \
5050
./html_diff /tmp/$*_asciidoc/$$file /tmp/$*_asciidoctor/$$file; \
5151
done
5252

0 commit comments

Comments
 (0)