diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-29 07:45:02 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-29 07:47:59 -0400 |
commit | 85fb015b45796002b689574b4ae09dad148b82b9 (patch) | |
tree | 9a965116be7cf228d6e68bc37b1d4808a84c598d | |
parent | d40b1d31b535e9d33321a1bd8d160bc90778b418 (diff) | |
download | gtk+-85fb015b45796002b689574b4ae09dad148b82b9.tar.gz |
docs: Fix links in markdown content differently
pandoc insists on using the xlink namespace for hrefs,
and the namespace setup doesn't carry over xi:includes.
My first fix was to tell pandoc to generate standalone
docbook documents, which makes it insert the xlink
namespace. But it also makes it wrap all sections and
chapters in articles, and that messes up our toc structure.
So, patch things up differently by stripping the xlink:
from hrefs via regex.
Yay for XML!
-rwxr-xr-x | docs/reference/gtk/gtk-markdown-to-docbook | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/reference/gtk/gtk-markdown-to-docbook b/docs/reference/gtk/gtk-markdown-to-docbook index 4268bf1b7a..a278b8b583 100755 --- a/docs/reference/gtk/gtk-markdown-to-docbook +++ b/docs/reference/gtk/gtk-markdown-to-docbook @@ -12,6 +12,13 @@ import subprocess # The following code is taken from gtk-doc def ExpandAbbreviations(symbol, text): + # Hack! + # Strip xlink namespace from hrefs since pandoc insists on + # inserting them, and namespace setup doesn't transfer across + # xi:include. + # Yay for XML! + text = re.sub('xlink:href', 'href', text) + # Convert '@param()' text = re.sub(r'(\A|[^\\])\@(\w+((\.|->)\w+)*)\s*\(\)', r'\1<parameter>\2()</parameter>', text) @@ -177,7 +184,6 @@ def ConvertToDocbook(infile, outfile): subprocess.check_call(["pandoc", infile, "-o", outfile, "--from=" + input_format, "--to=" + output_format, - "--standalone", "--top-level-division=" + division]) def ExpandGtkDocAbbreviations(infile, outfile): |