summaryrefslogtreecommitdiff
path: root/helpcontent2/wiki-to-help/mwlib_mods
diff options
context:
space:
mode:
authorTimo Richter <timo@iera.de>2011-08-26 14:03:25 +0200
committerJan Holesovsky <kendy@suse.cz>2011-08-26 14:03:56 +0200
commitba84d4ed501e1ae10683c2edf72ef2d3944e1333 (patch)
treeda20dfa3d59c961dd432e462fb8f5d58a78bb955 /helpcontent2/wiki-to-help/mwlib_mods
parent96210e715d167f793ce8830b4152f3327c265552 (diff)
Index is being created. Images are included in chm-files.
--images accepts zip files Program output is more quiet Added -v for verbosity Call of "convert.py" -h is a lot faster
Diffstat (limited to 'helpcontent2/wiki-to-help/mwlib_mods')
-rw-r--r--helpcontent2/wiki-to-help/mwlib_mods/__init__.py4
-rw-r--r--helpcontent2/wiki-to-help/mwlib_mods/indexterm_from_title.py24
2 files changed, 26 insertions, 2 deletions
diff --git a/helpcontent2/wiki-to-help/mwlib_mods/__init__.py b/helpcontent2/wiki-to-help/mwlib_mods/__init__.py
index c9c59e96f9..ca93600d47 100644
--- a/helpcontent2/wiki-to-help/mwlib_mods/__init__.py
+++ b/helpcontent2/wiki-to-help/mwlib_mods/__init__.py
@@ -17,6 +17,6 @@ docbook_internLinks.apply()
import custom_nfo
custom_nfo.apply()
-#import images_from_path
-#images_from_path.apply()
+import indexterm_from_title
+indexterm_from_title.apply()
diff --git a/helpcontent2/wiki-to-help/mwlib_mods/indexterm_from_title.py b/helpcontent2/wiki-to-help/mwlib_mods/indexterm_from_title.py
new file mode 100644
index 0000000000..53d3cfdefa
--- /dev/null
+++ b/helpcontent2/wiki-to-help/mwlib_mods/indexterm_from_title.py
@@ -0,0 +1,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
+