diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-01 09:51:27 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-10-16 11:07:30 -0500 |
commit | 61173c1b58efa79c0ba6b08348d2796a249d0186 (patch) | |
tree | 00ebf544db18942e2a1ecfc5e5fa16931127d38f /wiki-to-help/mwlib_mods/no_sections.py | |
parent | 3dc2e7497f1798ae4ff6c5c8c562666bc10a393c (diff) |
move help structure one directory up
Change-Id: Ie970e39fbb6795a92d9fdd13510409d7dcd071bc
Diffstat (limited to 'wiki-to-help/mwlib_mods/no_sections.py')
-rw-r--r-- | wiki-to-help/mwlib_mods/no_sections.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/wiki-to-help/mwlib_mods/no_sections.py b/wiki-to-help/mwlib_mods/no_sections.py new file mode 100644 index 0000000000..d01b7b9514 --- /dev/null +++ b/wiki-to-help/mwlib_mods/no_sections.py @@ -0,0 +1,38 @@ +""" +Writes <article>...</article> instead of <article><section>...</section></article>. + +""" + +import mwlib.docbookwriter +#import lxml.etree +Element = mwlib.docbookwriter.Element +SubElement = mwlib.docbookwriter.SubElement +class MyDocBookWriter(mwlib.docbookwriter.DocBookWriter): + def dbwriteArticle(self, a): + """ + this generates the root element if not available + """ + #e = super(MyDocBookWriter,self).dbwriteArticle(a) + #e.remove(e.find("section")) + #return e + # add head + title + e = Element("article", lang=self.language) + if self.root is None: + self.root = e + h = SubElement(e,"articleinfo") + t = SubElement(h, "title") + if a.caption: + t.text = a.caption + + # DONT add a section and heading for this article + #s = SubElement(e, "section") + #si = SubElement(s, "sectioninfo") + #h = SubElement(si, "title") + #h.text = a.caption + #e.writeto = s + return e + +def apply(): + mwlib.docbookwriter.DocBookWriter = MyDocBookWriter + + |