Merge branch 'bc/use-asciidoctor-opt'
authorJunio C Hamano <gitster@pobox.com>
Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)
Asciidoctor, an alternative reimplementation of AsciiDoc, still
needs some changes to work with documents meant to be formatted
with AsciiDoc. "make USE_ASCIIDOCTOR=YesPlease" to use it out of
the box to document our pages is getting closer to reality.

* bc/use-asciidoctor-opt:
Documentation: implement linkgit macro for Asciidoctor
Makefile: add a knob to enable the use of Asciidoctor
Documentation: move dblatex arguments into variable
Documentation: add XSLT to fix DocBook for Texinfo
Documentation: sort sources for gitman.texi
Documentation: remove unneeded argument in cat-texi.perl
Documentation: modernize cat-texi.perl
Documentation: fix warning in cat-texi.perl

1  2 
Documentation/Makefile
Makefile
diff --combined Documentation/Makefile
index a9fb497b837dd39673ab7105774ad61ecbf67a6f,b21e5808b1972c420752f0f6277826713cbeed5f..b5be2e2d3f5c8ade04fa81ddb5b24a8747838cdc
@@@ -120,6 -120,7 +120,7 @@@ INSTALL_INFO = install-inf
  DOCBOOK2X_TEXI = docbook2x-texi
  DBLATEX = dblatex
  ASCIIDOC_DBLATEX_DIR = /etc/asciidoc/dblatex
+ DBLATEX_COMMON = -p $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.xsl -s $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.sty
  ifndef PERL_PATH
        PERL_PATH = /usr/bin/perl
  endif
@@@ -173,6 -174,16 +174,16 @@@ ifdef GNU_ROF
  XMLTO_EXTRA += -m manpage-quote-apos.xsl
  endif
  
+ ifdef USE_ASCIIDOCTOR
+ ASCIIDOC = asciidoctor
+ ASCIIDOC_CONF =
+ ASCIIDOC_HTML = xhtml5
+ ASCIIDOC_DOCBOOK = docbook45
+ ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
+ ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
+ DBLATEX_COMMON =
+ endif
  SHELL_PATH ?= $(SHELL)
  # Shell quote;
  SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
@@@ -337,7 -348,7 +348,7 @@@ manpage-base-url.xsl: manpage-base-url.
  
  user-manual.xml: user-manual.txt user-manual.conf
        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 -      $(TXT_TO_XML) -d article -o $@+ $< && \
 +      $(TXT_TO_XML) -d book -o $@+ $< && \
        mv $@+ $@
  
  technical/api-index.txt: technical/api-index-skel.txt \
@@@ -368,13 -379,14 +379,14 @@@ user-manual.texi: user-manual.xm
  
  user-manual.pdf: user-manual.xml
        $(QUIET_DBLATEX)$(RM) $@+ $@ && \
-       $(DBLATEX) -o $@+ -p $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.xsl -s $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.sty $< && \
+       $(DBLATEX) -o $@+ $(DBLATEX_COMMON) $< && \
        mv $@+ $@
  
- gitman.texi: $(MAN_XML) cat-texi.perl
+ gitman.texi: $(MAN_XML) cat-texi.perl texi.xsl
        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
-       ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
-               --to-stdout $(xml) &&) true) > $@++ && \
+       ($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml)+ texi.xsl $(xml) && \
+               $(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml)+ && \
+               rm $(xml)+ &&) true) > $@++ && \
        $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
        rm $@++ && \
        mv $@+ $@
diff --combined Makefile
index 108d3731fcefc2abb0f593704794b95fd2c09c5c,24e35dd74f90cf1887b789b5f0b6a59694b441d0..8e4081e0619f8a9927a3a4c544048f576a194fd0
+++ b/Makefile
@@@ -250,6 -250,12 +250,12 @@@ all:
  # apostrophes to be ASCII so that cut&pasting examples to the shell
  # will work.
  #
+ # Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
+ # documentation.
+ #
+ # Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
+ # Extensions Lab if you have it available.
+ #
  # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
  #
  # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
  # is a simplified version of the merge sort used in glibc. This is
  # recommended if Git triggers O(n^2) behavior in your platform's qsort().
  #
 +# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
 +# compatible with the one described in C11 Annex K.
 +#
  # Define UNRELIABLE_FSTAT if your system's fstat does not return the same
  # information on a not yet closed file that lstat would return for the same
  # file after it was closed.
  #
  # Define NATIVE_CRLF if your platform uses CRLF for line endings.
  #
 -# Define XDL_FAST_HASH to use an alternative line-hashing method in
 -# the diff algorithm.  It gives a nice speedup if your processor has
 -# fast unaligned word loads.  Does NOT work on big-endian systems!
 -# Enabled by default on x86_64.
 -#
  # Define GIT_USER_AGENT if you want to change how git identifies itself during
  # network interactions.  The default is "git/$(GIT_VERSION)".
  #
@@@ -525,10 -533,12 +531,10 @@@ SCRIPT_LIB += git-sh-setu
  SCRIPT_LIB += git-sh-i18n
  
  SCRIPT_PERL += git-add--interactive.perl
 -SCRIPT_PERL += git-difftool.perl
  SCRIPT_PERL += git-archimport.perl
  SCRIPT_PERL += git-cvsexportcommit.perl
  SCRIPT_PERL += git-cvsimport.perl
  SCRIPT_PERL += git-cvsserver.perl
 -SCRIPT_PERL += git-relink.perl
  SCRIPT_PERL += git-send-email.perl
  SCRIPT_PERL += git-svn.perl
  
@@@ -884,7 -894,6 +890,7 @@@ BUILTIN_OBJS += builtin/diff-files.
  BUILTIN_OBJS += builtin/diff-index.o
  BUILTIN_OBJS += builtin/diff-tree.o
  BUILTIN_OBJS += builtin/diff.o
 +BUILTIN_OBJS += builtin/difftool.o
  BUILTIN_OBJS += builtin/fast-export.o
  BUILTIN_OBJS += builtin/fetch-pack.o
  BUILTIN_OBJS += builtin/fetch.o
@@@ -1420,11 -1429,6 +1426,11 @@@ ifdef INTERNAL_QSOR
        COMPAT_CFLAGS += -DINTERNAL_QSORT
        COMPAT_OBJS += compat/qsort.o
  endif
 +ifdef HAVE_ISO_QSORT_S
 +      COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
 +else
 +      COMPAT_OBJS += compat/qsort_s.o
 +endif
  ifdef RUNTIME_PREFIX
        COMPAT_CFLAGS += -DRUNTIME_PREFIX
  endif
@@@ -1487,6 -1491,10 +1493,6 @@@ ifndef NO_MSGFMT_EXTENDED_OPTION
        MSGFMT += --check --statistics
  endif
  
 -ifneq (,$(XDL_FAST_HASH))
 -      BASIC_CFLAGS += -DXDL_FAST_HASH
 -endif
 -
  ifdef GMTIME_UNRELIABLE_ERRORS
        COMPAT_OBJS += compat/gmtime.o
        BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
@@@ -1823,7 -1831,7 +1829,7 @@@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEF
  git.res: git.rc GIT-VERSION-FILE
        $(QUIET_RC)$(RC) \
          $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
 -        -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
 +        -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
  
  # This makes sure we depend on the NO_PERL setting itself.
  $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@@ -2053,7 -2061,7 +2059,7 @@@ git-%$X: %.o GIT-LDFLAGS $(GITLIBS
  
  git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 -              $(LIBS) $(IMAP_SEND_LDFLAGS)
 +              $(IMAP_SEND_LDFLAGS) $(LIBS)
  
  git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
@@@ -2112,8 -2120,7 +2118,8 @@@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --
        --keyword=_ --keyword=N_ --keyword="Q_:1,2"
  XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
        --keyword=gettextln --keyword=eval_gettextln
 -XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
 +XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
 +      --keyword=__ --keyword=N__ --keyword="__n:1,2"
  LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
  LOCALIZED_SH = $(SCRIPT_SH)
  LOCALIZED_SH += git-parse-remote.sh
@@@ -2148,22 -2155,9 +2154,22 @@@ endi
  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
        $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
  
 -FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \
 -                      $(FIND) . \( -name .git -type d -prune \) \
 -                              -o \( -name '*.[hcS]' -type f -print \) )
 +FIND_SOURCE_FILES = ( \
 +      git ls-files \
 +              '*.[hcS]' \
 +              '*.sh' \
 +              ':!*[tp][0-9][0-9][0-9][0-9]*' \
 +              ':!contrib' \
 +              2>/dev/null || \
 +      $(FIND) . \
 +              \( -name .git -type d -prune \) \
 +              -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
 +              -o \( -name contrib -type d -prune \) \
 +              -o \( -name build -type d -prune \) \
 +              -o \( -name 'trash*' -type d -prune \) \
 +              -o \( -name '*.[hcS]' -type f -print \) \
 +              -o \( -name '*.sh' -type f -print \) \
 +      )
  
  $(ETAGS_TARGET): FORCE
        $(RM) $(ETAGS_TARGET)