changeit(): Added support for \deprecated{}.
Chunk.__repr__(), main(): Allow Chunk objects to get the buffer, to make the
representation contain text instead of a pair of indexes. This makes debugging
a little easier.
diff --git a/Doc/tools/partparse.py b/Doc/tools/partparse.py
index d3b850f..33e4ad4 100644
--- a/Doc/tools/partparse.py
+++ b/Doc/tools/partparse.py
@@ -197,8 +197,14 @@
self.where = where
self.data = data
+ __datatypes = [chunk_type[CSNAME], chunk_type[PLAIN], chunk_type[CSLINE]]
+
def __repr__(self):
- return 'chunk' + `self.chtype, self.where, self.data`
+ if self.chtype in self.__datatypes:
+ data = s(self.buf, self.data)
+ else:
+ data = self.data
+ return 'chunk' + `self.chtype, self.where, data`
# and the wrapper
chunk = Chunk
@@ -2142,6 +2148,26 @@
i = i - 1
length = length + len(data) - 2
+ elif s_buf_data == 'deprecated':
+ length, newi = getnextarg(length, buf, pp, i)
+ version = pp[i:newi][0]
+ print "version =", version
+ length, newi2 = getnextarg(length, buf, pp, newi)
+ action = pp[newi:newi2]
+ print "action =", action
+ del pp[i-1:newi2]
+ length = length - (newi2 - i) - 1
+ stuff = [chunk(PLAIN, ch.where, 'Deprecated since release '),
+ version,
+ chunk(PLAIN, ch.where, '.')]
+ chunks = [chunk(CSNAME, ch.where, 'strong'),
+ chunk(GROUP, ch.where, stuff),
+ chunk(PLAIN, ch.where, ' ')] + action \
+ + [chunk(DENDLINE, ch.where, '\n')]
+ i = i - 1
+ pp[i:i] = chunks
+ length = length + len(chunks)
+
elif s_buf_data == "quad":
ch.chtype = PLAIN
ch.data = " "
@@ -2341,6 +2367,7 @@
for file in args:
if len(args) > 1: print '='*20, file, '='*20
buf = open(file, 'r').read()
+ chunk.buf = buf
w, pp = parseit(buf)
startchange()
changeit(buf, pp)