1 | static int hHiliteJava_timeout = 10000; |
2 | |
3 | static S hHiliteJava(S code) {
|
4 | ret hHiliteJava(code, null); |
5 | } |
6 | |
7 | static S hHiliteJava(S code, S style) {
|
8 | S url = "http://hilite.me/api" + htmlQuery(+code, lexer := "java", divstyles := style); |
9 | pcall {
|
10 | S html = loadPageWithTimeout(url, hHiliteJava_timeout); |
11 | if (nempty(style)) {
|
12 | if (contains(style, "width:")) |
13 | html = html.replace("width:auto;", "");
|
14 | html = html.replace("<div style=\"", "<div style=\"" + style + "; ");
|
15 | } |
16 | ret html; |
17 | } |
18 | ret hpre(htmlencode(code)); // fallback |
19 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1006023 |
| Snippet name: | hHiliteJava - format Java(X) code using hilite.me |
| Eternal ID of this version: | #1006023/1 |
| Text MD5: | b914281d47e9780af5f033fb6573222e |
| Author: | stefan |
| Category: | javax / html |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-12-14 15:54:45 |
| Source code size: | 579 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 772 / 761 |
| Referenced in: | [show references] |