Source Code Formatting Puzzle

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Source Code Formatting Puzzle

Post by kwag_myers »

The home page of this project has a grid of nine tiles, each linked to a topic. For some reason, Flare puts the source code into a single line, making edits very difficult. When I open the file in NotePad++ and format the code, Flare changes it back to a single line again. Any ideas as to why?

Formatted code sample :

Code: Select all

<div class="tile_section">
	<a href="gettingStarted.htm" title="[%=Tooltips.Tooltip Topic%]" alt="[%=Tooltips.Tooltip Topic%]">
		<div class="home_tile ">
			<img src="../Resources/Images/getting-started-icon.svg" class="getting_started" title="Getting Started" alt="Getting Started Tile" />
			<div class="tile_name">Getting Started</div>
		</div>
	</a>
	<a href="whatsNew.htm" title="[%=Tooltips.Tooltip Topic%]" alt="[%=Tooltips.Tooltip Topic%]">
		<div class="home_tile">
			<img src="../Resources/Images/megaphone-icon.svg" class="whats_new" title="What's New" alt="What's New Tile" />
			<div class="tile_name">What's New</div>
		</div>
	</a>
</div>
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
roboHAL
Sr. Propeller Head
Posts: 254
Joined: Mon Dec 31, 2012 9:57 am

Re: Source Code Formatting Puzzle

Post by roboHAL »

Hello kwag_myers. I may have solved your puzzle. I believe the issue (which I can recreate given your example) has to do with the fact that Flare's text editor expects and to some extent requires that your data be of an XML format. That is not the case with Notepad ++ which in that case you may simply be opening a text file.

There are some articles on the Internet, such as this one http://www.brighthub.com/internet/web-d ... 82183.aspx having to do with line breaks (or lack-thereof) with XML.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Source Code Formatting Puzzle

Post by kwag_myers »

Thanks roboHAL, but I'm still confused. When I run a check on XML syntax in NotePad++, I get no errors. Where is it that I've strayed from the path?
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
roboHAL
Sr. Propeller Head
Posts: 254
Joined: Mon Dec 31, 2012 9:57 am

Re: Source Code Formatting Puzzle

Post by roboHAL »

You're welcome :)

I'm not sure what you are doing to check XML in Notepad++, but in any event I don't believe you are necessarily doing anything wrong or in your words have strayed from the path. I'm no expert here so perhaps others can chime in, but based on the article (and there are a few and I haven't checked all that many) it appears that line handling in XML can vary from program to program. Conceivably Flare and Notepad++ each have a different proprietary way of reading and displaying XML.

You can pose the question to MadCap. Realistically though it doesn't appear as though there is an actual "problem". If anything they may categorize this as an inconvenience (meaning the code works, albeit it is difficult for you to read in the editor because its all on one line).

Sorry I can't help you further :(
NorthEast
Master Propellus Maximus
Posts: 6372
Joined: Mon Mar 05, 2007 8:33 am

Re: Source Code Formatting Puzzle

Post by NorthEast »

I think Flare will tend to put inline elements (like your <a> tags) on the same line.

I don't really understand why Flare will modify the XHTML code though; it also modifies CSS files too, and causes invalid code.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Source Code Formatting Puzzle

Post by kwag_myers »

roboHAL wrote:I'm not sure what you are doing to check XML in Notepad++
I'm using the UniversalIndentGUI plugin, which has a Check XML Syntax feature. I found that if I used the Pretty Print with Line Breaks feature, the formatting carried over to Flare. Strange that doing manually didn't.

Anyway, problem solved.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Dmuir
Propeller Head
Posts: 10
Joined: Fri Sep 04, 2015 9:01 am

Re: Source Code Formatting Puzzle

Post by Dmuir »

kwag_myers wrote:
roboHAL wrote:I'm not sure what you are doing to check XML in Notepad++
I'm using the UniversalIndentGUI plugin, which has a Check XML Syntax feature. I found that if I used the Pretty Print with Line Breaks feature, the formatting carried over to Flare. Strange that doing manually didn't.

Anyway, problem solved.
In my experience, Flare is pretty good at generating and reading back its own XML. When it does, it tends to use line-breaks. I have brought XML in from other sources and not realized it was all on one line until I had to go into the source editor in Flare.

I think your experience with Pretty Print actually injecting line breaks is proof that there were previously no line breaks in your code. Notepad++ and its plugins are very good about not changing your source even though they will display it in all sorts of useful ways -- so it may have seemed like there were line breaks even though there weren't.
David Muir | Technical Writer | Microdea Inc. | Markham ON | Canada
Post Reply