<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 02/18/2014 03:56 AM, Aline Manera
wrote:<br>
</div>
<blockquote
cite="mid:1392666981-25375-3-git-send-email-alinefm@linux.vnet.ibm.com"
type="cite">
<pre wrap="">From: Aline Manera <a class="moz-txt-link-rfc2396E" href="mailto:alinefm@br.ibm.com"><alinefm@br.ibm.com></a></pre>
</blockquote>
<br>
does the UI page will get the help information for these help
documents?<br>
<br>
Such as: <br>
________________________________________________________________________________<br>
Name CPU Network I/O Disk I/O Livetile
Actions <br>
<br>
When mouse hovers on CPU label, the Ui will get the CPU description
from help/guests.html and <br>
display it," Percentage of processor utilization in the virtual
machine"<br>
<br>
Also I want to know can we generate a help/guests.html stub from
/#tabs/guests ?<br>
<br>
or DITA is not easy to write and maintain. <br>
<font color="#000000"><font size="3">Why we choose DITA? such as
reStructuredText</font></font> is more easy. <br>
<br>
<blockquote
cite="mid:1392666981-25375-3-git-send-email-alinefm@linux.vnet.ibm.com"
type="cite">
<pre wrap="">
This patch generates help/index.html automatically based on all .dita
files during build time.
For each dita file it generates a link on index.html
Signed-off-by: Aline Manera <a class="moz-txt-link-rfc2396E" href="mailto:alinefm@br.ibm.com"><alinefm@br.ibm.com></a>
---
ui/pages/help/Makefile.am | 3 ++-
ui/pages/help/gen-index.py | 64 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 1 deletion(-)
create mode 100755 ui/pages/help/gen-index.py
diff --git a/ui/pages/help/Makefile.am b/ui/pages/help/Makefile.am
index 81d7e90..5146692 100644
--- a/ui/pages/help/Makefile.am
+++ b/ui/pages/help/Makefile.am
@@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
DITA_HTML_FILES = $(patsubst %.dita,%.html,$(wildcard *.dita))
-HTML_FILES = $(if $(wildcard *.html), $(wildcard *.html), $(DITA_HTML_FILES))
+HTML_FILES = $(if $(wildcard *.html), $(wildcard *.html), $(DITA_HTML_FILES) index.html)
DITA_XSL_FILE = dita-help.xsl
helpdir = $(datadir)/kimchi/ui/pages/help
@@ -27,5 +27,6 @@ dist_help_DATA = $(HTML_FILES) $(NULL)
%.html: %.dita $(DITA_XSL_FILE)
        xsltproc -o $@ $(DITA_XSL_FILE) $<
+        $(shell pwd)/gen-index.py
CLEANFILES = $(HTML_FILES)
diff --git a/ui/pages/help/gen-index.py b/ui/pages/help/gen-index.py
new file mode 100755
index 0000000..4fa7cbe
--- /dev/null
+++ b/ui/pages/help/gen-index.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014
+#
+# Authors:
+# Aline Manera <a class="moz-txt-link-rfc2396E" href="mailto:alinefm@linux.vnet.ibm.com"><alinefm@linux.vnet.ibm.com></a>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import glob
+import libxml2
+
+
+HTML_HEAD = """
+<html>
+<head>
+ <title>Kimchi Help</title>
+</head>
+<body>
+<h1>Kimchi Help</h1>
+"""
+
+HTML_TAIL = """
+</body>
+</html>
+"""
+
+
+def main():
+ pages = {}
+ files = sorted(glob.glob('*.dita'))
+ for f in files:
+ with open(f) as fd:
+ xml = fd.read()
+ doc = libxml2.parseDoc(xml)
+ node = doc.xpathEval('/cshelp/title')[0]
+ name = node.children.content
+ pages[f.replace('.dita', '.html')] = name
+ doc.freeDoc()
+
+ with open('index.html', 'w') as fd:
+ fd.write(HTML_HEAD)
+ for page, name in pages.iteritems():
+ html = ' <a href="/help/%s">%s</a><br />\n'
+ fd.write(html % (page, name))
+ fd.write(HTML_TAIL)
+
+
+if __name__ == '__main__':
+ main()
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Thanks and best regards!
Sheldon Feng(冯少合)<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
IBM Linux Technology Center</pre>
</body>
</html>