TEIC / TEI

The Text Encoding Initiative Guidelines
https://www.tei-c.org
Other
279 stars 88 forks source link

classes/memberOf should be ordered (att.global first, then alphabetical) #2463

Open joeytakeda opened 1 year ago

joeytakeda commented 1 year ago

As discussed at the F2F, we have tended to order classes/memberOf as att.global first, and then alphabetical for the rest. Only 14 elements do not have att.global as their first attribute class child (i.e. classes[not(memberOf[starts-with(@key,'att.')][1]/@key = 'att.global')]):

<change>:

  1. att.ascribed
  2. att.datable
  3. att.docStatus
  4. att.global
  5. att.typed

<death>:

  1. att.datable
  2. att.dimensions
  3. att.editLike
  4. att.global
  5. att.naming
  6. att.typed

<fDecl>:

  1. att.datcat
  2. att.global

<geogFeat>:

  1. att.datable
  2. att.editLike
  3. att.global
  4. att.naming
  5. att.typed
  6. att.dimensions

<geogName>:

  1. att.datable
  2. att.editLike
  3. att.global
  4. att.naming
  5. att.typed

<line>:

  1. att.typed
  2. att.global
  3. att.coordinated
  4. att.written

<media>:

  1. att.typed
  2. att.global
  3. att.media
  4. att.resourced
  5. att.declaring
  6. att.timed

<objectName>:

  1. att.datable
  2. att.editLike
  3. att.global
  4. att.personal
  5. att.typed

<offset>:

  1. att.datable
  2. att.editLike
  3. att.global
  4. att.naming
  5. att.typed
  6. att.dimensions

<placeName>:

  1. att.datable
  2. att.editLike
  3. att.global
  4. att.personal
  5. att.typed

<ptr>:

  1. att.cReferencing
  2. att.declaring
  3. att.global
  4. att.internetMedia
  5. att.pointing
  6. att.typed

<punctuation>:

  1. att.declarable
  2. att.global

<ref>:

  1. att.cReferencing
  2. att.declaring
  3. att.global
  4. att.internetMedia
  5. att.pointing
  6. att.typed

<stage>:

  1. att.ascribed.directed
  2. att.global
  3. att.placement
  4. att.written

I submit these should be all be changed to att.global and then alphabetically (A-Z)

sydb commented 1 month ago

To be clear, the order is obviously non-informational. This change would just be in a (possibly vain) attempt to make the specification XML easier to read by humans. I am not against it (nor really in favor), but if we do this we would want to add a <constraintSpec> to p5odds.odd that enforces the order in the future. Also this ticket does not address model class positioning vs attribute classes, but I think we may as well do both at once.

sydb commented 4 weeks ago

Thus

  <sch:rule context="tei:classes">
    <sch:let name="keys_as_specified" value="tei:memberOf/@key"/>
    <sch:let name="keys_in_order"
             value="if ( $keys_as_specified = 'att.global' )
                    then ( 'att.global', sort( $keys_as_specified )[. ne 'att.global'] )
                    else sort( $keys_as_specified )" />
    <sch:assert test="string-join( $keys_as_specified ) eq string-join( $keys_in_order )">
      class membership should be specified in sorted order, except att.global goes first.
    </sch:assert>
  </sch:rule>
sydb commented 3 weeks ago

Oh dear. What to do? I had intended to commit to a new branch, but somehow changes ended up in dev branch, instead.[1] Then, when my changes ended up in dev, not my new branch, I came here to look and realized I was not assigned to this ticket. (Somehow I left the F2F Council meeting last weekend thinking I was assigned to this one.) Sigh. Anyway, all tests are passing in the docker. There are a dozen occurrences of the new warning message, but those can be picked off at our leisure. So I am not personally inclined to try to revert this change and re-create it in a new branch, issue a PR, and have it pulled into dev. In large part because doing that would exceed my current git capabilities.

Note [1] I am guessing that the problem is that I have different setting in my .git file on my desktop and laptop. Because I can swear on a ton of bricks that the sequence of git commands I used has done what I want in the past, but did not this time. For the record, here is the console transcript for what I did:

(599) Padfoot ~/Documents/TEI_gitHub/P5 @ 08:32:48 ->git status -uno
On branch dev
Your branch is ahead of 'origin/dev' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit (use -u to show untracked files)
(600) Padfoot ~/Documents/TEI_gitHub/P5 @ 08:32:51 ->git checkout -b sydb_issue_2463
Switched to a new branch 'sydb_issue_2463'
(601) Padfoot ~/Documents/TEI_gitHub/P5 @ 08:33:22 ->git push
Enumerating objects: 1786, done.
Counting objects: 100% (1786/1786), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1033/1033), done.
Writing objects: 100% (1033/1033), 105.70 KiB | 522.00 KiB/s, done.
Total 1033 (delta 1021), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1021/1021), completed with 752 local objects.        
To github.com:TEIC/TEI.git
   ac2d0f7e0..d84b97546  dev -> dev
(602) Padfoot ~/Documents/TEI_gitHub/P5 @ 08:33:33 ->