mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-06-20 12:14:13 -04:00
Field parsing
This commit is contained in:
parent
c1cbc56459
commit
1d3538a604
1 changed files with 27 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import nomadnet
|
import nomadnet
|
||||||
import urwid
|
import urwid
|
||||||
|
import random
|
||||||
import time
|
import time
|
||||||
from urwid.util import is_mouse_press
|
from urwid.util import is_mouse_press
|
||||||
from urwid.text_layout import calc_coords
|
from urwid.text_layout import calc_coords
|
||||||
|
@ -423,6 +424,32 @@ def make_output(state, line, url_delegate):
|
||||||
elif c == "a":
|
elif c == "a":
|
||||||
state["align"] = state["default_align"]
|
state["align"] = state["default_align"]
|
||||||
|
|
||||||
|
elif c == "<":
|
||||||
|
# TODO: remove
|
||||||
|
import RNS
|
||||||
|
field_name = None
|
||||||
|
field_name_end = line[i:].find("`")
|
||||||
|
if field_name_end == -1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
field_name = line[i+1:i+field_name_end]
|
||||||
|
def sr():
|
||||||
|
return "@{"+str(random.randint(1000,9999))+"}"
|
||||||
|
rsg = sr()
|
||||||
|
while rsg in line[i+field_name_end:]:
|
||||||
|
rsg = sr()
|
||||||
|
lr = line[i+field_name_end:].replace("\\>", rsg)
|
||||||
|
endpos = lr.find(">")
|
||||||
|
|
||||||
|
if endpos == -1:
|
||||||
|
pass
|
||||||
|
|
||||||
|
else:
|
||||||
|
field_data = lr[1:endpos].replace(rsg, "\\>")
|
||||||
|
skip = len(field_data)+len(field_name)+2
|
||||||
|
field_data = field_data.replace("\\>", ">")
|
||||||
|
RNS.log("Field "+str(field_name)+": "+str(field_data))
|
||||||
|
|
||||||
elif c == "[":
|
elif c == "[":
|
||||||
endpos = line[i:].find("]")
|
endpos = line[i:].find("]")
|
||||||
if endpos == -1:
|
if endpos == -1:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue