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