single-source code snippets to print and web

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
pdenchfield
Propellus Maximus
Posts: 574
Joined: Tue Oct 03, 2006 7:56 am
Location: Seattle, WA
Contact:

single-source code snippets to print and web

Post by pdenchfield »

What are best practices for single-sourcing code snippets to both print and web outputs?

My team's authoring requirements:
- must be able to copy code from Notepad or other text editor into Flare's default editor (XML Editor) and retain code spacing

My print requirements (PDF and Word):
- preserve code spacing (like the <pre> tag does)
- BUT wrap code to avoid going past page margin; must not introduce hyphens or extra spacing when doing so

My web requirements (WebHelp and CHM):
- preserve code spacing
- either wrap code or present in a box with scroll bars (<overflow> property governs scroll bars)

What I'm looking at now (see my other post at http://forums.madcapsoftware.com/viewto ... &sk=t&sd=a):
- pre.code
- div.code

I feel like I'm reinventing the wheel. Surely some Flare user on this forum has single-sourced code snippets to print and web! Thanks for any ideas and suggestions you can provide. :-)
Ryan Cerniglia

Re: single-source code snippets to print and web

Post by Ryan Cerniglia »

The way to do this is to use the white-space property, available under the block property group, for whichever style you choose. Set the white-space property to "pre-wrap" and you'll be able to insert code that will wrap whenever it reaches the edge of the margin or screen.

I pasted my test text into the topic selecting the option "Paste as inline text (newlines are removed)" and the line breaks were properly kept.
Post Reply