git @ Cat's Eye Technologies Feedmark / 992b994
Improve interface on Document. Chris Pressey a month ago
2 changed file(s) with 17 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
5757 def __str__(self):
5858 return "document '{}'".format(self.title.encode("utf-8"))
5959
60 def set_title(self, title):
61 self.title = title
62
63 @property
64 def header_comment(self):
65 md = ""
66 for element in self._header_comment:
67 md += self.renderer.render(element)
68 return md
69
70 def add_to_header_comment(self, element):
71 self._header_comment.append(element)
72
6073 @property
6174 def preamble(self):
6275 md = ""
6578 md += "\n"
6679 return md
6780
68 @property
69 def header_comment(self):
70 md = ""
71 for element in self._header_comment:
72 md += self.renderer.render(element)
73 return md
74
75 def set_title(self, title):
76 self.title = title
81 def add_to_preamble(self, element):
82 self._preamble.append(element)
7783
7884 def add_property(self, kind, key, value):
7985 if kind == ":":
108108 else:
109109 document.preamble.append(child)
110110 elif isinstance(child, HTMLBlock) and not section:
111 document.header_comment.append(child)
111 document.add_to_header_comment(child)
112112 elif reading_properties and isinstance(child, List):
113113 reading_images = False
114114 reading_properties = False
134134 if section:
135135 section.add_to_body(child)
136136 else:
137 document._preamble.append(child)
137 document.add_to_preamble(child)
138138
139139 return document