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

folia2txt vs. FoLiA-2text handling of <part> nodes #28

Closed
kosloot opened this issue Feb 2, 2021 · 3 comments
Closed

folia2txt vs. FoLiA-2text handling of <part> nodes #28

kosloot opened this issue Feb 2, 2021 · 3 comments
Assignees

Comments

@kosloot
Copy link
Collaborator

kosloot commented Feb 2, 2021

Given this FoLiA file:

<?xml version="1.0" encoding="UTF-8"?>
<FoLiA xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://ilk.uvt.nl/folia" xml:id="parts" generator="libfolia-v2.8" version="2.4.0">
  <metadata type="native">
    <annotations>
      <paragraph-annotation set="set"/>
      <part-annotation set="set"/>
      <style-annotation set="set"/>
      <hyphenation-annotation set="set"/>
      <text-annotation set="https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/text.foliaset.ttl"/>
    </annotations>
  </metadata>
  <text xml:id="parts.text">
    <p xml:id="parts.text.p1">
      <feat class="Justified" subset="par_align"/>
      <part xml:id="parts.text.p1.part.1" class="line">
        <part xml:id="parts.text.p1.part.1.part.1" class="fragment">
          <t>
            <t-style>Dit </t-style>
          </t>
        </part>
        <part xml:id="parts.text.p1.part.1.part.2" class="fragment">
          <t>
            <t-style>is een gebroken lijn</t-style>
          </t>
        </part>
      </part>
      <part xml:id="parts.text.p1.part.2" class="line" space="no">
        <t>
          <t-style>met nog een lijn die is af<t-hbr/></t-style>
        </t>
      </part>
      <part xml:id="parts.text.p1.part.3" class="line">
        <part xml:id="parts.text.p1.part.3.part.1" class="fragment">
          <t>
            <t-style>gebroken bij een hyphen.<br/></t-style>
          </t>
          </part>
          <part xml:id="parts.text.p1.part.2.part.2" class="fragment">
            <t>
              <t-style>nieuwe regel</t-style>
            </t>
          </part>
      </part>
    </p>
  </text>
</FoLiA>

Note the space="no" and and the
!

folia2txt produces this text:

            Dit 
           
            is een gebroken lijn
           
          met nog een lijn die is af
        
            gebroken bij een hyphen.

           
              nieuwe regel

OTOH, FoLiA-2text produces:

Dit is een gebroken lijn met nog een lijn die is afgebroken bij een hyphen.
nieuwe regel

I wonder which of both is "correct". folia2txt missing the space="no" seems a problem to me anyway.

I tries the same with on level of <part> nodes less:

<?xml version="1.0" encoding="UTF-8"?>
<FoLiA xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://ilk.uvt.nl/folia" xml:id="parts" generator="libfolia-v2.8" version="2.4.0">
  <metadata type="native">
    <annotations>
      <paragraph-annotation set="set"/>
      <part-annotation set="set"/>
      <style-annotation set="set"/>
      <hyphenation-annotation set="set"/>
      <text-annotation set="https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/text.foliaset.ttl"/>
    </annotations>
  </metadata>
  <text xml:id="parts.text">
    <p xml:id="parts.text.p1">
      <feat class="Justified" subset="par_align"/>
      <part xml:id="parts.text.p1.part.1." class="line">
        <t>
          <t-style>Dit </t-style>
        </t>
      </part>
      <part xml:id="parts.text.p1.part.2" class="line">
        <t>
          <t-style>is een gebroken lijn</t-style>
        </t>
      </part>
      <part xml:id="parts.text.p1.part.3" class="line" space="no">
        <t>
          <t-style>met nog een lijn die is af<t-hbr/></t-style>
        </t>
      </part>
      <part xml:id="parts.text.p1.part.4" class="line">
        <t>
          <t-style>gebroken bij een hyphen.<br/></t-style>
        </t>
      </part>
      <part xml:id="parts.text.p1.part.5" class="fragment">
        <t>
          <t-style>nieuwe regel</t-style>
        </t>
      </part>
    </p>
  </text>
</FoLiA>

In that case the results are:
folia2txt:

            Dit 
           
            is een gebroken lijn
           
          met nog een lijn die is af
        
            gebroken bij een hyphen.

           
              nieuwe regel

FoLiA-2text:

Dit is een gebroken lijn met nog een lijn die is afgebroken bij een hyphen.
nieuwe regel

(which is the same as before)

So again: which one is "correct"

@proycon
Copy link
Owner

proycon commented Feb 2, 2021

Hmm, all that indentation and the newlines shouldn't be there, I was under the impression we fixed that in
proycon/folia#88 . Was this on the latest foliatools/foliapy?

The libfolia output is the correct one indeed here.

@proycon
Copy link
Owner

proycon commented Feb 2, 2021

I think your foliapy/foliatools was outdated, I can't reproduce it:

$ folia2txt issue28.folia.xml
Converting issue28.folia.xml
Dit is een gebroken lijn met nog een lijn die is afgebroken bij een hyphen.
 nieuwe regel

That indenting single space on the second line may be a new issue though, your FoLiA-2text is better.

@kosloot
Copy link
Collaborator Author

kosloot commented Feb 2, 2021

Yest thanx, I did an update and now I can reproduce the last 'new' issue

@proycon proycon closed this as completed Apr 8, 2021
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

No branches or pull requests

2 participants