Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
preview/**
!preview/_
doc/tags*

# Created by https://www.gitignore.io/api/vim,osx

### Vim ###
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

2 changes: 2 additions & 0 deletions preview/_/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
<script src="../_/js/lib/textile.js"></script>
<script src="../_/js/lib/mermaid.min.js"></script>
<script src="../_/js/lib/asciidoctor.min.js"></script>
<script src="../_/js/lib/zip_deflate.js"></script>
<script src="../_/js/lib/plantuml.js"></script>
<script src="../_/js/previm.js"></script>
<div id="monitor"></div>
</div>
Expand Down
64 changes: 64 additions & 0 deletions preview/_/js/lib/plantuml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
function encode64(a) {
r = "";
for (i = 0; i < a.length; i += 3) {
if (i + 2 == a.length) {
r += append3bytes(a.charCodeAt(i), a.charCodeAt(i + 1), 0)
} else {
if (i + 1 == a.length) {
r += append3bytes(a.charCodeAt(i), 0, 0)
} else {
r += append3bytes(a.charCodeAt(i), a.charCodeAt(i + 1), a.charCodeAt(i + 2))
}
}
}
return r
}

function append3bytes(c, b, a) {
c1 = c >> 2;
c2 = ((c & 3) << 4) | (b >> 4);
c3 = ((b & 15) << 2) | (a >> 6);
c4 = a & 63;
r = "";
r += encode6bit(c1 & 63);
r += encode6bit(c2 & 63);
r += encode6bit(c3 & 63);
r += encode6bit(c4 & 63);
return r
}

function encode6bit(a) {
if (a < 10) {
return String.fromCharCode(48 + a)
}
a -= 10;
if (a < 26) {
return String.fromCharCode(65 + a)
}
a -= 26;
if (a < 26) {
return String.fromCharCode(97 + a)
}
a -= 26;
if (a == 0) {
return "-"
}
if (a == 1) {
return "_"
}
return "?"
}

function compress(a) {
a = unescape(encodeURIComponent(a));
return "http://plantuml.com/plantuml/img/" + encode64(zip_deflate(a, 9));
}

function loadPlantUML() {
var umls = document.querySelectorAll('code.language-plantuml');
Array.prototype.slice.call(umls).forEach(function(el) {
var text = el.textContent
var url = compress(text);
el.parentNode.outerHTML = '<div><img src="' + url + '" /></div>'
});
}
Loading