style: fix style in theme.js

This commit is contained in:
Marcel Beck 2023-07-28 21:18:45 +02:00
parent 66ef1762f1
commit 6960d63ee0

View file

@ -179,10 +179,10 @@ function initMermaid( update, attrs ) {
}; };
var serializeGraph = function( graph ){ var serializeGraph = function( graph ){
if (JSON.stringify(graph.dir) === "{}") { if (JSON.stringify(graph.dir) === '{}') {
return "---\n" + jsyaml.dump(graph.yaml) + "---\n" + graph.content; return '---\n' + jsyaml.dump(graph.yaml) + '---\n' + graph.content;
} }
return "---\n" + jsyaml.dump(graph.yaml) + "---\n" + "%%{init: " + JSON.stringify(graph.dir) + "}%%\n" + graph.content; return '---\n' + jsyaml.dump(graph.yaml) + '---\n' + '%%{init: ' + JSON.stringify(graph.dir) + '}%%\n' + graph.content;
}; };
var init_func = function( attrs ){ var init_func = function( attrs ){
@ -191,18 +191,18 @@ function initMermaid( update, attrs ) {
document.querySelectorAll('.mermaid').forEach( function( element ){ document.querySelectorAll('.mermaid').forEach( function( element ){
var parse = parseGraph( decodeHTML( element.innerHTML ) ); var parse = parseGraph( decodeHTML( element.innerHTML ) );
if (JSON.stringify(parse.dir) === "{}") { if( JSON.stringify(parse.dir) === '{}' ){
if (parse.yaml.theme) { if( parse.yaml.theme ){
parse.yaml.relearn_user_theme = true; parse.yaml.relearn_user_theme = true;
} }
if (!parse.yaml.relearn_user_theme) { if( !parse.yaml.relearn_user_theme ){
parse.yaml.theme = theme; parse.yaml.theme = theme;
} }
} else { } else {
if (parse.dir.theme) { if( parse.dir.theme ){
parse.dir.relearn_user_theme = true; parse.dir.relearn_user_theme = true;
} }
if (!parse.dir.relearn_user_theme) { if( !parse.dir.relearn_user_theme ){
parse.dir.theme = theme; parse.dir.theme = theme;
} }
} }
@ -226,11 +226,11 @@ function initMermaid( update, attrs ) {
var code = e.querySelector( '.mermaid-code' ); var code = e.querySelector( '.mermaid-code' );
var parse = parseGraph( decodeHTML( code.innerHTML ) ); var parse = parseGraph( decodeHTML( code.innerHTML ) );
if (parse.dir.relearn_user_theme || parse.yaml.relearn_user_theme) { if( parse.dir.relearn_user_theme || parse.yaml.relearn_user_theme ){
return; return;
} }
if (parse.dir.theme == theme || parse.yaml.theme == theme) { if( parse.dir.theme == theme || parse.yaml.theme == theme ){
return; return;
} }
is_initialized = true; is_initialized = true;