Question
I want to remove the TWiki formatting rule which requires a space between lines to create a new line. This is driving my users crazy because they can't simply copy & paste an email into TWiki. Any help would be appreciated. I found code which will allow me to do this - I just need to know where to put it.
Environment
--
BrianMahoney - 06 Aug 2007
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
You should explicitly mark pasted emails between new TWiki tags like
%STARTMAIL% and
%ENDMAIL%. and process these tags in a plugin. It is extensions like this that make TWiki's plugin mechanism so powerful and valuable. Processing should most probably happen in a plugin's
preRenderingHandler, which is called after variable expansion, but before TML (TWiki Markup Language, which is responsible for the formatting rules) is processe.
--
HaraldJoerg - 06 Aug 2007
Thanks Harald, I have that working at the moment just using the
TWikiPreferences calling upon those processes %STARTMAIL% & %ENDMAIL%. Basically my goal is if I can remove that spacing feature in TWiki (which requires a space between lines of text to create a new line), so that a person who knows nothing at all can simply copy & paste an entire document into the page without having to do anything else besides click "save" would be ideal. Is this possible or would that affect the entire functionality of the TWiki platform?
--
BrianMahoney - 07 Aug 2007
Sorry, but I don't know what you're actually doing with definitions of
%STARTMAIL% and
%ENDMAIL%: If it is all in Main.TWikipreferences, then these are just constant strings, probably CSS tricks? If so, you could add these variables to your template topic when you create new topics. The default is at TWiki.WebTopicEditTemplate, traditionally it only has the author's signature in it.
If you really want
all topics to be affected (I doubt that), then you could add CSS settings to the
patternTopic class (if you are using Pattern skin). Or edit
/templates/view.pattern.tmpl, which I'd consider even more dangerous.
Some (or even many?) topics in the TWiki distribution may become difficult to read under such conditions.
Mastering
TWiki.TWikiTemplates or
TWiki.PatternSkin would be necessary before venturing to make such a change.
The original "spacing feature in TWiki" happens when TML (TWiki Markup Language) is expanded in
/lib/TWiki/Render.pm, subroutine
getRenderedVersion. It can not be
removed without heavy changes in the code. If I understand you correctly, then you don't want to
remove the spacing feature, but instead to
add a function which would convert every newline into a new paragraph. This, however, must not happen if we are in a list, or in a table, so the change would be non-trivial (as far as I can say).
Bottom line: I am afraid there is no simple, and not even a fairly easy solution to your requirement.
--
HaraldJoerg - 07 Aug 2007
Thank you harald, I will just have to provide users with the css code that I have inserted as functions in Main.TWiki preferences. I was looking at confluence and tried out their free 30 day hosted trial. They are plagued by the same problem as well. I found TWiki to be much better and about $1,200 - $8,000 cheaper
I will just create those functions %STARTMAIL% & %ENDMAIL% and create new buttons for them on the
NatEditContrib so that people who have no idea what they are doing in TWiki can still paste pages into the editor and just highlight it all click my button and then click submit. I felt that this way it might lead to a greater adoption of the site.
Do you know of a button/plugin to add that might enable a user who does not know what they are doing to click on something that says
"please help me format this page"
and it would e-mail the
TWikiAdministrator. If he/she has free time - they can work on modifying pages for users who are too busy / don't have the time to format their documents.
Thank you again for your continued help! I greatly appreciate it!
--
BrianMahoney - 08 Aug 2007
Well, I've never worked with
NatEditContrib, but I'm full of ideas
Idea 1: Have the button create a
mailto link like
<a href='mailto:%WIKIWEBMASTER%?subject=Formatting%20%Help%20Request;body=formatting%20%TOPIC%foo'>I need help formatting this page</a>
This will, however, not send the mail automatically, but fire up the user's mail client instead (which, BTW, will make sure that a correct
From: address is given).
Idea 2: Do it the TWiki way. Let the button create a HTML comment like
<!-- FormattingHelpNeeded -->
...and create a topic FormattingHelpNeeded which contains a simple search:
%SEARCH{"FormattingHelpNeeded" excludetopic="%TOPIC%"}%
TWiki's search looks into comments as well, so while the topic itself looks innocent, in FormattingHelpNeeded you find all topics where somebody wanted help.
- Advanced usage: Add a
format attribute to the search so that the results immediately show a link to edit the topic in question.
Whoever has time (not only admins), can have a look at the time whenever they want. The downside is that there's no active notification of potential helpers, not even in WebChanges (because the topic containing the SEARCH doesn't change).
Idea 3: Do it the Perl hacker's way. Stealing from how
CommentPlugin works, create a link that adds a "I need help" comment to
another topic. You need new code, because the
save action needs to return a 204 HTTP status, otherwise your edit screen will be lost.
Idea 4: Do it the AJAX way. Let the button send an
XMLHttpRequest which adds a comment asking for help to a predefined topic, like above.
The last two ideas are admittedly crazy, but have the nice effect that the changes to the FormattingHelpNeeded topic will be both visible in RSS and WebChanges, and can cause mail notifications being sent to interested gnomes.
--
HaraldJoerg - 08 Aug 2007
Harald you are amazing! Thank you again for the great ideas!
--
BrianMahoney - 09 Aug 2007
--
SvenDowideit - 18 Aug 2007