| OLD | NEW |
| 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. | 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
| 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr | 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
| 3 # | 3 # |
| 4 # This file is part of logilab-common. | 4 # This file is part of logilab-common. |
| 5 # | 5 # |
| 6 # logilab-common is free software: you can redistribute it and/or modify it unde
r | 6 # logilab-common is free software: you can redistribute it and/or modify it unde
r |
| 7 # the terms of the GNU Lesser General Public License as published by the Free | 7 # the terms of the GNU Lesser General Public License as published by the Free |
| 8 # Software Foundation, either version 2.1 of the License, or (at your option) an
y | 8 # Software Foundation, either version 2.1 of the License, or (at your option) an
y |
| 9 # later version. | 9 # later version. |
| 10 # | 10 # |
| 11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT | 11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT |
| 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | 13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 14 # details. | 14 # details. |
| 15 # | 15 # |
| 16 # You should have received a copy of the GNU Lesser General Public License along | 16 # You should have received a copy of the GNU Lesser General Public License along |
| 17 # with logilab-common. If not, see <http://www.gnu.org/licenses/>. | 17 # with logilab-common. If not, see <http://www.gnu.org/licenses/>. |
| 18 """HTML formatting drivers for ureports""" | 18 """HTML formatting drivers for ureports""" |
| 19 from __future__ import generators |
| 19 __docformat__ = "restructuredtext en" | 20 __docformat__ = "restructuredtext en" |
| 20 | 21 |
| 21 from six.moves import range | |
| 22 | |
| 23 from logilab.common.ureports import HTMLWriter | 22 from logilab.common.ureports import HTMLWriter |
| 24 | 23 |
| 25 class DocbookWriter(HTMLWriter): | 24 class DocbookWriter(HTMLWriter): |
| 26 """format layouts as HTML""" | 25 """format layouts as HTML""" |
| 27 | 26 |
| 28 def begin_format(self, layout): | 27 def begin_format(self, layout): |
| 29 """begin to format a layout""" | 28 """begin to format a layout""" |
| 30 super(HTMLWriter, self).begin_format(layout) | 29 super(HTMLWriter, self).begin_format(layout) |
| 31 if self.snippet is None: | 30 if self.snippet is None: |
| 32 self.writeln('<?xml version="1.0" encoding="ISO-8859-1"?>') | 31 self.writeln('<?xml version="1.0" encoding="ISO-8859-1"?>') |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 self.write(layout.data.replace('&', '&').replace('<', '<')) | 130 self.write(layout.data.replace('&', '&').replace('<', '<')) |
| 132 self.writeln(self._indent(' </programlisting>')) | 131 self.writeln(self._indent(' </programlisting>')) |
| 133 | 132 |
| 134 def visit_text(self, layout): | 133 def visit_text(self, layout): |
| 135 """add some text""" | 134 """add some text""" |
| 136 self.write(layout.data.replace('&', '&').replace('<', '<')) | 135 self.write(layout.data.replace('&', '&').replace('<', '<')) |
| 137 | 136 |
| 138 def _indent(self, string): | 137 def _indent(self, string): |
| 139 """correctly indent string according to section""" | 138 """correctly indent string according to section""" |
| 140 return ' ' * 2*(self.section) + string | 139 return ' ' * 2*(self.section) + string |
| OLD | NEW |