[Solved] Import HTML and <BR> vs <BR/>

Discuss the word processor
Post Reply
darren277
Posts: 4
Joined: Sat Oct 07, 2023 1:12 pm

[Solved] Import HTML and <BR> vs <BR/>

Post by darren277 »

I have a lot of ODT documents that I have converted to HTML and continue to modify directly, as well as by loading using Open Office Writer. Of course, I am very cautious when editing the HTML structure directly in order to maintain the ability to load with OO Writer with consistent behavior. So far, so good, except for one small thing...

The following snippet of HTML renders a new line inside of Open Office Writer:

Code: Select all

<p lang="zxx" style="margin-bottom: 0cm">
   <br>
</p>
Whereas the following snippet does not:

Code: Select all

<p lang="zxx" style="margin-bottom: 0cm">
   <br/>
</p>
The only difference here would appear to be the tag closing forward slash.

Is there some way to modify this behavior via Open Office Writer settings?

I noticed some XML files that appear to define various import and export behaviors:
C:\Program Files (x86)\OpenOffice 4\share\xslt

Is there perhaps some way to achieve what I'm after from there (or otherwise)?

Thank you,
Darren.
Last edited by MrProgrammer on Sat Oct 28, 2023 1:20 am, edited 1 time in total.
OpenOffice 4.1.14 on Windows 11 Pro.
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Importing HTML and <BR> vs <BR/>

Post by Zizi64 »

You can study HTML / XHTML properties here:

https://stackoverflow.com/questions/194 ... r-br-or-br
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
darren277
Posts: 4
Joined: Sat Oct 07, 2023 1:12 pm

Re: Importing HTML and <BR> vs <BR/>

Post by darren277 »

Thank you for the responses.

I've gone through that StackOverflow question about the <BR> vs <BR/> nuances. Unfortunately it did not really give me any actionable solutions to my situation. What I did learn, at least, is that apparently Open Office Writer uses HTML 4 to render HTML files. This may turn out to be helpful down the line.

As for the Help contents, I poked around a fair bit into the documentation that comes with Open Office Writer (which admittedly I hadn't dug around too much before posting this question). Still, though, I haven't found a way to customize how Open Office Writer renders HTML.

I can only conclude at this point (unless someone else comes along with a workable suggestion) that I have but the following two options:
1. Submit a bug/feature request.
2. "Manually" replace possibly hundreds of thousands of <br/> tags with <br> tags.

Luckily #2 can at least be automated with a Python script or something like that.

I'm going to hold out on #2 just a bit longer, though, in case anyone comes along with a fix, or even some explanatory insight as to why OpenOffice recognizes <br> but not <br/> tags.

Side note: Just to clarify, my issue is entirely centered around how Open Office Writer is displaying imported HTML content and not really at all about how it is exporting HTML content. I feel now like I may not have explained the original problem right.
Screenshot 2023-10-07 133504.png
Screenshot 2023-10-07 133504.png (5.3 KiB) Viewed 4402 times
OpenOffice 4.1.14 on Windows 11 Pro.
User avatar
robleyd
Moderator
Posts: 5509
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Importing HTML and <BR> vs <BR/>

Post by robleyd »

LibreOffice does recognise the <br/> tag as a line break. That may be an alternative for you.
Slackware 15 (current) 64 bit
Apache OpenOffice 4.1.16
LibreOffice 26.2.3.2; SlackBuild for 26.2.3 by Eric Hameleers
---------------
I hate this damn computer, I wish that I could sell it.
It won't do what I want it to, Only what I tell it.
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Importing HTML and <BR> vs <BR/>

Post by Zizi64 »

2. "Manually" replace possibly hundreds of thousands of <br/> tags with <br> tags.
Every Text Editor, Code Editor(even the simplyest one) has Find and Replace function... What editor software you have edit "manually" these "HTML files"?


Alway store your important documents in the native file format of the Office suite. If you use AOO or LO Writer, the native file format is the international standard ODF (.odt) file format.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
darren277
Posts: 4
Joined: Sat Oct 07, 2023 1:12 pm

Re: Importing HTML and <BR> vs <BR/>

Post by darren277 »

Zizi64 wrote: Sun Oct 08, 2023 7:06 am
2. "Manually" replace possibly hundreds of thousands of <br/> tags with <br> tags.
Every Text Editor, Code Editor(even the simplyest one) has Find and Replace function... What editor software you have edit "manually" these "HTML files"?
The problem there though is that we're talking about upwards of 3,000 HTML files.

I remembered though that Nodepad++ has a "Find and Replace in Multiple Files" function, though, so, the amount of time it will take is not really the issue.

The main issue is that I use Git for version control on all these HTML files.

My Git diff for this commit is just going to be not ideal.
Zizi64 wrote: Sun Oct 08, 2023 7:06 am Alway store your important documents in the native file format of the Office suite. If you use AOO or LO Writer, the native file format is the international standard ODF (.odt) file format.
The reason I store them in HTML format is actually two fold:
1. As per what I just mentioned about managing over 3,000 HTML files using Git, when they are stored in the compressed ODT format, I don't have viewable diffs.
2. The main crux of my particular use case is being able to view (and link between) the HTML files from inside a browser.
robleyd wrote: Sun Oct 08, 2023 1:20 am LibreOffice does recognise the <br/> tag as a line break. That may be an alternative for you.
Interesting! You are correct.

Hmm, this does at least circumvent me having to modify all my HTML files.

I've been a user of Open Office for over 15 years though, so, even if the two are entirely interchangeable aside from this one little thing, it still feels a bit "weird" to make the switch permanently. I mean, especially over something as seemingly trivial as a singular forward slash :lol:.

This allows me to make some of the edits I was looking to make a lot more easily.

As for calling it a permanent solution, I'll have to mull over that for the next few days.

Thank you, though.
OpenOffice 4.1.14 on Windows 11 Pro.
User avatar
LastUnicorn
Posts: 812
Joined: Sat Mar 29, 2008 2:41 am
Location: Scotland

Re: Importing HTML and <BR> vs <BR/>

Post by LastUnicorn »

You are well advised to switch from OpenOffice to LibreOffice. Some information to consider on this is here: [Tutorial] Considering a Switch from OpenOffice to LibreOffice? Some Useful Information
LibreOffice 25.8.4.2 (x64) installed to Windows 11 Pro. 25H2
Apache OpenOffice Portable 4.1.16 [Portable Apps]
For Java I use Adoptium Temurin JRE LTS Releases.
darren277
Posts: 4
Joined: Sat Oct 07, 2023 1:12 pm

Re: Importing HTML and <BR> vs <BR/>

Post by darren277 »

LastUnicorn wrote: Sun Oct 08, 2023 2:29 pm You are well advised to switch from OpenOffice to LibreOffice. Some information to consider on this is here: [Tutorial] Considering a Switch from OpenOffice to LibreOffice? Some Useful Information
Oh wow, right from the get go on that FAQ:

"I think it would be fair to say that Apache OpenOffice is cruising into obsolescence and dying a slow death."

That's good to know.

I guess that has officially guided my hand.

Thanks for pointing me to that.
OpenOffice 4.1.14 on Windows 11 Pro.
Post Reply