[PATCH] Multiple placeholder replacement

19 views
Skip to first unread message

Peter Johnson

unread,
Jul 23, 2009, 2:47:34 AM7/23/09
to asciidoc
When a nested replacement occurs in a macro, only the first
placeholder of each number is replaced; the rest are left as the \x07-
delimited number in the output. This is particularly noticeable with
indexterm docbook output, where the primary is repeated (for inline
version) or the secondary is repeated (for all).

Test input:
((`foo`))
(((foo,`bar`)))

Patch (against 8.4.5):
--- asciidoc.py.orig 2009-07-22 23:38:42.000000000 -0700
+++ asciidoc.py 2009-07-22 23:38:55.000000000 -0700
@@ -3326,7 +3326,7 @@
""" Replace passthough placeholders with the original
passthrough
text."""
for i,v in enumerate(self.passthroughs):
- text = text.replace('\x07'+str(i)+'\x07',
self.passthroughs[i], 1)
+ text = text.replace('\x07'+str(i)+'\x07',
self.passthroughs[i])
return text

class Macro:

Stuart Rackham

unread,
Aug 27, 2009, 6:25:32 PM8/27/09
to asci...@googlegroups.com
Peter Johnson wrote:
> When a nested replacement occurs in a macro, only the first
> placeholder of each number is replaced; the rest are left as the \x07-
> delimited number in the output. This is particularly noticeable with
> indexterm docbook output, where the primary is repeated (for inline
> version) or the secondary is repeated (for all).
>
> Test input:
> ((`foo`))
> (((foo,`bar`)))

Hi Peter

Thank you very much for spotting this bug, I've added your patch to the
trunk:
http://hg.sharesource.org/asciidoc/rev/97207925a295

Cheers, Stuart
Reply all
Reply to author
Forward
0 new messages