MS Word Paste and comments

Creating and modifying plugins.
psych3
Regular
Posts: 7
Joined: Mon Jul 11, 2005 2:57 pm
Location: Australia
Contact:

MS Word Paste and comments

Post by psych3 »

A few of my readers have had this problem. When pasting from MS word into the comments section, it puts into office specific tags which in turn cause the comments texts layout to go haywire.

I am just wondering if there is a way to strip out MS word specific tags on pasting?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: MS Word Paste and comments

Post by garvinhicking »

Wow. I've never ever heard of people who paste Word-stuff as comments!

The problem is that very deep in the code we make a strip_tags call. That removes all HTML markup formatting. Basically it shouldn't scrubb out any text information. Can you give me an example of what your people paste?

I think that Word has a feature to copy code as plaintext...but I bet that's too hard for your users to figure out. :-/

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
psych3
Regular
Posts: 7
Joined: Mon Jul 11, 2005 2:57 pm
Location: Australia
Contact:

Post by psych3 »

Yeah my users tend to be a lazy lot :wink: Actually a lot of them coming into the serendipity blog arent that web savvy as is not a technical blog as such.

Perhaps what I can do is modify one of the files and have a little note there to paste as text and with some instructions. Maybe even open a little popup window with help instructions for comment pasting etc..

thanks
Joerg

Pasting WORD text in new post

Post by Joerg »

I don't have this problem with comments, but I do have it with posts.

I write what I have to say in WORD, insert hyperlinks, indent the quotes, then I copy it all and paste it into a new poste (using IE, since pasting does not in Firefox). Often it works out fine, but sometimes the layout does not look correctly: Some paragraphes or words are bigger than others, although I used the same font and the same font size (verdana 10pt) in WORD.

Sometimes the post looks fine in Firefox, but not in IE. This usually happens, when I edit a post online (i.e. no copy and paste again).
Some posts look fine in Ansicht->Schriftgrad->"Mittel", but not in "Groesser".

=> Do I have to stop using WORD to layout my texts and then copy and paste into the blog?

Why have I done it so far? Because typing is faster in WORD. And I take my notes in WORD. And in WORD I can define the space between two paragraps as 0,4pt, while in s9y editor it has to be a full line.

I am running Serendipity v.0.7.1 and I am concerned that I do not manage to update. Well, should I try to update?

This is my blog: http://atlanticreview.org

Thanks

Joerg
psych3
Regular
Posts: 7
Joined: Mon Jul 11, 2005 2:57 pm
Location: Australia
Contact:

Post by psych3 »

yes its a problem for posts too, as I like to write in word and then cut and paste myself. So perhaps this could be a feature request to strip out all word comments.
Hathor
Regular
Posts: 118
Joined: Tue Mar 22, 2005 11:48 pm

Post by Hathor »

Ditto. Drupal has a mod that removes special Word formatting... I was wondering if someone could write something like that for Serendipity?

The problem for me is not the post looking funky - it's that the feed won't validate. Word uses its own code somehow for the following marks:
hyphen -
quote "
apostrophe '
I have several people who post articles by sending them to me as Word attachments. I've tried several shortcuts, but in the end, I just have to copy and paste from Word into the S9 entry box, then hand-replace every one of those marks with the same mark (but typed in via the S9 interface, they work fine), and then post. Otherwise, it wrecks the feed.

I haven't really tried the Drupal mod out too much, so I don't know how it works or even if it's as effective as it should be. But if they can do it, I think S9 should be able to. :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Yes, a plugin using the frontend_display hook to modify contents of $eventData['comment'] would be fairly easy.

Someones want to try it? He/She can use the nl2br or s9ymarkup plugin as a foundation class and make str_replace() calls to replace the ugly characters...
:)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hathor
Regular
Posts: 118
Joined: Tue Mar 22, 2005 11:48 pm

Post by Hathor »

I wish, but I'm nowhere near being able to write a plug-in. People talk like it's so simple (at other forums, too - Drupal, WP, etc.), but when I read tutorials on it, I get really lost really quickly. :(

But you know, if someone wants to write one for it and I can help by testing it or something, I'd be glad to help anyway I can.
alphalogic
Regular
Posts: 14
Joined: Mon Jul 25, 2005 12:11 am

Post by alphalogic »

if you give me a list of all word special formatting tags, i could write a plugin.
Hathor
Regular
Posts: 118
Joined: Tue Mar 22, 2005 11:48 pm

Post by Hathor »

Cool! The ones I'm aware of are just the symbols for quote marks, apostrophes and hyphens bookended by spaces. Word makes the quotes and apostrophes curly (typing them directly into S9 makes them straight) and it makes the hyphens like - these - a little bit longer than they appear here. Is that what you need? Or do you need me to go into Word code and find something? Please just let me know.

I think other posters here have raised other issues I'm not aware of - hopefully, they'll come in and explain.
Guest

Post by Guest »

Hathor wrote:Cool! The ones I'm aware of are just the symbols for quote marks, apostrophes and hyphens bookended by spaces. Word makes the quotes and apostrophes curly (typing them directly into S9 makes them straight) and it makes the hyphens like - these - a little bit longer than they appear here. Is that what you need? Or do you need me to go into Word code and find something? Please just let me know.

I think other posters here have raised other issues I'm not aware of - hopefully, they'll come in and explain.
i need a list of all word tags since i dont have ms word, something like:
<p:o>, <hyphen> ...
Guest

Post by Guest »

Anonymous wrote:
Hathor wrote:Cool! The ones I'm aware of are just the symbols for quote marks, apostrophes and hyphens bookended by spaces. Word makes the quotes and apostrophes curly (typing them directly into S9 makes them straight) and it makes the hyphens like - these - a little bit longer than they appear here. Is that what you need? Or do you need me to go into Word code and find something? Please just let me know.

I think other posters here have raised other issues I'm not aware of - hopefully, they'll come in and explain.
i need a list of all word tags since i dont have ms word, something like:
<p:o>, <word:xyz> ...
Quotes, and apostrophes are no prorblem
Hathor
Regular
Posts: 118
Joined: Tue Mar 22, 2005 11:48 pm

Post by Hathor »

I'm not sure I know what you mean, but... okay, if I type this in word:

"Blah's - blah - blah blah"

And then copy and paste that into the Serendipity entry box, the quotes and apostrophe will appear as sort of slanted instead of straight, and the hyphens will be longer than normal dashes. Then, if I go into the entry box and simply type OVER each symbol with the very same symbol, it replaces them with the simple version, and that works just fine.

If I leave the slanty Word stuff in, it invalidates the feed.

I'm afraid I'm not being very helpful, but I'll keep trying. :)
Guest

Post by Guest »

Hathor wrote:I'm not sure I know what you mean, but... okay, if I type this in word:

"Blah's - blah - blah blah"

And then copy and paste that into the Serendipity entry box, the quotes and apostrophe will appear as sort of slanted instead of straight, and the hyphens will be longer than normal dashes. Then, if I go into the entry box and simply type OVER each symbol with the very same symbol, it replaces them with the simple version, and that works just fine.

If I leave the slanty Word stuff in, it invalidates the feed.

I'm afraid I'm not being very helpful, but I'll keep trying. :)
well i know what you mean :) but thats not what i am asking for
psych3 wrote: A few of my readers have had this problem. When pasting from MS word into the comments section, it puts into office specific tags which in turn cause the comments texts layout to go haywire.
i am asking for the tags psych3 told about, when i know them - the plugin will be done soon :)
alphalogic
Regular
Posts: 14
Joined: Mon Jul 25, 2005 12:11 am

Post by alphalogic »

the post with the bad quote was mine :)
Post Reply