diff options
-rw-r--r-- | Documentation/Makefile | 4 | ||||
-rw-r--r-- | Documentation/asciidoctor-extensions.rb | 28 |
2 files changed, 29 insertions, 3 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile index 2057a3536..b21e5808b 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -179,9 +179,7 @@ ASCIIDOC = asciidoctor ASCIIDOC_CONF = ASCIIDOC_HTML = xhtml5 ASCIIDOC_DOCBOOK = docbook45 -ifdef ASCIIDOCTOR_EXTENSIONS_LAB -ASCIIDOC_EXTRA = -I$(ASCIIDOCTOR_EXTENSIONS_LAB) -rasciidoctor/extensions -rman-inline-macro -endif +ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;' DBLATEX_COMMON = endif diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb new file mode 100644 index 000000000..ec83b4959 --- /dev/null +++ b/Documentation/asciidoctor-extensions.rb @@ -0,0 +1,28 @@ +require 'asciidoctor' +require 'asciidoctor/extensions' + +module Git + module Documentation + class LinkGitProcessor < Asciidoctor::Extensions::InlineMacroProcessor + use_dsl + + named :chrome + + def process(parent, target, attrs) + if parent.document.basebackend? 'html' + prefix = parent.document.attr('git-relative-html-prefix') + %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>\n) + elsif parent.document.basebackend? 'docbook' + "<citerefentry>\n" \ + "<refentrytitle>#{target}</refentrytitle>" \ + "<manvolnum>#{attrs[1]}</manvolnum>\n" \ + "</citerefentry>\n" + end + end + end + end +end + +Asciidoctor::Extensions.register do + inline_macro Git::Documentation::LinkGitProcessor, :linkgit +end |