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

feat(developer): serialize KMXPlus (back) into XML 🗼 #12969

Open
wants to merge 7 commits into
base: epic/ldml-editor
Choose a base branch
from

Conversation

srl295
Copy link
Member

@srl295 srl295 commented Jan 21, 2025

  • Note: Does not yet handle transforms (which are excluded from the e2e test).
    • transforms are handled via new fields in the KMXPlus struct such as _from, _to which override the calculated output value.
  • e2e test checks in the fixture, so identifies if the serialized content drifts
  • this is to enable editing of XML in the XML editor.

Fixes: #12874

@keymanapp-test-bot skip

@srl295 srl295 self-assigned this Jan 21, 2025
@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S20 milestone Jan 21, 2025
@srl295 srl295 changed the base branch from master to epic/ldml-editor January 21, 2025 15:08
- workaround transform issue by adding bypass (_) fields in the KMXPlus structs

Fixes: #12784
@@ -409,6 +409,8 @@ export class TranTransform {
to: StrsItem;
mapFrom: StrsItem; // var name
mapTo: StrsItem; // var name
_from?: string; // for serialization
_to?: string; // for serialization
Copy link
Contributor

Choose a reason for hiding this comment

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

Will these cause any maintenance confusion with from and to?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using the same pattern as in kmx-plus-builder where we have

  id: BUILDER_STR_REF; // str with original key id
  _id: string; // original key id, for sorting

https://github.com/keymanapp/keyman/blob/feat/developer/12874-kmx-to-xml-epic-ldml-editor/developer/src/common/web/utils/src/types/kmx/kmx-plus-builder/build-keys.ts#L23

I will add clearer documentation on the property.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'm clear on this file and everything after it... just not so clear on the changes before and what their role is - all the new underscore-prefixed entries.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will clarify.

- clarify the purpose of the serializer and the serializer-required fields in KMXPlusFile
- remove an unused SetVarItems.rawItems property added in #11059

Fixes: #12784
// element string array
items: ElementString;
// like items, but with unprocessed marker strings
rawItems: string[];
Copy link
Member Author

Choose a reason for hiding this comment

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

I was going to add an underscore here ( as with _from etc) but realized it was unused.

@srl295 srl295 requested a review from darcywong00 January 23, 2025 18:41
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

LGTM as a starting point

* and are populated by the tran compiler.
*
* - TODO-LDML-EDITOR: Comments, whitespace, etc. are not preserved by this
* approach. Updates to the XML parsing will support this, see #10622.
Copy link
Member

Choose a reason for hiding this comment

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

#10622 (comment) I think the goals I outlined here cover what we need for ldml-editor?

This does mean that we need to be able to round-trip transforms with a 'release build'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

feat(developer): kmx+ to xml serialization 🗼
4 participants