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

Unknown Annotations #55

Merged
merged 2 commits into from
Jun 25, 2018
Merged

Unknown Annotations #55

merged 2 commits into from
Jun 25, 2018

Conversation

tim-evans
Copy link
Collaborator

This adds formal support for unknown annotations.

Unknown Annotations have a particular way of being created; they stuff their type and attributes into the attributes. This means all data is retained for these annotations, while they appear as a homogenous blob. When rendered, these annotations will get categorized into a single bucket of unknown, so they can be rendered for debugging purposes in a document.

For an example, if we import the following HTML document into AtJSON,

<p>Hello, <em>world</em>!</p>

The document created would be a bunch of Unknown Annotations:

{
  "contentType": "application/vnd.atjson+html",
  "content": "<p>Hello, <em>world</em>!</p>",
  "schema": [],
  "annotations": [{
    "type": "-atjson-unknown",
    "start": 0,
    "end": 29,
    "attributes": {
      "type": "-html-p",
      "attributes": {}
    }
  }, {
    "type": "-atjson-unknown",
    "start": 11,
    "end": 25,
    "attributes": {
      "type": "-html-em",
      "attributes": {}
    }
  }, {
    "type": "-atjson-parse-token",
    "start": 0,
    "end": 4,
    "attributes": {}
  }, {
    "type": "-atjson-parse-token",
    "start": 11,
    "end": 15,
    "attributes": {}
  }, {
    "type": "-atjson-parse-token",
    "start": 20,
    "end": 25,
    "attributes": {}
  }, {
    "type": "-atjson-parse-token",
    "start": 26,
    "end": 30,
    "attributes": {}
  }]
}

Copy link
Contributor

@bachbui bachbui left a comment

Choose a reason for hiding this comment

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

Looks good to me. Nice additions to the @atjson/document tests

Copy link
Contributor

@blaine blaine left a comment

Choose a reason for hiding this comment

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

Fantastic - Understand :all-the-things:

@tim-evans tim-evans changed the base branch from annotation-abstract-class to annotation-classes June 25, 2018 18:18
@tim-evans tim-evans merged commit aee83e0 into annotation-classes Jun 25, 2018
@tim-evans tim-evans deleted the unknown-annotation branch June 25, 2018 18:40
tim-evans added a commit that referenced this pull request Jun 25, 2018
This casts any annotations not identified in the schema list into an UnknownAnnotation. Unknown Annotations are AtJSON's form of Ruby's `method_missing`, with the added benefit that these annotations will be stored and updated in a document even after being updated.
tim-evans added a commit that referenced this pull request Aug 17, 2018
This casts any annotations not identified in the schema list into an UnknownAnnotation. Unknown Annotations are AtJSON's form of Ruby's `method_missing`, with the added benefit that these annotations will be stored and updated in a document even after being updated.
tim-evans added a commit that referenced this pull request Sep 26, 2018
This casts any annotations not identified in the schema list into an UnknownAnnotation. Unknown Annotations are AtJSON's form of Ruby's `method_missing`, with the added benefit that these annotations will be stored and updated in a document even after being updated.
tim-evans added a commit that referenced this pull request Oct 11, 2018
This casts any annotations not identified in the schema list into an UnknownAnnotation. Unknown Annotations are AtJSON's form of Ruby's `method_missing`, with the added benefit that these annotations will be stored and updated in a document even after being updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants