All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Followup patches for Asciidoctor
@ 2014-10-27  0:13 brian m. carlson
  2014-10-27  0:13 ` [PATCH 1/2] Documentation: refactor common operations into variables brian m. carlson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: brian m. carlson @ 2014-10-27  0:13 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Jakub Narębski

This series is essentially the same as the previous v2, but against next
instead.  It moves most of the AsciiDoc operations into a set of
variables (TXT_TO_HTML and TXT_TO_XML) as Junio suggested, and removes
the extensions.rb file, as it is not needed.

I did note Peff's suggestion to add a macro to enable the use of
Asciidoctor, but I want to defer that until a later point.  There isn't
a released version of Asciidoctor with the necessary changes and I'd
like to avoid confusing users by making them think it will work when it
probably won't.

brian m. carlson (2):
  Documentation: refactor common operations into variables
  Documentation: remove Asciidoctor linkgit macro

 Documentation/Makefile      | 22 +++++++++++-----------
 Documentation/extensions.rb | 39 ---------------------------------------
 2 files changed, 11 insertions(+), 50 deletions(-)
 delete mode 100644 Documentation/extensions.rb

-- 
2.1.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Documentation: refactor common operations into variables
  2014-10-27  0:13 [PATCH 0/2] Followup patches for Asciidoctor brian m. carlson
@ 2014-10-27  0:13 ` brian m. carlson
  2014-10-27  0:13 ` [PATCH 2/2] Documentation: remove Asciidoctor linkgit macro brian m. carlson
  2014-10-27  5:07 ` [PATCH 0/2] Followup patches for Asciidoctor Jeff King
  2 siblings, 0 replies; 4+ messages in thread
From: brian m. carlson @ 2014-10-27  0:13 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Jakub Narębski

The Makefile performs several very similar tasks to convert AsciiDoc
files into either HTML or DocBook.  Move these items into variables to
reduce the duplication.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 4cdef45..2f6b6aa 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -102,6 +102,10 @@ ASCIIDOC_EXTRA =
 ASCIIDOC_HTML = xhtml11
 ASCIIDOC_DOCBOOK = docbook
 ASCIIDOC_CONF = -f asciidoc.conf
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
+		-agit-version=$(GIT_VERSION)
+TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
+TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
 MANPAGE_XSL = manpage-normal.xsl
 XMLTO = xmlto
 XMLTO_EXTRA =
@@ -309,14 +313,12 @@ clean:
 
 $(MAN_HTML): %.html : %.txt asciidoc.conf
 	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
-	$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \
-		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
+	$(TXT_TO_HTML) -d manpage -o $@+ $< && \
 	mv $@+ $@
 
 $(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
 	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
-	$(ASCIIDOC) -b $(ASCIIDOC_HTML) $(ASCIIDOC_CONF) \
-		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
+	$(TXT_TO_HTML) -o $@+ $< && \
 	mv $@+ $@
 
 manpage-base-url.xsl: manpage-base-url.xsl.in
@@ -328,13 +330,12 @@ manpage-base-url.xsl: manpage-base-url.xsl.in
 
 %.xml : %.txt asciidoc.conf
 	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
-	$(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \
-		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
+	$(TXT_TO_XML) -d manpage -o $@+ $< && \
 	mv $@+ $@
 
 user-manual.xml: user-manual.txt user-manual.conf
 	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
-	$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b $(ASCIIDOC_DOCBOOK) -d article -o $@+ $< && \
+	$(TXT_TO_XML) -d article -o $@+ $< && \
 	mv $@+ $@
 
 technical/api-index.txt: technical/api-index-skel.txt \
@@ -343,8 +344,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
 
 technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
 $(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf
-	$(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) $(ASCIIDOC_CONF) \
-		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
+	$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
 
 XSLT = docbook.xsl
 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
@@ -391,7 +391,7 @@ howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 	mv $@+ $@
 
 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
-	$(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b $(ASCIIDOC_HTML) $*.txt
+	$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
 
 WEBDOC_DEST = /pub/software/scm/git/docs
 
@@ -399,7 +399,7 @@ howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 	sed -e '1,/^$$/d' $< | \
-	$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b $(ASCIIDOC_HTML) - >$@+ && \
+	$(TXT_TO_HTML) - >$@+ && \
 	mv $@+ $@
 
 install-webdoc : html
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Documentation: remove Asciidoctor linkgit macro
  2014-10-27  0:13 [PATCH 0/2] Followup patches for Asciidoctor brian m. carlson
  2014-10-27  0:13 ` [PATCH 1/2] Documentation: refactor common operations into variables brian m. carlson
@ 2014-10-27  0:13 ` brian m. carlson
  2014-10-27  5:07 ` [PATCH 0/2] Followup patches for Asciidoctor Jeff King
  2 siblings, 0 replies; 4+ messages in thread
From: brian m. carlson @ 2014-10-27  0:13 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Jakub Narębski

Asciidoctor provides an extension implementing a backend-independent
macro for dealing with manpage links just like the linkgit macro.  As
this is more likely to be up-to-date with future changes in Asciidoctor,
prefer using it over reimplementing in Git.

This reverts commit 773ee47c2b9c691d9758b2bea6cac10e3f0c4e12.
---
 Documentation/extensions.rb | 39 ---------------------------------------
 1 file changed, 39 deletions(-)
 delete mode 100644 Documentation/extensions.rb

diff --git a/Documentation/extensions.rb b/Documentation/extensions.rb
deleted file mode 100644
index c33a50d..0000000
--- a/Documentation/extensions.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-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'
-          generate_html(parent, target, attrs)
-        elsif parent.document.basebackend? 'docbook'
-          generate_docbook(parent, target, attrs)
-        end
-      end
-
-      private
-
-      def generate_html(parent, target, attrs)
-        section = attrs.has_key?(1) ? "(#{attrs[1]})" : ''
-        prefix = parent.document.attr('git-relative-html-prefix') || ''
-        %(<a href="#{prefix}#{target}.html">#{target}#{section}</a>\n)
-      end
-
-      def generate_docbook(parent, target, attrs)
-        %(<citerefentry>
-<refentrytitle>#{target}</refentrytitle><manvolnum>#{attrs[1]}</manvolnum>
-</citerefentry>
-)
-      end
-    end
-  end
-end
-
-Asciidoctor::Extensions.register do
-  inline_macro Git::Documentation::LinkGitProcessor, :linkgit
-end
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Followup patches for Asciidoctor
  2014-10-27  0:13 [PATCH 0/2] Followup patches for Asciidoctor brian m. carlson
  2014-10-27  0:13 ` [PATCH 1/2] Documentation: refactor common operations into variables brian m. carlson
  2014-10-27  0:13 ` [PATCH 2/2] Documentation: remove Asciidoctor linkgit macro brian m. carlson
@ 2014-10-27  5:07 ` Jeff King
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2014-10-27  5:07 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git, Junio C Hamano, Jakub Narębski

On Mon, Oct 27, 2014 at 12:13:41AM +0000, brian m. carlson wrote:

> I did note Peff's suggestion to add a macro to enable the use of
> Asciidoctor, but I want to defer that until a later point.  There isn't
> a released version of Asciidoctor with the necessary changes and I'd
> like to avoid confusing users by making them think it will work when it
> probably won't.

Thanks for considering it; your analysis makes sense to me.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-27  5:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-27  0:13 [PATCH 0/2] Followup patches for Asciidoctor brian m. carlson
2014-10-27  0:13 ` [PATCH 1/2] Documentation: refactor common operations into variables brian m. carlson
2014-10-27  0:13 ` [PATCH 2/2] Documentation: remove Asciidoctor linkgit macro brian m. carlson
2014-10-27  5:07 ` [PATCH 0/2] Followup patches for Asciidoctor Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.