Well, I've just converted my Word book to Sphinx, and "partial automation"
is the key. Actually, you can automate a lot of it but it's a cost-benefit
analysis each time. For example, If I had a lot more headers it would have
made sense to write a VBA Macro to put the Rest underlines on the headers,
but I just did it by hand.
What I ended up doing is creating a build system that would take the word
doc and convert it to ASCII, then do some post-processing (breaking it up
into individual files, modifying the contents, etc.) But I kept it in Word
and just continued to run the build until I was sure I had everything out
that I wanted (and I jumped the gun on a few things like stripping out some
of the indexing -- seemed like a good idea at the time but now I wish I
hadn't). And finally I felt like I didn't need the word doc anymore and just
started editing in Sphinx, but before that I did any edits in Word and ran
the converter.

To get you started, here's the part that automatically writes the Word doc
into an ASCII file:

if not os.path.exists("TIPython.txt") or os.path.getmtime("TIPython.doc") >
os.path.getmtime("TIPython.txt"):
    import win32com.client
    import sys, os
    from win32com.client import constants # Run makepy (part of Pythonwin)
if this doesn't work
    o = win32com.client.Dispatch("Word.Application")
    o.Visible = 0
    here = os.getcwd()
    o.Documents.Open(os.path.join(here, "TIPython.doc"))
    o.ActiveDocument.AcceptAllRevisions()
    o.ActiveDocument.SaveAs(FileName = os.path.join(here, "TIPython.txt"),
FileFormat = constants.wdFormatText)
    o.ActiveDocument.Close()
    print "(TIPython.doc saved as TIPython.txt)"

On Tue, Oct 28, 2008 at 10:35 AM, Martin Hans <[EMAIL PROTECTED]> wrote:

>  Hi,
> Currently our product's user manual is written in Word, but we'd like to
> move all our documentation into Sphinx. Does anybody have an idea how I can
> do this at least partially automatically?
>
> Thanks.
>
> Martin
>
> >
>


-- 
Bruce Eckel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to