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 | |
20 __docformat__ = "restructuredtext en" | 19 __docformat__ = "restructuredtext en" |
21 | 20 |
| 21 from six.moves import range |
| 22 |
22 from logilab.common.ureports import HTMLWriter | 23 from logilab.common.ureports import HTMLWriter |
23 | 24 |
24 class DocbookWriter(HTMLWriter): | 25 class DocbookWriter(HTMLWriter): |
25 """format layouts as HTML""" | 26 """format layouts as HTML""" |
26 | 27 |
27 def begin_format(self, layout): | 28 def begin_format(self, layout): |
28 """begin to format a layout""" | 29 """begin to format a layout""" |
29 super(HTMLWriter, self).begin_format(layout) | 30 super(HTMLWriter, self).begin_format(layout) |
30 if self.snippet is None: | 31 if self.snippet is None: |
31 self.writeln('<?xml version="1.0" encoding="ISO-8859-1"?>') | 32 self.writeln('<?xml version="1.0" encoding="ISO-8859-1"?>') |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 self.write(layout.data.replace('&', '&').replace('<', '<')) | 131 self.write(layout.data.replace('&', '&').replace('<', '<')) |
131 self.writeln(self._indent(' </programlisting>')) | 132 self.writeln(self._indent(' </programlisting>')) |
132 | 133 |
133 def visit_text(self, layout): | 134 def visit_text(self, layout): |
134 """add some text""" | 135 """add some text""" |
135 self.write(layout.data.replace('&', '&').replace('<', '<')) | 136 self.write(layout.data.replace('&', '&').replace('<', '<')) |
136 | 137 |
137 def _indent(self, string): | 138 def _indent(self, string): |
138 """correctly indent string according to section""" | 139 """correctly indent string according to section""" |
139 return ' ' * 2*(self.section) + string | 140 return ' ' * 2*(self.section) + string |
OLD | NEW |