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

Gonzalo Odiard gonzalo at laptop.org
Wed May 23 12:07:36 EDT 2012


Maybe you should git add parse.py?

Gonzalo

On Wed, May 23, 2012 at 1:05 PM, Manuel Kaufmann <humitos at gmail.com> wrote:

> 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
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120523/7ff894a7/attachment.html>


More information about the Sugar-devel mailing list