mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-05 18:26:56 +00:00
DEBUG: render result and diff below body only on browser
DEBUG: render result below body only on browser DEBUG: render result below body DEBUG: fix build DEBUG: show render result as ViewTemplate
This commit is contained in:
parent
2765e995dd
commit
069181d615
29
core/modules/filters/serializeparsetree.js
Normal file
29
core/modules/filters/serializeparsetree.js
Normal file
@ -0,0 +1,29 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/serializeparsetree.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for serializing JSON string of Abstract Syntax Tree (AST) of Wiki parse tree to a raw WikiText string.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.serializeparsetree = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var parseTreeObject = $tw.utils.parseJSONSafe(title);
|
||||
if(parseTreeObject) {
|
||||
results.push($tw.utils.serializeParseTree(parseTreeObject));
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
@ -6,3 +6,17 @@ code-body: yes
|
||||
<$transclude tiddler="$:/language/MissingTiddler/Hint"/>
|
||||
|
||||
</$transclude>
|
||||
|
||||
<%if [[$:/info/browser]text[yes]] %>
|
||||
<$wikify text={{!!text}} name=parsetree output=parsetree >
|
||||
<$let text2={{{[<parsetree>serializeparsetree[]]}}}>
|
||||
<$wikify name=rendered text=<<text2>> output=html >
|
||||
|
||||
<$diff-text source={{!!text}} dest=<<text2>>/>
|
||||
|
||||
<<rendered>>
|
||||
|
||||
</$wikify>
|
||||
</$let>
|
||||
</$wikify>
|
||||
<%endif%>
|
Loading…
x
Reference in New Issue
Block a user