mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 03:12:51 +00:00
Merge pull request #136987 from ryantm/nixos-doc-include-script-only
nixos/doc/md-to-db.sh: handle Docbook inclues in CommonMark
This commit is contained in:
commit
2d6d4f3607
@ -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>
|
||||
<para>
|
||||
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
|
||||
if [ "${mf: -11}" == ".section.md" ]; then
|
||||
mkdir -p $(dirname "$OUT/$mf")
|
||||
OUTFILE="$OUT/${mf%".section.md"}.section.xml"
|
||||
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
|
||||
|
||||
if [ "${mf: -11}" == ".chapter.md" ]; then
|
||||
mkdir -p $(dirname "$OUT/$mf")
|
||||
OUTFILE="$OUT/${mf%".chapter.md"}.chapter.xml"
|
||||
pandoc "$mf" "${pandoc_flags[@]}" \
|
||||
--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
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user