I want to include an example of a configuration in an xml file.
What is the easiest way to do this without manual formatting since many lines have different indents?
Style(s) for an xml sample
-
techwriter31
- Propellus Maximus
- Posts: 551
- Joined: Wed Mar 05, 2008 10:50 am
Re: Style(s) for an xml sample
We encountered this same problem a few months back and couldn't come up with a good/quick solution and ended up inserting them as screenshots. This only worked for us because the samples weren't intended to be copied/pasted into other applications.
Kellie
Re: Style(s) for an xml sample
There's no easy way, but this one works.
Create a pre (preserve white space) style in your style sheet, such as:
1. In Notepad, copy the code content, format your indents with tabs and/or spaces, and remove extra line spaces that might have been imported.
2. If there are tags, replace all left brackets (<) with < and right brackets (>) with >
3. Select All, and Copy.
4. In Flare (at the desired location), press Shift+space.
5. Select the line (click the P block), press Ctrl+Shift+H, select pre.codeblock, and press Enter.
6. In the Flare Text Editor, go to the location, select the space ( ), and Paste the code.
7. Click Save.
8. In the Flare XML Editor (or Text Editor), perform any edits needed for indents.
9. Click Save.
The beauty of this is that you can adjust indents at will (tabs and/or spaces) in either the UI Xml Editor or the Text Editor. That is, you're dealing with a single pre block, which accepts the Tab character, instead of multiple p lines, which do not.
Good luck,
Leon
Create a pre (preserve white space) style in your style sheet, such as:
Code: Select all
pre.codeblock
{
font-family: "Courier New", monospace;
font-size: 8pt;
line-height: 1.1em;
margin-left: 10px;
padding-left: 10px;
margin-top: 10px;
margin-bottom: 10px;
padding-top: 10px;
padding-bottom: 10px;
}
2. If there are tags, replace all left brackets (<) with < and right brackets (>) with >
3. Select All, and Copy.
4. In Flare (at the desired location), press Shift+space.
5. Select the line (click the P block), press Ctrl+Shift+H, select pre.codeblock, and press Enter.
6. In the Flare Text Editor, go to the location, select the space ( ), and Paste the code.
7. Click Save.
8. In the Flare XML Editor (or Text Editor), perform any edits needed for indents.
9. Click Save.
The beauty of this is that you can adjust indents at will (tabs and/or spaces) in either the UI Xml Editor or the Text Editor. That is, you're dealing with a single pre block, which accepts the Tab character, instead of multiple p lines, which do not.
Good luck,
Leon
-
techwriter31
- Propellus Maximus
- Posts: 551
- Joined: Wed Mar 05, 2008 10:50 am
Re: Style(s) for an xml sample
Another problem we encountered was that the lines of code were in different colors (I believe green, blue and red). Is there a way to accomplish this without local formatting?
Thanks!
Thanks!
Kellie
Re: Style(s) for an xml sample
Not that I know of, except for the already discussed screenshot solution.
Good luck,
Leon
Good luck,
Leon
Re: Style(s) for an xml sample
There are a number of free tools that automate colour formatting for code samples.
One I would suggest is Google prettify: http://code.google.com/p/google-code-prettify/
You just need to put the plain code in a pre tag, and all the formatting is done for you.
One I would suggest is Google prettify: http://code.google.com/p/google-code-prettify/
You just need to put the plain code in a pre tag, and all the formatting is done for you.