Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1000671 // Listen to commands on blog.

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (130L/2K/5K).

!636
!modern

main {
  psvm {
    S s = load("tinybrain.blog.de");
    L<S> tok = htmlcoarsetok(s);
    for (int i = 0; i+1 < tok.size(); i += 2) {
      String t = tok.get(i);
      
      if (tok.get(i+1).equals("<blockquote>")) {
        int j = i+1;
        while (j < tok.size() && !tok.get(j).equals("</blockquote>"))
          j += 2;
        i = j+1;
        continue;
      }
      
      if (t.indexOf("Computer!") < 0) continue;
      print("!!! " + t);
      if (tok.get(i+3).equals("<blockquote>")) {
        int j = i+3;
        while (j < tok.size() && !tok.get(j).equals("</blockquote>"))
          j += 2;
          
        new StringBuilder buf;
        for (i = i+4; i < j; i += 2)
          buf.append(tok.get(i) + "\n");
        String code = buf.toString();
        code = code.replace("&lt;", "<");
        code = code.replace("&gt;", ">");
        code = code.replace("\n\n", "\n");
        print("Code:\n" + indent("  ", code));
      }
    }
  }
  
  static S load(String bla) ctex {
    return loadPage(bla);
  }
}

Author comment

Began life as a copy of #1000669

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000671
Snippet name: Listen to commands on blog.
Eternal ID of this version: #1000671/1
Text MD5: d2e964be0adedc46cf68e479554dcbbb
Transpilation MD5: aba6ff6ac4e2edf2a48865018956a040
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-21 23:50:57
Source code size: 1084 bytes / 41 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 612 / 663
Referenced in: [show references]