Skip to content
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

CLDR-15990 Generate .xsd and .md from .dtd #3108

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

srl295
Copy link
Member

@srl295 srl295 commented Jul 21, 2023

CLDR-15990

  • Updates GenerateDtd, which is normally run automatically as part of BRS, to do two things:
  1. Generate a .xsd file for each .dtd with XML Schema for the DTD files. These are checked into the repository and intended to be released with CLDR.
  2. Generate a .md file in docs/ldml/dtd2md/ with a shell that can be copied into the specification for each element. This directory is .gitignored and the resulting files are not added to the repository.
  • Updates XMLValidator to add a --schema= option allowing it to be used to validate against a schema.

  • Note that DTD @-annotations such as @MATCH are not supported by the converter at present, so such comments are removed from the .xsd

  • CLDR-15990 generate .xsd from .dtd #2350 is the original PR


Example of the generated .md content:

### <a name="Element_languages" href="#Element_languages">Element: languages</a>

> <small>
>
> Parents: [localeDisplayNames](#Element_localeDisplayNames)
>
> Children: [alias](#Element_alias), [language](#Element_language), [_special_](tr35.md#special)
>
> Occurrence: ?, ?
> </small>

_Attribute:_ `draft`

_Attribute:_ `references`

_Attribute:_ `standard`

_Attribute:_ `validSubLocales`

* * *
  • This PR completes the ticket.

ALLOW_MANY_COMMITS=true

srl295 and others added 2 commits July 21, 2023 16:34
- originally unicode-org#2350
- also creates .md files from the .dtd for aid in spec updating

(cherry picked from commit cb6c8bf4928bd219e49620e355f11c67df360e34)
(cherry picked from commit 4fd3cef8f67bc2fd1df0fe17b66dd4f772b377ca)

Co-authored-by: Marc Durdin <marc@durdin.net>
- also add test in workflow (test is advisory. does not fail)
- ignore xml.xsd as it is not usefulx
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

</xs:element>
<!-- @METADATA -->
<!-- @DEPRECATED -->
<!-- @METADATA -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what does it mean to have the two successive @METADATA/@DEPRECATED annotations here?

Copy link
Member Author

Choose a reason for hiding this comment

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

These are now removed.

</xs:attribute>
</xs:complexType>
</xs:element>
<!-- @DEPRECATED -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Still confused about how these annotations are being used. Is there a mapping from the sequence of annotations to items inside the previous block?

Copy link
Member Author

Choose a reason for hiding this comment

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

The annotations aren't used, I've now removed them.

pedberg-icu
pedberg-icu previously approved these changes Jul 22, 2023
Copy link
Contributor

@pedberg-icu pedberg-icu left a comment

Choose a reason for hiding this comment

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

It all looks reasonable, but I did not check the xsd files in detail, I assume they are generated. I have a a general question about what the annotations like @deprecated mean in these xsd files and how they are used, but that is not blocking.

Copy link
Member

@macchiati macchiati left a comment

Choose a reason for hiding this comment

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

I looks like the xsd is tossing in all the annotations way after what they apply to. Also, the description for the PR needs much more information about what is being done and why.

@srl295
Copy link
Member Author

srl295 commented Jul 22, 2023 via email

@srl295
Copy link
Member Author

srl295 commented Jul 22, 2023

I looks like the xsd is tossing in all the annotations way after what they apply to.

They are just comments. It (the off the shelf dtd to xsd converter) is probably grouping them to the item they follow. Perhaps a step would be to just remove the annotation comments.

Also, the description for the PR needs much more information about what is being done and why.

Makes sense. Thanks.

@srl295 srl295 changed the title CLDR-15990 xsd from dtd CLDR-15990 .xsd and .md from .dtd Jul 25, 2023
@srl295 srl295 marked this pull request as draft July 25, 2023 16:02
- separated the markdown and xsd generation
- cleaned up paths and output
@srl295 srl295 marked this pull request as ready for review July 25, 2023 17:27
@srl295 srl295 changed the title CLDR-15990 .xsd and .md from .dtd CLDR-15990 Generate .xsd and .md from .dtd Jul 25, 2023
@srl295
Copy link
Member Author

srl295 commented Jul 31, 2023

ping… can i get a review on this? it now removes the annotation comments.

@srl295 srl295 merged commit 76c78fd into unicode-org:main Aug 2, 2023
@srl295 srl295 deleted the cldr-15990/xsd-from-dtd branch August 2, 2023 19:03
@srl295 srl295 mentioned this pull request Aug 17, 2023
1 task
srl295 added a commit to srl295/cldr that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants