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

Rich and localized text API #1423

Open
bartfeenstra opened this issue Apr 27, 2024 · 0 comments
Open

Rich and localized text API #1423

bartfeenstra opened this issue Apr 27, 2024 · 0 comments
Labels
BC break Breaks backwards compatibility with existing integrations enhancement New feature or request python Pull requests that update Python code
Milestone

Comments

@bartfeenstra
Copy link
Owner

bartfeenstra commented Apr 27, 2024

  • document-based (this would actually be a separate follow-up feature)
    • titles
    • dates
    • authors
  • per-text content type, e.g. any piece of natural language has a content type and a locale
  • allow plain text extraction (for search index)
  • Implement this for Note and Described
  • Introduce a new RichText interface to capture this
  • Update existing methods to return not just str but str | RichTextStr where RichTextStr(RichText, str)
  • Can this leverage renders somehow? Maybe those should provide extensions and content types they can render. Or better, just content types and keep a global content type map. Does a library for that already exist?
  • add Renderer.render()? Separate this out into a dedicated PR.
  • we'd need an HTML 'filter' Renderer to allow specific HTML only. This filter MUST NOT be used with other renderer such as Jinja2!
  • allow Gramps notes to get an attribute specifying their content type? If given, do not parse markup XML. If not given, parse markup XML to HTML and set the note as text/html

An example of how Gramps exports notes:

  <notes>
    <note handle="_fb02f4ee0eb2e4ac087c5d16b99" change="1724938235" id="N0000" type="Person Note">
      <text>This is a note WITH BOLD TEXT and a link?</text>
      <style name="bold">
        <range start="15" end="29"/>
      </style>
      <style name="link" value="gramps://Person/handle/f99770ed37f7eb61d0b2c92f0a1">
        <range start="34" end="40"/>
      </style>
    </note>
  </notes>

This can be used to represent pages with managed content, but also notes attached to entities

@bartfeenstra bartfeenstra added enhancement New feature or request python Pull requests that update Python code labels Apr 27, 2024
@bartfeenstra bartfeenstra added this to the 0.4.0 milestone May 19, 2024
@bartfeenstra bartfeenstra added the BC break Breaks backwards compatibility with existing integrations label May 19, 2024
@bartfeenstra bartfeenstra changed the title Rich text API Rich and localized text API Aug 28, 2024
@bartfeenstra bartfeenstra modified the milestones: 0.4.x, 0.4.0 Sep 1, 2024
@bartfeenstra bartfeenstra modified the milestones: 0.4.0, 0.5.0 Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC break Breaks backwards compatibility with existing integrations enhancement New feature or request python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

1 participant