From: Avery Pennarun Date: Sun, 24 Jan 2010 03:09:15 +0000 (-0500) Subject: Infrastructure for generating a markdown-based man page using pandoc. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=83999e8c824e3e0ddae46da181d9a4fa241f8113;p=packages%2Fb%2Fbup.git Infrastructure for generating a markdown-based man page using pandoc. The man page (bup.1) is total drivel for the moment, though. And arguably we could split up the manpages per subcommand like git does, but maybe that's overkill at this stage. --- diff --git a/.gitignore b/.gitignore index 88644b6..42c8465 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -bup -bup-* +/bup +/bup-* randomgen memtest *.o diff --git a/Documentation/.gitignore b/Documentation/.gitignore new file mode 100644 index 0000000..764de28 --- /dev/null +++ b/Documentation/.gitignore @@ -0,0 +1,2 @@ +*.[0-9] +*.html diff --git a/Documentation/Makefile b/Documentation/Makefile new file mode 100644 index 0000000..0b494a9 --- /dev/null +++ b/Documentation/Makefile @@ -0,0 +1,33 @@ +PANDOC:=$(shell \ + if pandoc /dev/null; then \ + echo pandoc; \ + else \ + echo "Warning: pandoc not installed; can't generate manpages." >&2; \ + echo '@echo Skipping: pandoc'; \ + fi) +BUP_VERSION=$(shell git describe --match 'bup-*' | sed 's/^bup-//') +BUP_DATE=$(shell git log --no-walk --pretty='%ci%n' | (read x y && echo $$x)) + +default: all + +all: man html + +man: $(patsubst %.md,%,$(wildcard *.md)) + +html: $(patsubst %.1.md,%.html,$(wildcard *.md)) + +%: %.md.tmp Makefile + $(PANDOC) -s -r markdown -w man -o $@ $< + +%.html: %.1.md.tmp Makefile + $(PANDOC) -s -r markdown -w html -o $@ $< + +.PRECIOUS: %.1.md.tmp +%.md.tmp: %.md Makefile + rm -f $@ $@.new + sed -e 's,%BUP_VERSION%,${BUP_VERSION},g' \ + -e 's,%BUP_DATE%,${BUP_DATE},g' <$< >$@.new + mv $@.new $@ + +clean: + rm -f *~ .*~ *.[0-9] *.new *.tmp *.html diff --git a/Documentation/bup.1.md b/Documentation/bup.1.md new file mode 100644 index 0000000..2f09f46 --- /dev/null +++ b/Documentation/bup.1.md @@ -0,0 +1,59 @@ +% bup(1) Bup %BUP_VERSION% +% Avery Pennarun +% %BUP_DATE% + +# NAME + +bup - Backup program using rolling checksums and git file formats + +# SYNOPSIS + +bup [*options*] [*input-file*]... + +# DESCRIPTION + +This is the sample description. + + embeddeded code + more code + +More stuff. + +## Subsection + +Yay! + +- this is a list. + +- another list item. + + list continuation. + +- another item. + + with some code + and more code + +1. numbered item. + +1. another numbered item. + + - with a list + - of items + - that say stuff + +1. yet another number. + +# OPTIONS + +-o, --output=*output* +: the stuff about the term + +--hello +: more stuff + +# SEE ALSO + +`git`(1) and the *README* file from the bup distribution. + +The home of bup is at . diff --git a/Makefile b/Makefile index a007484..fc415de 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,14 @@ default: all all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \ bup-midx bup-fuse bup-ls bup-damage bup-fsck bup-margin bup-drecurse \ - bup memtest randomgen$(EXT) _hashsplit$(SOEXT) + bup memtest randomgen$(EXT) _hashsplit$(SOEXT) \ + Documentation/all + +%/all: + $(MAKE) -C $* all + +%/clean: + $(MAKE) -C $* clean randomgen$(EXT): randomgen.o $(CC) $(CFLAGS) -o $@ $< @@ -67,7 +74,7 @@ bup-%: cmd-%.sh %.o: %.c gcc -c -o $@ $< $(CPPFLAGS) $(CFLAGS) -clean: +clean: Documentation/clean rm -f *.o *.so *.dll *.exe *~ .*~ *.pyc */*.pyc */*~ \ bup bup-* randomgen memtest \ out[12] out2[tc] tags[12] tags2[tc]