Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix registry.dtd to not use alternatives in function, formatSignature, matchSignature #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2023

Conversation

stasm
Copy link
Collaborator

@stasm stasm commented Jul 23, 2023

A spin-off from #420, in which @mihnita noticed that registry.dtd uses alternatives in a wrong way. For example, <!ELEMENT formatSignature (input?|option*)> means that formatSignature is allowed to have as children either: at most one input OR any number of options, but not both.

Instead, @mihnita suggested using sequences: <!ELEMENT formatSignature (input?,option*)>, which this PR does. Note that sequences require the children to appear in a specific order, which isn't something that's useful to us. However, I'm not aware of any way of lifting this requirement that also allows to enforce at most on input or exactly one description.

…, matchSignature

A spin-off from unicode-org#420, in which @mihnita noticed that `registry.dtd` uses alternatives in a wrong way. For example, `<!ELEMENT formatSignature (input?|option*)>` means that `formatSignature` is allowed to have as children either: at most one `input` OR any number of `options`, but not both.

Instead, @mihnita suggested using sequences: `<!ELEMENT formatSignature (input?,option*)>`, which this PR does. Note that sequences require the children to appear in a specific order, which isn't something that's useful to us. However, I'm not aware of any way of lifting this requirement that also allows to enforce at most on `input` or exactly one `description`.
@@ -1,6 +1,6 @@
<!ELEMENT registry (function*|pattern*)>
<!ELEMENT registry (function|pattern)*>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #420 @mihnita suggested changing this to:

<!ELEMENT registry (function,pattern)*>

...but IIUC, this requires function and pattern to appear one after the other, in this specific order, i.e. interleaved. Instead, in this PR I'm changing the original (function*|pattern*) — which wrongly meant any number of function OR any number of pattern, but never both — to (function|pattern)*.

@stasm stasm requested review from aphillips, eemeli and mihnita July 23, 2023 22:30
@aphillips aphillips added the functions Issue pertains to the default function set label Jul 24, 2023
@stasm
Copy link
Collaborator Author

stasm commented Jul 24, 2023

#420 was merged today, but before I rebase this PR on top of it, I'd like to make sure that we're OK with using DTD sequences:

<!ELEMENT function (description,(formatSignature|matchSignature)+)>
<!ELEMENT formatSignature (input?,option*)>
<!ELEMENT matchSignature (input?,option*,match*)>

Using sequences here means that, for instance, the following formatSignature would not be valid, because option comes before input:

<formatSignature>
    <option name="dateStyle" values="full long medium short"/>
    <input pattern="iso8601"/>
</formatSignature>

@eemeli
Copy link
Collaborator

eemeli commented Jul 24, 2023

I'd like to make sure that we're OK with using DTD sequences

I'm fine with that.

@aphillips aphillips merged commit 2528e8d into unicode-org:main Aug 13, 2023
@stasm
Copy link
Collaborator Author

stasm commented Aug 14, 2023

The commit that made it to the main branch is empty: 2528e8d. Most likely the merge of main into this PR didn't work as intended.

That's OK, however. #435 touches the same lines, so I'll make sure to make appropriate fixes there.

@stasm stasm deleted the registry-dtd-sequences branch August 16, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Issue pertains to the default function set
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants