Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Parser able to read comments/documentation#4

Open
danielkutik wants to merge 2 commits intoJakeWharton:masterfrom
danielkutik:eat-comment
Open

Parser able to read comments/documentation#4
danielkutik wants to merge 2 commits intoJakeWharton:masterfrom
danielkutik:eat-comment

Conversation

@danielkutik
Copy link
Copy Markdown
Contributor

Known issues:

  • Android Build process eats comments.
  • Simple implementation without any validation, WIP

This PR is to discuss the issues. Do not merge until resolved.

Problem: If we use the ValueResourceParser and parse the processed values.xml file, which is generated by the build process, then there are no comments, the get eaten.
Possible solution: we need to parse the untouched xml files (strings.xml, ...) to get the comments/documentation...

Original strings.xml:

<resources>
  <!-- This is a comment. Hopefully it makes it to the Javadoc someday! -->
  <string name="simple_test">The {quick} brown {fox} jumps over the {lazy} {dog}.</string>
  <string name="non_matching">A man, a plan, a canal. Panama.</string>
</resources>

Processed/generated values.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

  <!-- From: file:/Users/d/Projects/github/paraphrase/src/test/fixtures/simple/src/main/res/values/strings.xml -->
  <eat-comment />

  <string name="non_matching">A man, a plan, a canal. Panama.</string>
  <string name="simple_test">The {quick} brown {fox} jumps over the {lazy} {dog}.</string>

</resources>

Additional todos:
<!-- <string name="disabled_string">...</string> --> should be ignored and not seen as documentation

Known issue: Android Build process eats comments.
@JakeWharton
Copy link
Copy Markdown
Owner

I discussed this with Xavier on the mailing list. Future versions of the Android plugin will correctly merge comments.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why commented? Seems logical.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Forgot to uncomment... Done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants