Skip to content

feat(experimental): begin support for text content whitespace handling #52

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 6 commits into from
Jun 7, 2020

Conversation

aimee-gm
Copy link
Member

@aimee-gm aimee-gm commented Jun 1, 2020

Fixes # 51.

Checklist

  • Added validaton to any changes in the parser API.
  • Added tests covering the parsing behaviour changes.
  • Linked to any relevant issues this will close.
  • Tested the output using the demo.

Changes to parsing behaviour

With an experimental flag, whitespace will be handled in textContent()

Example input covered by new behaviour

<div class="h-entry">
  <span class="p-location h-adr">
    <span class="p-locality">Berlin</span>,
    <span class="p-region">Berlin</span>,
    <span class="p-country-name">DE</span>
    <data class="p-latitude" value="52.518606"></data>
    <data class="p-longitude" value="13.376127"></data>
  </span>
</div>

Example output from new behaviour

{
  "items": [
    {
      "type": ["h-entry"],
      "properties": {
        "location": [
          {
            "type": ["h-adr"],
            "properties": {
              "locality": ["Berlin"],
              "region": ["Berlin"],
              "country-name": ["DE"],
              "latitude": ["52.518606"],
              "longitude": ["13.376127"]
            },
            "value": "Berlin, Berlin, DE"
          }
        ]
      }
    }
  ],
  "rels": {},
  "rel-urls": {}
}

Other changes

  • Adds isEnabled() method for determining if an experimental option is enabled.

@aimee-gm aimee-gm marked this pull request as draft June 1, 2020 07:53
@aimee-gm aimee-gm self-assigned this Jun 1, 2020
@aimee-gm aimee-gm force-pushed the feat/text-content branch from dfa0256 to d9d3723 Compare June 1, 2020 08:02
@aimee-gm aimee-gm added the experimental Relates to experimental microformat parasing label Jun 1, 2020
@aimee-gm aimee-gm force-pushed the feat/text-content branch from c3d7171 to a6b76f2 Compare June 6, 2020 22:27
@aimee-gm aimee-gm force-pushed the feat/text-content branch from b7fc072 to 9c3ad30 Compare June 6, 2020 22:32
@aimee-gm aimee-gm marked this pull request as ready for review June 7, 2020 08:00
@aimee-gm aimee-gm merged commit 930b4cb into master Jun 7, 2020
@aimee-gm aimee-gm deleted the feat/text-content branch June 7, 2020 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental Relates to experimental microformat parasing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants