mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
commit
42181f9b45
8
bld.cmd
8
bld.cmd
@ -94,6 +94,14 @@ node .\tiddlywiki.js ^
|
||||
--rendertiddler $:/core/save/all markdowndemo.html text/plain ^
|
||||
|| exit 1
|
||||
|
||||
rem classicparserdemo.html: wiki to demo classicparser plugin
|
||||
|
||||
node .\tiddlywiki.js ^
|
||||
.\editions\classicparserdemo ^
|
||||
--verbose ^
|
||||
--output %TW5_BUILD_OUTPUT% ^
|
||||
--rendertiddler $:/core/save/all classicparserdemo.html text/plain ^
|
||||
|| exit 1
|
||||
|
||||
rem highlightdemo.html: wiki to demo highlight plugin
|
||||
|
||||
|
9
bld.sh
9
bld.sh
@ -95,6 +95,15 @@ node ./tiddlywiki.js \
|
||||
--rendertiddler $:/core/save/all markdowndemo.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# classicparserdemo.html: wiki to demo classicparser plugin
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
./editions/classicparserdemo \
|
||||
--verbose \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all classicparserdemo.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# highlightdemo.html: wiki to demo highlight plugin
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
|
12
editions/classicparserdemo/tiddlers/$__DefaultTiddlers.tid
Normal file
12
editions/classicparserdemo/tiddlers/$__DefaultTiddlers.tid
Normal file
@ -0,0 +1,12 @@
|
||||
created: 20140417191319973
|
||||
modified: 20140901082708004
|
||||
title: $:/DefaultTiddlers
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
[[Classic Parser Plugin Demo]]
|
||||
[[Classic Slider Demo]]
|
||||
[[ClassicTabsDemo]]
|
||||
[[Classic Transclusion]]
|
||||
[[text/x-tiddlywiki typeblock]]
|
||||
[[Markup]]
|
||||
[[Developers Notes]]
|
@ -0,0 +1,6 @@
|
||||
created: 20140416191641926
|
||||
modified: 20140417181106838
|
||||
title: $:/ShowEditPreview
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
yes
|
5
editions/classicparserdemo/tiddlers/$__SiteSubtitle.tid
Normal file
5
editions/classicparserdemo/tiddlers/$__SiteSubtitle.tid
Normal file
@ -0,0 +1,5 @@
|
||||
created: 20140417192155748
|
||||
modified: 20140417192155748
|
||||
title: $:/SiteSubtitle
|
||||
type: text/vnd.tiddlywiki
|
||||
|
6
editions/classicparserdemo/tiddlers/$__SiteTitle.tid
Normal file
6
editions/classicparserdemo/tiddlers/$__SiteTitle.tid
Normal file
@ -0,0 +1,6 @@
|
||||
created: 20140417192135107
|
||||
modified: 20140417192152339
|
||||
title: $:/SiteTitle
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Classic Parser Demo
|
24
editions/classicparserdemo/tiddlers/Basic Formatting.tid
Normal file
24
editions/classicparserdemo/tiddlers/Basic Formatting.tid
Normal file
@ -0,0 +1,24 @@
|
||||
created: 20121217004633000
|
||||
creator: keithb
|
||||
modified: 20140415164633773
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Basic Formatting
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
|
||||
!Summary
|
||||
//''Emphasizing''// @@text@@ __is easy__!
|
||||
!Markup
|
||||
| !Style | !Markup |h
|
||||
|<html><b><i>bold</i></b></html>|{{{''bold''}}} -- two single-quotes|
|
||||
|//italics//|{{{//italics//}}}|
|
||||
|<html><b><i>bold italics</i></b></html>|{{{''//bold italics//''}}}|
|
||||
|__underline__|{{{__underline__}}}|
|
||||
|--strikethrough--|{{{--Strikethrough--}}}|
|
||||
|super^^script^^|{{{super^^script^^}}}|
|
||||
|sub~~script~~|{{{sub~~script~~}}}|
|
||||
|@@Highlight@@|{{{@@Highlight@@}}}|
|
||||
|{{{plain text}}}|<html><code>{{{PlainText No ''Formatting''}}}</code></html>|
|
||||
|/%this text will be invisible%/hidden text|{{{/%this text will be invisible%/}}}|
|
||||
|foo -- bar|{{{use two dashes -- between two words to create an Em dash}}}|
|
43
editions/classicparserdemo/tiddlers/Blockquotes.tid
Normal file
43
editions/classicparserdemo/tiddlers/Blockquotes.tid
Normal file
@ -0,0 +1,43 @@
|
||||
created: 20110215174227000
|
||||
creator: pmario
|
||||
modified: 20140415164659711
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Blockquotes
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
Use quotations to cite other sources or simply indent content.
|
||||
!!Blockquotes
|
||||
Text can be displayed as quotations using three less-than signs:
|
||||
{{{
|
||||
<<<
|
||||
Steve Jobs: "computers are like a bicycle for our minds"
|
||||
<<<
|
||||
}}}
|
||||
<<<
|
||||
Steve Jobs: "computers are like a bicycle for our minds"
|
||||
<<<
|
||||
!Nested Blockquotes
|
||||
Quotes can be displayed with multi-levels:
|
||||
{{{
|
||||
> blockquote, level 1
|
||||
>> blockquote, level 2
|
||||
>>> blockquote, level 3
|
||||
}}}
|
||||
> blockquote, level 1
|
||||
>> blockquote, level 2
|
||||
>>> blockquote, level 3
|
||||
!!Mixed Blockquotes
|
||||
{{{
|
||||
<<<
|
||||
Steve Jobs: "computers are like a bicycle for our minds"
|
||||
> blockquote, level 1
|
||||
Some more text.
|
||||
<<<
|
||||
}}}
|
||||
<<<
|
||||
Steve Jobs: "computers are like a bicycle for our minds"
|
||||
> blockquote, level 1
|
||||
Some more text.
|
||||
<<<
|
39
editions/classicparserdemo/tiddlers/CSS Formatting.tid
Normal file
39
editions/classicparserdemo/tiddlers/CSS Formatting.tid
Normal file
@ -0,0 +1,39 @@
|
||||
created: 20130211145116000
|
||||
creator: tobibeer
|
||||
modified: 20140415164516606
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: CSS Formatting
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
|
||||
!Summary
|
||||
You can directly apply CSS rules inline or use custom classes.
|
||||
!Markup
|
||||
!!!Inline Styles
|
||||
Enclose text using two double @ signs and let the first two follow by your CSS rules.
|
||||
{{{
|
||||
@@color:#4bbbbb;Some random text@@
|
||||
}}}
|
||||
''Displays as:''
|
||||
@@color:red;Some random text@@
|
||||
|
||||
!!!CSS Classes
|
||||
CSS classes can be applied to text blocks.
|
||||
|
||||
To wrap your text inline in a HTML {{{<span>}}} element use...
|
||||
{{{
|
||||
before » {{customClassName{inline content}}} « after
|
||||
}}}
|
||||
''Displays as:''
|
||||
before » {{customClassName{inline content}}} « after
|
||||
|
||||
To wrap your text as a block level element -- a HTML {{{<div>}}} -- use line-breaks...
|
||||
<html><pre>
|
||||
before » {{customClassName{
|
||||
box content
|
||||
}}} « after
|
||||
</pre></html>''Displays as:''
|
||||
before » {{customClassName{
|
||||
box content
|
||||
}}} « after
|
@ -0,0 +1,14 @@
|
||||
created: 20140416201128370
|
||||
modified: 20140901082657977
|
||||
title: Classic Parser Plugin Demo
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
This is a demo of the Tiddlywiki Classic parser for Tiddlywiki5 (the tw2parser plugin).
|
||||
Below is a [[Test card|Markup]] from [[http://tiddlywiki.org]] showing examples of all Classic markup.
|
||||
|
||||
Tiddlers that are given the type 'text/x-tiddlywiki' will be interpreted as containing Classic Tiddlywiki markup. In addition Classic Tiddlywiki markup can be embedded in a tiddlywiki5 tiddler by the use of a type block - see [[text/x-tiddlywiki typeblock]] below.
|
||||
!!Support for Classic macros
|
||||
At present there is limited support for Classic macros. See below for examples of the [[slider|Classic Slider Demo]], [[tabs|ClassicTabsDemo]] and [[tiddler|Classic Transclusion]] macros.
|
||||
!!Status
|
||||
See here for <<slider $:/temp/1 Issues "Issues»" "more" >>
|
||||
!!See also [[Developers Notes]]
|
13
editions/classicparserdemo/tiddlers/Classic Slider Demo.tid
Normal file
13
editions/classicparserdemo/tiddlers/Classic Slider Demo.tid
Normal file
@ -0,0 +1,13 @@
|
||||
created: 20140831105412236
|
||||
modified: 20140901072049425
|
||||
title: Classic Slider Demo
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!!Demo text:
|
||||
{{{
|
||||
<<slider $:/temp/xxx slidertest "click me»" "more" >>
|
||||
}}}
|
||||
!!Demo results:
|
||||
|
||||
<<slider $:/temp/xxx slidertest "click me»" "more" >>
|
||||
|
12
editions/classicparserdemo/tiddlers/Classic Transclusion.tid
Normal file
12
editions/classicparserdemo/tiddlers/Classic Transclusion.tid
Normal file
@ -0,0 +1,12 @@
|
||||
created: 20140831105630157
|
||||
modified: 20140901082725277
|
||||
title: Classic Transclusion
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!!Demo text:
|
||||
{{{
|
||||
<<tiddler [[Classic Parser Plugin Demo##Support for Classic macros]]>>
|
||||
}}}
|
||||
!!Demo results:
|
||||
|
||||
<<tiddler [[Classic Parser Plugin Demo##Support for Classic macros]]>>
|
39
editions/classicparserdemo/tiddlers/ClassicTabsDemo.tid
Normal file
39
editions/classicparserdemo/tiddlers/ClassicTabsDemo.tid
Normal file
@ -0,0 +1,39 @@
|
||||
created: 20140603181004793
|
||||
modified: 20140901071957024
|
||||
title: ClassicTabsDemo
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!!Demo text:
|
||||
{{{
|
||||
<<tabs $:/state/tabtxtdemo
|
||||
"show a section" "sec 1" ClassicTabsDemo##Do1
|
||||
"section 2" "Priority 2" ClassicTabsDemo##Do2
|
||||
"and a slice" "a slice" [[ClassicTabsDemo::slice]]
|
||||
>>
|
||||
|
||||
/%
|
||||
!Do1
|
||||
first section: this is a hidden section below
|
||||
!Do2
|
||||
another hidden section of this tiddler
|
||||
!end
|
||||
|~slice| a hidden slice of this tiddler|
|
||||
!end
|
||||
%/
|
||||
}}}
|
||||
!!Demo results:
|
||||
<<tabs $:/state/tabtxtdemo
|
||||
"show a section" "sec 1" ClassicTabsDemo##Do1
|
||||
"section 2" "Priority 2" ClassicTabsDemo##Do2
|
||||
"and a slice" "a slice" [[ClassicTabsDemo::slice]]
|
||||
>>
|
||||
|
||||
/%
|
||||
!Do1
|
||||
first section: this is a hidden section below
|
||||
!Do2
|
||||
another hidden section of this tiddler
|
||||
!end
|
||||
|~slice| a hidden slice of this tiddler|
|
||||
!end
|
||||
%/
|
30
editions/classicparserdemo/tiddlers/Code.tid
Normal file
30
editions/classicparserdemo/tiddlers/Code.tid
Normal file
@ -0,0 +1,30 @@
|
||||
created: 20130211142734000
|
||||
creator: tobibeer
|
||||
modified: 20140901061201603
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Code
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
You can render text monospaced text, e.g. using the font //Courier//, while preserving line breaks and not applying WikiText formating or turning WikiWords into links.
|
||||
!!"""Monospaced Text Block"""
|
||||
<html><pre>
|
||||
{{{
|
||||
Some plain text including WikiLinks
|
||||
}}}
|
||||
</pre></html>''Displays as:'' a HTML <pre> element
|
||||
{{{
|
||||
Some plain text including WikiLinks
|
||||
}}}
|
||||
<<<
|
||||
''Note:'' Code blocks are displayed using a white-space 'as-is', fixed-width font without no word-wrapping -- displayed in a box.
|
||||
<<<
|
||||
!!"""Monospaced Inline Text"""
|
||||
Alternatively, you can also display monospaced text __inline__ by wrapping the text in three braces <html><code>{{{...}}}</code></html>:
|
||||
<html><pre>{{{inline //code//}}}</pre></html>''Displays as:'' a HTML <code> element
|
||||
{{{inline //code//}}}
|
||||
<<<
|
||||
''Note:'' Inline code uses a white-space 'collapsed', word-wrapped, fixed-width font.
|
||||
|
||||
|
29
editions/classicparserdemo/tiddlers/Comment Formatting.tid
Normal file
29
editions/classicparserdemo/tiddlers/Comment Formatting.tid
Normal file
@ -0,0 +1,29 @@
|
||||
created: 20130213001758000
|
||||
creator: tobibeer
|
||||
modified: 20140901061006864
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Comment Formatting
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
Occasionally you want to add notes to your tiddler markup yet don't want it displayed when the tiddler is rendered. To achieve this, wrap the text using {{{/% hidden %/}}}.
|
||||
!Example
|
||||
{{{
|
||||
text before .../%
|
||||
!HIDDEN SECTION
|
||||
This is content of a hidden section.
|
||||
!END%/ text after
|
||||
}}}
|
||||
''Display as:''
|
||||
<<<
|
||||
text before /%
|
||||
!HIDDEN SECTION
|
||||
This is content of a hidden section.
|
||||
!END%/... text after
|
||||
<<<
|
||||
!Also see...
|
||||
;[[Suppressing Formatting]]
|
||||
:» when you just don't want that text to be TiddlyWiki markup
|
||||
:» when you want to prevent WikiWords
|
||||
:» when you copy & paste from other sources
|
26
editions/classicparserdemo/tiddlers/Developers Notes.tid
Normal file
26
editions/classicparserdemo/tiddlers/Developers Notes.tid
Normal file
@ -0,0 +1,26 @@
|
||||
created: 20140831112438405
|
||||
modified: 20140901080739956
|
||||
title: Developers Notes
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
The includes handling of namespace conflicts between Classic and Tw5 macros.
|
||||
|
||||
One of the goals of the Tw2parser plugin is to hide the Classic macros from tiddlers of types other than text/x-tiddlywiki. This is achieved by having the parser prepend the macro definitions to the 'local' parse tree (see around line 60 wikitextparser.js), making them only visible in text/x-tiddlywiki tiddlers and typed-blocks. At present all text based Classic macros are in the same file.
|
||||
|
||||
As all global Tw5 macros are visible in all tiddlers (including text/x-tiddlywiki tiddlers), there is a name-space conflict between Classic and tw5 macros. For macros that are defined using tiddlytext (ie /define() /end blocks) the local defined Classic definition will override the global Tw5 macros (which is what we want).
|
||||
|
||||
For cases where simple overriding is not sufficient, the tw2parser plugin also has a 'macro name adapter' module (macroadapter.js) to move the Classic macros names to a new names -
|
||||
(in wikitextrules.js around line 490)
|
||||
|
||||
{{{tw2on5-name=macroadapter.namedapter[tw2name];}}}
|
||||
|
||||
This is invisible to the user.
|
||||
|
||||
An example is the {{{tabs()}}} macro which is mapped to {{{__system_tabs()}}}
|
||||
so the user still types {{{tabs()}}} but this is mapped to {{{__system_tabs()}}} in the parser which is what appears in the file macrodefs.tids
|
||||
|
||||
There is also the facility to manipulate the parameters via {{{params=macroadapter.paramadaptername}}}
|
||||
This is used in the 'tabs' macro where there is a variable number of parameters that must be mapped into fixed number of tw5 macro parameters.
|
||||
|
||||
The implementation of the tabs macro is rather sophisticated, the parameters are put into maps from tab-tiddername to tab-property (properties are cookies, prompts and labels) implemented as jsons.
|
||||
|
50
editions/classicparserdemo/tiddlers/HTML Entities.tid
Normal file
50
editions/classicparserdemo/tiddlers/HTML Entities.tid
Normal file
@ -0,0 +1,50 @@
|
||||
created: 20130204165019000
|
||||
creator: tobibeer
|
||||
modified: 20140415164150742
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: HTML Entities
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
Use HTML entities to enter characters that can't easily be typed on an ordinary keyboard. They take the form of an ampersand ({{{&}}}), an identifying string, and a terminating semi-colon ({{{;}}}), e.g. {{{&}}}.
|
||||
!Markup
|
||||
{{{
|
||||
The value of Tiddlers™ cannot even be expressed in £, € or $.
|
||||
}}}
|
||||
''Displays as:''
|
||||
The value of Tiddlers™ cannot even be expressed in £, € or $.
|
||||
|
||||
!"""Entity References"""
|
||||
Comprehensive lists of html entities can be found at...
|
||||
* [[w3schools.com|http://www.w3schools.com/tags/ref_entities.asp]]
|
||||
* [[htmlhelp.com|http://www.htmlhelp.com/reference/html40/entities]]
|
||||
|
||||
!"""Examples Of Common And Eseful Entities"""
|
||||
|>|>|>|>|>|>| !HTML Entities |
|
||||
| &nbsp; | | no-break space | | &apos; | ' | single quote, apostrophe |
|
||||
| &ndash; | – | en dash |~| &quot; | " | quotation mark |
|
||||
| &mdash; | — | em dash |~| &prime; | ′ | prime; minutes; feet |
|
||||
| &hellip; | … | horizontal ellipsis |~| &Prime; | ″ | double prime; seconds; inches |
|
||||
| &copy; | © | Copyright symbol |~| &lsquo; | ‘ | left single quote |
|
||||
| &reg; | ® | Registered symbol |~| &rsquo; | ’ | right single quote |
|
||||
| &trade; | ™ | Trademark symbol |~| &ldquo; | “ | left double quote |
|
||||
| &dagger; | † | dagger |~| &rdquo; | ” | right double quote |
|
||||
| &Dagger; | ‡ | double dagger |~| &laquo; | « | left angle quote |
|
||||
| &para; | ¶ | paragraph sign |~| &raquo; | » | right angle quote |
|
||||
| &sect; | § | section sign |~| &times; | × | multiplication symbol |
|
||||
| &uarr; | ↑ | up arrow |~| &darr; | ↓ | down arrow |
|
||||
| &larr; | ← | left arrow |~| &rarr; | → | right arrow |
|
||||
| &lArr; | ⇐ | double left arrow |~| &rArr; | ⇒ | double right arrow |
|
||||
| &harr; | ↔ | left right arrow |~| &hArr; | ⇔ | double left right arrow |
|
||||
!"""Accented Characters"""
|
||||
The table below shows how accented characters can be built up by subsituting the underscore (_) into the corresponding character:
|
||||
|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>| !Accented Characters |
|
||||
| grave accent | &_grave; | À | à | È | è | Ì | ì | Ò | ò | Ù | ù | | | | | | |
|
||||
| acute accent | &_acute; | Á | á | É | é | Í | í | Ó | ó | Ú | ú | | | Ý | ý | | |
|
||||
| circumflex accent | &_circ; | Â | â | Ê | ê | Î | î | Ô | ô | Û | û | | | | | | |
|
||||
| umlaut mark | &_uml; | Ä | ä | Ë | ë | Ï | ï | Ö | ö | Ü | ü | | | Ÿ | ÿ | | |
|
||||
| tilde | &_tilde; | Ã | ã | | | | | Õ | õ | | | Ñ | ñ | | | | |
|
||||
| ring | &_ring; | Å | å | | | | | | | | | | | | | | |
|
||||
| slash | &_slash; | | | | | | | Ø | ø | | | | | | | | |
|
||||
| cedilla | &_cedil; | | | | | | | | | | | | | | | Ç | ç |
|
29
editions/classicparserdemo/tiddlers/HTML Formatting.tid
Normal file
29
editions/classicparserdemo/tiddlers/HTML Formatting.tid
Normal file
@ -0,0 +1,29 @@
|
||||
created: 20130212225913000
|
||||
creator: tobibeer
|
||||
modified: 20140415163847476
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: HTML Formatting
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
TiddlyWiki provides support for rendering pure HTML markup. To do this, simply wrap your HTML code in {{{<html>your html markup goes here</html>}}}. This way you are able to use embed code using iFrames often suggested by popular media sites like ~YouTube.
|
||||
!!"""Embedded HTML"""
|
||||
{{{
|
||||
<html>
|
||||
<span style="padding-right:30px;font-size:2em;">any</span><br />
|
||||
<b>valid</b> <em>xhtml</em>
|
||||
</html>
|
||||
}}}
|
||||
<html><span style="padding-right:30px;font-size:2em;">any</span><br /><b>valid</b> <em>xhtml</em></html>
|
||||
!!"""Embedded iFrame"""
|
||||
{{{
|
||||
<html>
|
||||
<iframe src="http://www.youtube.com/embed/Cj6ho1-G6tw"
|
||||
width="450" height="315" frameborder="0" allowfullscreen/>
|
||||
</html>
|
||||
}}}
|
||||
<html>
|
||||
<iframe src="http://www.youtube.com/embed/Cj6ho1-G6tw?vq=hd720&iv_load_policy=3"
|
||||
width="450" height="315" frameborder="0" allowfullscreen/>
|
||||
</html>
|
26
editions/classicparserdemo/tiddlers/Headings.tid
Normal file
26
editions/classicparserdemo/tiddlers/Headings.tid
Normal file
@ -0,0 +1,26 @@
|
||||
created: 20130211150503000
|
||||
creator: tobibeer
|
||||
modified: 20140831113805090
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Headings
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
|
||||
Start a line using exclamation marks to create headings.
|
||||
!Markup
|
||||
{{{
|
||||
!Heading Level 1
|
||||
!!Heading Level 2
|
||||
!!!Heading Level 3
|
||||
!!!!Heading Level 4
|
||||
!!!!!Heading Level 5
|
||||
!!!!!!Heading Level 6
|
||||
}}}
|
||||
!Heading Level 1
|
||||
!!Heading Level 2
|
||||
!!!Heading Level 3
|
||||
!!!!Heading Level 4
|
||||
!!!!!Heading Level 5
|
||||
!!!!!!Heading Level 6
|
25
editions/classicparserdemo/tiddlers/Horizontal Rules.tid
Normal file
25
editions/classicparserdemo/tiddlers/Horizontal Rules.tid
Normal file
@ -0,0 +1,25 @@
|
||||
created: 20130211150739000
|
||||
creator: tobibeer
|
||||
modified: 20140415164242103
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Horizontal Rules
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
Use four dashes on a line or the HTML tag {{{<hr>}}} to produce a horizontal rule.
|
||||
!Markup
|
||||
{{{
|
||||
before
|
||||
----
|
||||
after
|
||||
}}}
|
||||
or
|
||||
{{{
|
||||
before<hr>after
|
||||
}}}
|
||||
''Displays as:''
|
||||
|
||||
before
|
||||
----
|
||||
after
|
49
editions/classicparserdemo/tiddlers/Images.tid
Normal file
49
editions/classicparserdemo/tiddlers/Images.tid
Normal file
@ -0,0 +1,49 @@
|
||||
created: 20130211151808000
|
||||
creator: tobibeer
|
||||
modified: 20140901062342853
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Images
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
Generally, images are external to TiddlyWiki. You have different means to layout the image flow.
|
||||
!Markup
|
||||
!!Simple Images
|
||||
{{{
|
||||
[img[http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
}}}
|
||||
[img[http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
!!Images Titles
|
||||
{{{
|
||||
[img[tooltip|http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
}}}
|
||||
[img[tooltip|http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
!!Image Links
|
||||
{{{
|
||||
[img[http://wikitext.tiddlyspace.com/fractalveg.jpg][http://www.flickr.com/photos/jermy/10134618/]]
|
||||
}}}
|
||||
[img[http://wikitext.tiddlyspace.com/fractalveg.jpg][http://www.flickr.com/photos/jermy/10134618/]]
|
||||
|
||||
!!Floating Images
|
||||
To clear a float, append...
|
||||
{{{
|
||||
@@clear:both;display:block; @@
|
||||
}}}
|
||||
|
||||
!!Floating Left...
|
||||
{{{
|
||||
[<img[http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
@@clear:both;display:block; all clear@@
|
||||
}}}
|
||||
[<img[http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
@@clear:both;display:block; all clear@@
|
||||
!!Floating Right
|
||||
{{{
|
||||
[>img[http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
@@float:right;clear:both;display:block; all clear@@
|
||||
@@clear:both;display:block; @@
|
||||
}}}
|
||||
[>img[http://wikitext.tiddlyspace.com/fractalveg.jpg]]
|
||||
@@float:right;clear:both;display:block; all clear@@
|
||||
@@clear:both;display:block; @@
|
9
editions/classicparserdemo/tiddlers/Issues.tid
Normal file
9
editions/classicparserdemo/tiddlers/Issues.tid
Normal file
@ -0,0 +1,9 @@
|
||||
created: 20140416202554189
|
||||
modified: 20140831091025876
|
||||
title: Issues
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
*There is problem with table colspan with > to the right of a text filled cell.
|
||||
*tiddler macro incomplete
|
||||
*not all classic core macros supported
|
||||
|
24
editions/classicparserdemo/tiddlers/Line Breaks.tid
Normal file
24
editions/classicparserdemo/tiddlers/Line Breaks.tid
Normal file
@ -0,0 +1,24 @@
|
||||
created: 20130211153646000
|
||||
creator: tobibeer
|
||||
modified: 20140415164315536
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Line Breaks
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
Line breaks can be forced explicitly using a {{{<br>}}} -- useful in lists or tables.
|
||||
!Markup
|
||||
{{{
|
||||
|A cell<br> with a line break|
|
||||
}}}
|
||||
|A cell<br> with a line break|
|
||||
!!Avoiding Linebreaks
|
||||
Sometimes you want to avoid superflous linebreaks and increase readability of your wiki text, e.g. when using @@highlights@@ or the tiddler macro. To achieve that, end the current line by starting a hidden comment and ending it on the next line, e.g.:
|
||||
{{{
|
||||
@@highlight@@/%
|
||||
%/<<tiddler foo>>
|
||||
}}}
|
||||
This will prevent from adding a superflous linebreak between the highlight and the transcluded content that follows.
|
||||
!!Also see
|
||||
* [[Table Formatting
|
51
editions/classicparserdemo/tiddlers/Links.tid
Normal file
51
editions/classicparserdemo/tiddlers/Links.tid
Normal file
@ -0,0 +1,51 @@
|
||||
created: 20130211154140000
|
||||
creator: tobibeer
|
||||
modified: 20140831095524601
|
||||
modifier: tobibeer
|
||||
tags: Formatting
|
||||
title: Links
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
TiddlyWiki allows different kinds of links, e.g. WikiWords, [[TiddlyLinks|TiddlyLink]], external Links or TiddlySpace links.
|
||||
!!WikiWords
|
||||
Any words or phrases that are CamelCase or [[Compound-Words|CamelCase]] - in which the elements are joined without spaces - will result in them becoming wiki links to tiddlers with that name.
|
||||
{{{
|
||||
WikiWord
|
||||
}}}
|
||||
WikiWord
|
||||
|
||||
To prevent this, append a tilde {{{~}}}...
|
||||
{{{
|
||||
~WikiWord
|
||||
}}}
|
||||
~WikiWord
|
||||
|
||||
!![[TiddlyLinks|TiddlyLink]]
|
||||
A tiddler can also be linked using square brackets encompassing the tiddler title:
|
||||
{{{
|
||||
[[Core Macros]]
|
||||
}}}
|
||||
[[Core Macros]]
|
||||
|
||||
!![[Pretty TiddlyLinks|TiddlyLink]]
|
||||
Optionally, a custom title can be used, separated by a pipe character (|)
|
||||
{{{
|
||||
[[standard macros|Core Macros]]
|
||||
}}}
|
||||
[[standard macros|Core Macros]]
|
||||
|
||||
!![[External Links|External Link]]
|
||||
A valid URL directly results in a link to that external site:
|
||||
{{{
|
||||
http://tiddlywiki.org
|
||||
}}}
|
||||
http://tiddlywiki.org
|
||||
|
||||
!![[Pretty External Links|External Link]]
|
||||
Similar to TiddlyLinks, external links can have a different title as well:
|
||||
{{{
|
||||
[[visit TiddlyWiki.org|http://tiddlywiki.org]]
|
||||
}}}
|
||||
[[visit TiddlyWiki.org|http://tiddlywiki.org]]
|
||||
|
42
editions/classicparserdemo/tiddlers/Lists.tid
Normal file
42
editions/classicparserdemo/tiddlers/Lists.tid
Normal file
@ -0,0 +1,42 @@
|
||||
created: 20120131235950000
|
||||
creator: sandman619
|
||||
modified: 20140415164107038
|
||||
modifier: tobibeer
|
||||
tags: Formatting
|
||||
title: Lists
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
In TiddlyWiki you can make user of different list types, such as unordered lists, ordered or numbered lists, as well as definition lists.
|
||||
!!Ordered Lists
|
||||
Lists can be ordered using numbers and letters by starting a line with a hash {{{#}}}...
|
||||
{{{
|
||||
#List item one
|
||||
##List item two
|
||||
###List item three
|
||||
}}}
|
||||
#List item one
|
||||
##List item two
|
||||
###List item three
|
||||
!!Unordered Lists
|
||||
Create unordered lists by starting a line using an asterisk {{{*}}}...
|
||||
{{{
|
||||
*Unordered List Level 1
|
||||
**Unordered List Level 2
|
||||
***Unordered List Level 3
|
||||
}}}
|
||||
*Unordered List Level 1
|
||||
**Unordered List Level 2
|
||||
***Unordered List Level 3
|
||||
!!Definition Lists
|
||||
Create definition lists by starting a line using a semi-colon {{{;}}} for the term followed by a line starting with a colon {{{:}}} for the definition...
|
||||
{{{
|
||||
;Term 1
|
||||
:Definition for Term 1
|
||||
;Term 2
|
||||
:Definition for Term 2
|
||||
}}}
|
||||
;Term 1
|
||||
:Definition for Term 1
|
||||
;Term 2
|
||||
:Definition for Term 2
|
101
editions/classicparserdemo/tiddlers/Markup.tid
Normal file
101
editions/classicparserdemo/tiddlers/Markup.tid
Normal file
@ -0,0 +1,101 @@
|
||||
created: 20130205062501000
|
||||
creator: tobibeer
|
||||
modified: 20140831153103538
|
||||
modifier: tobibeer
|
||||
title: Markup
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
TiddlyWiki markup is a dedicated markup syntax to <<tag Formatting "format your content">> using WikiText...
|
||||
|noLinkify|k
|
||||
|width:250px; !Example | !Example Markup |h
|
||||
| how the example markup renders | what to enter as tiddler text |
|
||||
|>| ![[Basic Text Formatting|Basic Formatting]] |
|
||||
|''bold''|{{{''bold''}}} (two __single__-quotes) |
|
||||
|//italics//|{{{//italics//}}} |
|
||||
|''//bold italics//''|{{{''//bold italics//''}}} |
|
||||
|__underline__|{{{__underline__}}} |
|
||||
|--strikethrough--|{{{--strikethrough--}}} |
|
||||
|super^^script^^|{{{super^^script^^}}} |
|
||||
|sub~~script~~|{{{sub~~script~~}}} |
|
||||
|@@highlight@@|{{{@@highlight@@}}} |
|
||||
|foo -- bar|{{{foo -- bar}}} -- two dashes create an Em dash|
|
||||
|>| ![[Avoiding Wikification|Suppressing Formatting]] |
|
||||
|to output text as-is (escaping), enclose it in three double quotes or use the {{{<nowiki>}}} markup|>|
|
||||
|"""plain//text""" |{{{"""plain//text"""}}}|
|
||||
|<nowiki>not__wikified</nowiki>|{{{<nowiki>not__wikified</nowiki>}}}|
|
||||
|>| ![[Headings]] |
|
||||
|start a new line with one or more question marks to create headings |>|
|
||||
|<html><h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5></html>|{{{!Heading 1}}}<br />{{{!!Heading 2}}}<br />{{{!!!Heading 3}}}<br />{{{!!!!Heading 4}}}<br />{{{!!!!!Heading 5}}}|
|
||||
|>|![[Lists]]|
|
||||
|>| [[Ordered Lists|Lists]] |
|
||||
|<html><ol><li>item one</li><li>item two<ol><li>level two<ol><li>level three</li></ol></li></ol></li></ol></li></ol></html>|{{{#item one}}}<br/>{{{#item two}}}<br/>{{{##level two}}}<br/>{{{###level three}}}|
|
||||
|>| [[Unordered Lists|Lists]] |
|
||||
|<html><ul><li>item one</li><li>item two<ul><li>level two<ul><li>level three</li></ul></li></ul></li></ul></html>|{{{*item one}}}<br/>{{{*item two}}}<br/>{{{**level two}}}<br/>{{{***level three}}}|
|
||||
|>| [[Definition List|Lists]] |
|
||||
|<html><dl><dt>term</dt><dd>definition</dd></dl></html>|{{{;term}}}<br />{{{:definition}}}|
|
||||
|>| [[Mixed Lists|Lists]] |
|
||||
|<html><ol><li>ordered<ul><li>unordered<dl><dt>term</dt><dd>definition</dd></dl></li></ul></li></ol></html>|{{{# ordered}}}<br />{{{#* unordered}}}<br />{{{#*;term}}}<br />{{{#*:definition}}}|
|
||||
| ![[Blockquotes]] |>|
|
||||
| [[Nested Blockquotes|Blockquotes]] |>|
|
||||
|<html><blockquote>blockquote<blockquote>level two<blockquote>level three</blockquote></blockquote></blockquote></html>|{{{>blockquote}}}<br />{{{>>level two}}}<br />{{{>>>level three}}}|
|
||||
|>| [[Multi-line Blockquotes|Blockquotes]] |
|
||||
|<html><blockquote>multi-line<br/>blockquote</blockquote></html>|{{{<<<}}}<br />{{{multi-line}}}<br />{{{blockquote}}}<br />{{{<<<}}}|
|
||||
|>| [[Mixed Blockquotes|Blockquotes]] |
|
||||
|<html><blockquote>foo<br><blockquote>inner foo, level 1<br><blockquote>inner foo, level 2<br></blockquote></blockquote>more foo<br></blockquote></html>|{{{<<<}}}<br />{{{foo}}}<br />{{{> inner foo, level 1}}}<br />{{{>> inner foo, level 2}}}<br />{{{more foo}}}<br />{{{<<<}}}|
|
||||
|>| ![[Code / Monospaced Text|Code]] |
|
||||
|>| [[Inline Code|Code]] |
|
||||
|{{{monospaced text}}}|<html><code>{{{mono space text}}}</code></html>|
|
||||
|>| [[Code Block|Code]] |
|
||||
|<html><pre>{{{<br/>multi-line<br/>code block<br/>}}}</pre></html>|<html><code>{{{</code></html><br/>{{{multi-line}}}<br/>{{{code block}}}<br/><html><code>}}}</code></html>|
|
||||
| ![[Links]] |>|
|
||||
|>| [[Internal Links|TiddlyLink]] |
|
||||
|[[WikiWord]]|{{{WikiWord}}}|
|
||||
|~NoLink|{{{~NoLink}}} -- a tilde {{{~}}} prevents automatic ~WikiWord links|
|
||||
|[[Plain Link]]|{{{[[Plain Link]]}}}|
|
||||
|[[Pretty Link|Tiddler Name]]|{{{[[Pretty Link|Tiddler Name]]}}}|
|
||||
|>| [[External Links|External Link]] |
|
||||
|A valid URL is automatically rendered as an external link.|>|
|
||||
|http://www.tiddlywiki.com|{{{http://www.tiddlywiki.com}}}|
|
||||
|[[Pretty External Link|http://www.tiddlywiki.com]]|{{{[[Pretty External Link|http://www.tiddlywiki.com]]}}}|
|
||||
|>| ![[Filesystem Links|Links]] |
|
||||
|You can, of course, use file system links both as plain or pretty links.|>|
|
||||
|''Windows Network Path''|{{{[[file://///server/share]]}}}|
|
||||
|''Windows Local''|{{{[[file:///c:/folder/file]]}}}|
|
||||
|''Linux/Unix Local''|{{{[[file:///folder/file]]}}}|
|
||||
|''Relative Path (Subfolder)''|{{{[[folder/file]]}}}|
|
||||
|>| ![[Images]] |
|
||||
|In general, image files are external to a TiddlyWiki.|>|
|
||||
|[img[http://www.tiddlywiki.com/favicon.ico]]|{{{[img[path/image.jpg]]}}}|
|
||||
| aligned right [>img[http://www.tiddlywiki.com/favicon.ico]]|{{{[>img[path/image.jpg]]}}}|
|
||||
|[<img[http://www.tiddlywiki.com/favicon.ico]] aligned left|{{{[<img[path/image.jpg]]}}}|
|
||||
|w/ internal link [>img[http://www.tiddlywiki.com/favicon.ico][TiddlyWiki]]|{{{[img[path/image.jpg][TiddlerName]]}}}|
|
||||
|w/ external link [>img[http://www.tiddlywiki.com/favicon.ico][http://www.tiddlywiki.com]]|{{{[img[path/image.jpg][TiddlyWiki|http://www.tiddlywiki.com]]}}}|
|
||||
|>| ![[Gradients|gradient]] |
|
||||
|<<gradient horiz #faa #afa #aaf>> __vert__ical or __horiz__ontal<br> see [[gradient macro|http://tiddlywiki.org/#%5B%5Bgradient%20(macro)%5D%5D]]>>|{{{<<gradient horiz #faa #afa #aaf>>wiki text>>}}}|
|
||||
|>| ![[Tables]] |
|
||||
|<<tiddler HTML_TABLE>>|<<tiddler HTML_TABLE_MARKUP>>|
|
||||
|>|<<tiddler HTML_TABLE_RULES>>|
|
||||
|>| ![[Custom Styles|CSS Formatting]] |
|
||||
|>|a {{{@@highlight@@}}} element can accept CSS syntax to directly style text.|>|
|
||||
|@@color:green;green coloured@@|{{{@@color:green;green coloured@@}}}|
|
||||
|>| ![[Custom CSS Class Wrapper|CSS Formatting]] |
|
||||
|>|You can define a custom css class wrapper, like {{{.button}}} below. By default, the inner text is placed inline into a {{{<span>}}} of said class(s). If you start and end the inner text with a newline, the content is placed in a {{{<div>}}}. Use the StyleSheet to define the css styles applied to the class.|
|
||||
|<br>{{button title{Click!}}}|<html><pre>{{button title{Click!}}}</pre></html>|
|
||||
|>| ![[Embedded HTML|HTML Formatting]] |
|
||||
|<html><span style="padding-right:30px;font-size:2em;">any</span><br /><b>valid</b> <em>xhtml</em></html>|<html><code style="font-weight:bold"><html></code></html>{{{<span style="padding-right:30px;font-size:2em;">any</span><br /><b>valid</b> <em>xhtml</em>}}}<html><code style="font-weight:bold"></html></code></html>|
|
||||
|>| [[Embedded <iframe>|HTML Formatting]] |
|
||||
|<html><iframe height="200px" width="300px" src="http://www.youtube.com/embed/Cj6ho1-G6tw?vq=hd720" frameborder="0" allowfullscreen/></html>|<html><code style="font-weight:bold"><html></code></html>{{{<iframe src="http://the.url"/>}}}<html><code style="font-weight:bold"></html></code></html>|
|
||||
|>| ![[Line Break|Line Breaks]] |
|
||||
|handy for entering multi-line content into table cells or lists|>|
|
||||
|a<br>b|{{{a<br>b}}} or {{{a<br/>a}}} or {{{a<br />a}}}|
|
||||
|>| ![[Horizontal Rules]] |
|
||||
|before<hr>after|{{{<hr>}}} or <br>{{{----}}} on its own line|
|
||||
|>| ![[HTML Entities]] |
|
||||
|>|You can use HTML entities...|
|
||||
|ɸ™ |{{{ɸ™}}}|
|
||||
| ![[Macros]] |>|
|
||||
|>|macros are called by enclosing the macro name in {{{<<}}} and {{{>>}}}|
|
||||
|<<version>> |{{{<<version>>}}}|
|
||||
|>| ![[Hidden Text|Basic Formatting]] |
|
||||
|This is hidden: |{{{This is hidden: /% secret comment %/}}}|
|
||||
|
10
editions/classicparserdemo/tiddlers/Monospaced Text.tid
Normal file
10
editions/classicparserdemo/tiddlers/Monospaced Text.tid
Normal file
@ -0,0 +1,10 @@
|
||||
created: 20130213002736000
|
||||
creator: tobibeer
|
||||
modified: 20140415163915430
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Monospaced Text
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
|
||||
<<tiddler Code>>
|
@ -0,0 +1,29 @@
|
||||
created: 20130211143136000
|
||||
creator: tobibeer
|
||||
modified: 20140415164021461
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Suppressing Formatting
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
TiddlyWiki markup rules can be suppressed for any given section of text by enclosing it in three ''double'' quotes or wrapping it using the {{{<nowiki>}}} markup...
|
||||
* when you just don't want that text to be TiddlyWiki markup
|
||||
* when you want to prevent WikiWords
|
||||
* when you copy & paste from other sources
|
||||
!Markup
|
||||
{{{
|
||||
» neither is this italicised or a """//WikiWord//"""
|
||||
» nor is this <nowiki>__underlined__</nowiki>
|
||||
}}}
|
||||
» neither is this italicised or a """//WikiWord//"""
|
||||
» nor is this <nowiki>__underlined__</nowiki>
|
||||
|
||||
In addition, you can suppress auto-linking for WikiWords, use the tilde prefix {{{~}}}:
|
||||
{{{
|
||||
~WikiWord
|
||||
}}}
|
||||
~WikiWord
|
||||
!!Also see
|
||||
*[[Comment Formatting]]
|
||||
*[[Code Formatting]]
|
117
editions/classicparserdemo/tiddlers/Tables.tid
Normal file
117
editions/classicparserdemo/tiddlers/Tables.tid
Normal file
@ -0,0 +1,117 @@
|
||||
created: 20130205062438000
|
||||
creator: tobibeer
|
||||
modified: 20140901062133767
|
||||
modifier: andrewstern
|
||||
tags: Formatting
|
||||
title: Tables
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!Summary
|
||||
TiddlyWiki provides flexible means to output tables.
|
||||
!!"""Simple Tables"""
|
||||
{{{
|
||||
|North West|North|North East|
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
}}}
|
||||
|North West|North|North East|
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
!!"""Cell Formatting"""
|
||||
*Insert a space before cell content to right justify cell
|
||||
*Insert a space after cell content to left justify cell
|
||||
*Insert spaces before and after cell content to centre justify cell
|
||||
*Insert an exclamation mark ({{{!}}}) as the first non-space character of a cell to turn it into a header cell
|
||||
{{{
|
||||
|!First column|!Second column|!Third column|
|
||||
|left | centre | right|
|
||||
}}}
|
||||
|!First column|!Second column|!Third column|
|
||||
|left | centre | right|
|
||||
!!"""Table Headers and Footers"""
|
||||
* Mark a table row as a header by adding an 'h' to the end
|
||||
* Mark a table row as a footer by adding an 'f' to the end
|
||||
{{{
|
||||
|NW|N|NE|h
|
||||
|W|X|E|
|
||||
|SW|S|SE|f
|
||||
}}}
|
||||
|NW|N|NE|h
|
||||
|W|X|E|
|
||||
|SW|S|SE|f
|
||||
Use an exclamation mark to turn an individual cell into a header cell of type {{{<th}}}...
|
||||
{{{
|
||||
| NW| !N |NE |h
|
||||
| !W| X |!E |
|
||||
| SW| !S |SE |f
|
||||
}}}
|
||||
| NW| !N |NE |h
|
||||
| !W| X |!E |
|
||||
| SW| !S |SE |f
|
||||
!!"""Table Caption"""
|
||||
A caption can be added to a table by adding a {{{c}}} after the last column either before the main table...
|
||||
{{{
|
||||
|A caption above the table|c
|
||||
|North West|North|North East|
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
}}}
|
||||
|A caption above the table|c
|
||||
|North West|North|North East|h
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
or after the main table...
|
||||
{{{
|
||||
|North West|North|North East|
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
|A caption below the table|c
|
||||
}}}
|
||||
|North West|North|North East|h
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
|A caption below the table|c
|
||||
!!"""Merging Table Cells"""
|
||||
Merge a cell horizontally with the one to its right using greater-than {{{>}}}...
|
||||
{{{
|
||||
|North West|North|North East|
|
||||
|>|>|West and Here and East|
|
||||
|South West|South|South East|
|
||||
}}}
|
||||
|North West|North|North East|
|
||||
|>|>|West and Here and East|
|
||||
|South West|South|South East|
|
||||
Merge a cell vertically with the one above using a tilde {{{~}}}...
|
||||
{{{
|
||||
|Westerly|North|North East|
|
||||
|~|Here|East|
|
||||
|~|South|South East|
|
||||
}}}
|
||||
|Westerly|North|North East|
|
||||
|~|Here|East|
|
||||
|~|South|South East|
|
||||
!!"""CSS Formatting for Tables"""
|
||||
A CSS class can be added to an entire table using a special first row that ends with a {{{k}}}...
|
||||
{{{
|
||||
|myClass|k
|
||||
|North West|North|North East|
|
||||
|West|Here|East|
|
||||
|South West|South|South East|
|
||||
}}}
|
||||
Use your StyleSheet tiddler to define the desired styles.
|
||||
|
||||
CSS properties can also be added to individual table cells by appending the CSS syntax directly after the delimiting pipe {{{|}}}.
|
||||
{{{
|
||||
|color:red; North West|opacity:0.5;North|North East|
|
||||
|color(green):West|Here|East|
|
||||
|South West|South|South East|
|
||||
}}}
|
||||
|color:red; North West|opacity:0.5;North|North East|
|
||||
|color(green):West|Here|East|
|
||||
|South West|South|South East|
|
||||
!!"""Alternating Row Colors"""
|
||||
TiddlyWiki automatically assigns the classes {{{oddRow}}} and {{{evenRow}}} to table row elements {{{<TR>}}}. These can then be styled using the StyleSheet tiddler:
|
||||
{{{
|
||||
tr.oddRow { background-color: #fff; }
|
||||
tr.evenRow { background-color: #ffe; }
|
||||
}}}
|
8
editions/classicparserdemo/tiddlers/slidertest.tid
Normal file
8
editions/classicparserdemo/tiddlers/slidertest.tid
Normal file
@ -0,0 +1,8 @@
|
||||
created: 20140416192513067
|
||||
modified: 20140416200952144
|
||||
title: slidertest
|
||||
type: text/x-tiddlywiki
|
||||
|
||||
!!now a transclusion of [[Basic Formatting]]
|
||||
<hr>
|
||||
<<tiddler [[Basic Formatting]]>>
|
@ -0,0 +1,25 @@
|
||||
created: 20140416193948971
|
||||
modified: 20140901082129041
|
||||
title: text/x-tiddlywiki typeblock
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
This is a tiddlywiki5 tiddler containing a Classic type-block.
|
||||
|
||||
!!Demo text:
|
||||
|
||||
```
|
||||
!!Tw5 Here
|
||||
|
||||
$$$text/x-tiddlywiki
|
||||
!Classic Here
|
||||
<<slider $:/temp/xxx slidertest "click me»" "more" >>
|
||||
$$$
|
||||
```
|
||||
!!Demo results:
|
||||
|
||||
!!Tw5 Here
|
||||
|
||||
$$$text/x-tiddlywiki
|
||||
!Classic Here
|
||||
<<slider $:/temp/xxx slidertest "click me»" "more" >>
|
||||
$$$
|
15
editions/classicparserdemo/tiddlywiki.info
Normal file
15
editions/classicparserdemo/tiddlywiki.info
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"plugins": [
|
||||
"tiddlywiki/tw2parser"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
"tiddlywiki/snowwhite"
|
||||
],
|
||||
"includeWikis": [
|
||||
],
|
||||
"build": {
|
||||
"index": [
|
||||
"--rendertiddler","$:/core/save/all","classicparserdemo.html","text/plain"]
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ type: text/vnd.tiddlywiki
|
||||
* Explore the [[D3.js visualisation plugin|http://tiddlywiki.com/d3demo.html]]
|
||||
* [[CodeMirror support via a plugin|http://tiddlywiki.com/codemirrordemo.html]]
|
||||
* [[Markdown support via a plugin|http://tiddlywiki.com/markdowndemo.html]]
|
||||
* [[Classic TiddlyWiki markup support via a plugin|http://tiddlywiki.com/classicparserdemo.html]]
|
||||
* Many internal improvements:
|
||||
** TiddlyWiki can now be run under [[Node.js]] as well as in the browser, allowing it to be used as a personal web server
|
||||
** An elegant [[microkernel architecture|PluginMechanism]], that allows infinite customisation by replacing and augmenting the core modules
|
||||
|
@ -0,0 +1,6 @@
|
||||
tags: $:/tags/ViewTemplate $:/tags/EditTemplate
|
||||
title: $:/core/ui/ViewTemplate/classic
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
||||
|
195
plugins/tiddlywiki/tw2parser/classictransclude.js
Normal file
195
plugins/tiddlywiki/tw2parser/classictransclude.js
Normal file
@ -0,0 +1,195 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/classictransclude.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Transclude widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
var sliceSeparator = "::";
|
||||
var sectionSeparator = "##";
|
||||
|
||||
function getsectionname(title) {
|
||||
if(!title)
|
||||
return "";
|
||||
var pos = title.indexOf(sectionSeparator);
|
||||
if(pos != -1) {
|
||||
return title.substr(pos + sectionSeparator.length);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
function getslicename(title) {
|
||||
if(!title)
|
||||
return "";
|
||||
var pos = title.indexOf(sliceSeparator);
|
||||
if(pos != -1) {
|
||||
return title.substr(pos + sliceSeparator.length);
|
||||
}
|
||||
return "";
|
||||
};
|
||||
function gettiddlername(title) {
|
||||
if(!title)
|
||||
return "";
|
||||
var pos = title.indexOf(sectionSeparator);
|
||||
|
||||
if(pos != -1) {
|
||||
return title.substr(0,pos);
|
||||
}
|
||||
pos = title.indexOf(sliceSeparator);
|
||||
if(pos != -1) {
|
||||
return title.substr(0,pos);
|
||||
}
|
||||
return title;
|
||||
}
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var TranscludeWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
TranscludeWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
TranscludeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
TranscludeWidget.prototype.execute = function() {
|
||||
// Get our parameters
|
||||
this.rawTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.transcludeTitle = gettiddlername(this.rawTitle);
|
||||
this.section = getsectionname(this.rawTitle);
|
||||
this.slice = getslicename(this.rawTitle);
|
||||
// Check for recursion
|
||||
var recursionMarker = this.makeRecursionMarker();
|
||||
if(this.parentWidget && this.parentWidget.hasVariable("transclusion",recursionMarker)) {
|
||||
this.makeChildWidgets([{type: "text", text: "Recursive transclusion error in transclude widget"}]);
|
||||
return;
|
||||
}
|
||||
// Check for correct type
|
||||
var existingTiddler = this.wiki.getTiddler(this.transcludeTitle);
|
||||
// Check if we're dealing with a classic tiddler
|
||||
if(existingTiddler && existingTiddler.hasField("type") && existingTiddler.fields.type !== "text/x-tiddlywiki") {
|
||||
this.makeChildWidgets([{type: "text", text: "Tiddler not of type 'text/x-tiddlywiki'"}]);
|
||||
return;
|
||||
}
|
||||
if(existingTiddler && !existingTiddler.hasField("type")) {
|
||||
this.makeChildWidgets([{type: "text", text: "Tiddler not of type 'text/x-tiddlywiki'"}]);
|
||||
return;
|
||||
}
|
||||
// Set context variables for recursion detection
|
||||
this.setVariable("transclusion",recursionMarker);
|
||||
// Parse
|
||||
var text = this.wiki.getTiddlerText(this.transcludeTitle);
|
||||
if (!!this.section||!!this.slice) {
|
||||
text =this.refineTiddlerText(text, this.section, this.slice);
|
||||
}
|
||||
|
||||
this.options ={};
|
||||
this.options.parseAsInline = false;
|
||||
var parser = this.wiki.parseText("text/x-tiddlywiki",text,{});
|
||||
var parseTreeNodes = parser ? parser.tree : this.parseTreeNode.children;
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
};
|
||||
/*
|
||||
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
|
||||
*/
|
||||
TranscludeWidget.prototype.makeRecursionMarker = function() {
|
||||
var output = [];
|
||||
output.push("{");
|
||||
output.push(this.getVariable("currentTiddler",{defaultValue: ""}));
|
||||
output.push("|");
|
||||
output.push(this.transcludeTitle || "");
|
||||
output.push("|");
|
||||
output.push(this.transcludeField || "");
|
||||
output.push("|");
|
||||
output.push(this.transcludeIndex || "");
|
||||
output.push("|");
|
||||
output.push(this.section || "");
|
||||
output.push("|");
|
||||
output.push(this.slice || "");
|
||||
output.push("}");
|
||||
return output.join("");
|
||||
};
|
||||
|
||||
TranscludeWidget.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1[\t\x20]*([^\n]*)[\t\x20]*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|[\t\x20]*([^\|\n]*)[\t\x20]*\|$)/gm;
|
||||
|
||||
TranscludeWidget.prototype.calcAllSlices = function(text)
|
||||
{
|
||||
var slices = {};
|
||||
this.slicesRE.lastIndex = 0;
|
||||
var m = this.slicesRE.exec(text);
|
||||
while(m) {
|
||||
if(m[2])
|
||||
slices[m[2]] = m[3];
|
||||
else
|
||||
slices[m[5]] = m[6];
|
||||
m = this.slicesRE.exec(text);
|
||||
}
|
||||
return slices;
|
||||
};
|
||||
|
||||
// Returns the slice of text of the given name
|
||||
TranscludeWidget.prototype.getTextSlice = function(text,sliceName)
|
||||
{
|
||||
return (this.calcAllSlices(text))[sliceName];
|
||||
};
|
||||
|
||||
TranscludeWidget.prototype.refineTiddlerText = function(text,section,slice)
|
||||
{
|
||||
var textsection = null;
|
||||
if (slice) {
|
||||
var textslice = this.getTextSlice(text,slice);
|
||||
if(textslice)
|
||||
return textslice;
|
||||
}
|
||||
if(!section)
|
||||
return text;
|
||||
var re = new RegExp("(^!{1,6}[ \t]*" + $tw.utils.escapeRegExp(section) + "[ \t]*\n)","mg");
|
||||
re.lastIndex = 0;
|
||||
var match = re.exec(text);
|
||||
if(match) {
|
||||
var t = text.substr(match.index+match[1].length);
|
||||
var re2 = /^!/mg;
|
||||
re2.lastIndex = 0;
|
||||
match = re2.exec(t); //# search for the next heading
|
||||
if(match)
|
||||
t = t.substr(0,match.index-1);//# don't include final \n
|
||||
return t;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
TranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tiddler ||changedTiddlers[this.transcludeTitle]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
}
|
||||
};
|
||||
|
||||
exports.classictransclude = TranscludeWidget;
|
||||
|
||||
})();
|
30
plugins/tiddlywiki/tw2parser/entry.js
Normal file
30
plugins/tiddlywiki/tw2parser/entry.js
Normal file
@ -0,0 +1,30 @@
|
||||
/*\
|
||||
title: $:/macros/tiddlywiki/entry.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
\*/
|
||||
(function(){
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
/*
|
||||
Information about this macro
|
||||
returns value of key in a data json tiddler
|
||||
note that macros are not connected with the refresh mechanism -use with caution.
|
||||
*/
|
||||
exports.name = "entryof";
|
||||
|
||||
exports.params = [
|
||||
{ name: "key" }, { name: "map" }
|
||||
];
|
||||
/*
|
||||
Run the macro
|
||||
*/
|
||||
exports.run = function(key,map) {
|
||||
try{
|
||||
return JSON.parse(map)[key];
|
||||
} catch(e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
})();
|
11
plugins/tiddlywiki/tw2parser/image-css.tid
Normal file
11
plugins/tiddlywiki/tw2parser/image-css.tid
Normal file
@ -0,0 +1,11 @@
|
||||
tags: $:/tags/stylesheet
|
||||
title: $:/plugins/tiddlywiki/tw2parser/image-css
|
||||
type: text/plain
|
||||
|
||||
.classic-image-left{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.classic-image-right{
|
||||
float: right;
|
||||
}
|
34
plugins/tiddlywiki/tw2parser/macrodefs.tid
Normal file
34
plugins/tiddlywiki/tw2parser/macrodefs.tid
Normal file
@ -0,0 +1,34 @@
|
||||
title: $:/plugins/tiddlywiki/tw2parser/macrodefs
|
||||
|
||||
\define tiddler(tiddler)
|
||||
<$classictransclude tiddler = "$tiddler$"/>
|
||||
\end
|
||||
|
||||
\define slider(chkUniqueCookieName tiddler label tooltip)
|
||||
<span title=$tooltip$><$button popup="$chkUniqueCookieName$" class="btn-invisible tw-slider">$label$</$button>
|
||||
<$reveal type="nomatch" text="" default="" state="$chkUniqueCookieName$" animate="yes">
|
||||
<$classictransclude tiddler = "$tiddler$"/>
|
||||
</$reveal></span>
|
||||
\end
|
||||
|
||||
\define __system_tabinstance(state, currentTab, prompts, labels)
|
||||
<span title=<<entryof "$currentTab$" """$prompts$""">> ><$button set=<<qualify "$state$">> setTo="$currentTab$" selectedClass="tw-tab-selected">
|
||||
<<entryof "$currentTab$" """$labels$""" >>
|
||||
</$button></span>
|
||||
\end
|
||||
|
||||
\define __system_tabs(tabsList,prompts,labels,state:"$:/state/tab")
|
||||
<div class="tw-tab-buttons">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
<$macrocall $name="__system_tabinstance" state="$state$" prompts="""$prompts$""" labels="""$labels$""" currentTab=<<currentTab>>/>
|
||||
</$list>
|
||||
</div>
|
||||
<div class="tw-tab-divider"/>
|
||||
<div class="tw-tab-content">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
<$reveal type="match" state=<<qualify "$state$">> text=<<currentTab>> default="$default$">
|
||||
<$classictransclude tiddler=<<currentTab>> />
|
||||
</$reveal>
|
||||
</$list>
|
||||
</div>
|
||||
\end
|
97
plugins/tiddlywiki/tw2parser/parameteradapter.js
Normal file
97
plugins/tiddlywiki/tw2parser/parameteradapter.js
Normal file
@ -0,0 +1,97 @@
|
||||
/*\
|
||||
title: $:/macros/classic/macroadapter.js
|
||||
type: application/javascript
|
||||
module-type: module
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
/*
|
||||
Information about this module:
|
||||
rename macros and
|
||||
re-jig macro params from tw2 to tw5 style
|
||||
new macros created as a result of adapting tw2 should be
|
||||
prepended "__system" to distinguish them from the actual used name
|
||||
*/
|
||||
var sliceSeparator = "::";
|
||||
var sectionSeparator = "##";
|
||||
|
||||
function getsectionname(title) {
|
||||
if(!title)
|
||||
return "";
|
||||
var pos = title.indexOf(sectionSeparator);
|
||||
if(pos != -1) {
|
||||
return title.substr(pos + sectionSeparator.length);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
function getslicename(title) {
|
||||
if(!title)
|
||||
return "";
|
||||
var pos = title.indexOf(sliceSeparator);
|
||||
if(pos != -1) {
|
||||
return title.substr(pos + sliceSeparator.length);
|
||||
}
|
||||
return "";
|
||||
};
|
||||
function gettiddlername(title) {
|
||||
if(!title)
|
||||
return "";
|
||||
var pos = title.indexOf(sectionSeparator);
|
||||
|
||||
if(pos != -1) {
|
||||
return title.substr(0,pos);
|
||||
}
|
||||
pos = title.indexOf(sliceSeparator);
|
||||
if(pos != -1) {
|
||||
return title.substr(0,pos);
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
var parserparams = function(paramString) {
|
||||
var params = [],
|
||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
||||
paramMatch = reParam.exec(paramString);
|
||||
while(paramMatch) {
|
||||
// Process this parameter
|
||||
var paramInfo = {
|
||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]
|
||||
};
|
||||
if(paramMatch[1]) {
|
||||
paramInfo.name = paramMatch[1];
|
||||
}
|
||||
params.push(paramInfo);
|
||||
// Find the next match
|
||||
paramMatch = reParam.exec(paramString);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
var tabshandler = function(paramstring) {
|
||||
var params = parserparams(paramstring);
|
||||
var cookie = params[0].value;
|
||||
var numTabs = (params.length-1)/3;
|
||||
var t;
|
||||
var tabslist = "";
|
||||
var labelarray = {};
|
||||
var promptarray = {};
|
||||
for(t=0; t<numTabs; t++) {
|
||||
var contentName = params[t*3+3].value;
|
||||
tabslist = tabslist+" " + contentName;
|
||||
labelarray[contentName] = params[t*3+1].value;
|
||||
promptarray[contentName] = params[t*3+2].value;
|
||||
}
|
||||
//Create a list of names (tiddlers, tiddler/sections, tiddler/slices), and create maps from name -> label and name -> prompt
|
||||
//Use json to implement maps
|
||||
return '"""'+tabslist +'""" """'+JSON.stringify(promptarray)+'""" """'+JSON.stringify(labelarray)+'""" """'+cookie+'"""';
|
||||
};
|
||||
var namedapter = {tabs:'__system_tabs'};
|
||||
var paramadapter = {
|
||||
tabs: tabshandler
|
||||
}
|
||||
exports.name = 'macroadapter';
|
||||
exports.namedapter = namedapter;
|
||||
exports.paramadapter = paramadapter;
|
||||
})();
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/tw2parser",
|
||||
"description": "TiddlyWiki Classic-compatible wikitext parser",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0"
|
||||
"authors": "JeremyRuston, JeffreyWilkinson",
|
||||
"core-version": ">=5.0.15",
|
||||
"plugin-type": "plugin"
|
||||
}
|
||||
|
@ -48,11 +48,29 @@ Planned:
|
||||
extraMacros: An array of additional macro handlers to add
|
||||
*/
|
||||
|
||||
var WikiTextParser = function(options) {
|
||||
var WikiTextParser = function(type,text,options) {
|
||||
this.wiki = options.wiki;
|
||||
this.autoLinkWikiWords = true;
|
||||
this.installRules();
|
||||
text = text || "no text";
|
||||
this.source = text;
|
||||
this.nextMatch = 0;
|
||||
this.children = [];
|
||||
//this.children.push({type: "text",text:"hello to the queen"});
|
||||
this.tree =[];
|
||||
this.output = null;
|
||||
this.subWikify(this.children);
|
||||
var parser = $tw.wiki.old_parseTiddler("$:/plugins/tiddlywiki/tw2parser/macrodefs",{parseAsInline:false});
|
||||
this.tree = [{
|
||||
type: "element",
|
||||
tag: "div",
|
||||
children:this.children
|
||||
}];
|
||||
Array.prototype.push.apply(parser.tree,this.tree);
|
||||
this.tree = parser.tree;
|
||||
};
|
||||
|
||||
|
||||
WikiTextParser.prototype.installRules = function() {
|
||||
var rules = require("./wikitextrules.js").rules,
|
||||
pattern = [];
|
||||
@ -63,23 +81,10 @@ WikiTextParser.prototype.installRules = function() {
|
||||
this.rulesRegExp = new RegExp(pattern.join("|"),"mg");
|
||||
};
|
||||
|
||||
WikiTextParser.prototype.parse = function(type,text) {
|
||||
text = text || "";
|
||||
this.source = text;
|
||||
this.nextMatch = 0;
|
||||
this.children = [];
|
||||
this.dependencies = new $tw.Dependencies();
|
||||
this.output = null;
|
||||
this.subWikify(this.children);
|
||||
var tree = new $tw.Renderer(this.children,this.dependencies);
|
||||
this.source = null;
|
||||
this.children = null;
|
||||
return tree;
|
||||
};
|
||||
|
||||
WikiTextParser.prototype.outputText = function(place,startPos,endPos) {
|
||||
if(startPos < endPos) {
|
||||
place.push($tw.Tree.Text(this.source.substring(startPos,endPos)));
|
||||
place.push({type: "text",text:this.source.substring(startPos,endPos)});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@ Rule modules for the wikitext parser
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var macroadapter = require("$:/macros/classic/macroadapter.js");
|
||||
var textPrimitives = {
|
||||
upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]",
|
||||
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff\u0151\u0171]",
|
||||
@ -51,7 +51,7 @@ var setAttr = function(node,attr,value) {
|
||||
if(!node.attributes) {
|
||||
node.attributes = {};
|
||||
}
|
||||
node.attributes[attr] = value;
|
||||
node.attributes[attr] ={type: "string", value:value} ;
|
||||
};
|
||||
|
||||
var inlineCssHelper = function(w) {
|
||||
@ -80,17 +80,14 @@ var inlineCssHelper = function(w) {
|
||||
};
|
||||
|
||||
var applyCssHelper = function(e,styles) {
|
||||
|
||||
if(styles.length > 0) {
|
||||
if(!e.attributes) {
|
||||
e.attributes = {};
|
||||
}
|
||||
if(!e.attributes.style) {
|
||||
e.attributes.style = {};
|
||||
}
|
||||
|
||||
for(var t=0; t< styles.length; t++) {
|
||||
e.attributes.style[styles[t].style] = styles[t].value;
|
||||
$tw.utils.addStyleToParseTreeNode(e,$tw.utils.roundTripPropertyName(styles[t].style),styles[t].value);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var enclosedTextHelper = function(w) {
|
||||
@ -98,23 +95,41 @@ var enclosedTextHelper = function(w) {
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
var text = lookaheadMatch[1];
|
||||
w.output.push($tw.Tree.Element(this.element,null,[$tw.Tree.Text(text)]));
|
||||
w.output.push({type:"element",tag:this.element,
|
||||
children:[{type: "text",text: lookaheadMatch[1]}]});
|
||||
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
|
||||
}
|
||||
};
|
||||
|
||||
var insertMacroCall = function(w,output,name,params,content) {
|
||||
if(name in w.wiki.macros) {
|
||||
var macroNode = $tw.Tree.Macro(name,{
|
||||
srcParams: params,
|
||||
content: content,
|
||||
wiki: w.wiki
|
||||
});
|
||||
w.dependencies.mergeDependencies(macroNode.dependencies);
|
||||
output.push(macroNode);
|
||||
var insertMacroCall = function(w,output,macroName,paramString) {
|
||||
var params = [],
|
||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
||||
paramMatch = reParam.exec(paramString);
|
||||
while(paramMatch) {
|
||||
// Process this parameter
|
||||
var paramInfo = {
|
||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]
|
||||
};
|
||||
if(paramMatch[1]) {
|
||||
paramInfo.name = paramMatch[1];
|
||||
}
|
||||
params.push(paramInfo);
|
||||
// Find the next match
|
||||
paramMatch = reParam.exec(paramString);
|
||||
}
|
||||
};
|
||||
output.push({
|
||||
type: "macrocall",
|
||||
name: macroName,
|
||||
params: params,
|
||||
isBlock: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var isLinkExternal = function(to) {
|
||||
var externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s'"]+(?:\/|\b)/i;
|
||||
return externalRegExp.test(to);
|
||||
};
|
||||
var rules = [
|
||||
{
|
||||
name: "table",
|
||||
@ -126,7 +141,9 @@ var rules = [
|
||||
rowTypes: {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"},
|
||||
handler: function(w)
|
||||
{
|
||||
var table = $tw.Tree.Element("table",{"class": "table"},[]);
|
||||
var table = {type:"element",tag:"table",attributes: {"class": {type: "string", value:"table"}},
|
||||
children: []};
|
||||
|
||||
w.output.push(table);
|
||||
var prevColumns = [];
|
||||
var currRowType = null;
|
||||
@ -142,7 +159,7 @@ var rules = [
|
||||
w.nextMatch += lookaheadMatch[0].length+1;
|
||||
} else {
|
||||
if(nextRowType != currRowType) {
|
||||
rowContainer = $tw.Tree.Element(this.rowTypes[nextRowType],{},[]);
|
||||
rowContainer = {type:"element",tag:this.rowTypes[nextRowType],children: []};
|
||||
table.children.push(rowContainer);
|
||||
currRowType = nextRowType;
|
||||
}
|
||||
@ -154,11 +171,14 @@ var rules = [
|
||||
table.children.pop(); // Take rowContainer out of the children array
|
||||
table.children.splice(0,0,rowContainer); // Insert it at the bottom
|
||||
}
|
||||
rowContainer.attributes={};
|
||||
rowContainer.attributes.align = rowCount === 0 ? "top" : "bottom";
|
||||
w.subWikifyTerm(rowContainer.children,this.rowTermRegExp);
|
||||
} else {
|
||||
var theRow = $tw.Tree.Element("tr",{},[]);
|
||||
theRow.attributes["class"] = rowCount%2 ? "oddRow" : "evenRow";
|
||||
var theRow = {type:"element",tag:"tr",
|
||||
attributes: {"class": {type: "string", value:rowCount%2 ? "oddRow" : "evenRow"}},
|
||||
children: []};
|
||||
|
||||
rowContainer.children.push(theRow);
|
||||
this.rowHandler(w,theRow.children,prevColumns);
|
||||
rowCount++;
|
||||
@ -179,15 +199,16 @@ var rules = [
|
||||
if(cellMatch[1] == "~") {
|
||||
// Rowspan
|
||||
var last = prevColumns[col];
|
||||
if(last) {
|
||||
last.rowSpanCount++;
|
||||
last.element.attributes.rowspan = last.rowSpanCount;
|
||||
last.element.attributes.valign = "center";
|
||||
if(colSpanCount > 1) {
|
||||
last.element.attributes.colspan = colSpanCount;
|
||||
colSpanCount = 1;
|
||||
}
|
||||
if(last) {
|
||||
last.rowSpanCount++;
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"rowspan",last.rowSpanCount);
|
||||
var vAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,"valign","center");
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"valign",vAlign);
|
||||
if(colSpanCount > 1) {
|
||||
$tw.utils.addAttributeToParseTreeNode(last.element,"colspan",colSpanCount);
|
||||
colSpanCount = 1;
|
||||
}
|
||||
}
|
||||
w.nextMatch = this.cellRegExp.lastIndex-1;
|
||||
} else if(cellMatch[1] == ">") {
|
||||
// Colspan
|
||||
@ -213,25 +234,26 @@ var rules = [
|
||||
}
|
||||
var cell;
|
||||
if(chr == "!") {
|
||||
cell = $tw.Tree.Element("th",{},[]);
|
||||
cell = {type:"element",tag:"th",children: []};
|
||||
e.push(cell);
|
||||
w.nextMatch++;
|
||||
} else {
|
||||
cell = $tw.Tree.Element("td",{},[]);
|
||||
cell = {type:"element",tag:"td",children: []};
|
||||
e.push(cell);
|
||||
}
|
||||
prevCell = cell;
|
||||
prevColumns[col] = {rowSpanCount:1,element:cell};
|
||||
if(colSpanCount > 1) {
|
||||
cell.attributes.colspan = colSpanCount;
|
||||
$tw.utils.addAttributeToParseTreeNode(cell,"colspan",colSpanCount);
|
||||
colSpanCount = 1;
|
||||
}
|
||||
applyCssHelper(cell,styles);
|
||||
w.subWikifyTerm(cell.children,this.cellTermRegExp);
|
||||
if (!cell.attributes) cell.attributes ={};
|
||||
if(w.matchText.substr(w.matchText.length-2,1) == " ") // spaceRight
|
||||
cell.attributes.align = spaceLeft ? "center" : "left";
|
||||
$tw.utils.addAttributeToParseTreeNode(cell,"align",spaceLeft ? "center" : "left");
|
||||
else if(spaceLeft)
|
||||
cell.attributes.align = "right";
|
||||
$tw.utils.addAttributeToParseTreeNode(cell,"align","right");
|
||||
w.nextMatch--;
|
||||
}
|
||||
col++;
|
||||
@ -247,7 +269,7 @@ var rules = [
|
||||
termRegExp: /(\n)/mg,
|
||||
handler: function(w)
|
||||
{
|
||||
var e = $tw.Tree.Element("h" + w.matchLength,{},[]);
|
||||
var e = {type:"element",tag:"h" + w.matchLength,children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,this.termRegExp);
|
||||
}
|
||||
@ -291,7 +313,7 @@ var rules = [
|
||||
if(currLevel !== 0 && target.children) {
|
||||
target = target.children[target.children.length-1];
|
||||
}
|
||||
e = $tw.Tree.Element(listType,{},[]);
|
||||
e = {type:"element",tag:listType,children: []};
|
||||
target.push(e);
|
||||
stack.push(e.children);
|
||||
}
|
||||
@ -303,13 +325,13 @@ var rules = [
|
||||
stack.pop();
|
||||
} else if(listLevel == currLevel && listType != currType) {
|
||||
stack.pop();
|
||||
e = $tw.Tree.Element(listType,{},[]);
|
||||
e = {type:"element",tag:listType,children: []};
|
||||
stack[stack.length-1].push(e);
|
||||
stack.push(e.children);
|
||||
}
|
||||
currLevel = listLevel;
|
||||
currType = listType;
|
||||
e = $tw.Tree.Element(itemType,{},[]);
|
||||
e = {type:"element",tag:itemType,children: []};
|
||||
stack[stack.length-1].push(e);
|
||||
w.subWikifyTerm(e.children,this.termRegExp);
|
||||
this.lookaheadRegExp.lastIndex = w.nextMatch;
|
||||
@ -324,7 +346,7 @@ var rules = [
|
||||
termRegExp: /(^<<<(\n|$))/mg,
|
||||
element: "blockquote",
|
||||
handler: function(w) {
|
||||
var e = $tw.Tree.Element(this.element,{},[]);
|
||||
var e = {type:"element",tag:this.element,children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,this.termRegExp);
|
||||
}
|
||||
@ -338,23 +360,32 @@ var rules = [
|
||||
element: "blockquote",
|
||||
handler: function(w)
|
||||
{
|
||||
var stack = [w.output];
|
||||
var stack = [];
|
||||
var currLevel = 0;
|
||||
var newLevel = w.matchLength;
|
||||
var t,matched,e;
|
||||
do {
|
||||
if(newLevel > currLevel) {
|
||||
for(t=currLevel; t<newLevel; t++) {
|
||||
e = $tw.Tree.Element(this.element,{},[]);
|
||||
stack[stack.length-1].push(e);
|
||||
var f = stack[stack.length-1];
|
||||
e = {type:"element",tag:this.element,children: []};
|
||||
stack.push(e);
|
||||
if (t ===0){
|
||||
w.output.push(e);
|
||||
}else {
|
||||
f.children.push(e);
|
||||
|
||||
}
|
||||
}
|
||||
} else if(newLevel < currLevel) {
|
||||
for(t=currLevel; t>newLevel; t--)
|
||||
stack.pop();
|
||||
}
|
||||
currLevel = newLevel;
|
||||
w.subWikifyTerm(stack[stack.length-1],this.termRegExp);
|
||||
stack[stack.length-1].push($tw.Tree.Element("br"));
|
||||
w.subWikifyTerm(stack[stack.length-1].children,this.termRegExp);
|
||||
stack[stack.length-1].children.push({type:"element",tag:"br"});
|
||||
//e.push({type:"element",tag:"br"});
|
||||
|
||||
this.lookaheadRegExp.lastIndex = w.nextMatch;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
matched = lookaheadMatch && lookaheadMatch.index == w.nextMatch;
|
||||
@ -371,7 +402,7 @@ var rules = [
|
||||
match: "^----+$\\n?|<hr ?/?>\\n?",
|
||||
handler: function(w)
|
||||
{
|
||||
w.output.push($tw.Tree.Element("hr"));
|
||||
w.output.push({type:"element",tag:"hr"});
|
||||
}
|
||||
},
|
||||
|
||||
@ -403,28 +434,33 @@ var rules = [
|
||||
|
||||
{
|
||||
name: "typedBlock",
|
||||
match: "^\\$\\$\\$(?:.*)\\n",
|
||||
lookaheadRegExp: /^\$\$\$(.*)\n((?:^[^\n]*\n)+?)(^\f*\$\$\$$\n?)/mg,
|
||||
match: "^\\$\\$\\$(?:[^ >\\r\\n]*)\\r?\\n",
|
||||
lookaheadRegExp: /^\$\$\$([^ >\r\n]*)\n((?:^[^\n]*\r?\n)+?)(^\f*\$\$\$\r?\n?)/mg,
|
||||
//match: "^\\$\\$\\$(?:[^ >\\r\\n]*)(?: *> *([^ \\r\\n]+))?\\r?\\n",
|
||||
//lookaheadRegExp: /^\$\$\$([^ >\r\n]*)(?: *> *([^ \r\n]+))\n((?:^[^\n]*\n)+?)(^\f*\$\$\$$\n?)/mg,
|
||||
handler: function(w)
|
||||
{
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
// The wikitext parsing infrastructure is horribly unre-entrant
|
||||
var mimeType = lookaheadMatch[1],
|
||||
content = lookaheadMatch[2],
|
||||
var parseType = lookaheadMatch[1],
|
||||
renderType ,//= this.match[2],
|
||||
text = lookaheadMatch[2],
|
||||
oldOutput = w.output,
|
||||
oldSource = w.source,
|
||||
oldNextMatch = w.nextMatch,
|
||||
oldChildren = w.children,
|
||||
oldDependencies = w.dependencies,
|
||||
parseTree = w.wiki.parseText(mimeType,content,{defaultType: "text/plain"}).tree;
|
||||
oldChildren = w.children;
|
||||
// Parse the block according to the specified type
|
||||
var parser = $tw.wiki.parseText(parseType,text.toString(),{defaultType: "text/plain"});
|
||||
|
||||
w.output = oldOutput;
|
||||
w.source = oldSource;
|
||||
w.nextMatch = oldNextMatch;
|
||||
w.children = oldChildren;
|
||||
w.dependencies = oldDependencies;
|
||||
w.output.push.apply(w.output,parseTree);
|
||||
for (var i=0; i<parser.tree.length; i++) {
|
||||
w.output.push(parser.tree[i]);
|
||||
}
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
}
|
||||
}
|
||||
@ -448,14 +484,26 @@ var rules = [
|
||||
{
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source),
|
||||
name;
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
name = lookaheadMatch[1] || lookaheadMatch[2];
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && name) {
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
insertMacroCall(w,w.output,name,lookaheadMatch[3]);
|
||||
var params = lookaheadMatch[3], nameold =name;
|
||||
if (name) {
|
||||
if (!!macroadapter.paramadapter[name]) {
|
||||
params=macroadapter.paramadapter[name](params);
|
||||
//alert("going out as "+params);
|
||||
}
|
||||
if (!!macroadapter.namedapter[name]) {
|
||||
name=macroadapter.namedapter[name];
|
||||
}
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
insertMacroCall(w,w.output,name,params);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
name: "prettyLink",
|
||||
match: "\\[\\[",
|
||||
@ -471,12 +519,35 @@ var rules = [
|
||||
// Pretty bracketted link
|
||||
link = lookaheadMatch[3];
|
||||
}
|
||||
insertMacroCall(w,w.output,"link",{to: link},[$tw.Tree.Text(text)]);
|
||||
if(isLinkExternal(link)) {
|
||||
w.output.push({
|
||||
type: "element",
|
||||
tag: "a",
|
||||
attributes: {
|
||||
href: {type: "string", value: link},
|
||||
"class": {type: "string", value: "tw-tiddlylink-external"},
|
||||
target: {type: "string", value: "_blank"}
|
||||
},
|
||||
children: [{
|
||||
type: "text", text: text
|
||||
}]
|
||||
});
|
||||
} else {
|
||||
w.output.push({
|
||||
type: "link",
|
||||
attributes: {
|
||||
to: {type: "string", value: link}
|
||||
},
|
||||
children: [{
|
||||
type: "text", text: text
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: "wikiLink",
|
||||
match: textPrimitives.unWikiLink+"?"+textPrimitives.wikiLink,
|
||||
@ -496,8 +567,17 @@ var rules = [
|
||||
}
|
||||
}
|
||||
if(w.autoLinkWikiWords) {
|
||||
insertMacroCall(w,w.output,"link",{to: w.matchText},[$tw.Tree.Text(w.source.substring(w.matchStart,w.nextMatch))]);
|
||||
} else {
|
||||
w.output.push({
|
||||
type: "link",
|
||||
attributes: {
|
||||
to: {type: "string", value: w.matchText}
|
||||
},
|
||||
children: [{
|
||||
type: "text",
|
||||
text: w.source.substring(w.matchStart,w.nextMatch)
|
||||
}]
|
||||
});
|
||||
} else {
|
||||
w.outputText(w.output,w.matchStart,w.nextMatch);
|
||||
}
|
||||
}
|
||||
@ -508,7 +588,19 @@ var rules = [
|
||||
match: textPrimitives.urlPattern,
|
||||
handler: function(w)
|
||||
{
|
||||
insertMacroCall(w,w.output,"link",{to: w.matchText},[$tw.Tree.Text(w.source.substring(w.matchStart,w.nextMatch))]);
|
||||
w.output.push({
|
||||
type: "element",
|
||||
tag: "a",
|
||||
attributes: {
|
||||
href: {type: "string", value: w.matchText},
|
||||
"class": {type: "string", value: "tw-tiddlylink-external"},
|
||||
target: {type: "string", value: "_blank"}
|
||||
},
|
||||
children: [{
|
||||
type: "text", text: w.source.substring(w.matchStart,w.nextMatch)
|
||||
}]
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -519,27 +611,47 @@ var rules = [
|
||||
lookaheadRegExp: /\[([<]?)(>?)[Ii][Mm][Gg]\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg,
|
||||
handler: function(w)
|
||||
{
|
||||
var node = {
|
||||
type: "image",
|
||||
attributes: {}
|
||||
};
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source),
|
||||
imageParams = {},
|
||||
linkParams = {};
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
if(lookaheadMatch[1]) {
|
||||
imageParams.alignment = "left";
|
||||
node.attributes.class = {type: "string", value: "classic-image-left"};
|
||||
} else if(lookaheadMatch[2]) {
|
||||
imageParams.alignment = "right";
|
||||
node.attributes.class = {type: "string", value: "classic-image-right"};
|
||||
}
|
||||
if(lookaheadMatch[3]) {
|
||||
imageParams.text = lookaheadMatch[3];
|
||||
node.attributes.tooltip = {type: "string", value: lookaheadMatch[3]};
|
||||
}
|
||||
imageParams.src = lookaheadMatch[4];
|
||||
node.attributes.source = {type: "string", value: lookaheadMatch[4]};
|
||||
if(lookaheadMatch[5]) {
|
||||
linkParams.target = lookaheadMatch[5];
|
||||
var linkChildren = [];
|
||||
insertMacroCall(w,w.output,"link",linkParams,linkChildren);
|
||||
insertMacroCall(w,linkChildren,"image",imageParams);
|
||||
if(isLinkExternal(lookaheadMatch[5])) {
|
||||
w.output.push({
|
||||
type: "element",
|
||||
tag: "a",
|
||||
attributes: {
|
||||
href: {type: "string", value:lookaheadMatch[5]},
|
||||
"class": {type: "string", value: "tw-tiddlylink-external"},
|
||||
target: {type: "string", value: "_blank"}
|
||||
},
|
||||
children: [node]
|
||||
});
|
||||
} else {
|
||||
w.output.push({
|
||||
type: "link",
|
||||
attributes: {
|
||||
to: {type: "string", value: lookaheadMatch[5]}
|
||||
},
|
||||
children: [node]
|
||||
});
|
||||
}
|
||||
} else {
|
||||
insertMacroCall(w,w.output,"image",imageParams);
|
||||
w.output.push(node);
|
||||
}
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
}
|
||||
@ -555,7 +667,7 @@ var rules = [
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
w.output.push($tw.Tree.Element("html",{},[$tw.Tree.Raw(lookaheadMatch[1])]));
|
||||
w.output.push({ type:"raw", html:lookaheadMatch[1]});
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
}
|
||||
}
|
||||
@ -582,32 +694,32 @@ var rules = [
|
||||
var e,lookaheadRegExp,lookaheadMatch;
|
||||
switch(w.matchText) {
|
||||
case "''":
|
||||
e = $tw.Tree.Element("strong",null,[]);
|
||||
e = {type:"element",tag:"strong",children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/('')/mg);
|
||||
break;
|
||||
case "//":
|
||||
e = $tw.Tree.Element("em",null,[]);
|
||||
e = {type:"element",tag:"em",children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/(\/\/)/mg);
|
||||
break;
|
||||
case "__":
|
||||
e = $tw.Tree.Element("u",null,[]);
|
||||
e = {type:"element",tag:"u",children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/(__)/mg);
|
||||
break;
|
||||
case "^^":
|
||||
e = $tw.Tree.Element("sup",null,[]);
|
||||
e = {type:"element",tag:"sup",children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/(\^\^)/mg);
|
||||
break;
|
||||
case "~~":
|
||||
e = $tw.Tree.Element("sub",null,[]);
|
||||
e = {type:"element",tag:"sub",children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/(~~)/mg);
|
||||
break;
|
||||
case "--":
|
||||
e = $tw.Tree.Element("strike",null,[]);
|
||||
e = {type:"element",tag:"strike",children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/(--)/mg);
|
||||
break;
|
||||
@ -616,8 +728,8 @@ var rules = [
|
||||
lookaheadRegExp.lastIndex = w.matchStart;
|
||||
lookaheadMatch = lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
w.output.push($tw.Tree.Element("code",null,[$tw.Tree.Text(lookaheadMatch[1])]));
|
||||
w.nextMatch = lookaheadRegExp.lastIndex;
|
||||
w.output.push({type:"element",tag:"code",
|
||||
children:[{type: "text",text: lookaheadMatch[1]}]});
|
||||
}
|
||||
break;
|
||||
case "{{{":
|
||||
@ -625,7 +737,8 @@ var rules = [
|
||||
lookaheadRegExp.lastIndex = w.matchStart;
|
||||
lookaheadMatch = lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
w.output.push($tw.Tree.Element("code",null,[$tw.Tree.Text(lookaheadMatch[1])]));
|
||||
w.output.push({type:"element",tag:"code",
|
||||
children:[{type: "text",text: lookaheadMatch[1]}]});
|
||||
w.nextMatch = lookaheadRegExp.lastIndex;
|
||||
}
|
||||
break;
|
||||
@ -640,7 +753,7 @@ var rules = [
|
||||
{
|
||||
switch(w.matchText) {
|
||||
case "@@":
|
||||
var e = $tw.Tree.Element("span",null,[]);
|
||||
var e = {type:"element",tag:"span",children: []};
|
||||
w.output.push(e);
|
||||
var styles = inlineCssHelper(w);
|
||||
if(styles.length === 0)
|
||||
@ -655,9 +768,8 @@ var rules = [
|
||||
var lookaheadMatch = lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch) {
|
||||
w.nextMatch = lookaheadRegExp.lastIndex;
|
||||
e = $tw.Tree.Element(lookaheadMatch[2] == "\n" ? "div" : "span",{
|
||||
"class": lookaheadMatch[1]
|
||||
},[]);
|
||||
e = {type:"element",tag:lookaheadMatch[2] == "\n" ? "div" : "span",
|
||||
attributes: {"class": {type: "string", value:lookaheadMatch[1]}},children: []};
|
||||
w.output.push(e);
|
||||
w.subWikifyTerm(e.children,/(\}\}\})/mg);
|
||||
}
|
||||
@ -671,7 +783,7 @@ var rules = [
|
||||
match: "--",
|
||||
handler: function(w)
|
||||
{
|
||||
w.output.push($tw.Tree.Entity("—"));
|
||||
w.output.push({type: "entity", entity: "—"});
|
||||
}
|
||||
},
|
||||
|
||||
@ -680,7 +792,7 @@ var rules = [
|
||||
match: "\\n|<br ?/?>",
|
||||
handler: function(w)
|
||||
{
|
||||
w.output.push($tw.Tree.Element("br"));
|
||||
w.output.push({type:"element",tag:"br"});
|
||||
}
|
||||
},
|
||||
|
||||
@ -693,7 +805,8 @@ var rules = [
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
w.output.push($tw.Tree.Text(lookaheadMatch[1]));
|
||||
w.output.push({type: "text",text: lookaheadMatch[1]
|
||||
});
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
}
|
||||
}
|
||||
@ -704,7 +817,7 @@ var rules = [
|
||||
match: "&#?[a-zA-Z0-9]{2,8};",
|
||||
handler: function(w)
|
||||
{
|
||||
w.output.push($tw.Tree.Entity(w.matchText));
|
||||
w.output.push({type: "entity", entity: w.matchText});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user