mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-30 23:23:02 +00:00 
			
		
		
		
	Fixed type block bug
This commit is contained in:
		| @@ -400,9 +400,10 @@ var rules = [ | ||||
| { | ||||
| 	name: "typedBlock", | ||||
| 	match: "^\\$\\$\\$(?:.*)\\n", | ||||
| 	lookaheadRegExp: /^\$\$\$(.*)\n((?:.|\n)*?)\$\$\$/mg, | ||||
| 	lookaheadRegExp: /^\$\$\$(.*)\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 | ||||
|   | ||||
| @@ -1,11 +1,31 @@ | ||||
| title: TypedBlockTests | ||||
|  | ||||
| Here's an example of a typed block containing JavaScript source code: | ||||
| $$$.js | ||||
| return 2+2; | ||||
| WikiText can include blocks of text that are rendered with an explicit MIME type like this: | ||||
| {{{ | ||||
| $$$application/javascript | ||||
| //This is some JavaScript | ||||
| return 2 + "one"; | ||||
| $$$ | ||||
| }}} | ||||
| This renders as: | ||||
|  | ||||
| $$$application/javascript | ||||
| //This is some JavaScript | ||||
| return 2 + "one"; | ||||
| $$$ | ||||
|  | ||||
| Here's an example of a typed block containing an SVG image: | ||||
| It is also possible to abbreviate the MIME type to a file extension. For example: | ||||
|  | ||||
| {{{ | ||||
| $$$.svg | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="150" height="100"> | ||||
|   <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> | ||||
| </svg> | ||||
| $$$ | ||||
| }}} | ||||
|  | ||||
| This renders as: | ||||
|  | ||||
| $$$image/svg+xml | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="150" height="100"> | ||||
|   <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston