-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (42 loc) · 1.31 KB
/
Makefile
File metadata and controls
59 lines (42 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Makefile
# Convert <README.adoc> to <README.md> for SourceHut.
# By Marcos Cruz (programandala.net)
# Last modified 20250903T1103+0200.
# Requirements {{{1
# ==============================================================
# Asciidoctor (by Dan Allen, Sarah White et al.)
# http://asciidoctor.org
# Pandoc (by John MaFarlane)
# http://pandoc.org
# Config {{{1
# ==============================================================
title := fsb2
# Interface {{{1
# ==============================================================
.PHONY: all
all: readme
.PHONY: readme
readme: README.md
.PHONY: clean
clean:
rm --force README.md
# AsciiDoc to DocBook {{{1
# ==============================================================
tmp/README.db: README.adoc
asciidoctor \
--backend docbook \
--out-file=$@ $<
# DocBook to CommonMark {{{1
# ==============================================================
# XXX FIXME Somehow `pandoc --from docbook --to commonmark` ignores the main
# title and makes section headings level 1. This happens still with pandoc
# v3.7.0.2, converting from DocBook to Markdown or CommonMark. A workaround is
# used with `echo` and `--shift-heading-level-by`:
README.md: tmp/README.db
echo "# $(title)\n" > $@
pandoc \
--from docbook \
--to commonmark \
--shift-heading-level-by 1 \
$< \
>> $@