When I say document fragment I really mean any fragment of a document. As in the example starting this it had a single list item (<li>) element, not even with the list (<list>) element surrounding it.
The code you reference does not deal with such fragments.Whether handing in such a small fragment as the one starting this discussion is correct may be disputed as context could be lost and so results may not be accurate.
Michael Whapples On 06/06/2014 15:58, John J. Boyer wrote:
If you look at the first switch statement in transcribe_document.c you will see that liblouisutdml handles a number of document fragments, such as computer code, graphics music, and of course MathML. John On Fri, Jun 06, 2014 at 02:20:25PM +0100, Michael Whapples wrote:OK, I may differ over whether translateString should be different to translateFile other than the source of the document, but yes it may be worth having a translate fragment function(s). Michael Whapples On 06/06/2014 14:03, Keith Creasy wrote:I agree. My opinion is that the "TranslateString" method should have a different behavior from "TranslateFile". It is counter intuitive at the very least to think that TranslateString would require a complete document. In other words, we should fix it. Also, I think we have the LibLouisUTDML test suite mystery worked out and we should begin to write tests to be sure LibLouisUTDML is doing what we expect. *From:*liblouis-liblouisxml-bounce@xxxxxxxxxxxxx [mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx] *On Behalf Of *Brandon Roller *Sent:* Friday, June 06, 2014 8:58 AM *To:* liblouis-liblouisxml@xxxxxxxxxxxxx *Subject:* [liblouis-liblouisxml] Re: [liblouisutdml] 5 new revisions pushed by mwhapples on 2014-06-04 13:48 GMT So what do you suggest to do to handle editing within brailleblaster? If I edit a range of text and that element begins with a space then how can I get back just the text and the indexes? This seems like a core function of Brailleblaster and if liblouisutdml can't handle it then it seems like we should address this. On Fri, Jun 6, 2014 at 6:38 AM, Michael Whapples <dmarc-noreply@xxxxxxxxxxxxx <mailto:dmarc-noreply@xxxxxxxxxxxxx>> wrote: It is not usual to begin a line or page with a space, so when formatting one would normally not include it. To indent text in XML there normally are better ways to indicate the line should be indented, normally using markup. The problem here is you are passing a document fragment to a document processing function. Michael Whapples On 05/06/2014 16:02, Brandon Roller wrote: I don't follow how cancelling all formatting would result in the inclusion of the space. Shouldn't it just be translated since it is text? On Thu, Jun 5, 2014 at 11:00 AM, John J. Boyer <john.boyer@xxxxxxxxxxxxxxxxx <mailto:john.boyer@xxxxxxxxxxxxxxxxx>> wrote: Well, that's another bug! "paragraphs no" is supposed to cancel all formatting. It might be good to have a less blunt instrument that at least preserves <newline> tags. John On Thu, Jun 05, 2014 at 10:22:42AM -0400, Brandon Roller wrote: > That has no effect. > > > On Thu, Jun 5, 2014 at 9:40 AM, John J. Boyer <john.boyer@xxxxxxxxxxxxxxxxx <mailto:john.boyer@xxxxxxxxxxxxxxxxx>> > wrote: > > > When using translateString with utd you might want to include > > "paragraphs no" in the configuration settings string. > > > > John > > On Thu, Jun 05, 2014 at 01:32:32PM +0100, Michael Whapples wrote: > > > One thing I notice in what you posted is that the brl element when > > > using translateString has a newpage and newline element at the > > > beginning, where as the file sample does not. Might the fact its at > > > the beginning of a page be impacting on this? > > > > > > Would be useful to have the full XML being passed in to both functions. > > > > > > Michael Whapples > > > On 05/06/2014 13:24, Brandon Roller wrote: > > > >Yes, but when I look at the liblouisutdml logs I see the following > > > >line: "Begin insert_text: node->content= Items one." > > > >The space is included in the log statement. > > > > > > > > > > > >On Thu, Jun 5, 2014 at 4:51 AM, Michael Whapples > > > ><dmarc-noreply@xxxxxxxxxxxxx <mailto:dmarc-noreply@xxxxxxxxxxxxx> <mailto:dmarc-noreply@xxxxxxxxxxxxx <mailto:dmarc-noreply@xxxxxxxxxxxxx>>> > > > >wrote: > > > > > > > > My initial reaction was the same as Keith, DTD information must be > > > > included for it to work correct. > > > > > > > > The only other one where I would expect things to be different is > > > > if you give anything but nimas in, as I only turned on > > > > internetAccess yes in nimas.cfg. > > > > > > > > However if the XML is identical in both calls then there should be > > > > no difference. Thus it seems like a bug. I will get to look at > > > > this, could you open a ticket in RT, feel free to assign it to me > > > > as I probably will be picking it up anyway. > > > > > > > > Michael Whapples > > > > On 04/06/2014 19:00, Brandon Roller wrote: > > > >> I just tried that and it didn't work. > > > >> > > > >> > > > >> On Wed, Jun 4, 2014 at 1:49 PM, Keith Creasy <kcreasy@xxxxxxx <mailto:kcreasy@xxxxxxx> > > > >> <mailto:kcreasy@xxxxxxx <mailto:kcreasy@xxxxxxx>>> wrote: > > > >> > > > >> When you send the fragment do you include the DTD reference? > > > >> > > > >> *From:*liblouis-liblouisxml-bounce@xxxxxxxxxxxxx <mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx> > > > >> <mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx <mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx>> > > > >> [mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx <mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx> > > > >> <mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx <mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx>>] *On > > > >> Behalf Of *Brandon Roller > > > >> *Sent:* Wednesday, June 04, 2014 1:37 PM > > > >> *To:* liblouis-liblouisxml@xxxxxxxxxxxxx <mailto:liblouis-liblouisxml@xxxxxxxxxxxxx> > > > >> <mailto:liblouis-liblouisxml@xxxxxxxxxxxxx <mailto:liblouis-liblouisxml@xxxxxxxxxxxxx>> > > > >> *Subject:* [liblouis-liblouisxml] Re: [liblouisutdml] 5 new > > > >> revisions pushed by mwhapples on 2014-06-04 13:48 GMT > > > >> > > > >> The changes to whitespace seem to be working well, which is > > > >> great, but it doesn't seem to be honored when translateString > > > >> is called. Any ideas why this might be happening? For > > > >> example, if the original element is translated as follows, > > > >> which is correct, the braille translation is correct: <span > > > >> semantics="action,no"> Item one.<brl index="0 1 1 2 3 4 5 6 6 > > > >> 9"> ,item "o4</brl></span> > > > >> > > > >> However, if I call translateString and pass that element the > > > >> result does not include the space as follows: <span > > > >> semantics="action,no"> Items one.<brl index="0 0 1 2 3 4 5 6 > > > >> 6 9"><newpage brlnumber="1" /><newline xy="20,10" />,items > > > >> "o4</brl></span>. > > > >> > > > >> On Wed, Jun 4, 2014 at 9:48 AM, <liblouisutdml@xxxxxxxxxxxxxx <mailto:liblouisutdml@xxxxxxxxxxxxxx> > > > >> <mailto:liblouisutdml@xxxxxxxxxxxxxx <mailto:liblouisutdml@xxxxxxxxxxxxxx>>> wrote: > > > >> > > > >> 5 new revisions: > > > >> > > > >> Revision: acac8f8318d5 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Mon Jun 2 11:53:48 2014 UTC > > > >> Log: Add logging to show nodes as they are parsed. > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=acac8f8318d5 > > > >> > > > >> Revision: 0fe61e0119e2 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Mon Jun 2 12:47:54 2014 UTC > > > >> Log: Explicit cast. > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=0fe61e0119e2 > > > >> > > > >> Revision: 09f7c4b43c60 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Mon Jun 2 12:52:44 2014 UTC > > > >> Log: Move log message to after all variable declarations. > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=09f7c4b43c60 > > > >> > > > >> Revision: 5a1c5e095e7b > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Tue Jun 3 08:22:15 2014 UTC > > > >> Log: More logging > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=5a1c5e095e7b > > > >> > > > >> Revision: 71378ffa2b31 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Wed Jun 4 13:53:29 2014 UTC > > > >> Log: Disable whitespace stripping > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=71378ffa2b31 > > > >> > > > >> > > ============================================================================== > > > >> Revision: acac8f8318d5 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Mon Jun 2 11:53:48 2014 UTC > > > >> Log: Add logging to show nodes as they are parsed. > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=acac8f8318d5 > > > >> > > > >> Modified: > > > >> /liblouisutdml/examine_document.c > > > >> > > > >> ======================================= > > > >> --- /liblouisutdml/examine_document.c Sat Mar 30 05:19:40 > > > >> 2013 UTC > > > >> +++ /liblouisutdml/examine_document.c Mon Jun 2 11:53:48 > > > >> 2014 UTC > > > >> @@ -41,6 +41,7 @@ > > > >> examine_document (xmlNode * node) > > > >> { > > > >> /*Examine the parse tree, add semantic attributes and set > > > >> indicators.*/ > > > >> + logMessage(LOG_INFO, "Begin examine_document: > > > >> node->name=%s", node->name); > > > >> xmlNode *child; > > > >> if (node == NULL) > > > >> return 0; > > > >> @@ -111,6 +112,7 @@ > > > >> examText (xmlNode * node) > > > >> /*We may want to examine text content in the future*/ > > > >> { > > > >> + logMessage(LOG_INFO, "Begin examText: node->content=%s", > > > >> node->content); > > > >> switch (ud->stack[ud->top]) > > > >> { > > > >> case pagenum: > > > >> > > > >> > > ============================================================================== > > > >> Revision: 0fe61e0119e2 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Mon Jun 2 12:47:54 2014 UTC > > > >> Log: Explicit cast. > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=0fe61e0119e2 > > > >> > > > >> Modified: > > > >> /liblouisutdml/examine_document.c > > > >> > > > >> ======================================= > > > >> --- /liblouisutdml/examine_document.c Mon Jun 2 11:53:48 > > > >> 2014 UTC > > > >> +++ /liblouisutdml/examine_document.c Mon Jun 2 12:47:54 > > > >> 2014 UTC > > > >> @@ -41,7 +41,7 @@ > > > >> examine_document (xmlNode * node) > > > >> { > > > >> /*Examine the parse tree, add semantic attributes and set > > > >> indicators.*/ > > > >> - logMessage(LOG_INFO, "Begin examine_document: > > > >> node->name=%s", node->name); > > > >> + logMessage(LOG_INFO, "Begin examine_document: > > > >> node->name=%s", (char *)node->name); > > > >> xmlNode *child; > > > >> if (node == NULL) > > > >> return 0; > > > >> > > > >> > > ============================================================================== > > > >> Revision: 09f7c4b43c60 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Mon Jun 2 12:52:44 2014 UTC > > > >> Log: Move log message to after all variable declarations. > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=09f7c4b43c60 > > > >> > > > >> Modified: > > > >> /liblouisutdml/examine_document.c > > > >> > > > >> ======================================= > > > >> --- /liblouisutdml/examine_document.c Mon Jun 2 12:47:54 > > > >> 2014 UTC > > > >> +++ /liblouisutdml/examine_document.c Mon Jun 2 12:52:44 > > > >> 2014 UTC > > > >> @@ -41,8 +41,8 @@ > > > >> examine_document (xmlNode * node) > > > >> { > > > >> /*Examine the parse tree, add semantic attributes and set > > > >> indicators.*/ > > > >> - logMessage(LOG_INFO, "Begin examine_document: > > > >> node->name=%s", (char *)node->name); > > > >> xmlNode *child; > > > >> + logMessage(LOG_INFO, "Begin examine_document: > > > >> node->name=%s", node->name); > > > >> if (node == NULL) > > > >> return 0; > > > >> ud->stack[++ud->top] = set_sem_attr (node); > > > >> > > > >> > > ============================================================================== > > > >> Revision: 5a1c5e095e7b > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Tue Jun 3 08:22:15 2014 UTC > > > >> Log: More logging > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=5a1c5e095e7b > > > >> > > > >> Modified: > > > >> /liblouisutdml/examine_document.c > > > >> > > > >> ======================================= > > > >> --- /liblouisutdml/examine_document.c Mon Jun 2 12:52:44 > > > >> 2014 UTC > > > >> +++ /liblouisutdml/examine_document.c Tue Jun 3 08:22:15 > > > >> 2014 UTC > > > >> @@ -125,6 +125,7 @@ > > > >> static void > > > >> examCdataa (xmlNode * node) > > > >> { > > > >> + logMessage(LOG_INFO, "Begin examCdata"); > > > >> ud->has_cdata = 1; > > > >> } > > > >> > > > >> > > > >> > > ============================================================================== > > > >> Revision: 71378ffa2b31 > > > >> Branch: default > > > >> Author: Michael Whapples > > > >> Date: Wed Jun 4 13:53:29 2014 UTC > > > >> Log: Disable whitespace stripping > > > >> > > http://code.google.com/p/liblouisutdml/source/detail?r=71378ffa2b31 > > > >> > > > >> Modified: > > > >> /liblouisutdml/transcriber.c > > > >> > > > >> ======================================= > > > >> --- /liblouisutdml/transcriber.c Mon Jun 2 08:45:16 2014 UTC > > > >> +++ /liblouisutdml/transcriber.c Wed Jun 4 13:53:29 2014 UTC > > > >> @@ -1095,16 +1095,16 @@ > > > >> int k; > > > >> // int stripSpace = 0; > > > >> logMessage(LOG_INFO, "Begin insert_text: > > > >> node->content=%s", node->content); > > > >> - for (k = length; k > 0 && node->content[k - 1] <= 32; k--); > > > >> + // for (k = length; k > 0 && node->content[k - 1] <= 32; > > k--); > > > >> // We want to track if the node only contains space 0x20 > > > >> characters > > > >> // if (node->content[k - 1] != 32) > > > >> // stripSpace = 1; > > > >> // if (stripSpace == 0) > > > >> // k = length; // We want to keep the spaces > > > >> - if (k <= 0) > > > >> - return; > > > >> - if (k < length) > > > >> - length = k + 1; /*Keep last whitespace */ > > > >> + //if (k <= 0) > > > >> + // return; > > > >> + //if (k < length) > > > >> + // length = k + 1; /*Keep last whitespace */ > > > >> if (style->emphasis) > > > >> push_action (style->emphasis); > > > >> if (ud->format_for == utd) > > > >> For a description of the software, to download it and links to > > > >> project pages go to http://www.abilitiessoft.com <http://www.abilitiessoft.com> > > > >> > > > >> > > > > > > > > > > > > > > > -- > > John J. Boyer; President, Chief Software Developer > > Abilitiessoft, Inc. > > http://www.abilitiessoft.com > > Madison, Wisconsin USA > > Developing software for people with disabilities > > > > For a description of the software, to download it and links to > > project pages go to http://www.abilitiessoft.com > > -- John J. Boyer; President, Chief Software Developer Abilitiessoft, Inc. http://www.abilitiessoft.com Madison, Wisconsin USA Developing software for people with disabilities For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com <http://www.abilitiessoft.com>
For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com