groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] Groff editor.


From: Meg McRoberts
Subject: RE: [Groff] Groff editor.
Date: Mon, 20 Aug 2007 12:29:08 -0700 (PDT)

Thanks for the explanation...  You do have a bit of a conundrum here.
How frequently does this file need to be modified?

I am rapidly getting in over my head here, but one thought is that,
since Eric Raymond's groff-to-xml converter is open source, it wouldn't
be too tough to make a version that then converts XML back to groff.
You might be able to modify the source to eliminate any coding that is
not converting well so that it's a clean conversion in both directions.

If this file needs frequent maintenance and the application has a long
future, it might actually be easier to rewrite the code that uses this
file to use XML, then convert the file to XML and go forward with that.

I guess it depends on what sort of information has to be changed, too.
For example, if this is a price list and the users just need to modify
the price amount and perhaps add/remove items, it might be possible to
write a little application for them that pulls the info from the groff
file, displays it in some friendly format, then modifies the groff file
in the background for them...  I remember being involved in something
like this years ago -- the trick was to use comment lines that contained
some unique string before and after the lines that were modified...

meg


--- "Karee, Srinivas" <address@hidden> wrote:

> This is existing code (groff) which I picked-up for the enhancement, I
> cannot replace groff, there is quite a code which uses groff. I could
> ask users to do that tag thing as you suggested but they do
> ADDING/MODIFYING and DELETING lines/words and you know users they don't
> want to write these tags.
> 
> I need to save the file as groff file after the editing because current
> framework uses groff file to send the fax to customers and printing
> work.
> 
> So even if I can convert groff to PDF or XML or PS file and let users
> edit the file, I need a way to convert it back to groff file. Unless I
> rewrite the code which uses groff file post editing.
> 
> 
> Thanks,
> Srini.
> 
> 
> -----Original Message-----
> From: Meg McRoberts [mailto:address@hidden 
> Sent: Monday, August 20, 2007 2:39 PM
> To: Karee, Srinivas; Clarke Echols
> Cc: address@hidden
> Subject: RE: [Groff] Groff editor.
> 
> Why do you need to maintain this as a groff file?  Perhaps if we
> understood
> that we could help you find a better solution.
> 
> I happen to love groff and I can code it very quickly.  What I have done
> in
> this situation is give the user the formatted ASCII file and tell them
> to
> edit it, sticking some string like "SRINI START" and "SRINI END" before
> and
> after any changes they make.  Then I manually make their changes to the
> groff
> source, inserting the appropriate codings.  It's basically the same
> procedure
> as if they hand-wrote comments on a formatted draft...
> 
> I think that converting the file to Docbook/XML would preserve the
> bold/italic
> fonts and probably most of the tables unless the tables were coded by
> someone
> who went crazy with the coding.  And it gives you a text source file
> which is
> very nice for source code control.  So you get a lot of the benefits of
> groff
> with a format for which there are tools like you want.
> 
> I haven't worked with the any PDF editing software but, theoretically,
> it should retain all the formatting for you. I just googled "edit PDF
> file"
> and got some interesting hits -- software that converts PDF to XML (it's
> shaded at the top of the list and that site seems to allow you to submit
> a
> test file for conversion for free to see the results).
> 
> Those of us on this list love groff and so I certainly don't mean to
> discourage
> you from learning it and joining us ;-)  However, the learning curve is
> fairly
> significant...   XML has many of the advantages of groff but editors
> such as
> XMetal (and others, and I haven't actually worked with any of them so
> this is
> not an endorsement -- google "XML editors" if you want to investigate)
> give you
> the ability to maintain the text-based source with visible formatting
> and yet
> have a WYSIWYG editor as an alternative to manual coding...
> 
> meg
> 
> --- "Karee, Srinivas" <address@hidden> wrote:
> 
> > This file does not contain any pics, it has some tables, I can covert
> it
> > to ascii (-Tascii) and show to the users. But my requirement is for
> user
> > to edit the file and I should able to save it back in groff format and
> > use user edited (groff file) file for printing on the PS printer and
> > sending fax.
> > 
> > Basically I cannot lose bold/italic/font and other stuff. I am new to
> > groff, so I thought there could be some tools which I could buy and
> > workout this requirement, but looks like there are no tools out there
> > which I can use.
> > 
> > Srini.
> > 
> > 
> > -----Original Message-----
> > From: Meg McRoberts [mailto:address@hidden 
> > Sent: Monday, August 20, 2007 2:03 PM
> > To: Karee, Srinivas; Clarke Echols
> > Cc: address@hidden
> > Subject: RE: [Groff] Groff editor.
> > 
> > What sort of document is this?  Is it mostly text or are there
> > a lot of tables, graphics, and such?
> > 
> > I can think of a few ways that one might get the content into
> > some sort of WYSIWYG editor, but the fancier the formatting,
> > the less satisfactory these will be:
> > 
> > - Run the text into formatted ASCII then import the formatted text
> >   into Word or some other editor.  A command similar to the following
> >   might work:
> > 
> >   groff -mandoc -stC -Tascii <filename>| col -b > <filename>.txt
> > 
> >   This is for man page source -- replace -mandoc with the appropriate
> >   string if the document is using a different set of macros.
> > 
> >   You will loose all bold/italic and lots of other stuff but it will
> >   get you text that does not show the formatting characters.
> > 
> > - Run the text into PDF and then try a PDF editor.  I know that
> > Broderbund
> >   is selling such an editor but I haven't used it.  The following
> > commands
> >   will create PDF from a groff file (these are the commands I use --
> > perhaps
> >   someone will have a more elegant method) -- note that you have to
> > create
> >   a PostScript file and then convert the ps file to PDF:
> > 
> >   groff -mandoc -st <filename> > <filename>.ps
> >   ps2pdf <filename>.ps <filename>.pdf
> > 
> > - Convert the groff code to Docbook/XML; editors like you want are
> > available
> >   for XML.  Here is some information about a tool that does this:
> > 
> >   http://www.xmlhack.com/read.php?item=1749
> > 
> > These are not perfect solutions but would allow you to capture the
> text
> > into a format that can be maintained without learning groff.  
> > 
> > meg
> > 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]