Export Forced Line Break (soft returns) to XML
Sivakatirswami
katir at hindu.org
Tue Oct 11 05:31:30 EDT 2005
Goal-context: Mac OSX
1) Songs with verses are maintained in a Rev stack, mini-dbase. Total
project data is small enough to warrant keeping everything in the
stack fields, most facile environment for lots of manipulation and
different languages translations/versions....
2) We want to export these songs to XML files for upload into Adobe's
InDesign CS2, where the XML tags will be mapped to paragraphs styles
for typsetting.
PROBLEM: Sounds simple, and it is... but for one problem...InDesign
CS2 on the Mac apparently uses char(10) for a "Force Line Break" or
"Soft Return" which does not end the paragraph style and then another
character for a "real" end of line which does mark the end of a
paragraphs stye..
I am unable to distinquish the two... if I cut and paste into
Revolution and query the chars with charToNum... they both return char
(10) though in InDesign, they are clearly different. I think this
obviousl but to be super clear:
Any given verse in a song wants to be considered a paragraph from a
typesetting point of view.
Oh my darling Revolution
You are so sweet to me
It takes but a minute to build
Anything from a mouse to a tree
From Perl to PhP to big fat C (eeee)
You have forever, set me free
Oh My darling Revolution
You are so sweet to me.
... Ok in InDesign we want, on import:
char(13)
Oh amazing, Revolution char(10)
You are so sweet to me char(10)
It takes but a minute to build char(10)
Anything from a mouse to a tree char(13)
char(13)
From Perl to PhP to big fat C (eeee) char(10)
You have forever, set me free char(10)
Oh amazing, Revolution char(10)
You are so sweet to me char(13)
Marked up as HTML this would look like
<p>Oh amazing, Revolution <br />
You are so sweet to me <br />
It takes but a minute to build <br />
Anything from a mouse to a tree</p>
Obvious enough... but I can't find a way to do it.
My script steps through the lines of any song...
[snip]
# this is the key function which closes and opens a verse,
# or puts char(10) (soft return) after any line
# where x is the name of the song and y is each line in that song:
repeat for each line y in tVerses
if y is empty then
delete last char of tOutput
put "</" & x &"_verses>" & cr & "<" & x &"_verses>"
after tOutput
else
put y & numTochar(10) after tOutput
end if
end repeat
# then save a binfile to avoid line ending translation:
ask file "Enter an output filename."
put tOutput into url ("binfile:"& it)
Opening this in BBedit with line translation off.. I get 1 line of data!
I can of course resort to a hack and insert a special char like "%"
after each line and then search and replace those in InDesign CS2
with the "^n" character (soft return). But I would rather solve this
problem without having to do that kind of operation after import....
Any ideas? Meanwhile I'm off to the Adobe forums to get more info on
exactly what the XML file would need to be like in order to import in
a forced line break...as opposed to "regular vertical whitespace"
TIA
Sivakatirswami
More information about the use-livecode
mailing list