nixos/doc/md-to-db.sh: handle Docbook inclues in CommonMark
You can do includes like this: ```{=docbook} <xi:include href="rl-2111.section.xml" /> ```
This commit is contained in:
parent
bc06c93905
commit
c863de29a7
@ -1,4 +1,4 @@
|
|||||||
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-writing-documentation">
|
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="sec-writing-documentation">
|
||||||
<title>Writing NixOS Documentation</title>
|
<title>Writing NixOS Documentation</title>
|
||||||
<para>
|
<para>
|
||||||
As NixOS grows, so too does the need for a catalogue and explanation
|
As NixOS grows, so too does the need for a catalogue and explanation
|
||||||
|
@ -24,15 +24,19 @@ mapfile -t MD_FILES < <(find . -type f -regex '.*\.md$')
|
|||||||
for mf in ${MD_FILES[*]}; do
|
for mf in ${MD_FILES[*]}; do
|
||||||
if [ "${mf: -11}" == ".section.md" ]; then
|
if [ "${mf: -11}" == ".section.md" ]; then
|
||||||
mkdir -p $(dirname "$OUT/$mf")
|
mkdir -p $(dirname "$OUT/$mf")
|
||||||
|
OUTFILE="$OUT/${mf%".section.md"}.section.xml"
|
||||||
pandoc "$mf" "${pandoc_flags[@]}" \
|
pandoc "$mf" "${pandoc_flags[@]}" \
|
||||||
-o "$OUT/${mf%".section.md"}.section.xml"
|
-o "$OUTFILE"
|
||||||
|
grep -q -m 1 "xi:include" "$OUTFILE" && sed -i 's|xmlns:xlink="http://www.w3.org/1999/xlink"| xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"|' "$OUTFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${mf: -11}" == ".chapter.md" ]; then
|
if [ "${mf: -11}" == ".chapter.md" ]; then
|
||||||
mkdir -p $(dirname "$OUT/$mf")
|
mkdir -p $(dirname "$OUT/$mf")
|
||||||
|
OUTFILE="$OUT/${mf%".chapter.md"}.chapter.xml"
|
||||||
pandoc "$mf" "${pandoc_flags[@]}" \
|
pandoc "$mf" "${pandoc_flags[@]}" \
|
||||||
--top-level-division=chapter \
|
--top-level-division=chapter \
|
||||||
-o "$OUT/${mf%".chapter.md"}.chapter.xml"
|
-o "$OUTFILE"
|
||||||
|
grep -q -m 1 "xi:include" "$OUTFILE" && sed -i 's|xmlns:xlink="http://www.w3.org/1999/xlink"| xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"|' "$OUTFILE"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user