paraphrase
paraphrase copied to clipboard
Parser able to read comments/documentation
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
I discussed this with Xavier on the mailing list. Future versions of the Android plugin will correctly merge comments.