Commit 025620d
Redesign of repo tooling for mixed URI prefixes in 7.1 (#729)
* Redesign for mixed URI prefixes in 7.1
Closes #727
Unblocks #722 and #723
There's a lot going on here, and I spent several weeks trying to minimize this PR, split it into pieces, etc, but couldn't find a way that worked. So here's an outline of what's changed.
1. In the spec, many tables (notably enumsets) now have an explicit URI entry.
I made the URIs their own column, not the two-line cells used for URIs of events and attributes earlier, mostly because I thought we have space. We can refactor that into using <br> if we prefer.
2. I re-wrote `build/uri-def.py` from the ground up as `build/extract-yaml-tsv.py`.
`uri-def.py` was a 50-line script I wrote that I slowly changed into a 500-line monstristy that I find almost impossible to read or maintain. And it had many assumptions about the spec's format not only in its code (that's inevitable when parsing human text into machine-readable files) ubt also in its design. Trying to add the more versatile URIs was such a headache I decided to use it as an excuse for a long-verdue re-write.
`extract-yaml-tsv.py` uses classes to have the code mirror the files it is designed to produce. It uses type annotations (which pass `mypy`) to avoid various typing bugs. It tries to do one thing in one place instead of doing all things possible everywhere. It's 100 lines longer than `uri-def.py` but faster to run and easier to maintain.
I spent some effort to match ideosynracies of `uri-def.py`, like when to use `strings`, `'strings'`, or `"strings"` in the emitted YAML; but sometimes dong that was not possible without replicating `uri-def.py`'s worse parts, so there are some trivial changes (notably in the order of lists) in the files it creates.
3. I (accidentally) fixed various bugs of omission. `uri-def.py` was sloppy in how it handled the textual explantions in sections that had either gedstruct rules with alternatives or tables. Fixing that with a more principled approach means adding extra `specification:` entries for around half of all YAML files.
4. I tried but failed to match the sorting of the various .tsv files from `uri-def.py`, which was based on some kind of sorting of structures before they were used to generate multiple lines each. I was tempted to scrap that and simply sort the final lines, which is easy and well-defined, but this commit does not do that, instead doing a half-hearted effort at mimickiing the old sorting.
I did all this on 7.1 because that was the original motivation, but if we like it I can port it back to the 7.0 branch (either by adding explicit URIs to the 7.0 spec or by adding special-case handling of tag-to-URI) with relative ease.
* Update build/extract-yaml-tsv.py
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Update build/extract-yaml-tsv.py
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Update build/extract-yaml-tsv.py
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Update build/extract-yaml-tsv.py
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Update build/extract-yaml-tsv.py
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Update build/extract-yaml-tsv.py
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* refactor to split YAML and TSV generation
* add additional version checks, and many updated v7 -> v7.1 URIs
* missing period; handle spaces around <br> in table
* Fix erroneous 7.1 URI found by @dthaler
* roll back some URIs to v7
---------
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>1 parent e8ef142 commit 025620d
209 files changed
Lines changed: 8455 additions & 6215 deletions
File tree
- build
- extracted-files
- tags
- specification
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
0 commit comments