Flushes a doc structure to a ReSTructed string The document is flushed out in a DFS style where sections and their subsections' values are added to the string as they are visited.
(self)
| 214 | del self._structure[name] |
| 215 | |
| 216 | def flush_structure(self): |
| 217 | """Flushes a doc structure to a ReSTructed string |
| 218 | |
| 219 | The document is flushed out in a DFS style where sections and their |
| 220 | subsections' values are added to the string as they are visited. |
| 221 | """ |
| 222 | # We are at the root flush the links at the beginning of the |
| 223 | # document |
| 224 | if len(self.path) == 1: |
| 225 | if self.hrefs: |
| 226 | self.style.new_paragraph() |
| 227 | for refname, link in self.hrefs.items(): |
| 228 | self.style.link_target_definition(refname, link) |
| 229 | value = self.getvalue() |
| 230 | for name, section in self._structure.items(): |
| 231 | value += section.flush_structure() |
| 232 | return value |
| 233 | |
| 234 | def getvalue(self): |
| 235 | return ''.join(self._writes).encode('utf-8') |