mirror of https://github.com/python/cpython
Getting uglier. But it doesn't completely bomb except for some table stuff.
I'll get to it when I can.
This commit is contained in:
parent
78f8e98232
commit
43c9350f7a
|
@ -827,7 +827,7 @@ class Wobj:
|
||||||
self.data = self.data + data
|
self.data = self.data + data
|
||||||
|
|
||||||
# ignore these commands
|
# ignore these commands
|
||||||
ignoredcommands = ('bcode', 'ecode', 'hline', 'fulllineitems', 'small', '/')
|
ignoredcommands = ('bcode', 'ecode', 'hline', 'small', '/')
|
||||||
# map commands like these to themselves as plaintext
|
# map commands like these to themselves as plaintext
|
||||||
wordsselves = ('UNIX', 'ABC', 'C', 'ASCII', 'EOF', 'LaTeX')
|
wordsselves = ('UNIX', 'ABC', 'C', 'ASCII', 'EOF', 'LaTeX')
|
||||||
# \{ --> {, \} --> }, etc
|
# \{ --> {, \} --> }, etc
|
||||||
|
@ -1191,18 +1191,19 @@ def do_opcodedesc(length, buf, pp, i):
|
||||||
del pp[i:newi]
|
del pp[i:newi]
|
||||||
length = length - (newi-i)
|
length = length - (newi-i)
|
||||||
|
|
||||||
ch.chtype = chunk_type[CSLINE]
|
ch.chtype = CSLINE
|
||||||
ch.data = "defcv"
|
ch.data = "deffn"
|
||||||
|
|
||||||
cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, "data")]),
|
cslinearg = [#chunk(GROUP, wh, [chunk(PLAIN, wh, "exception")]),
|
||||||
chunk(PLAIN, wh, ' '),
|
chunk(PLAIN, wh, 'exception '),
|
||||||
chunk(GROUP, wh, [chunk(PLAIN, wh, "byte code instruction")]),
|
chunk(GROUP, wh, [chunk(PLAIN, wh, "byte code instruction")]),
|
||||||
chunk(PLAIN, wh, ' '),
|
chunk(PLAIN, wh, ' '),
|
||||||
dataname,
|
dataname,
|
||||||
|
chunk(PLAIN, wh, ' '),
|
||||||
|
pp[i],
|
||||||
]
|
]
|
||||||
|
|
||||||
pp.insert(i, chunk(GROUP, wh, cslinearg))
|
pp[i] = chunk(GROUP, wh, cslinearg)
|
||||||
i, length = i+1, length+1
|
|
||||||
hist.command = ch.data
|
hist.command = ch.data
|
||||||
return length, i
|
return length, i
|
||||||
|
|
||||||
|
@ -1224,7 +1225,7 @@ def rm_commas_etc(text):
|
||||||
result = result + text
|
result = result + text
|
||||||
break
|
break
|
||||||
if changed:
|
if changed:
|
||||||
print 'Warning: nodename changhed to ' + `result`
|
print 'Warning: nodename changed to ' + `result`
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -1232,6 +1233,10 @@ def rm_commas_etc(text):
|
||||||
flags = {'texi': 1}
|
flags = {'texi': 1}
|
||||||
|
|
||||||
|
|
||||||
|
# map of \label{} to node names
|
||||||
|
label_nodes = {}
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## changeit: the actual routine, that changes the contents of the parsed
|
## changeit: the actual routine, that changes the contents of the parsed
|
||||||
## chunks
|
## chunks
|
||||||
|
@ -1260,12 +1265,22 @@ def changeit(buf, pp):
|
||||||
# check for {\em ...} constructs
|
# check for {\em ...} constructs
|
||||||
if ch.data and \
|
if ch.data and \
|
||||||
ch.data[0].chtype == chunk_type[CSNAME] and \
|
ch.data[0].chtype == chunk_type[CSNAME] and \
|
||||||
s(buf, ch.data[0].data) in fontchanges.keys():
|
fontchanges.has_key(s(buf, ch.data[0].data)):
|
||||||
k = s(buf, ch.data[0].data)
|
k = s(buf, ch.data[0].data)
|
||||||
del ch.data[0]
|
del ch.data[0]
|
||||||
pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k]))
|
pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k]))
|
||||||
length, i = length+1, i+1
|
length, i = length+1, i+1
|
||||||
|
|
||||||
|
elif ch.data:
|
||||||
|
k = s(buf, ch.data[0].data)
|
||||||
|
if k == "fulllineitems":
|
||||||
|
del ch.data[0]
|
||||||
|
data = ch.data
|
||||||
|
pp[i-1:i] = data
|
||||||
|
i = i - 1
|
||||||
|
length = length + len(data) - 1
|
||||||
|
continue
|
||||||
|
|
||||||
# recursively parse the contents of the group
|
# recursively parse the contents of the group
|
||||||
changeit(buf, ch.data)
|
changeit(buf, ch.data)
|
||||||
|
|
||||||
|
@ -1424,6 +1439,9 @@ def changeit(buf, pp):
|
||||||
length = length + len(chunks) - 1
|
length = length + len(chunks) - 1
|
||||||
i = i + len(chunks) - 1
|
i = i + len(chunks) - 1
|
||||||
|
|
||||||
|
elif envname in ('sloppypar', 'flushleft'):
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'WARNING: don\'t know what to do with env ' + `envname`
|
print 'WARNING: don\'t know what to do with env ' + `envname`
|
||||||
|
|
||||||
|
@ -1436,34 +1454,29 @@ def changeit(buf, pp):
|
||||||
i, length = i-1, length-1
|
i, length = i-1, length-1
|
||||||
|
|
||||||
if envname == 'verbatim':
|
if envname == 'verbatim':
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'example')])]
|
chunk(PLAIN, ch.where, 'example')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif envname == 'itemize':
|
elif envname == 'itemize':
|
||||||
hist.itemizenesting = hist.itemizenesting - 1
|
hist.itemizenesting = hist.itemizenesting - 1
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'itemize')])]
|
chunk(PLAIN, ch.where, 'itemize')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif envname == 'enumerate':
|
elif envname == 'enumerate':
|
||||||
hist.enumeratenesting = hist.enumeratenesting-1
|
hist.enumeratenesting = hist.enumeratenesting-1
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'enumerate')])]
|
chunk(PLAIN, ch.where, 'enumerate')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif envname == 'description':
|
elif envname == 'description':
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'table')])]
|
chunk(PLAIN, ch.where, 'table')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif (envname == 'tableiii') or (envname == 'tableii'):
|
elif (envname == 'tableiii') or (envname == 'tableii'):
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'table')])]
|
chunk(PLAIN, ch.where, 'table')])]
|
||||||
i, length = i+2, length + 2
|
i, length = i+2, length + 2
|
||||||
|
@ -1471,13 +1484,18 @@ def changeit(buf, pp):
|
||||||
i, length = i+1, length+1
|
i, length = i+1, length+1
|
||||||
|
|
||||||
elif envname in ('funcdesc', 'excdesc', 'datadesc'):
|
elif envname in ('funcdesc', 'excdesc', 'datadesc'):
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, hist.command)])]
|
chunk(PLAIN, ch.where, hist.command)])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
|
|
||||||
elif envname in ('seealso', 'opcodedesc'):
|
elif envname == 'opcodedesc':
|
||||||
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
|
chunk(GROUP, ch.where, [
|
||||||
|
chunk(PLAIN, ch.where, "deffn")])]
|
||||||
|
i, length = i+2, length+2
|
||||||
|
|
||||||
|
elif envname in ('seealso', 'sloppypar', 'flushleft'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -1553,6 +1571,10 @@ def changeit(buf, pp):
|
||||||
del pp[i:newi]
|
del pp[i:newi]
|
||||||
length = length - (newi-i)
|
length = length - (newi-i)
|
||||||
|
|
||||||
|
elif s_buf_data == "fulllineitems":
|
||||||
|
del pp[i-1]
|
||||||
|
i, length = i-1, length-1
|
||||||
|
|
||||||
elif s_buf_data == 'item':
|
elif s_buf_data == 'item':
|
||||||
ch.chtype = chunk_type[CSLINE]
|
ch.chtype = chunk_type[CSLINE]
|
||||||
length, newi = getoptarg(length, buf, pp, i)
|
length, newi = getoptarg(length, buf, pp, i)
|
||||||
|
@ -1828,12 +1850,6 @@ def changeit(buf, pp):
|
||||||
del pp[i:newi]
|
del pp[i:newi]
|
||||||
length = length - (newi-i)
|
length = length - (newi-i)
|
||||||
|
|
||||||
## ingroupch.append(chunk(PLAIN, ch.where, ' '))
|
|
||||||
## ingroupch.append(chunk(CSNAME, ch.where, 'r'))
|
|
||||||
## ingroupch.append(chunk(GROUP, ch.where, [
|
|
||||||
## chunk(PLAIN, ch.where,
|
|
||||||
## '(built-in)')]))
|
|
||||||
|
|
||||||
pp.insert(i, chunk(GROUP, ch.where, ingroupch))
|
pp.insert(i, chunk(GROUP, ch.where, ingroupch))
|
||||||
length, i = length+1, i+1
|
length, i = length+1, i+1
|
||||||
|
|
||||||
|
@ -2048,13 +2064,30 @@ def changeit(buf, pp):
|
||||||
i = i - 1
|
i = i - 1
|
||||||
length = length + len(data) - 2
|
length = length + len(data) - 2
|
||||||
|
|
||||||
|
elif s_buf_data == "quad":
|
||||||
|
ch.chtype = PLAIN
|
||||||
|
ch.data = " "
|
||||||
|
|
||||||
elif s_buf_data in ('noindent', 'indexsubitem'):
|
elif s_buf_data in ('noindent', 'indexsubitem'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif s_buf_data == 'label':
|
elif s_buf_data == 'label':
|
||||||
|
name = s(buf, pp[i].data[0].data)
|
||||||
del pp[i-1:i+1]
|
del pp[i-1:i+1]
|
||||||
length = length - 2
|
length = length - 2
|
||||||
i = i - 1
|
i = i - 1
|
||||||
|
label_nodes[name] = hist.nodenames[-1]
|
||||||
|
|
||||||
|
elif s_buf_data == 'ref':
|
||||||
|
name = s(buf, pp[i].data[0].data)
|
||||||
|
if label_nodes.has_key(name):
|
||||||
|
pp[i].data[0].data = label_nodes[name]
|
||||||
|
else:
|
||||||
|
pp[i-1:i+1] = [
|
||||||
|
chunk(PLAIN, ch.where,
|
||||||
|
"(unknown node reference: %s)" % name)]
|
||||||
|
length = length - 1
|
||||||
|
print "WARNING: unknown node label", `name`
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "don't know what to do with keyword " + s_buf_data
|
print "don't know what to do with keyword " + s_buf_data
|
||||||
|
|
|
@ -827,7 +827,7 @@ class Wobj:
|
||||||
self.data = self.data + data
|
self.data = self.data + data
|
||||||
|
|
||||||
# ignore these commands
|
# ignore these commands
|
||||||
ignoredcommands = ('bcode', 'ecode', 'hline', 'fulllineitems', 'small', '/')
|
ignoredcommands = ('bcode', 'ecode', 'hline', 'small', '/')
|
||||||
# map commands like these to themselves as plaintext
|
# map commands like these to themselves as plaintext
|
||||||
wordsselves = ('UNIX', 'ABC', 'C', 'ASCII', 'EOF', 'LaTeX')
|
wordsselves = ('UNIX', 'ABC', 'C', 'ASCII', 'EOF', 'LaTeX')
|
||||||
# \{ --> {, \} --> }, etc
|
# \{ --> {, \} --> }, etc
|
||||||
|
@ -1191,18 +1191,19 @@ def do_opcodedesc(length, buf, pp, i):
|
||||||
del pp[i:newi]
|
del pp[i:newi]
|
||||||
length = length - (newi-i)
|
length = length - (newi-i)
|
||||||
|
|
||||||
ch.chtype = chunk_type[CSLINE]
|
ch.chtype = CSLINE
|
||||||
ch.data = "defcv"
|
ch.data = "deffn"
|
||||||
|
|
||||||
cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, "data")]),
|
cslinearg = [#chunk(GROUP, wh, [chunk(PLAIN, wh, "exception")]),
|
||||||
chunk(PLAIN, wh, ' '),
|
chunk(PLAIN, wh, 'exception '),
|
||||||
chunk(GROUP, wh, [chunk(PLAIN, wh, "byte code instruction")]),
|
chunk(GROUP, wh, [chunk(PLAIN, wh, "byte code instruction")]),
|
||||||
chunk(PLAIN, wh, ' '),
|
chunk(PLAIN, wh, ' '),
|
||||||
dataname,
|
dataname,
|
||||||
|
chunk(PLAIN, wh, ' '),
|
||||||
|
pp[i],
|
||||||
]
|
]
|
||||||
|
|
||||||
pp.insert(i, chunk(GROUP, wh, cslinearg))
|
pp[i] = chunk(GROUP, wh, cslinearg)
|
||||||
i, length = i+1, length+1
|
|
||||||
hist.command = ch.data
|
hist.command = ch.data
|
||||||
return length, i
|
return length, i
|
||||||
|
|
||||||
|
@ -1224,7 +1225,7 @@ def rm_commas_etc(text):
|
||||||
result = result + text
|
result = result + text
|
||||||
break
|
break
|
||||||
if changed:
|
if changed:
|
||||||
print 'Warning: nodename changhed to ' + `result`
|
print 'Warning: nodename changed to ' + `result`
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -1232,6 +1233,10 @@ def rm_commas_etc(text):
|
||||||
flags = {'texi': 1}
|
flags = {'texi': 1}
|
||||||
|
|
||||||
|
|
||||||
|
# map of \label{} to node names
|
||||||
|
label_nodes = {}
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## changeit: the actual routine, that changes the contents of the parsed
|
## changeit: the actual routine, that changes the contents of the parsed
|
||||||
## chunks
|
## chunks
|
||||||
|
@ -1260,12 +1265,22 @@ def changeit(buf, pp):
|
||||||
# check for {\em ...} constructs
|
# check for {\em ...} constructs
|
||||||
if ch.data and \
|
if ch.data and \
|
||||||
ch.data[0].chtype == chunk_type[CSNAME] and \
|
ch.data[0].chtype == chunk_type[CSNAME] and \
|
||||||
s(buf, ch.data[0].data) in fontchanges.keys():
|
fontchanges.has_key(s(buf, ch.data[0].data)):
|
||||||
k = s(buf, ch.data[0].data)
|
k = s(buf, ch.data[0].data)
|
||||||
del ch.data[0]
|
del ch.data[0]
|
||||||
pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k]))
|
pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k]))
|
||||||
length, i = length+1, i+1
|
length, i = length+1, i+1
|
||||||
|
|
||||||
|
elif ch.data:
|
||||||
|
k = s(buf, ch.data[0].data)
|
||||||
|
if k == "fulllineitems":
|
||||||
|
del ch.data[0]
|
||||||
|
data = ch.data
|
||||||
|
pp[i-1:i] = data
|
||||||
|
i = i - 1
|
||||||
|
length = length + len(data) - 1
|
||||||
|
continue
|
||||||
|
|
||||||
# recursively parse the contents of the group
|
# recursively parse the contents of the group
|
||||||
changeit(buf, ch.data)
|
changeit(buf, ch.data)
|
||||||
|
|
||||||
|
@ -1424,6 +1439,9 @@ def changeit(buf, pp):
|
||||||
length = length + len(chunks) - 1
|
length = length + len(chunks) - 1
|
||||||
i = i + len(chunks) - 1
|
i = i + len(chunks) - 1
|
||||||
|
|
||||||
|
elif envname in ('sloppypar', 'flushleft'):
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'WARNING: don\'t know what to do with env ' + `envname`
|
print 'WARNING: don\'t know what to do with env ' + `envname`
|
||||||
|
|
||||||
|
@ -1436,34 +1454,29 @@ def changeit(buf, pp):
|
||||||
i, length = i-1, length-1
|
i, length = i-1, length-1
|
||||||
|
|
||||||
if envname == 'verbatim':
|
if envname == 'verbatim':
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'example')])]
|
chunk(PLAIN, ch.where, 'example')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif envname == 'itemize':
|
elif envname == 'itemize':
|
||||||
hist.itemizenesting = hist.itemizenesting - 1
|
hist.itemizenesting = hist.itemizenesting - 1
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'itemize')])]
|
chunk(PLAIN, ch.where, 'itemize')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif envname == 'enumerate':
|
elif envname == 'enumerate':
|
||||||
hist.enumeratenesting = hist.enumeratenesting-1
|
hist.enumeratenesting = hist.enumeratenesting-1
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'enumerate')])]
|
chunk(PLAIN, ch.where, 'enumerate')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif envname == 'description':
|
elif envname == 'description':
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'table')])]
|
chunk(PLAIN, ch.where, 'table')])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
elif (envname == 'tableiii') or (envname == 'tableii'):
|
elif (envname == 'tableiii') or (envname == 'tableii'):
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, 'table')])]
|
chunk(PLAIN, ch.where, 'table')])]
|
||||||
i, length = i+2, length + 2
|
i, length = i+2, length + 2
|
||||||
|
@ -1471,13 +1484,18 @@ def changeit(buf, pp):
|
||||||
i, length = i+1, length+1
|
i, length = i+1, length+1
|
||||||
|
|
||||||
elif envname in ('funcdesc', 'excdesc', 'datadesc'):
|
elif envname in ('funcdesc', 'excdesc', 'datadesc'):
|
||||||
pp[i:i] = [
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
chunk(CSLINE, ch.where, 'end'),
|
|
||||||
chunk(GROUP, ch.where, [
|
chunk(GROUP, ch.where, [
|
||||||
chunk(PLAIN, ch.where, hist.command)])]
|
chunk(PLAIN, ch.where, hist.command)])]
|
||||||
i, length = i+2, length+2
|
i, length = i+2, length+2
|
||||||
|
|
||||||
elif envname in ('seealso', 'opcodedesc'):
|
elif envname == 'opcodedesc':
|
||||||
|
pp[i:i] = [chunk(CSLINE, ch.where, 'end'),
|
||||||
|
chunk(GROUP, ch.where, [
|
||||||
|
chunk(PLAIN, ch.where, "deffn")])]
|
||||||
|
i, length = i+2, length+2
|
||||||
|
|
||||||
|
elif envname in ('seealso', 'sloppypar', 'flushleft'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -1553,6 +1571,10 @@ def changeit(buf, pp):
|
||||||
del pp[i:newi]
|
del pp[i:newi]
|
||||||
length = length - (newi-i)
|
length = length - (newi-i)
|
||||||
|
|
||||||
|
elif s_buf_data == "fulllineitems":
|
||||||
|
del pp[i-1]
|
||||||
|
i, length = i-1, length-1
|
||||||
|
|
||||||
elif s_buf_data == 'item':
|
elif s_buf_data == 'item':
|
||||||
ch.chtype = chunk_type[CSLINE]
|
ch.chtype = chunk_type[CSLINE]
|
||||||
length, newi = getoptarg(length, buf, pp, i)
|
length, newi = getoptarg(length, buf, pp, i)
|
||||||
|
@ -1828,12 +1850,6 @@ def changeit(buf, pp):
|
||||||
del pp[i:newi]
|
del pp[i:newi]
|
||||||
length = length - (newi-i)
|
length = length - (newi-i)
|
||||||
|
|
||||||
## ingroupch.append(chunk(PLAIN, ch.where, ' '))
|
|
||||||
## ingroupch.append(chunk(CSNAME, ch.where, 'r'))
|
|
||||||
## ingroupch.append(chunk(GROUP, ch.where, [
|
|
||||||
## chunk(PLAIN, ch.where,
|
|
||||||
## '(built-in)')]))
|
|
||||||
|
|
||||||
pp.insert(i, chunk(GROUP, ch.where, ingroupch))
|
pp.insert(i, chunk(GROUP, ch.where, ingroupch))
|
||||||
length, i = length+1, i+1
|
length, i = length+1, i+1
|
||||||
|
|
||||||
|
@ -2048,13 +2064,30 @@ def changeit(buf, pp):
|
||||||
i = i - 1
|
i = i - 1
|
||||||
length = length + len(data) - 2
|
length = length + len(data) - 2
|
||||||
|
|
||||||
|
elif s_buf_data == "quad":
|
||||||
|
ch.chtype = PLAIN
|
||||||
|
ch.data = " "
|
||||||
|
|
||||||
elif s_buf_data in ('noindent', 'indexsubitem'):
|
elif s_buf_data in ('noindent', 'indexsubitem'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif s_buf_data == 'label':
|
elif s_buf_data == 'label':
|
||||||
|
name = s(buf, pp[i].data[0].data)
|
||||||
del pp[i-1:i+1]
|
del pp[i-1:i+1]
|
||||||
length = length - 2
|
length = length - 2
|
||||||
i = i - 1
|
i = i - 1
|
||||||
|
label_nodes[name] = hist.nodenames[-1]
|
||||||
|
|
||||||
|
elif s_buf_data == 'ref':
|
||||||
|
name = s(buf, pp[i].data[0].data)
|
||||||
|
if label_nodes.has_key(name):
|
||||||
|
pp[i].data[0].data = label_nodes[name]
|
||||||
|
else:
|
||||||
|
pp[i-1:i+1] = [
|
||||||
|
chunk(PLAIN, ch.where,
|
||||||
|
"(unknown node reference: %s)" % name)]
|
||||||
|
length = length - 1
|
||||||
|
print "WARNING: unknown node label", `name`
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "don't know what to do with keyword " + s_buf_data
|
print "don't know what to do with keyword " + s_buf_data
|
||||||
|
|
Loading…
Reference in New Issue