Fixed problem with styled block wikitext rule

print-window-tiddler
Jeremy Ruston 2012-06-14 18:49:51 +01:00
rodzic 11c9031873
commit b41a1cb4de
2 zmienionych plików z 22 dodań i 2 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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>
}}}