summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2013-10-26 01:11:05 -0600
committerDan Allen <dan.j.allen@gmail.com>2013-10-26 01:23:21 -0600
commit997de61b7309ba1f5d5eb21dd85f0d44787d31b0 (patch)
tree43ab92d6aea0556c2a8babc6bc8d36b0c7a3b2c5 /Rakefile
parentdb1ad70202e58b66ba7b836f6a09ae79516ddf37 (diff)
prevent YARD from mangling command statements in README
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index ddb9ddc9..5a3f9e75 100644
--- a/Rakefile
+++ b/Rakefile
@@ -61,6 +61,18 @@ begin
require 'yard'
require 'yard-tomdoc'
require './lib/asciidoctor'
+ require './lib/asciidoctor/extensions'
+
+ # Prevent YARD from breaking command statements in literal paragraphs
+ class CommandBlockPostprocessor < Asciidoctor::Extensions::Postprocessor
+ def process output
+ output.gsub(/<pre>\$ (.+?)<\/pre>/m, '<pre class="command code"><span class="const">$</span> \1</pre>')
+ end
+ end
+ Asciidoctor::Extensions.register do |doc|
+ postprocessor CommandBlockPostprocessor
+ end
+
# register .adoc extension for AsciiDoc markup helper
YARD::Templates::Helpers::MarkupHelper::MARKUP_EXTENSIONS[:asciidoc] = %w(adoc)
YARD::Rake::YardocTask.new do |yard|
@@ -76,7 +88,6 @@ begin
--exclude backends
--exclude opal_ext
--hide-api private
- --no-highlight
-o rdoc
--plugin tomdoc
--title Asciidoctor\ API\ Documentation