File tree Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ module Git
5
+ module Documentation
6
+ class LinkGitProcessor < Asciidoctor ::Extensions ::InlineMacroProcessor
7
+ use_dsl
8
+
9
+ named :chrome
10
+
11
+ def process ( parent , target , attrs )
12
+ prefix = parent . document . attr ( 'git-relative-html-prefix' )
13
+ if parent . document . doctype == 'book'
14
+ "<ulink url=\" #{ prefix } #{ target } .html\" >" \
15
+ "#{ target } (#{ attrs [ 1 ] } )</ulink>"
16
+ elsif parent . document . basebackend? 'html'
17
+ %(<a href="#{ prefix } #{ target } .html">#{ target } (#{ attrs [ 1 ] } )</a>)
18
+ elsif parent . document . basebackend? 'manpage'
19
+ "#{ target } (#{ attrs [ 1 ] } )"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ Asciidoctor ::Extensions . register do
27
+ inline_macro Git ::Documentation ::LinkGitProcessor , :linkgit
28
+ end
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ include ../../Makefile
22
22
23
23
XMLTO_EXTRA += --searchpath ../..
24
24
ifdef USE_ASCIIDOCTOR
25
- ASCIIDOC_EXTRA += -I../..
25
+ ASCIIDOC_EXTRA += -I../.. -I. -rasciidoctor-extensions
26
26
else
27
27
ASCIIDOC_CONF = -f ../../asciidoc.conf
28
28
endif
@@ -43,12 +43,17 @@ ifndef V
43
43
QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $(lang) $@;
44
44
endif
45
45
46
+ -include ../GIT-VERSION-FILE
47
+
46
48
$(HTML_FILTER): %.html: %.txt
47
- $(QUIET_ASCIIDOC)asciidoctor -b xhtml5 -d manpage $<
49
+ $(QUIET_ASCIIDOC)asciidoctor -b xhtml5 -d manpage -d manpage -I.. -I. -rasciidoctor-extensions \
50
+ -amanversion=$(GIT_VERSION) -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' $<
48
51
49
52
MANPAGES=$(patsubst %.txt,%.1,$(MAN_FILTER))
50
53
$(MANPAGES): %.1: %.txt
51
- $(QUIET_ASCIIDOC)asciidoctor -b manpage -d manpage -o $@ $<
54
+ $(QUIET_ASCIIDOC)asciidoctor -b manpage -d manpage -o $@ \
55
+ -I. -I.. -rasciidoctor-extensions \
56
+ -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' $<
52
57
53
58
man: $(MANPAGES)
54
59
html: $(HTML_FILTER)
You can’t perform that action at this time.
0 commit comments