From 34a79756a9d3177d4f9fa7a323570f75d8db16a6 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Mon, 1 Apr 2019 23:55:47 -0600 Subject: [PATCH] upgrade to Asciidoctor 2.0.x - 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 --- Gemfile | 2 +- lib/github/markups.rb | 1 + test/markups/README.asciidoc | 4 +- test/markups/README.hidetitle.asciidoc | 4 ++ test/markups/README.hidetitle.asciidoc.html | 3 ++ test/markups/README.toc.asciidoc | 15 +++++++ test/markups/README.toc.asciidoc.html | 46 +++++++++++++++++++++ 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 test/markups/README.hidetitle.asciidoc create mode 100644 test/markups/README.hidetitle.asciidoc.html create mode 100644 test/markups/README.toc.asciidoc create mode 100644 test/markups/README.toc.asciidoc.html diff --git a/Gemfile b/Gemfile index cbd97b7b..61920ab8 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index c900594d..ea816c75 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -32,6 +32,7 @@ 'showtitle' => '@', 'idprefix' => '', 'idseparator' => '-', + 'sectanchors' => nil, 'docname' => File.basename(filename, (extname = File.extname(filename))), 'docfilesuffix' => extname, 'outfilesuffix' => extname, diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc index d3c872f7..5f65dd2b 100644 --- a/test/markups/README.asciidoc +++ b/test/markups/README.asciidoc @@ -1,4 +1,6 @@ = Document Title +// sectanchors will be ignored +:sectanchors: == First Section @@ -7,7 +9,7 @@ Refer to <> or <>. -Navigate from {docname}{outfilesuffix} to <>. +Navigate from {docname}{outfilesuffix} to xref:another-document.asciidoc[another document]. == Another Section diff --git a/test/markups/README.hidetitle.asciidoc b/test/markups/README.hidetitle.asciidoc new file mode 100644 index 00000000..38cf76b0 --- /dev/null +++ b/test/markups/README.hidetitle.asciidoc @@ -0,0 +1,4 @@ += Not Shown +:!showtitle: + +This test verifies the author can disable the document title by adding `:!showtitle:` to the document header. diff --git a/test/markups/README.hidetitle.asciidoc.html b/test/markups/README.hidetitle.asciidoc.html new file mode 100644 index 00000000..ae6b258f --- /dev/null +++ b/test/markups/README.hidetitle.asciidoc.html @@ -0,0 +1,3 @@ +
+

This test verifies the author can disable the document title by adding :!showtitle: to the document header.

+
diff --git a/test/markups/README.toc.asciidoc b/test/markups/README.toc.asciidoc new file mode 100644 index 00000000..a8e42bdd --- /dev/null +++ b/test/markups/README.toc.asciidoc @@ -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 diff --git a/test/markups/README.toc.asciidoc.html b/test/markups/README.toc.asciidoc.html new file mode 100644 index 00000000..e6f598cf --- /dev/null +++ b/test/markups/README.toc.asciidoc.html @@ -0,0 +1,46 @@ +

Document Title

+
+
Contents
+ +
+
+

Section A

+
+
+

Subsection A-1

+ +
+
+

Subsection A-2

+ +
+
+
+
+

Section B

+
+
+

Subsection B-1

+ +
+
+

Subsection B-2

+ +
+
+