Removes existing table of contents starting at index contentLineNdx.
(lines)
| 58 | return out |
| 59 | |
| 60 | def removeToC(lines): |
| 61 | """Removes existing table of contents starting at index contentLineNdx.""" |
| 62 | if not lines[contentLineNdx ].startswith(contentTitle): |
| 63 | return lines[:] |
| 64 | |
| 65 | result_top = lines[:contentLineNdx] |
| 66 | |
| 67 | pos = contentLineNdx + 1 |
| 68 | while lines[pos].startswith('['): |
| 69 | pos = pos + 1 |
| 70 | |
| 71 | result_bottom = lines[pos + 1:] |
| 72 | |
| 73 | return result_top + result_bottom |
| 74 | |
| 75 | def dashifyHeadline(line): |
| 76 | """ |