mirror of
https://github.com/meld-cp/obsidian-build.git
synced 2026-07-22 07:30:25 +00:00
fix marker fetching
remove console logging version bump
This commit is contained in:
parent
9cf988da38
commit
71c45bdf07
7 changed files with 19 additions and 14 deletions
2
dist/manifest.json
vendored
2
dist/manifest.json
vendored
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "meld-build",
|
||||
"name": "Meld Build",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"minAppVersion": "1.0.1",
|
||||
"description": "Write and execute (sandboxed) JavaScript to render templates, query DataView and create dynamic notes.",
|
||||
"author": "meld-cp",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "meld-build",
|
||||
"name": "Meld Build",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"minAppVersion": "1.0.1",
|
||||
"description": "Write and execute (sandboxed) JavaScript to render templates, query DataView and create dynamic notes.",
|
||||
"author": "meld-cp",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "meld-build-obsidian-plugin",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export default class MeldBuildPlugin extends Plugin {
|
|||
return;
|
||||
}
|
||||
|
||||
console.debug( `Meld-Build::Rebuilding view for file '${view.file.path}'` );
|
||||
//console.debug( `Meld-Build::Rebuilding view for file '${view.file.path}'` );
|
||||
|
||||
(view.leaf as any).rebuildView();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ export class Parser {
|
|||
const fileCache = view.app.metadataCache.getFileCache( file );
|
||||
|
||||
if ( fileCache == null ){
|
||||
console.debug('Parser::fetchCodeBlocks, fileCache is null');
|
||||
//console.debug('Parser::fetchCodeBlocks, fileCache is null');
|
||||
return result;
|
||||
}
|
||||
|
||||
if ( fileCache.sections == undefined ){
|
||||
console.debug('Parser::fetchCodeBlocks, fileCache.sections is undefined');
|
||||
//console.debug('Parser::fetchCodeBlocks, fileCache.sections is undefined');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ export class Parser {
|
|||
// filter languages
|
||||
const codeBlockInfo = this.extractCodeBlockInfo(lines[0]);
|
||||
if ( codeBlockInfo == null ){
|
||||
console.debug('Parser::fetchCodeBlocks, codeBlockInfo is null', {content});
|
||||
//console.debug('Parser::fetchCodeBlocks, codeBlockInfo is null', {content});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ export class Parser {
|
|||
//const matches = line.match(/````*/i);
|
||||
|
||||
if ( codeBlockMatch == null || codeBlockMatch.length < 1 ){
|
||||
console.debug('Parser::extractCodeBlockInfo, codeBlockMatch is null or length < 1', {codeBlockMatch, line});
|
||||
//console.debug('Parser::extractCodeBlockInfo, codeBlockMatch is null or length < 1', {codeBlockMatch, line});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export class MarkerRunContextImplementation implements TMarkerRunContext {
|
|||
private markerEndPrefix = '%%=';
|
||||
private markerEndSuffix = '%%'
|
||||
|
||||
private markerValueRegEx = '((?:.|\n|\r)*)';
|
||||
private markerValueRegEx = '((?:.|\\n|\\r)*?)';
|
||||
|
||||
private vault: Vault;
|
||||
private log: RunLogger;
|
||||
|
|
@ -89,15 +89,19 @@ export class MarkerRunContextImplementation implements TMarkerRunContext {
|
|||
+ '(.*?)' // marker name end
|
||||
+ this.escapeRegex(this.markerEndSuffix)
|
||||
;
|
||||
//console.debug({exp});
|
||||
const rgexp = new RegExp(exp, 'g');
|
||||
|
||||
//console.debug('MarkerRunContextImplementation::findMarkers', {exp});
|
||||
|
||||
const rgexp = new RegExp(exp, 'gm');
|
||||
|
||||
const matches = text.matchAll( rgexp );
|
||||
|
||||
const result:MarkerValue[] = [];
|
||||
|
||||
for (const match of matches) {
|
||||
|
||||
//console.debug({match});
|
||||
|
||||
if( match.index == undefined ){
|
||||
continue;
|
||||
}
|
||||
|
|
@ -158,7 +162,7 @@ export class MarkerRunContextImplementation implements TMarkerRunContext {
|
|||
|
||||
//console.log({findExp, replacement, currentMarkers});
|
||||
|
||||
const findRegex = new RegExp(findExp, 'g');
|
||||
const findRegex = new RegExp(findExp, 'gm');
|
||||
|
||||
targetFileContent = targetFileContent.replaceAll( findRegex, replacement );
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
"0.1.4": "1.0.1",
|
||||
"0.1.5": "1.0.1",
|
||||
"0.1.6": "1.0.1",
|
||||
"0.1.7": "1.0.1"
|
||||
"0.1.7": "1.0.1",
|
||||
"0.1.8": "1.0.1"
|
||||
}
|
||||
Loading…
Reference in a new issue