Giter VIP home page Giter VIP logo

Comments (8)

osamuaoki avatar osamuaoki commented on August 17, 2024

This bug is preventing to move debian-history to migrate to XML.

It's not the bug in the normalization of output to the file but the way output strings are stored on @{$self->{TT}{doc_out}}. Although code expects array item to contain one line, it actually contain new line character for XML case.

If you carefully check output under debug, this is obvious since it lists multiple lines as the matched string. (Yes, it's too much to realize. I actually needed to change source to clearly mark matched line ... but that is another story) This reviled that array item contained multiple lines.

So what is needed seems to be something like:
@{$self->{TT}{doc_out}} = map {"$\n"} map {split '\n', $ } @{$self->{TT}{doc_out}};

This is a simple code to split multi-line item into multiple items of array. This sort-of works right if this is inserted after encoding setting before checking match with $position around line 651.

Now the question is the detail around "\n" handling. Avoiding perl odd rule using -1 for split seemed to be good thing to consider in order not to drop tailing "\n" for split. I thought doing the following seems to be better if each array item itself

@{$self->{TT}{doc_out}} = map {"$\n"} map {split '\n', $, -1 } @{$self->{TT}{doc_out}};

But this seems to produce too many "\n"s.

The initial map {"$_\n"} looks stupid time consuming code. So Setting one of:

  • IO::Handle->output_record_separator( EXPR )
  • $OUTPUT_RECORD_SEPARATOR
  • $ORS
  • $
    seems to be good before "print" if you are perl speaker. But I only see "write" in code which doesn't do this trick. I am not good enough to judge code style.

So I propose to add following as patch to address this bug. This works OK to add translator names into legalnotice within bookinfo tag.

0001-Ensure-one-line-per-item-of-array.patch.txt

from po4a.

osamuaoki avatar osamuaoki commented on August 17, 2024

If you check my patch doesn't have any unwanted side effects, please upload new package with this fix. Than many XML doc get benefit of addendum for buster.

Please.

from po4a.

mquinson avatar mquinson commented on August 17, 2024

I will test your patch ASAP, but that's the beginning of the new term at university here. My free time is really scarce, sorry... Do not hesitate to ping me regularly if you don't see anything coming.

from po4a.

osamuaoki avatar osamuaoki commented on August 17, 2024

I am not familiar with test suite. Now that I have some idea how to change its behavior of parser for docbook without patching the source, test was done via "-o".

I tested on 4 simple XML book and article files based on examples in https://tdg.docbook.org/tdg/4.5/ with minor edits.

I think applying OPTION1 gives best result. po4a-normalize doesn't work, so there is some space for improvement. But this should give good reference test for book and article.

OPTIONS1 :=
-o nodefault=" "
-o break=" "
-o untranslated=" "
-o translated=" "

So default needs to be updated. I will propose patch later.

Here is the test run on 0.54
po4a-docbook-test.tar.gz

from po4a.

osamuaoki avatar osamuaoki commented on August 17, 2024

Apparently, pasting XML look-like doesn't work. See it in tarball. Sorry.

from po4a.

mquinson avatar mquinson commented on August 17, 2024

Hello again @osamuaoki

I have the feeling that this issue can be closed, since #153 was merged to master. Could you please confirm?

Thanks in advance,

from po4a.

osamuaoki avatar osamuaoki commented on August 17, 2024

Yah... this is non-issue now, I think

from po4a.

mquinson avatar mquinson commented on August 17, 2024

Thanks for confirming. Thus closing.

from po4a.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.