mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-30 23:23:02 +00:00 
			
		
		
		
	Fixed problem with missing macros throwing an error
This commit is contained in:
		| @@ -3,15 +3,7 @@ title: $:/core/modules/parsers/wikitextparser/rules/macro.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for pretty links. For example: | Wiki text rule for macros | ||||||
|  |  | ||||||
| {{{ |  | ||||||
| <<version>> |  | ||||||
|  |  | ||||||
| <<link to:HelloThere>< |  | ||||||
| A macro with a bunch of content inside it. The content can include //formatting//. |  | ||||||
| >> |  | ||||||
| }}} |  | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
| @@ -52,14 +44,19 @@ exports.parse = function(match,isBlock) { | |||||||
| 				content = this.parseRun(/(>>)/mg); | 				content = this.parseRun(/(>>)/mg); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		var macroNode = $tw.Tree.Macro(match[1] || match[2],{ | 		var macroName = match[1] || match[2]; | ||||||
| 				srcParams: match[3], | 		if(macroName in $tw.wiki.macros) { | ||||||
| 				content: content, | 			var macroNode = $tw.Tree.Macro(match[1] || match[2],{ | ||||||
| 				isBlock: isBlock, | 					srcParams: match[3], | ||||||
| 				wiki: this.wiki | 					content: content, | ||||||
| 			}); | 					isBlock: isBlock, | ||||||
| 		this.dependencies.mergeDependencies(macroNode.dependencies); | 					wiki: this.wiki | ||||||
| 		return [macroNode]; | 				}); | ||||||
|  | 			this.dependencies.mergeDependencies(macroNode.dependencies); | ||||||
|  | 			return [macroNode]; | ||||||
|  | 		} else { | ||||||
|  | 			console.log("Missing macro '" + macroName + "'"); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	return []; | 	return []; | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston