There is a problem with <literal> in TMCE
If you have two lines of HTML you want to protect against TMCE with literal it seems that TMCE or probably the
WysiwygPlugin sees the first <literal> and the last </literal> as the entire literal block. It does not see the the first </literal> tag. At least this is how it seems to be like.
Test case first in verbatim
<literal><div style="background-color:yellow"></literal>
__How to add the first administrator__ %BR%
If you haven't previously set up an administrator, follow these steps:
1 Authenticate as the internal TWiki administrator using the [[%SCRIPTURL{login}%/%WEB%/%TOPIC%?sudo=sudo;origurl=%SCRIPTURL{"view"}%/%BASEWEB%/%BASETOPIC%][internal admin login]] (use the username suggested, and the password you set in =configure=).
1 Edit this topic
1 Insert the wikinames of admin users in the TWiki Administrator Group by listing them in the GROUP setting %BR% (example =* Set GROUP = <nop>JohnSmith, <nop>JamesBond=)
1 Save this topic
1 [[%LOGOUTURL%][Logout]] from the Internal TWikiAdminUser
1 Verify that new members show up properly in the group listing at %USERSWEB%.TWikiGroups </li> <li type="a">Make sure always to keep this topic write protected by keeping the already defined ALLOWTOPICCHANGE setting
1 The ALLOWTOPICHANGE and ALLOWTOPICRENAME settings in [[%SYSTEMWEB%.TWikiPreferences]] and [[%USERSWEB%.TWikiPreferences]] have already been set to this group (<nop>TWikiAdminGroup), restricting edit of site-wide preferences to the TWiki Administrator Group
<literal></div></literal>
And pasted in in Raw Edit.
How to add the first administrator
If you haven't previously set up an administrator, follow these steps:
- Authenticate as the internal TWiki administrator using the [[https://develop.twiki.org/do/login/Bugs/Item4888?sudo=sudo;origurl=https://develop.twiki.org/do/view/Bugs/Item4888][internal admin login]] (use the username suggested, and the password you set in
configure
).
- Edit this topic
- Insert the wikinames of admin users in the TWiki Administrator Group by listing them in the GROUP setting
(example * Set GROUP = <nop>JohnSmith, <nop>JamesBond
)
- Save this topic
- [[/do/view/Bugs/Item4888?logout=1][Logout]] from the Internal TWikiAdminUser
- Verify that new members show up properly in the group listing at Main.TWikiGroups
- Make sure always to keep this topic write protected by keeping the already defined ALLOWTOPICCHANGE setting
- The ALLOWTOPICHANGE and ALLOWTOPICRENAME settings in [[TWiki.TWikiPreferences]] and [[Main.TWikiPreferences]] have already been set to this group (<nop>TWikiAdminGroup), restricting edit of site-wide preferences to the TWiki Administrator Group
In fact I am not sure the literal works at all because the table made of TML bullets gets converted into HTML.
--
TWiki:Main/KennethLavrsen - 25 Oct 2007
Rev 1 is before and now I save forcing a rev 2.
WYSIWYD. What you see is what you destroy.
KJL
Argh, another victim of TWiki's "tags that are not tags".
The purpose of literal is to protect a block of HTML so that it is passed through to the browser unaffected by rendering. It was only ever intended to be used to protect well-formed blocks of HTML.
Literal works in WYSIWYG by creating an HTML block around the marked area, such that the content inside the area is not touched by the translation of TML to HTML. It marks these regions with a DIV (it has to mark them so it can reverse the translation). In the case above, you have used the plain text editor to protect a single open DIV tag with LITERAL, so this will be generated in HTML as <DIV><div</DIV>. The /DIV is associated with the yellow-block DIV by the browser, leaving the LITERAL div still open. Thus the entire region up to the next matching /DIV (or the entire topic if there is none) is taken as literal.
As is often the case with
TML2HTML translation there is a compromise between what makes sense in plain text TML, and what makes sense for WYSIWYG users. In TML, literal tags can be stuck in anywhere, around disconnected fragments of HTML. This is because they are not really HTML tags, and can violate the rules of HTML which dictate that <>..</> tags must be balanced. WYSIWYG, on the other hand, edits structured HTML. When you apply the LITERAL style, it can only apply to a well-formed block of HTML. The browser enforces this "structuredness", and the only way around it would be make literal tags in WYSIWYG appear as plain text embedded in the content, which would mean that WYSIWYG users would not be able to use the editor to edit the content of the literal area (it would have to be rendered as HTML text), which IMHO wrecks the usability of the literal marking in WYSIWYG.
There are a couple of alternative approaches you could have taken, instead of using literal tags. First, you could have blocked the translator from removing the yellow DIV by adding an attribute to the div that blocks translation (see
WysiwygPluginSettings fo a list of attributes that block removal of DIV blocks). The obvious blocking attribute to add is
id
. <div style="background-color:yellow" id="keepme"> will
not be removed by the
HTML2TML translation.
Secondly, you could have used <sticky> instead of <literal> tags. Sticky tags permanently protect and content between them and allow the use of malformed HTML too, but present the content as plain text, in WYSIWYG, rather than editable HTML.
Thirdly, if you had used WYSIWYG and opened the original text (without literal marks) you could have selected the block and marked it with the LITERAL style. You could then select that block and select the literal style. Saving the topic would save the entire block as HTML, which is the purpose of the literal tag.
So, my inclination here is to mark this "no action", though I will leave it open as we need to think about additional documentation related to literal/sticky/attributes. I'm marking this as needing feedback, because I want to be sure you understand.
CC
I documented sticky and literal. If you are happy with my doc changes, please could you merge to MAIN? Thx.
CC
Reviewed and merged. Closing. Thanks again again.
KJL