Commit f09647de authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Add logs for mermaid/plantuml blocks found

parent 8c801d19
Loading
Loading
Loading
Loading
Loading
+6
Changes for generateBaseline/mermaid-filter.js: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -165,11 +165,16 @@ function captionFromAttrs(el) {
	return [];
}

function warnMermaidBlock() {
	fs.writeSync(2, 'warning: mermaid block found\n');
}

function walkBlocks(blocks) {
	const out = [];
	for (let i = 0; i < blocks.length; i++) {
		const el = blocks[i];
		if (isMermaidBlock(el)) {
			warnMermaidBlock();
			let caption = captionFromAttrs(el);
			if (isFigureCaptionPara(blocks[i + 1])) {
				caption = figureCaptionInlines(blocks[i + 1]);
@@ -192,6 +197,7 @@ function walk(node) {
	}
	if (node && typeof node === 'object') {
		if (isMermaidBlock(node)) {
			warnMermaidBlock();
			return renderMermaid(node, []);
		}
		// Pandoc 3 JSON is {pandoc-api-version, meta, blocks}. Older filters
+6
Changes for generateBaseline/plantuml-filter.js: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -191,11 +191,16 @@ function captionFromAttrs(el) {
	return [];
}

function warnPlantumlBlock() {
	fs.writeSync(2, '⚠ WARNING: PlantUML block found. Please, substitute it with a regular image.\n');
}

function walkBlocks(blocks) {
	const out = [];
	for (let i = 0; i < blocks.length; i++) {
		const el = blocks[i];
		if (isPlantumlBlock(el)) {
			warnPlantumlBlock();
			let caption = captionFromAttrs(el);
			if (isFigureCaptionPara(blocks[i + 1])) {
				caption = figureCaptionInlines(blocks[i + 1]);
@@ -218,6 +223,7 @@ function walk(node) {
	}
	if (node && typeof node === 'object') {
		if (isPlantumlBlock(node)) {
			warnPlantumlBlock();
			return renderPlantuml(node, []);
		}
		if (Object.prototype.hasOwnProperty.call(node, 'c')) {