Skip to content

Redo structure labels code #703

Open

Description

@krusynth

The get_structure_labels function assumes that every structure in the code will have the same label at the same depth; in practice, this is not the case. E.g., even a small subset of VA's code yields the following inconsistencies:

+----------+-------+
| label    | depth |
+----------+-------+
| title    |     1 |
| chapter  |     2 |
| part     |     2 |
| subtitle |     2 |
| title    |     2 |
| article  |     3 |
| chapter  |     3 |
| part     |     3 |
| article  |     4 |
| chapter  |     4 |
| article  |     5 |
+----------+-------+

This function should be removed entirely since it's inconsistent, and the code that uses it rewritten to parse the structures of the current section instead.

Activity

  1. self-assigned this
    on Apr 16, 2017
  2. krusynth commented on Apr 16, 2017

    @krusynth
    MemberAuthor

    A side effect of this problem is that as-written, the query for structure labels results in less labels than actually account for the full depth of the structure tree, making browsing inconsistent. (Structure pages do not have enough ancestors in the breadcrumbs.)

  3. waldoj commented on Apr 17, 2017

    @waldoj
    Member

    Argh, you're right, of course. When I put together that functionality, it was when both the official SGML and the official site reflected a simple title / chapter / section structure. I can't envision, at the moment, how many things are broken by this new reality. :-/

  4. krusynth commented on Apr 17, 2017

    @krusynth
    MemberAuthor

    That PR should take care of the bulk of this – it only effects two places: the dictionary generation, and the calculation for the structure_unified view.

    The American Legal parser should get a similar treatment at some point, but that's not a high priority right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions