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

Editing Snippet ID: #1014164
Snippet name:
Category, Type:
Content:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sbool indexedSimpleWikipedia_magicMap_debug;
srecord WikiPage(S title, S text) {}
static Map<S, WikiPage> indexedSimpleWikipedia_magicMap(final Map<S
, IndexedWikiPage> map) {
  final File f = unpackSimpleWikipedia();
  Map<S, WikiPage> actualMap = new TreeMap<S, WikiPage>(caseInsensi
tiveComparator()) {
    public WikiPage get(O title) {
      IndexedWikiPage ip = map.get(title);
      if (ip == null) null;
      
      S xml = loadTextFilePart(f, ip.start, ip.start+ip.len);
      if (indexedSimpleWikipedia_magicMap_debug) {
        print("Loaded from " + ip.start + " to " + (ip.start+ip.len
));
        printIndent(xml);
      }
      
      L<S> tok = htmlTok(xml);
      S realTitle = trim(htmldecode(join(contentsOfContainerTag(tok
, "title"))));
      S text = trim(htmldecode(join(contentsOfContainerTag(tok, 
"text"))));
      ret WikiPage(realTitle, text);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Comment:
Public (visible to everyone):
Created: 2018-04-15 14:17:00

This page without fancy editor.