[Sugar-devel] [PATCH InfoSlicer] Export content as HTML SL #3608

Manuel Kaufmann humitos at gmail.com
Wed May 23 12:05:30 EDT 2012


Added HTML files to the bundle so this content can be opened with Browse
Activity. The old dita/ditamap files are not removed because they are parsed to
generate the new HTML files.

Besides, the HTML generation uses these dita files to not be too aggressive
with the code in this cycle. We will improve this code in the future and we
will remove completely the dita generation.

Signed-off-by: Manuel Kaufmann <humitos at gmail.com>
---
 xol.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xol.py b/xol.py
index b5aa1df..6b2a34f 100644
--- a/xol.py
+++ b/xol.py
@@ -19,6 +19,7 @@ import gtk
 import zipfile
 import uuid
 import logging
+import parse
 from glob import glob
 from gettext import gettext as _
 
@@ -152,6 +153,8 @@ def _dita_management(zip, uid, title):
                 'href="ditastylesheet.xsl"?>')
         zipstr(zip, os.path.join(uid, 'slicecontent', '%s.dita' % auid),
                 content.prettify())
+        zipstr(zip, os.path.join(uid, 'slicecontent', '%s.html' % auid),
+                parse.parse_dita(content.prettify()))
 
         map.append('<topicref href="%s.dita" navtitle="%s">' % (auid, atitle))
         map.append('</topicref>')
@@ -159,12 +162,14 @@ def _dita_management(zip, uid, title):
     map.append('</map>')
     zipstr(zip, os.path.join(uid, 'slicecontent', 'librarymap.ditamap'),
             "\n".join(map))
+    zipstr(zip, os.path.join(uid, 'slicecontent', 'librarymap.html'),
+            parse.parse_ditamap("\n".join(map)))
 
 def _index_redirect(zip, uid):
     """
         Creates the redirecting index.html
     """
-    redirect_loc = 'slicecontent/librarymap.ditamap'
+    redirect_loc = 'slicecontent/librarymap.html'
 
     html = ['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">',\
             '<html>',\
-- 
1.7.10



More information about the Sugar-devel mailing list