2009-10-20 10:52:23 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2006-12-07 13:41:40 +00:00
|
|
|
##############################################################################
|
2009-10-30 12:33:59 +00:00
|
|
|
#
|
2009-04-28 10:24:21 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2009-10-14 12:32:15 +00:00
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 12:32:15 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# This program 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
|
2009-10-14 12:32:15 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2009-10-14 12:32:15 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2009-10-30 12:33:59 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
import render
|
|
|
|
import rml2pdf
|
|
|
|
import rml2html as htmlizer
|
2008-12-12 23:16:18 +00:00
|
|
|
import rml2txt as txtizer
|
2009-04-28 10:24:21 +00:00
|
|
|
import odt2odt as odt
|
2009-05-05 11:42:27 +00:00
|
|
|
import html2html as html
|
2009-10-30 12:33:59 +00:00
|
|
|
import makohtml2html as makohtml
|
2009-04-28 10:24:21 +00:00
|
|
|
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
class rml(render.render):
|
2010-12-14 16:28:26 +00:00
|
|
|
def __init__(self, rml, localcontext = None, datas=None, path='.', title=None):
|
|
|
|
render.render.__init__(self, datas, path)
|
2009-04-28 10:24:21 +00:00
|
|
|
self.localcontext = localcontext
|
|
|
|
self.rml = rml
|
2008-07-22 14:24:36 +00:00
|
|
|
self.output_type = 'pdf'
|
2008-08-11 09:27:55 +00:00
|
|
|
self.title=title
|
2006-12-07 13:41:40 +00:00
|
|
|
|
2009-04-28 10:24:21 +00:00
|
|
|
|
2008-07-22 14:24:36 +00:00
|
|
|
def _render(self):
|
2009-04-28 10:24:21 +00:00
|
|
|
return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
class rml2html(render.render):
|
2010-12-14 16:28:26 +00:00
|
|
|
def __init__(self, rml,localcontext = None, datas=None):
|
2008-07-22 14:24:36 +00:00
|
|
|
super(rml2html, self).__init__(datas)
|
2009-04-28 10:24:21 +00:00
|
|
|
self.rml = rml
|
|
|
|
self.localcontext = localcontext
|
2008-07-22 14:24:36 +00:00
|
|
|
self.output_type = 'html'
|
2008-08-11 09:27:55 +00:00
|
|
|
|
2008-07-22 14:24:36 +00:00
|
|
|
def _render(self):
|
2009-04-28 10:24:21 +00:00
|
|
|
return htmlizer.parseString(self.rml,self.localcontext)
|
|
|
|
|
2008-12-12 23:16:18 +00:00
|
|
|
class rml2txt(render.render):
|
2010-12-14 16:28:26 +00:00
|
|
|
def __init__(self, rml, localcontext= None, datas=None):
|
2008-12-12 23:16:18 +00:00
|
|
|
super(rml2txt, self).__init__(datas)
|
2009-05-07 17:17:06 +00:00
|
|
|
self.rml = rml
|
2010-11-23 15:11:10 +00:00
|
|
|
self.localcontext = localcontext
|
2008-12-12 23:16:18 +00:00
|
|
|
self.output_type = 'txt'
|
|
|
|
|
|
|
|
def _render(self):
|
2009-05-07 17:17:06 +00:00
|
|
|
return txtizer.parseString(self.rml, self.localcontext)
|
2008-12-12 23:16:18 +00:00
|
|
|
|
2009-04-28 10:24:21 +00:00
|
|
|
class odt2odt(render.render):
|
2010-12-14 16:28:26 +00:00
|
|
|
def __init__(self, rml, localcontext=None, datas=None):
|
2009-04-28 10:24:21 +00:00
|
|
|
render.render.__init__(self, datas)
|
|
|
|
self.rml_dom = rml
|
|
|
|
self.localcontext = localcontext
|
|
|
|
self.output_type = 'odt'
|
|
|
|
|
|
|
|
def _render(self):
|
|
|
|
return odt.parseNode(self.rml_dom,self.localcontext)
|
2008-07-23 15:01:27 +00:00
|
|
|
|
2009-05-05 11:42:27 +00:00
|
|
|
class html2html(render.render):
|
2010-12-14 16:28:26 +00:00
|
|
|
def __init__(self, rml, localcontext=None, datas=None):
|
2009-05-05 11:42:27 +00:00
|
|
|
render.render.__init__(self, datas)
|
|
|
|
self.rml_dom = rml
|
|
|
|
self.localcontext = localcontext
|
|
|
|
self.output_type = 'html'
|
2009-10-30 12:33:59 +00:00
|
|
|
|
2009-05-05 11:42:27 +00:00
|
|
|
def _render(self):
|
|
|
|
return html.parseString(self.rml_dom,self.localcontext)
|
|
|
|
|
2009-10-30 12:33:59 +00:00
|
|
|
class makohtml2html(render.render):
|
|
|
|
def __init__(self, html, localcontext = None):
|
|
|
|
render.render.__init__(self)
|
|
|
|
self.html = html
|
|
|
|
self.localcontext = localcontext
|
|
|
|
self.output_type = 'html'
|
|
|
|
|
|
|
|
def _render(self):
|
|
|
|
return makohtml.parseNode(self.html,self.localcontext)
|
|
|
|
|
2008-07-23 15:01:27 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|