Skip to content

Improve extract_examples to allow naming files based on the chapter or section number  #233

@fingolfin

Description

@fingolfin

In AutoDoc 2019.09.04, the extract_examples generates files which are named pkg01.tst, pkg02.tst, etc., in a strictly linear fashion, with one file "per unit", where units without examples are skipped. In commit 573359e I hacked this up so that it doesn't skip empty units, so that if one uses chapters as units, one gets the chapter number in the filename, which IMHO is better.

But as @zickgraf reminded me today, of course one can also use sections as units; and then the new behavior makes little sense.

So, I think it would be much better if we gave the use the choice between the following variants:

  1. number in a strictly linear fashion, without gaps (the current default)
  2. number based on "unit identifiers": so the chapter number; or for sections, use "chapternum.sectionnum". So examples from section 5.4 would end up in a file pkg_5_4.tst (or pkg_5.4.tst, or pkg_chapter_5_section_4.tst, or whatever). Not sure what other unit types we support, but I'd hope we could come up with a good numbering for each.

I guess other variants are possible, but for now, having option 2 would already make me quite happy and I think it'd work out nicely.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions