blob: 53d3cfdefa94231263e542221f131f4818952fd3 (
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
|
"""
Adds
<indexterm><primary>TITLE</primary></indexterm>
to each <article>
"""
## Set up docbookwriter
import mwlib.docbookwriter
#import lxml.etree
SubElement = mwlib.docbookwriter.SubElement
class MyDocBookWriter(mwlib.docbookwriter.DocBookWriter):
def dbwriteArticle(self, a):
"""
Add <indexterm><primary>a.caption</primary></indexterm>
"""
e = super(MyDocBookWriter,self).dbwriteArticle(a)
i = SubElement(e,"indexterm")
p = SubElement(i,"primary")
p.text = a.caption
return e
def apply():
mwlib.docbookwriter.DocBookWriter = MyDocBookWriter
|