issue-#113 XhtmlExporter bug with StdLinks.Target

Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Ivan Denisov »

Josef Templ wrote:@Ivan: There is a bug in SetAttr.
I tried to read it but it is pretty hard to read. Then I made some experiments
and found a bug with the nesting of bold and italics.
aaabbbccc

Code: Select all

<p><b><i>aaa</b>bbb<b>ccc</i></b></p>
It can be seen that some tags are overlapping instead of nested.
Some tags does not need to be nested. So that is not a bug, because it follow the strict standard of XML. You can check this output with validator.
http://validator.w3.org/check
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Ivan Denisov »

Josef Templ wrote:Here is a corrected and (IMHO) polished version of SetAttr.
It solves the nesting bug.
It uses StartTag/EndTag.
It also adds support for strikeout.
I will try today.
Josef Templ wrote:By the way, was there a special reason for changing <em> to <i> and <strong> to <b>?
In the menu of BlackBox is "bold" and "italic". There is <b> and <i> tags for this in HTML. Not <em> and <strong>.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Ivan Denisov »

Thanks for everybody.
I add Josefs version. Default font and also add support for fixed right side.
<BR> tags now forbidden out of <P>.
http://blackboxframework.org/unstable/i ... b1.539.zip
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Josef Templ »

I thought that it is one of the major differences between html and xhtml that xhtml tags must be properly nested.
Historically, html tags were not always properly nested and that is why browsers try to support that to some degree but it has limits and the handling differs between browsers. That's why xhtml has been defined. To clean up the mess.
In our XhtmlExporter we should of course adhere to the rule of properly nested tags in order to avoid any problems with some current or future browsers. This was also implemented in the previous version.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Josef Templ »

Code: Select all

					e.wr.Data("<br/>"+0AX)
This line should be changed to follow the conventions, i.e. the abstractions used throughout XhtmlExporter.
In other words, it should use wr.StartTag/EndTag and wr.Ln instead of hard coding it.
It is clear that it works and it may even save a few CPU cycles but it is not worth a brake of abstraction layers.


A more general question is how to obtain a meaningful document title.
Setting it to "New Page" is not very helpful. This title is displayed in the browser's tab list!
If it is not possible to set it to a meaningful value it would be better to omit it at all.
Then the filename is displayed in the browser's tab list.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Josef Templ »

Zinn wrote: It is a question about text formatting. Multiple spaces and new lines are ignored in Html.
In Html text formatting are not done with spaces and new lines. Text formatting are done with paragraph, list, tables and CSS.

Normally text are grouped in paragraph which allow to have line breaks but it is not grouped with line breaks. Line breaks should be used rarely.

The sample 1 2 3 What is Blackbox is translated wrong. A better translation uses list <li>, but I can accept line breaks here.
The original translation with paragraph is much better, even the result of the formatting looks wrong.

It is like the same situation as if you write a letter with the typewriter. There you have a line break at each line.
Now you change from typewriter to word and write the same letter. It is wrong to have a line break at the end of each line.

- Helmut
Helmut, I cannot follow your arguments.
XhtmlExporter preserves multiple spaces and multiple new lines.
It does its best to create an html document that looks as similar as possible to the original BB document.
It is, however, not an artificial intelligence tool that corrects any mistakes in the formatting of a BB document.
It simply tries to preserve its appearance as good as possible and with reasonable effort.

In BB documents you can also do the text formatting with paragraphs and rulers instead of using line breaks.
And in this case XhtmlExporter does not emit any line breaks but only paragraphs.

> The sample 1 2 3 What is Blackbox is translated wrong
This would require an artificial intelligence tool. Way beyond our scope.

> The original translation with paragraph is much better, even the result of the formatting looks wrong.
Probably, what you mean is the line spacing, which is currently not defined by the XhtmlExporter.
The browser uses a default and this is a bit smaller than what you see in BB. I think it could be adjusted but don't know the details. At least equally important is the paragraph lead space. This is now exported to html and creates about the same white space between paragraphs as in BB.

- Josef
Last edited by Josef Templ on Tue May 24, 2016 8:57 pm, edited 1 time in total.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Ivan Denisov »

Josef Templ wrote:it should use wr.StartTag/EndTag and wr.Ln instead of hard coding it.
It was the first version that I had tried, however this not works because ...

Code: Select all

e.wr.StartTag("p", XhtmlWriters.preserve);
And then in XhtmlStdFileWriters there is an IF statement

Code: Select all

	PROCEDURE (wr: Writer) Ln;
	BEGIN
		IF ~wr.current.preserve THEN
			wr.rider.WriteByte(ORD(line))
		END
	END Ln;
So this new line can not be written inside <p>.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Josef Templ »

> It was the first version that I had tried, however this not works because ...

I see.
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Zinn »

Ivan Denisov wrote:I found, that Helmut made one subsystem
http://www.zinnamturm.eu/downloadsDH.htm#Html
Ivan, you may copy module HtmlTags and add it. Then we can add e.g. navigation commands into odc source.

The new version of Xhtml is a big impovement. I have 2 points missing than Xhtml replace the the complete Exporter of Html.

Point 1: Add HtmlTags
Point 2: Translate <br/><br/> to </p><p> In other words have only one <br/>. Sequences of new lines change to <p> </p>

- Helmut
Last edited by Zinn on Wed May 25, 2016 6:19 am, edited 1 time in total.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#113 XhtmlExporter bug with StdLinks.Target

Post by Josef Templ »

Zinn wrote: Point 2: Translate <br/><br/> to </p><p> In other words have only one <br/>. Sequences of new lines change to <p> </p>

- Helmut
This is wrong. Keep the text as it is.
Why in the world should we want to modify the text while we convert it to html?
A line break is a line break and a paragraph is a paragraph.

- Josef
Post Reply