Skip to content

Commit

Permalink
upgrade to Asciidoctor 2.0.x
Browse files Browse the repository at this point in the history
- upgrade to Asciidoctor 2.0.x (starting with 2.0.5)
- switch to fuzzy version match for asciidoctor gem
- disable sectanchors (since they get removed by the sanitizer anyway)
- use formal xref macro for interdocument xref in test
- add test for toggling the document title using showtitle/!showtitle
- add test to verify toc is generated at top of document when toc attribute is set
  • Loading branch information
mojavelinux committed Apr 2, 2019
1 parent 24d25cb commit 34a7975
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ gem "org-ruby", "= 0.9.9"
gem "creole", "~>0.3.6"
gem "wikicloth", "=0.8.3"
gem "twitter-text", "~> 1.14"
gem "asciidoctor", "= 1.5.6.1"
gem "asciidoctor", "~> 2.0.5"
gem "rake"
1 change: 1 addition & 0 deletions lib/github/markups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'showtitle' => '@',
'idprefix' => '',
'idseparator' => '-',
'sectanchors' => nil,
'docname' => File.basename(filename, (extname = File.extname(filename))),
'docfilesuffix' => extname,
'outfilesuffix' => extname,
Expand Down
4 changes: 3 additions & 1 deletion test/markups/README.asciidoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
= Document Title
// sectanchors will be ignored
:sectanchors:

== First Section

Expand All @@ -7,7 +9,7 @@

Refer to <<another-section>> or <<another-section-1>>.

Navigate from {docname}{outfilesuffix} to <<another-document#,another document>>.
Navigate from {docname}{outfilesuffix} to xref:another-document.asciidoc[another document].

== Another Section

Expand Down
4 changes: 4 additions & 0 deletions test/markups/README.hidetitle.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= Not Shown
:!showtitle:

This test verifies the author can disable the document title by adding `:!showtitle:` to the document header.
3 changes: 3 additions & 0 deletions test/markups/README.hidetitle.asciidoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<p>This test verifies the author can disable the document title by adding <code>:!showtitle:</code> to the document header.</p>
</div>
15 changes: 15 additions & 0 deletions test/markups/README.toc.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
= Document Title
:toc:
:toc-title: Contents

== Section A

=== Subsection A-1

=== Subsection A-2

== Section B

=== Subsection B-1

=== Subsection B-2
46 changes: 46 additions & 0 deletions test/markups/README.toc.asciidoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<h1>Document Title</h1>
<div>
<div>Contents</div>
<ul>
<li>
<a href="#section-a">Section A</a>
<ul>
<li><a href="#subsection-a-1">Subsection A-1</a></li>
<li><a href="#subsection-a-2">Subsection A-2</a></li>
</ul>
</li>
<li>
<a href="#section-b">Section B</a>
<ul>
<li><a href="#subsection-b-1">Subsection B-1</a></li>
<li><a href="#subsection-b-2">Subsection B-2</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h2>Section A</h2>
<div>
<div>
<h3>Subsection A-1</h3>

</div>
<div>
<h3>Subsection A-2</h3>

</div>
</div>
</div>
<div>
<h2>Section B</h2>
<div>
<div>
<h3>Subsection B-1</h3>

</div>
<div>
<h3>Subsection B-2</h3>

</div>
</div>
</div>

0 comments on commit 34a7975

Please sign in to comment.