1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 07:14:50 +00:00

Fixed problem with styled block wikitext rule

This commit is contained in:
Jeremy Ruston 2012-06-14 18:49:51 +01:00
parent 11c9031873
commit b41a1cb4de
2 changed files with 22 additions and 2 deletions

View File

@ -39,9 +39,9 @@ exports.parse = function(match,isBlock) {
// Look for the first style specifier
reStyleSpecififer.lastIndex = this.pos;
match = reStyleSpecififer.exec(this.source);
while(match) {
while(match && match.index === this.pos) {
// Save the style specified
styles[match[1].trim()] = match[2].trim();
styles[match[1]] = match[2].trim();
// Look to see if there is a further style specifier
this.pos = match.index + match[0].length;
reStyleSpecififer.lastIndex = this.pos;

View File

@ -19,3 +19,23 @@ The HTML looks like this:
{{{
<p style="color:rgb(255, 0, 0);">This is in red!</p>
}}}
Note that the style block doesn't generate any HTML elements itself, but instead causes the styles to be applied to all of the elements contained within the style block. This means that you can assign styles to elements generated from WikiText. For example, here is a list with some additional styles applied:
{{{
@@background-color:#00f
* First item
* Second item
* Third item
@@
}}}
The generated HTML is:
{{{
<ul style="background-color: rgb(0, 0, 255);">
<li>First item</li>
<li>Second item</li>
<li>Third item</li></ul>
}}}