Skip to content
Snippets Groups Projects
Commit 4e87701f authored by Jean-Noël Avila's avatar Jean-Noël Avila
Browse files

Merge branch 'asciidoctor-extension'

parents f739239b a26d455f
No related branches found
No related tags found
No related merge requests found
require 'asciidoctor'
require 'asciidoctor/extensions'
module Git
module Documentation
class LinkGitProcessor < Asciidoctor::Extensions::InlineMacroProcessor
use_dsl
named :chrome
def process(parent, target, attrs)
prefix = parent.document.attr('git-relative-html-prefix')
if parent.document.doctype == 'book'
"<ulink url=\"#{prefix}#{target}.html\">" \
"#{target}(#{attrs[1]})</ulink>"
elsif parent.document.basebackend? 'html'
%(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>)
elsif parent.document.basebackend? 'manpage'
"#{target}(#{attrs[1]})"
end
end
end
end
end
Asciidoctor::Extensions.register do
inline_macro Git::Documentation::LinkGitProcessor, :linkgit
end
......@@ -22,7 +22,7 @@ include ../../Makefile
XMLTO_EXTRA += --searchpath ../..
ifdef USE_ASCIIDOCTOR
ASCIIDOC_EXTRA += -I../..
ASCIIDOC_EXTRA += -I../.. -I. -rasciidoctor-extensions
else
ASCIIDOC_CONF = -f ../../asciidoc.conf
endif
......@@ -43,12 +43,17 @@ ifndef V
QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $(lang) $@;
endif
-include ../GIT-VERSION-FILE
$(HTML_FILTER): %.html: %.txt
$(QUIET_ASCIIDOC)asciidoctor -b xhtml5 -d manpage $<
$(QUIET_ASCIIDOC)asciidoctor -b xhtml5 -d manpage -d manpage -I.. -I. -rasciidoctor-extensions \
-amanversion=$(GIT_VERSION) -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' $<
MANPAGES=$(patsubst %.txt,%.1,$(MAN_FILTER))
$(MANPAGES): %.1: %.txt
$(QUIET_ASCIIDOC)asciidoctor -b manpage -d manpage -o $@ $<
$(QUIET_ASCIIDOC)asciidoctor -b manpage -d manpage -o $@ \
-I. -I.. -rasciidoctor-extensions \
-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' $<
man: $(MANPAGES)
html: $(HTML_FILTER)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment