plain text article versions for saving/printing?
-
Hello, great job your doing! But I've said this already once I guess. One more suggestion I have: I think it would be practical to offer a version of an article description in text format for printing / saving. Just a thought. Matthias
-
Hello, great job your doing! But I've said this already once I guess. One more suggestion I have: I think it would be practical to offer a version of an article description in text format for printing / saving. Just a thought. Matthias
I've already added a "View Printable version" tag in each article (see the bottom right hand corner of article headers). If anyone knows a quick and easy way to filter out HTML tags to produce plain text then part two of your suggestion is easy. - Chris
-
I've already added a "View Printable version" tag in each article (see the bottom right hand corner of article headers). If anyone knows a quick and easy way to filter out HTML tags to produce plain text then part two of your suggestion is easy. - Chris
-
I've already added a "View Printable version" tag in each article (see the bottom right hand corner of article headers). If anyone knows a quick and easy way to filter out HTML tags to produce plain text then part two of your suggestion is easy. - Chris
Hmm... The DOM does that for us, why create a needless server side program or use Perl? hmm. I'd attach a sample file if I could, but I guess I can just type it in here. <SCRIPT langauge="javaScript"> function WithoutTags() { var wnd = window.open(""); wnd.document.all(3).innerText = window.document.all.withtags.innerText; } </SCRIPT> <SPAN ID="withtags"> <IMG SRC="http://www.codeproject.com/images/cplogo.gif"> <BR> <B>Hello</B> <BR>Would you like to see more? <BR> <FONT COLOR="RED">This is more colored text in tags</FONT> </SPAN> <BR> <INPUT TYPE="BUTTON" VALUE="View Without Tags" onclick="return WithoutTags();"> I have tested this and it works. just don't F5 in the new window and you are safe. Then file/saveas and save as a text file. Done, no server hit and it's painless to do in the client. -Erik
-
To strip out HTML tags, off the top of my head... perl -p -e 's/<\/?[a-z]+.*?>//goi' I'm a newbie Perl programmer, so please debug this before putting it into production. ;)
Stripping tags is easy - it's the formatted text output that is the trick. For instance, <h1>Heading</h1>This is a paragraph Should come out: Heading This is a paragraph but by stripping tags we'd get Heading This is a paragraph I'll check out the DOM as per Eriks suggestion