summaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx/post_convert.sed
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2016-03-06 20:29:31 -0700
committerJani Nikula <jani.nikula@intel.com>2016-05-30 13:38:53 +0300
commit89a66d76109935aad387a5058f120aeb8246ae40 (patch)
tree256f6bd0d8f5b56ad2fbf87da4625e2a625335e8 /Documentation/sphinx/post_convert.sed
parentc13ce448c8532965eb4e1115e78cb5b8ff8261a3 (diff)
downloadtalos-obmc-linux-89a66d76109935aad387a5058f120aeb8246ae40.tar.gz
talos-obmc-linux-89a66d76109935aad387a5058f120aeb8246ae40.zip
sphinx: cheesy script to convert .tmpl files
This script uses pandoc to convert existing DocBook template files to RST templates. A couple of sed scripts are need to massage things both before and after the conversion, but the result is then usable with no hand editing. [Jani: Change usage to tmplcvt <in> <out>. Fix escaping for docproc directives. Add support the new kernel-doc extension.] Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'Documentation/sphinx/post_convert.sed')
-rw-r--r--Documentation/sphinx/post_convert.sed19
1 files changed, 19 insertions, 0 deletions
diff --git a/Documentation/sphinx/post_convert.sed b/Documentation/sphinx/post_convert.sed
new file mode 100644
index 000000000000..ce17049f6a8e
--- /dev/null
+++ b/Documentation/sphinx/post_convert.sed
@@ -0,0 +1,19 @@
+#
+# pandoc thinks that both "_" needs to be escaped. Remove the extra
+# backslashes. Also put in proper backquotes now that pandoc won't quote
+# them.
+#
+s/$bq/`/g
+s/\\_/_/g
+#
+# Unwrap docproc directives.
+#
+s/^``DOCPROC: !E\(.*\)``$/.. kernel-doc:: \1\n :export:/
+s/^``DOCPROC: !I\(.*\)``$/.. kernel-doc:: \1\n :internal:/
+s/^``DOCPROC: !F\([^ ]*\) \(.*\)``$/.. kernel-doc:: \1\n :functions: \2/
+s/^``DOCPROC: !P\([^ ]*\) \(.*\)``$/.. kernel-doc:: \1\n :doc: \2/
+s/^``DOCPROC: \(!.*\)``$/.. WARNING: DOCPROC directive not supported: \1/
+#
+# Trim trailing whitespace.
+#
+s/[[:space:]]*$//
OpenPOWER on IntegriCloud