| 1 |
# a very limited debiandoc to xml converter
|
| 2 |
# can also be used by itself on entity files,
|
| 3 |
# for those uncomment next line:
|
| 4 |
s/<item>/|/gi
|
| 5 |
# ENTITY must upper case
|
| 6 |
s|<!entity|<!ENTITY|gi
|
| 7 |
# start links on a new line
|
| 8 |
s|<URL ID=\"\([^\"]*\)\" NAME=\"\([^\"]*\)\">|\
|
| 9 |
<ulink url="\1">\2</ulink>|gi
|
| 10 |
# pick up halves of those that got wrapped to different lines
|
| 11 |
s|<URL ID=\"\([^\"]*\)\"|\
|
| 12 |
<ulink url="\1">|gi
|
| 13 |
s|<URL|<ulink|gi
|
| 14 |
s|^ID=\"\([^\"]*\)\" NAME=\"\([^\"]*\)\">|url="\1">\2</ulink>|gi
|
| 15 |
s|^NAME=\"\([^\"]*\)\">|\1</ulink>|gi
|
| 16 |
# ID= at the start of a line can also be an orphan ref
|
| 17 |
s|^ID=\"\(\&url[^\"]*\)\"|url="\1"></ulink>|gi
|
| 18 |
s|<REF ID=\"\([^\"]*\)\">|<xref linkend="\1"></xref>|gi
|
| 19 |
s|<^ID=\"\([^\"]*\)\">|linkend="\1"></xref>|gi
|
| 20 |
s|<REF|<xref|gi
|
| 21 |
s|<P>|<para>|gi
|
| 22 |
s|</P>|</para>|gi
|
| 23 |
s|HEADING>|title>|gi
|
| 24 |
# An extra line is helpful when replacing with 2 tags
|
| 25 |
s|<ITEM>|<listitem><para>\
|
| 26 |
|gi
|
| 27 |
s|</ITEM>|\
|
| 28 |
</para></listitem>|gi
|
| 29 |
s|<EM>\([^<]*\)</EM>|<emphasis>\1</emphasis>|gi
|
| 30 |
s|<EM>|<emphasis>|gi
|
| 31 |
s|</EM>|</emphasis>|gi
|
| 32 |
s|ENUMLIST>|orderedlist>|gi
|
| 33 |
s|TAGLIST>|variablelist>|gi
|
| 34 |
s|<TAG>|<varentry><term>\
|
| 35 |
|gi
|
| 36 |
s|</TAG>|</term>|gi
|
| 37 |
s|<LIST COMPACT>|<itemizedlist>|gi
|
| 38 |
s|<LIST>|<itemizedlist>|gi
|
| 39 |
s|</LIST>|</itemizedlist>|gi
|
| 40 |
s|FILE>|filename>|gi
|
| 41 |
s|CHAPT>|chapter>|gi
|
| 42 |
s|CHAPT ID=|chapter id=|gi
|
| 43 |
# xml has no plain <sect>, must be numbered
|
| 44 |
# so move each one up a level
|
| 45 |
s|SECT3>|sect4>|gi
|
| 46 |
s|SECT2>|sect3>|gi
|
| 47 |
s|SECT1>|sect2>|gi
|
| 48 |
s|SECT>|sect1>|gi
|
| 49 |
s|SECT3 ID=|sect4 id=|gi
|
| 50 |
s|SECT2 ID=|sect3 id=|gi
|
| 51 |
s|SECT1 ID=|sect2 id=|gi
|
| 52 |
s|SECT ID=|sect1 id=|gi
|
| 53 |
# locate sect's with text immediately following, insert <title>
|
| 54 |
s|\(<sect[^>]*>\)\([^<>]\+$\)|\1<title>\2</title>|i
|
| 55 |
# prgn could be <application>, but use <command> as default
|
| 56 |
s|PRGN>|command>|gi
|
| 57 |
# our <example>s don't have headings, use <informalexample>
|
| 58 |
s|<EXAMPLE>|<informalexample><screen>\
|
| 59 |
|gi
|
| 60 |
s|</EXAMPLE>|\
|
| 61 |
</screen></informalexample>|gi
|
| 62 |
s|VAR>|replaceable>|gi
|
| 63 |
# <tt> has been used for many purposes, but it _should_ be <userinput>
|
| 64 |
s|TT>|userinput>|gi
|
| 65 |
# no <package> allowed, substitute <classname> for now
|
| 66 |
s|PACKAGE>|classname>|g
|
| 67 |
# just change the case
|
| 68 |
s|FOOTNOTE>|footnote>|gi
|
| 69 |
#
|
| 70 |
# formatting stuff
|
| 71 |
s| |\
|
| 72 |
\
|
| 73 |
|g
|
| 74 |
# all <para> to left margin on next line
|
| 75 |
s|^ *\(<para>.*\)|\
|
| 76 |
\1|
|
| 77 |
s|^ *\(</para>.*\)|\1|
|
| 78 |
# sect's on next line, appropriate indent
|
| 79 |
s|^ *\(</*sect1.*\)|\
|
| 80 |
\1|
|
| 81 |
s|^ *\(</*sect2.*\)|\
|
| 82 |
\1|
|
| 83 |
s|^ *\(</*sect3.*\)|\
|
| 84 |
\1|
|
| 85 |
s|^ *\(</*sect4.*\)|\
|
| 86 |
\1|
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|