1
0
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:
lin onetwo 2025-02-19 15:38:49 +08:00
parent 2765e995dd
commit 069181d615
2 changed files with 43 additions and 0 deletions

View 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;
};
})();

View File

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