1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-08 01:38:06 +00:00

Adds support for indenting pragmas with whitespace (#7185)

* feat: first pass at allowing pragmas to be indented

* Added documentation
This commit is contained in:
Saq Imtiaz
2023-01-08 14:17:01 +01:00
committed by GitHub
parent 7b7063a7b2
commit dd6e00687b
9 changed files with 117 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ Instantiate parse rule
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /^\\import[^\S\n]/mg;
this.matchRegExp = /\\import[^\S\n]/mg;
};
/*

View File

@@ -27,7 +27,7 @@ Instantiate parse rule
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /^\\define\s+([^(\s]+)\(\s*([^)]*)\)(\s*\r?\n)?/mg;
this.matchRegExp = /\\define\s+([^(\s]+)\(\s*([^)]*)\)(\s*\r?\n)?/mg;
};
/*
@@ -58,7 +58,7 @@ exports.parse = function() {
var reEnd;
if(this.match[3]) {
// If so, the end of the body is marked with \end
reEnd = new RegExp("(\\r?\\n\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
reEnd = new RegExp("(\\r?\\n\\s*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
} else {
// Otherwise, the end of the definition is marked by the end of the line
reEnd = /($|\r?\n)/mg;

View File

@@ -26,7 +26,7 @@ Instantiate parse rule
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /^\\parsermode[^\S\n]/mg;
this.matchRegExp = /\\parsermode[^\S\n]/mg;
};
/*

View File

@@ -26,7 +26,7 @@ Instantiate parse rule
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /^\\rules[^\S\n]/mg;
this.matchRegExp = /\\rules[^\S\n]/mg;
};
/*

View File

@@ -26,7 +26,7 @@ Instantiate parse rule
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /^\\whitespace[^\S\n]/mg;
this.matchRegExp = /\\whitespace[^\S\n]/mg;
};
/*