Preserving Code Formatting

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
nfberg
Propeller Head
Posts: 31
Joined: Mon Jun 09, 2008 1:01 pm
Location: Plano, TX
Contact:

Preserving Code Formatting

Post by nfberg »

I'd like to create a box much like one can in these forums with code in it and have the formatting preserved.

As an example...

Code: Select all

<if condition="$displaypromotion">
    <table class="tborder" id="post$userinfo[postid]" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
    <tr>
	<td class="alt2" style="padding:10px; background-color:#ffff00" align="center">$vboptions[dto_garage_promotion_message]</td>
    </tr>
    </table>
<br>
</if>
However when cut and pasted into Flare all the spacing is lost. Ideally we'd like the end user of this section to be able to cut and paste when needed.

I've searched up, down and sideways in Flare's doc set and can find nothing.

Thanks
http://www.drivethruonline.com
Drive Thru Online - Supercharging vBulletin
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Preserving Code Formatting

Post by NorthEast »

Use a pre tag. Select the tag first, then copy and paste the text inside the tag.

Results may vary depending on the application you copy the text from, notepad or text editors normally work fine. If it's copied as 'formatted' text, then it may not work, and you might have to paste it in notepad first then copy/paste into Flare.
stephgl
Propeller Head
Posts: 94
Joined: Wed Jan 17, 2007 11:22 am
Location: Greater Sacramento Area

Re: Preserving Code Formatting

Post by stephgl »

I am making a Help file for a programming environment, and this is what we do:

1. Create the topic with a PRE tag.
2. Since our code uses the symbols <, >, and & as operators (which are also seen as functional symbols and not content by the html code) , we first do a search and replace of those symbols with the allowed html substitutes to prepare it. Added: search/repace the ampersand first.
& - use &
< - use <
> - use &gt
3. I open up the topic in Notepad (not the internal text editor) and then paste in the "prepared" code text between the PRE tags.

We developed this technique using Madcap 4.0, even though the software already has some features for dealing with those special symbols we always ran into problems. This has been a stable solution for us.

We also made a pre tag class that uses a particular font for the code, and a background color.

I hope this helps, and if the MadCap pro's know a better way by all means I'd love to hear it too.
-stephgl
Post Reply