Make it a function
This commit is contained in:
parent
65c22ab35a
commit
8110e0b281
|
@ -1,11 +1,17 @@
|
|||
/* Copyright (C) 2020 David Svantesson
|
||||
* MIT License
|
||||
*
|
||||
*/
|
||||
|
||||
var plantumlBasePath = "http://www.plantuml.com/plantuml/img/"
|
||||
function parsePlantumlCodeBlocks(plantumlServer = "http://www.plantuml.com/plantuml", htmlClass = "language-plantuml") {
|
||||
var codeBlocks = document.getElementsByClassName(htmlClass);
|
||||
|
||||
var codeBlocks = document.getElementsByClassName("language-plantuml");
|
||||
|
||||
for (var block_i = 0; block_i < codeBlocks.length; block_i++) {
|
||||
block_string = codeBlocks[block_i].innerText
|
||||
//UTF8
|
||||
block_string = unescape(encodeURIComponent(block_string));
|
||||
codeBlocks[block_i].innerHTML = "<img src=\"" + plantumlBasePath + encode64(zip_deflate(block_string, 9)) + "\">";
|
||||
for (var block_i = 0; block_i < codeBlocks.length; block_i++) {
|
||||
block_string = codeBlocks[block_i].innerText
|
||||
//UTF8
|
||||
block_string = unescape(encodeURIComponent(block_string));
|
||||
codeBlocks[block_i].innerHTML = "<img src=\"" + plantumlServer + "/img/" + encode64(zip_deflate(block_string, 9)) + "\">";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue