Slashdot Log In
Sanely Moving from Word to the Web?
Posted by
Cliff
on Tue Aug 09, 2005 04:50 PM
from the tag-soup dept.
from the tag-soup dept.
FooAtWFU asks: "I have a job for a web site (no link for you, Slashdot hordes!). A lot of it is systems administration and development, but I have to routinely post content which comes from a myriad of other sources. Usually they are from academic users, come in Word format, and ultimately need to be posted in HTML. The problem is that Word has all sorts of tricks up its sleeve to throw off the font, layout, size, and so forth. To achieve any sort of visual consistency on the site these various formatting tags all need to be scrubbed, but even using other office suites with better HTML export (OpenOffice.Org) to do the dirty work, it's often easier to recreate the formatting by hand from a plain-text version than it is to clean up a sea of messy tags. Does anyone have any advice (or magical tools) to help me deal with this sort of tedious cleanup?"
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
Scrapping (Score:5, Interesting)
1. Place all "to-process" documents in a specific folder in a webserver
2. Write a script to read those documents
3. Use Regex (and similar functions) to strip off and/or replace specific tags/wordings (similar to web scrapping technique).
Admittedly it was a tedious job at first to identify every possible template, however I'm amazed how predictable some documents are and once you get hold of such "blueprint", you can reformat documents to HTML/XML fairly easily.
Once the changes are done, I then preview them in a browser, and if everything's expected, I simply save the page and use it; If not, it's easy enough to make a few tweaks from the familar HTML environment.
Sounds like you should release on sourceforge (Score:5, Interesting)
Parent
Re:Sounds like you should release on sourceforge (Score:3, Insightful)
Plus the templates are probably in-house templates and thus would be useless outside of the company.
Actually, an NDA probably doesn't matter. (Score:3, Interesting)
However, I am also not willing to just assume that no company would ever consider letting someone sourceforge a script like this. It is 1) worth good advertising and 2) clearly not important enough to be worth selling. Release it in the company's name, or not depending on what they prefer.
At a minimum a lot of small companies
Re:Actually, an NDA probably doesn't matter. (Score:5, Funny)
Parent
Re:Scrapping (Score:3, Insightful)
Of course, you really can't properly parse html just using regular expressions. You can get it right 90% of the time relatively quickly, and a day or so work will get you 5% more, but you could spend weeks trying to get that last 5% -- and never quite get it.
It's really better to use things that other people have made for parsing html. For example, if you use perl (and you shou
Re:Scrapping (Score:3, Informative)
PDF? (Score:3, Insightful)
Re:PDF? (Score:3, Funny)
Re:PDF? (Score:3, Interesting)
However, if someone is getting the idea for another open source project to solve this dilema then I'd suggest somethin
Re:PDF? (Score:3, Informative)
Dreamweaver (Score:5, Informative)
Re:Dreamweaver (Score:5, Informative)
Parent
Re:Dreamweaver (Score:5, Informative)
If you paste text into the Code view, DW removes the formatting completely and just uses the raw text.
Parent
Re:Dreamweaver (Score:4, Funny)
Parent
Re:Dreamweaver (Score:3, Informative)
Worked pretty well, once I'd got the search/replace stuff sussed out.
Mind you, on a big word file you can think it's crashed when actually it's just doing lots of thinking...
Re:Dreamweaver (Score:3, Insightful)
Indeed we'd love to move to advanced CSS for page formatting but that's a big step right now - there are no professional WYSIWYG editors that have the sheer range and quality of features we need - Page templates, ability for clients to update the site later
Antiword (Score:3, Informative)
Textism (Score:5, Informative)
http://textism.com/wordcleaner/ [textism.com]
I used it once and it did a pretty decent job at preserving the tables. Yet if they're using anything odd like graphics or it's been incredibly tweaked, it probably won't be 100% perfect.
Re:Textism (Score:4, Informative)
Parent
One suggestion (Score:4, Funny)
You might consider a pack of monkeys and typewriters. They can ultimately reproduce Shakespeare so maybe, maybe they might be ablt to properly reformat the HTML gibberish Word produces.
Of course, you could also outsource to India but that's unethical to both the monkeys and the Americon economy.
Re:One suggestion (Score:3, Funny)
One Word... (Score:5, Funny)
Re:One Word... (Score:5, Funny)
Usually they are from academic users
It sounds like this might be a university environment. The correct answer should be grad students .
Parent
HTML Export (Score:3, Informative)
http://www.microsoft.com/downloads/details.aspx?F
I believe this functionality is built into later versions of Word.
Per the site, this produces simpler HTML with Office-specific tags removed. With that done, you could probably use a PERL script, and you might also try writing some Word macros or COM/VBA scripts that clean up the document from within Word.
Re:HTML Export (Score:5, Informative)
Parent
Dreamweaver (Score:5, Informative)
Good luck!
HTML Tidy (Score:5, Informative)
Tidy Flags (Score:5, Informative)
Parent
no link for you, Slashdot hordes! (Score:5, Informative)
Step 1: Let's look at his user page [slashdot.org]
Ahh! He put in a website with his profile. Let's all go and check out http://fennec.homedns.org/ [homedns.org]
Hmm... looks like a personal page. Not too sure what to make of the comic. Anyway, let's move on to..
Step 2: Let's look at his author [wfu.edu] page. Some interesting stuff here, including three separate e-mail addresses (which I won't post here. You're welcome
A-ha! There is a link to his employer! It's Economic History Services [eh.net]. And what do you know... there are a significant number of pages (especially under abstracts and book reviews) that seem to come straight out of a word processor, only with extensive cleaning. A quick look at the source reveals something interesting. It's clean. Very clean. We're talking on the level of I-use-vim-for-my-webpage-editor clean. Nice job.
Anyway, it looks like it was done by hand. I'm not saying its not good work (quite to the contrary), but I can see your need for an automated solution.
Re:no link for you, Slashdot hordes! (Score:5, Funny)
There is NO WAY the slashdot effect can be avoided. Resistance is futile...
Parent
Re:no link for you, Slashdot hordes! (Score:4, Informative)
Parent
Re:no link for you, Slashdot hordes! (Score:5, Funny)
You must be new here.
Parent
HTML Tidy (Score:3, Informative)
HTML Tidy has a special mode for cleaning up Word's crappy HTML export. HTML Tidy is a free command-line tool that is also embedded in a lot of popular HTML editors.
HTML Tidy:
http://tidy.sourceforge.net/ [sourceforge.net]
HTML Kit (great integration with HTML Tidy; it includes HTML Tidy so you can just grab HTML Kit without grabbing HTML Tidy)
http://www.chami.com/html-kit/ [chami.com]
Countless other editors integrate with HTML Tidy as well. Have fun and good luck!
Get it in PDF first. (Score:3, Interesting)
What I would do in your shoes is set up a (mostly) automated system to convert the Word files to PDF. You can buy Acrobat or you can go with a third-party, printer-driver-style converter, but in the end you'll probably save more headaches just using Acrobat.
Once you have a document in PDF, you can use any of the numerous (free and commercial) tools to convert that to HTML, text, whatever - all much more reliably than from Word directly. It's not perfect, but it's probably the closest you'll get.
Plus, you can post the PDFs themselves for download in case someone wants them - and at least Google will still happily index your PDFs.
Yes, you'll probably have to live with some NT variant to get that part done (though it might work with OSX) - but it's most likely your fastest path to *quality* conversions.
Resign from your executive position (Score:3, Interesting)
Re:Resign from your executive position (Score:5, Insightful)
I use mutt and fetchmail in a company of Exchange users. Almost every email I get at work now, from everybody, is in html. (Unless I sent it to myself.) I don't like it, but I deal with it. It's certainly easier to deal with it than to try and change everybody else.
I could change jobs, but over something as trivial as html emails? No. I like my job, I like the people I work with, so I just bend like the reed in the wind ...
Still, the executives are certainly worse about email ettiquette than most, and it's not just in this company -- everywhere I've worked I've found this to be the case. They don't include Subjects at all, or include useless ones like `message'. Some will type up a memo and send it as a .pdf file attachment, or worse as a .bmp file. They rarely trim anything when responding to a post -- they just top post away. (But many people do that ...)
Parent
Amen (Score:5, Funny)
Parent
Re:Resign from your executive position (Score:5, Funny)
I was given 61 screenshots (blithely dubbed "program requirements"), each its own Word document. Each containing only a (weirdly scaled) picture, of course.
61 Word documents.
Parent
fckeditor (Score:3, Informative)
The interface is similar to Word - maybe if you're lucky, you could get some of your content producers to use it.
HTML Tidy program (Score:5, Informative)
One program I've had luck with is the HTML Tidy program at http://www.w3.org/People/Raggett/tidy/ [w3.org]. It seems to clean up code (particularly from Word) quite a bit.
WordML - FO - XHTML/PDF (Score:5, Informative)
Using a modern version of Word, output in WordML (xml format). Use a XSL stylesheet [antennahouse.com] to convert the WordML to FO (formatting objects).
From there, do anything you want, like XHTML or PDF.
Or just go to XHTML from WordML with some stylesheet. XSL is teh cool!
Net-It is your magical tool (Score:4, Informative)
Oh, you mean non-commercial magical tools?
Pagify (Score:3, Informative)
Try this.... (Score:5, Informative)
Demoroniser is, in the author's own man pages words:
A Perl script which corrects incompatible HTML generated by Microsoft applications. [fourmilab.ch]
You can get it from the link in the same page. I must confess that I've not used it myself (don't use Office/Frontpage) but if it does what it says on the tin it should sort you out.
Dreamweaver MX 2004 (Score:3, Informative)
2) Select All -> Copy
3) Open Dreamweaver
4) File -> New Html Doc
5) Paste
6) Commands -> Clean up Word Html
7) Commands -> Apply Source Formatting (if you take the time to set the programs preferences to what you like)
8) Done
9) Drink beer
10) Sleep
Re:Change the Model? (Score:3, Interesting)
Re:Use antiword (Score:3, Informative)
Re:DEMORONISER (Score:3, Informative)
The Unmoroniser is an updated version that handles Unicode properly and will do things like convert proprietary Windows-only curly quotes to the appropriate HTML4 entities instead of dropping them back to less accurate, typographically offensive straight quotes. Same with ligatures and other characters that the Demoronizer would munge instead of convert.
http://rheme.net/unmoroniser/ [rheme.net]
Yes! (Score:3, Insightful)
For documents that are going to be viewed online, it's infinitely preferable to use a free-form format like HTML (was designed to be) that can adjust to varying monitor and window sizes.