Feature Proposal: Add a little UI to make it easier to escape TML

Motivation

I find that I frequently write Foswiki Markup in a text editor, and then mechanically replace % with $percnt, " with \", etc if I need to put the markup inside and %IF macro, for example. This feature proposal is to add a little UI to the 'Edit wiki text' editor, to make it easier to do this transformations.

Description and Documentation

This could be implemented using a %TWISTY to keep the UI clean. It could even go under the existing "Edit help" twisty. Possible UI:

TML:

Examples

Impact

%WHATDOESITAFFECT%
edit

Implementation

TML: Escape Un Escape

-- Contributors: KipLubliner - 20 Feb 2012

Discussion

Great idea. I've often wanted something similar. We should look into doing a http://codemirror.net/ editor

-- PaulHarvey - 23 Oct 2011

you know, this should be a pretty easy thing to add to the ComponentEditContrib TinyMCE plugin demo i made - it would be pretty cool..

-- SvenDowideit - 24 Oct 2011

I think this would be a great thing to do for 1.2..... all we need is a committed developer.

-- CrawfordCurrie - 17 Feb 2012

Sven - this is the only page that shows up if I google for ComponentEditContrib. Is that TinyMCE plugin accessible anywhere?

-- MichaelTempest - 18 Feb 2012

Well I do have commit access now, so I could commit to working on this. But I'm not sure about what is the best way to do so. If someone posts an implementation plan, I will set my name.

-- KipLubliner - 19 Feb 2012

I would personally do it entirely in Javascript.

-- CrawfordCurrie - 20 Feb 2012

As it turned out, I need this right now ... so I whipped it up (see Implementation section)

-- KipLubliner - 20 Feb 2012

Nice one! Though I suggest you move the functions into the foswiki namespace and give them more intention-revealing names (escape and unescape are rather general) e.g. foswiki.escapeTML and foswiki.unescapeTML. I can see them being useful in other places.

-- CrawfordCurrie - 21 Feb 2012

Very nice smile ... but I think there is a bug. I think backslashes also need to be (un)escaped.

-- MichaelTempest - 21 Feb 2012

Michael, I implemented unescape(\") → " What additional transformations should be included?

-- KipLubliner - 22 Feb 2012

Based on the list of format $tokens in FormattedSearch, I think you have all that is needed. Nice smile

-- MichaelTempest - 22 Feb 2012

I just got back from vacation, and SvenDowideit had somewhat of an open mind to include this feature in 1,2. I'd like to discuss with MichaelDaum about if it should be added to NatEdit or as a separate contrib.

kip3f   question about http://foswiki.org/Development/EscapeTmlInEditor 
it's listed as PlannedFor 1.2 
and now that I am back in the country, I would be happy to get it in 
but I'm not really sure what the next steps should be ... given that NatEdit got added to core, should it be done as an addition to NatEdit? 
or at a bare minimum, I could check in javascript functions to escape / unescape TML   [03:34]
gac410   For one, need to grovel to release manager. 1.2 is now in feature freeze..ish   [03:37]
kip3f   SvenDowideit ... ping! 
if he doesn't want it in 1.2, that's fine with me. The sun will come up tomorrow, etc. etc. 
I'd really love the ability to highlight text in the text editor, and have 'escape TML' / 'unescape TML' menu items or buttons   [03:38]
GithubBot   [foswiki] FoswikiBot pushed 1 new commit to Release01x01: http://git.io/xgzEsg 
foswiki/Release01x01 10ac46c GeorgeClark: Item12233: Implement static mode...   [03:40]
***   GithubBot has left   [03:40]
FoswikiBot   http://foswiki.org/Tasks/Item12233 [ Item12233: All default extensions should honor =static= context ]   [03:40]
kip3f   hmm .. the page is not currently working on trunk nor on f.o   [03:41]
gac410   Hey Sven... over here. ... 
which page?   [03:41]
kip3f   in the 'implementation' section 
it was working before   [03:42]
gac410   yeah... i remember it working not that long ago,. 
works for me 
Escape creates $dollar $amp $lt $gt $percent $comma "   [03:42]
SvenDowideit   kip3f, you have until er, yester-mumble 
however, there are ways we can negotiate. 
imo, natedit is new, so can be considered as an unfinished feature   [03:44]
gac410   :D Lots of unfinished features   [03:45]
SvenDowideit   so if you make it a natedit thing, and in the process are testing natedit, and making sure that it works well for adding extra things 
then i will be happier   [03:45]
gac410   yeesh... EditTablePlugin (the old) on 1.1.6 is a convoluted mess   [03:46]
SvenDowideit   SvenDowideit needs more people looking at stuff   [03:46]
kip3f   ok, hopefully MichaelDaum will be around tomorrow and I will see if he will be happy with that. Thanks   [03:46]
SvenDowideit   y, thats why i was eager to get ERP 
kip3f, if he's not happy to have it in nateditcontrib   [03:46]
gac410   gac410 decides to step quietly away from the static context there.   [03:46]
SvenDowideit   then please make it a separate contrib   [03:46]
kip3f   OK   [03:47]
SvenDowideit   and explore the ability to add extra tools to natedit 
as that would meet our collective goals to be able to extend things   [03:47]
kip3f   OK I will check it out, lots of new stuff to learn :-)   [03:47]
SvenDowideit   yup 
plus it makes me less scared of one more unknown 
and someone else is also looking   [03:48]

-- KipLubliner - 12 Nov 2012

Integrated with Nat Edit, and added to foswikiString_src.js & Foswiki:System.FormatTokens.

-- KipLubliner - 12 Nov 2012
Topic revision: r20 - 05 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy