update mhx monster list, reorg jqui mobile site
This commit is contained in:
@@ -36,10 +36,10 @@ def print_header_nav(title, pid):
|
||||
|
||||
def mk_html_list(dict_list, keys, sort_keys, divider_fn="auto"):
|
||||
if divider_fn == "auto":
|
||||
print ('<ul data-role="listview" data-filter="true"'
|
||||
print ('<ul data-role="listview" data-filter="false"'
|
||||
' data-autodividers="true">')
|
||||
else:
|
||||
print '<ul data-role="listview" data-filter="true">'
|
||||
print '<ul data-role="listview" data-filter="false">'
|
||||
|
||||
if isinstance(sort_keys, types.FunctionType):
|
||||
sort_fn = sort_keys
|
||||
|
||||
@@ -38,7 +38,7 @@ MONSTER_RE = re.compile(
|
||||
|
||||
JAPANESE_NAME_STR = '<h3 class="pi-data-label pi-secondary-font">Japanese:</h3>'
|
||||
JAPANESE_NAME_RE = re.compile(
|
||||
'<div class="pi-data-value pi-font">([^<]*)')
|
||||
'<div class="pi-data-value pi-font">(.*)</div>')
|
||||
|
||||
|
||||
def parse_wikia_monsters(f):
|
||||
@@ -83,12 +83,24 @@ def get_jp_names(monster_path):
|
||||
line = lines.pop(0).strip()
|
||||
m = JAPANESE_NAME_RE.match(line)
|
||||
assert m, "No match: " + line
|
||||
names.append(m.group(1))
|
||||
names.append(parse_japanese_name(m.group(1)))
|
||||
if len(names) == 2:
|
||||
break
|
||||
return names
|
||||
|
||||
|
||||
def parse_japanese_name(div_contents):
|
||||
parts = div_contents.split("<br />")
|
||||
if len(parts) == 1:
|
||||
return parts[0]
|
||||
assert len(parts) == 2
|
||||
# Remobra has different titles in 2nd and 4th gen, parse from
|
||||
# second part and remove the paren part
|
||||
if parts[1].endswith("(4th Gen)"):
|
||||
return parts[1][:-len("(4th Gen)")]
|
||||
return parts[0]
|
||||
|
||||
|
||||
def _main():
|
||||
with open(sys.argv[1]) as f:
|
||||
monster_list = parse_wikia_monsters(f)
|
||||
|
||||
Reference in New Issue
Block a user