[oXygen-user] Pretty Print <lb/> in Oxygen

George Bina
Mon Oct 27 18:02:10 CDT 2014


Hi Daniel,

Yes, oXygen already breaks lines at <lb/> elements in Author mode. This 
is done by making lb a block and displaying an empty string as its 
content, thus making it invisible but forcing the following text to go 
on a new line:

lb:before{
     content:"";
}

lb {
     display:block;
}

Users can also modify the CSS files if they want to or provide 
additional or alternate CSS rules either at the framework level or 
directly within the document itself, in the later case using an 
xml-stylesheet processing instruction.

Syd was talking about the Text editing mode. We treat space preserve 
versus mixed content versus element only content but the semantics of lb 
is somehow special... For example, if we have:

<p>test<lb/>new line</p>

Then oXygen will consider this as mixed content and it will not add new 
whitespace where there is none, that means it will never add whitespace 
immediately before or after <lb/> in this case. This

<p>test
<lb/>new line</p>

is not equivalent to the original is you apply a space normalization 
algorithm on the text content of the p element but in this case the 
semantics of <lb/> itself implies a whitespace so theoretically they are 
equivalent. However, there is no way to say in a schema language that an 
element represents whitespace, so oXygen cannot infer that information 
from the schema. I guess that may be yet another option, plus the 
choices to define where to split the line on formatting, for example the 
following is also a possible option:

<p>test<lb/>
new line</p>

or

<p>test
<lb/>
new line</p>

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 27/10/14 21:49, Daniel O'Donnell wrote:
> So just to be clear. What you're saying George is that you basically
> need to hand format it and then tell Oxygen not to format the parent
> element (at least in terms of spaces and line breaks).
>
> Oxygen's display is CSS driven, isn't it? Is there a technical reason
> why tei:lb and html:br couldn't be added to the CSS so that they would
> break? The relevant CSS exists, right? Could a user modify the sheets?
> Or is some other mechanism used?
>
> Or is Syd talking about the editor mode here?
>
>
> On 14-10-27 12:59 PM, George Bina wrote:
>> Hi Syd,
>>
>> I do not think that is possible with any of the current settings.. You
>> should set space preserve on a p or ancestor element and then format
>> it as you want and oXygen's format and indent will leave it like that.
>>
>>    <text>
>>       <body>
>>          <p xml:space="preserve">I call our world Flatland, not
>> because we call it so, but to make
>>          <lb/>its nature clearer to you, my happy readers, who are
>> privileged to live
>>          <lb/>in Space.</p>
>>          <p xml:space="preserve">Imagine a vast sheet of paper on
>> which straight Lines, Triangles,
>>          <lb/>Squares, Pentagons, Hexagons, and other figures, instead
>> of remaining
>>          <lb/>fixed in their places, move freely about, on or in the
>> surface, but without
>>          <lb/>the power of rising above or sinking below it, very much
>> like shadows
>>          <lb/>—only hard with luminous edges—and you will then have a
>> pretty
>>          <lb/>correct notion of my country and countrymen. Alas, a few
>> years ago,
>>          <lb/>I should have said “my universe:” but now my mind has
>> been opened
>>          <lb/>to higher views of things.</p>
>>       </body>
>>    </text>
>>
>> Best Regards,
>> George
>> --
>> George Cristian Bina
>> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
>> http://www.oxygenxml.com
>>
>> On 27/10/14 19:25, Syd Bauman wrote:
>>> A few hours ago Ute Recker-Hamm posted a wonderful question to TEI-L,
>>> the main list for the Text Encoding Initiative.[1]
>>>
>>> She basically asked "what do y'all do to get your physical lines, as
>>> encoded with the empty TEI <lb> element, to line up nicely in
>>> oXygen?".
>>>
>>> I remember asking a similar question a few years ago, and vaguely
>>> recall being told that manipulating the options under "Preferences >
>>> Editor / Format / XML" (in particular the "Preserve space" and
>>> "Default space" lists) should get format-and-indent to do the trick.
>>> However, I recall that I never got it working to my satisfaction, and
>>> when I look through the archives of this list now, I can't find the
>>> answer I recall.
>>>
>>> So what is "it" that I want format-and-indent to do? When given a
>>> text that looks like this:
>>>
>>> view A
>>> ---- -
>>>        <p>I call our world Flatland, not because we call it so, but
>>> to make
>>>        <lb/>its nature clearer to you, my happy readers, who are
>>> privileged to live
>>>        <lb/>in Space.</p>
>>>        <p>Imagine a vast sheet of paper on which straight Lines,
>>> Triangles,
>>>        <lb/>Squares, Pentagons, Hexagons, and other figures, instead
>>> of remaining
>>>        <lb/>fixed in their places, move freely about, on or in the
>>> surface, but without
>>>        <lb/>the power of rising above or sinking below it, very much
>>> like shadows
>>>        <lb/>—only hard with luminous edges—and you will then have a
>>> pretty
>>>        <lb/>correct notion of my country and countrymen. Alas, a few
>>> years ago,
>>>        <lb/>I should have said “my universe:” but now my mind has
>>> been opened
>>>        <lb/>to higher views of things.</p>
>>>
>>> I'd like it to end up formatted as it is now -- with each <lb>
>>> starting a new line. If the desired line length were long enough, it
>>> wouldn't be changed at all. If the desired line length were shorter,
>>> it might look like this:
>>>
>>> view B
>>> ---- -
>>>        <p>I call our world Flatland, not because we call it so,
>>>        but to make
>>>        <lb/>its nature clearer to you, my happy readers, who are
>>>        privileged to live
>>>        <lb/>in Space.</p>
>>>        <p>Imagine a vast sheet of paper on which straight Lines,
>>>        Triangles,
>>>        <lb/>Squares, Pentagons, Hexagons, and other figures,
>>>        instead of remaining
>>>        <lb/>fixed in their places, move freely about, on or in the
>>>        surface, but without
>>>        <lb/>the power of rising above or sinking below it, very
>>>        much like shadows
>>>        <lb/>—only hard with luminous edges—and you will then have
>>>        a pretty
>>>        <lb/>correct notion of my country and countrymen. Alas, a
>>>        few years ago,
>>>        <lb/>I should have said “my universe:” but now my mind has
>>>        been opened
>>>        <lb/>to higher views of things.</p>
>>>
>>> What I *don't* want is for format-and-indent to make it look like
>>> this:
>>>
>>> view C
>>> ---- -
>>>
>>>      <p>I call our world Flatland, not because we call it so, but to
>>> make <lb/>its nature clearer to
>>>          you, my happy readers, who are privileged to live <lb/>in
>>> Space.</p>
>>>      <p>Imagine a vast sheet of paper on which straight Lines,
>>> Triangles, <lb/>Squares, Pentagons,
>>>          Hexagons, and other figures, instead of remaining <lb/>fixed
>>> in their places, move freely
>>>          about, on or in the surface, but without <lb/>the power of
>>> rising above or sinking below it,
>>>          very much like shadows <lb/>—only hard with luminous
>>> edges—and you will then have a pretty
>>>          <lb/>correct notion of my country and countrymen. Alas, a
>>> few years ago, <lb/>I should have
>>>          said “my universe:” but now my mind has been opened <lb/>to
>>> higher views of things.</p>
>>>
>>> In fact, if I had my druthers, an input document that looked like
>>> view C would come out of the processing looking like view A or B.
>>>
>>> Note
>>> ----
>>> [1] Those of you who are members of a TEI list at Brown can find it
>>>      at https://listserv.brown.edu/?A2=ind1410&L=tei-l&F=&S=&P=64155.
>>>      I have not re-produced it here because I did not get the original
>>>      poster's permission to do so. (Not that I think it is illegal or
>>>      immoral to re-post without such permission, only that it's rude.)
>>> _______________________________________________
>>> oXygen-user mailing list
>>> 
>>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>>
>> _______________________________________________
>> oXygen-user mailing list
>> 
>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>


More information about the oXygen-user mailing list