papyri/xsugar

Combining <num> with <gap> and @rend="tick"

Opened this issue · 2 comments

In the course of encoding some mathematical papyri, I've discovered a gap in XSugar that it would be nice to fill. If we are dealing with a multi-digit whole number or fraction and one of the digits is in a <gap>, it is not possible to add @rend="tick" to <num> without breaking XSugar.

So, for example, we might consider the following. This first scenario behaves as expected, with XSugar conversion from xml to Leiden+ and back.

  • κ[.] (= print)
  • <#κ[.1]=21-29#> (= Leiden+)
  • <num atLeast="21" atMost="29">κ<gap reason="lost" quantity="1" unit="character"/></num> (= xml)

The addition of a tick is problematic because XSugar does not recognize it in the vicinity of <gap>, as the xml indicates

  • κ[.] ´ (= print)
  • <#κ[.1] '=21-29#> (= Leiden+)
  • <num atLeast="21" atMost="29">κ<gap reason="lost" quantity="1" unit="character"/> '</num> (= xml)

Of course, one can add @rend="tick" manually to the xml, but although this displays correctly in PN or in PE under 'preview', it breaks Leiden+, rendering the file broken for future editors.

This bug persists regardless of the position of <gap>; no matter which digit is lacunose, XSugar fails to process the tick properly

I think this particular issue is happening because we don't have a grammar rule for combining @rend=tick with @atMost/@atLeast—so the @atMost/@atLeast grammar rule gets triggered and treats the tick like content text. I think I just need to add an ordered rule above the existing @atMost/@atLeast rules that adds a @rend=tick rule so that it will be consumed first.

I should have known it was something niche and not something more ordinary. If it's an easy fix that's great; if not I doubt it's one we'll encounter too frequently since @atMost/Least isn't especially common in our number markup.