Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index



On 2013-06-27 03:13, Fred James wrote:
Helen wrote:
I've volunteered to edit a one-time publication of a collection of plays.
The plays came to me
in different styles -- three of the plays came to me with all the
characters's speaking lines
  centered -- the characters's names centered a line above.

Some of the writers seem to have centered the names with a centering code
-- I can
highlight the name and use the "left margin" code to move the name to left
margin.  Others
seem to have centered by spacing over! (yes) and I have to backspace until
I get the name
to the left margin.

None used a colon after the speaker, and the publisher wants it. I've made
some progress with
Search & Replace -- Search for all incidents of TOM and replace with TOM
colon space. But the
most tedious part is moving TOM from center to left and bring his speaking
lines up to begin
on the same line.  Is there any way I can put these plays into a style
sheet and save this work, or
would creating the style sheet take as long as what I'm doing? I've never
used styles.  And this is a one-time
job so if I have to do it all by hand, at least it's only once.

Thanks for any advice,
Helen
Not sure this is helpful ... Things are so context dependent ... Let me preface my remarks with: (1) send a sample file to me (off line, if you like) and I could take a look at it and see what I might be able to do?
(2) depends on the results of step 1

And so, on to what I have thought of so far ...

First I thought "Macro" (which I don't do anything with, so no help there) Second I thought "gawk" ... and I played with that with some degree of success ...

Steps:
(1) save document as (plain) txt (no encoding)
(2) in a terminal window, apply this command to the *.txt file ...
    awk '{gsub(/^[ \t]+|[ \t]+$/,"")};1' <filename.txt >newfilename.txt
... this removes all leading (and trailing) white space, and everything is left justified. It takes out spaces, tabs, and centering, and the result would look like this ...
Tom
said one
Tom
said two
Tom
said three
... and LibreOffice can open and edit the new *.txt file.

That doesn't get the "speaker's" line adjoined or insert the necessary : either, but depending upon context something might be made to do the job?

Regards
Fred James

PS: credit where credit is due: I found that little one-liner at <http://www.pement.org/awk/awk1line.txt
Hi.
I think you are almost there. You just need to do a substitution if you have the actors names.
Substitute "Tom:" for "Tom\n"
I think you can perform substitution or transliteration on a list but can't just locate the syntax
Something like /(Tom\n)(Burt\n)(Joan\n)/(Tom:)(Burt:)(Joan:)/
Steve

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.