import_document() has not been returning a section for some time. It's possible there isn't one "top level" section in an AN file (if there's no docTitle, for example), so output the stats that the web interface to AN import is currently using. Thanks to Jaroslav Semančík for reporting. Fixes #460.
Refine clobber to allow skipping, merging, or replacing existing sections. @girogiro's original message: We use a three-level section hierarchy for parliamentary debates: electoral term - session - sitting. There is one AN file per sitting and the files share up to two outer level sections. To import a file into an existing hierarchy and still have an opportunity to replace existing sections I propose the following two changes in AkomaNtoso import. Clobbering works on all levels of section hierarchy now, not on the top-level section only. There are three options for clobbering of sections with the same heading: skip to skip import of a section that already exists, replace to delete existing section and replace it with the imported one, merge to append content of the imported section to the existing one. It might be better also to join respective command-line options into something like --clobbering with three allowed values skip, replace and merge. I just added third separate option --merge-existing to the existing two in sake of backwards compatibility.
The Akoma Ntoso import page needs a small update to work with the new skip/merge/replace options for AN top level sections on import.
* `replace` deletes all existing sections with the same heading (or no heading) as the one being imported. If there are more sections with that name in the import, all of them are imported. * `merge` if there is an existing section with the same heading as the one being imported, speeches of all sections in the import with that heading will be added to it (if there are more existing sections with the same name, speeches are added to the first one). If there is no existing section with the same heading as the one being imported, all sections with that heading are imported as separate sections. * `skip` if there is an existing section with the same heading as the one being imported, import of the section is skipped
Some listings in SayIt depend on the order the speeches and sections were imported. However, when importing a directory files imported by os.walk() function were traversed in random order. This commit sorts the files first by their path and name.
Clobbering works on all levels of section hierarchy now, not on the top-level section only. There are three options for clobbering of sections with the same heading: * `skip` to skip import of sections that already exist, * `replace` to replace existing sections with the imported ones and * `merge` to append content of the imported sections to the existing ones.
We need a title for a section to make the slug out of.
There's no section-list child if it's just a list of sections, so add the border to speech-wrapper instead - but only if it's the last child, because it's still present when there is a section-list.