Skip to content

Commit a902adf

Browse files
afhtbm
authored andcommitted
Generate version.texi for ledger repo
Move all current documentation to /doc.
1 parent b4dfaa9 commit a902adf

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

Makefile

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
MANPAGE := ledger.1
22
TEXINFO := $(addsuffix .texi,ledger3 ledger-mode)
3-
SOURCES := $(MANPAGE) $(TEXINFO)
3+
SOURCES := version.texi $(MANPAGE) $(TEXINFO)
44
PDF := $(addsuffix .pdf,$(basename $(TEXINFO)))
55
HTML := $(addsuffix .html,$(basename $(TEXINFO)) $(MANPAGE))
66
BUILD := build
7+
OUTPUT := $(BUILD)/doc
8+
CURL := curl --silent --location
79

8-
HOST := https://raw.githubusercontent.com/ledger
9-
ledger3.texi_repopath := ledger/v3.3.1/doc
10-
ledger.1_repopath := ledger/v3.3.1/doc
11-
ledger.texi_repopath := ledger/v2.6.3
12-
ledger-mode.texi_repopath := ledger-mode/master/doc
10+
OWNER := ledger
11+
REPO := ledger
12+
LATEST := $(shell curl -sqI -w '%{redirect_url}\n' -o /dev/null https://github.com/$(OWNER)/$(REPO)/releases/latest | rev | cut -d/ -f1 | rev)
1313

14-
ledger3.texi_build := 3.0/doc
15-
ledger.1_build := 3.0/doc
16-
ledger-mode.texi_build := 3.0/doc
14+
HOST := https://raw.githubusercontent.com
15+
ledger3.texi_repopath := $(OWNER)/$(REPO)/$(LATEST)/doc
16+
ledger.1_repopath := $(OWNER)/$(REPO)/$(LATEST)/doc
17+
ledger-mode.texi_repopath := $(OWNER)/ledger-mode/master/doc
1718

1819
docs: init sources pdf html
1920

@@ -25,20 +26,34 @@ sources: $(SOURCES)
2526

2627
.PHONY: init
2728
init:
28-
mkdir -p $(BUILD)/$(ledger.texi_build) $(BUILD)/$(ledger3.texi_build)
29+
mkdir -p $(OUTPUT)
2930

3031
.PHONY: clean
3132
clean:
3233
rm -rf $(BUILD) $(addsuffix *,$(basename $(SOURCES)))
3334

3435
$(TEXINFO) $(MANPAGE):
35-
curl -sLO $(HOST)/$($(@)_repopath)/$@
36+
$(CURL) --remote-name $(HOST)/$($(@)_repopath)/$@
37+
38+
# TODO: Remove the line after this comment once the next release after 3.3.1
39+
# is published as it will include the necessary changes for version.texi and
40+
# related files to be fetched from the tag instead of the master branch.
41+
version.texi: LATEST := master
42+
version.texi:
43+
$(CURL) --parallel --create-dirs \
44+
--output-dir doc --remote-name $(HOST)/$(OWNER)/$(REPO)/$(LATEST)/doc/$@.in \
45+
--remote-name $(HOST)/$(OWNER)/$(REPO)/$(LATEST)/doc/CMakeLists.txt \
46+
--next --silent --location --create-dirs \
47+
--output-dir cmake --remote-name $(HOST)/$(OWNER)/$(REPO)/$(LATEST)/cmake/LedgerVersion.cmake \
48+
# curl
49+
cmake -Wno-dev -S doc
50+
mv doc/$@ $@
3651

3752
%.pdf : %.texi
38-
texi2pdf --batch --verbose --output=$(BUILD)/$($(<)_build)/$@ $<
53+
texi2pdf --batch --verbose --output=$(OUTPUT)/$@ $<
3954

4055
%.html : %.texi
41-
makeinfo --force --html --no-split --output=$(BUILD)/$($(<)_build)/$@ $<
56+
makeinfo --force --html --no-split --output=$(OUTPUT)/$@ $<
4257

4358
%.1.html : %.1
44-
groff -mandoc -Thtml $< > $(BUILD)/$($(<)_build)/$@
59+
groff -mandoc -Thtml $< > $(OUTPUT)/$@

source/docs.html.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ title: Documentation - Ledger
88
.dim, .dim a:link, .dim a:visited { color:#ccc; }
99
</style>
1010

11-
* <b><a href="3.0/doc/ledger3.html">Ledger 3 manual</a></b> and <a href="3.0/doc/ledger3.pdf">pdf</a> <span class="dim">(<a href="https://github.com/ledger/ledger/commits/master/doc/ledger3.texi">changes</a>)
12-
* <a href="3.0/doc/ledger.1.html">Ledger 3 man page</a> <span class="dim">(<a href="https://github.com/ledger/ledger/commits/master/doc/ledger.1">changes</a>)
13-
* <a href="3.0/doc/ledger-mode.html">ledger-mode manual</a> and <a href="3.0/doc/ledger-mode.pdf">pdf</a> <span class="dim">(<a href="https://github.com/ledger/ledger-mode/commits/master/doc/ledger-mode.texi">changes</a>)
11+
* <b><a href="doc/ledger3.html">Ledger 3 manual</a></b> and <a href="doc/ledger3.pdf">pdf</a> <span class="dim">(<a href="https://github.com/ledger/ledger/commits/master/doc/ledger3.texi">changes</a>)
12+
* <a href="doc/ledger.1.html">Ledger 3 man page</a> <span class="dim">(<a href="https://github.com/ledger/ledger/commits/master/doc/ledger.1">changes</a>)
13+
* <a href="doc/ledger-mode.html">ledger-mode manual</a> and <a href="doc/ledger-mode.pdf">pdf</a> <span class="dim">(<a href="https://github.com/ledger/ledger-mode/commits/master/doc/ledger-mode.texi">changes</a>)
1414

1515
## External links
1616

version.texi

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)