Fixed: Flare reformatting my HTML

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
czupke
Jr. Propeller Head
Posts: 4
Joined: Sun Jul 05, 2020 4:21 pm

Fixed: Flare reformatting my HTML

Post by czupke »

My HTML was getting frequently getting reformatted by Flare. The first image below shows how I formatted the HTML. Then when I used the XML editor, Flare would reformat my HTML to look like the lower image, which was a real problem in long, complex files.

I finally figured out how to consistently cause the problem to happen. I tested it in brand-new empty projects on my local disk and OneDrive, in both Flare 18 r2 and Flare 20.
· If my html looks like the below with the <p></p> it works fine.
· If I remove the <p></p> then the problem occurs.

In my real project file have added the <p></p> tags around all the text in my list items.  It seems to be working fine.

Caveat: text in <pre></pre> tags is still affected. Line breaks before and after the block are removed.
 
Update -- using <pre> or <h2> tags works as well as the <p></p> -- Flare wasn't handling untagged content well. And, I know, that it's sloppy to not tag all my content. It's an inherited project.
=============================================
Properly formatted HTML
=============================================

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd">
    <head>
    </head>
    <body>
        <h1>nested-ordered-lists</h1>
        <p>Outside the nested ordered lists.</p>
        <ol>
            <li>
               <p>Before inner ordered list.</p>
                <ol>
                    <li>Inside the nested ordered lists.
                   </li>
                </ol>
            </li>
        </ol>
    </body>
</html>
_________________________________________________



=============================================
Reformatted HTML
=============================================

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd">
<head>
</head>
<body>
<h1>nested-ordered-lists</h1>
<p>Outside the nested ordered lists.</p>
<ol>
<li>
Before inner ordered lists.
<ol><li>Inside the nested ordered lists.
</li></ol></li>
</ol>
</body>
</html>
Chicago_HPT
Sr. Propeller Head
Posts: 133
Joined: Sun Feb 03, 2013 6:01 pm

Re: Fixed: Flare reformatting my HTML

Post by Chicago_HPT »

I'm unclear what the problem is, other than cleaner-looking tabbing. If I understood you correctly, you said the problem happens when there are no <p></p> tags around content in the <li></li> tags? If so, that makes sense.

Both <p> and <li> are block-level tags, meaning that <li> is a kind of specialized paragraph formatted as a listed item (bullets, numbers, what have you). For example,

Code: Select all

<p>I'm a stand-alone line of text.</p>
and

Code: Select all

<li>I'm a stand alone line of text -- in a list.</li>
are both valid HTML. Or am I misunderstanding?

The main advantage (that I know of) to using nested paragraphs, like this

Code: Select all

<li><p>I'm a stand-alone line of text in a list.</p></li>
is that you can include other paragraphs, <p></p>, nested in the <li> and they will align properly, without the list item (or advancing list numbers), under the initial text of that numbered or bulleted item. Also, you can format <p> tags separately from <li> tags, if desired.
czupke
Jr. Propeller Head
Posts: 4
Joined: Sun Jul 05, 2020 4:21 pm

Re: Fixed: Flare reformatting my HTML

Post by czupke »

You are correct; they are both valid HTML. The sample I showed was very simple and I copied and pasted it into here, but my RL HTML has large complex nested lists that include dropdowns and tables. When those lists elements were run together, one after the other with no line breaks, it gets very hard to read. It would end up looking something like this:

<ul><li>asdasd</li><li>slkdlsjdf<ul><li>askldjflajsdf><ol><li>lskdjfjdks</li><li>lksjdflkdjsf</li></ol></li><li>lksjdfld</li></ul></li></ul>

My nicely formatted 100 lines of HTML would end up 35 lines looking like that.
Post Reply