1 | !636 |
2 | !standard functions |
3 | !680 // "quicknew" |
4 | |
5 | main {
|
6 | psvm {
|
7 | String text; |
8 | if (args.length != 0) |
9 | text = loadSnippet(args[0]); |
10 | else {
|
11 | text = loadTextFile("input/input.txt", null);
|
12 | if (text == null) text = loadSnippet("#1000341"); // example input
|
13 | } |
14 | |
15 | Matcher m = Pattern.compile("(#\\d+)").matcher(text);
|
16 | new StringBuffer buf; // cool "quicknew" syntax! |
17 | while (m.find()) |
18 | m.appendReplacement(buf, m.quoteReplacement(formatSnippetRef(m.group()))); |
19 | m.appendTail(buf); |
20 | text = buf.toString(); |
21 | |
22 | text = text.replaceAll("\r?\n\r?\n", "\n<br><br>\n");
|
23 | |
24 | saveTextFile("output/output.txt", text);
|
25 | System.out.println(text); |
26 | } |
27 | |
28 | static String formatSnippetRef(String in) {
|
29 | in = in.substring(1); |
30 | in = "<a href=\"http://tinybrain.de/%!%\">#%!%</a>".replace("%!%", in);
|
31 | return in; |
32 | } |
33 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
2 comment(s) hidden. show
| Snippet ID: | #679 |
| Snippet name: | Blog formatter (developing) |
| Eternal ID of this version: | #679/1 |
| Text MD5: | b1a68ffe5b3b2dd0c82fa681164a9aa2 |
| Author: | stefan |
| Category: | |
| Type: | JavaX (input.txt to output.txt) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-07-24 21:11:42 |
| Source code size: | 902 bytes / 33 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1325 / 1163 |
| Referenced in: | [show references] |