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

WIP: Render text parts using refsDecls #71

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jacobwegner
Copy link
Contributor

Decouple type="textpart" from refsDecl when rendering text parts / ribbon in SV 1

Calculation is done within the XSLT and within word_tokens; we may
be able to simplify this in the future.

This would also require the XSL stylesheet at the site level to be updated:
```
  <xsl:template match="text()">
    <xsl:variable name="node" select="." />
    <xsl:for-each select="py:tokens(.)">
      <xsl:choose>
        <xsl:when test="py:token_type(.) = 'w'">
          <xsl:element name="t">
            ...
            <xsl:attribute name="passageIdx"><xsl:value-of select="py:token_passage_idx(.)" /></xsl:attribute>
            ...
```
Creates a lookup from word_tokens and allows the XLST
to map from passage token position to veRef

```
  <xsl:template match="text()">
    <xsl:variable name="node" select="." />
    <xsl:for-each select="py:tokens(.)">
      <xsl:choose>
        <xsl:when test="py:token_type(.) = 'w'">
          <xsl:element name="t">
            ...
            <xsl:attribute name="veRef"><xsl:value-of select="py:token_ve_ref(.)" /></xsl:attribute>
            ...
```
Will allow us to pass sub references through to the front end while ignoring them for querying things internally
This commit introduces several XSLT functions that are used to resolve
text parts.

We pass the Citation (refsDecl) instances for a text to the renderer,
and then use the xpaths from each citation to query the XML fragment
for text parts.

This improves upon earlier attempts by not relying on `div[type=textpart]`
or on `l[@n]` for selectors.

I made several processing passes to land on the current implementation;

Timing notes:

`/library/passage/urn:cts:latinLit:phi0893.phi001.perseus-lat2:1/json/`

previous implementation: 0.299s
new implementation: 0.680s

(the new implementation has the new tokenization bits too)
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.

1 participant