Running the following code snippet yields something unexpected
p = wikitextparser.parse("{{A|a=\n\nx\n\n|b=xxx}}")
print(p)
t = p.templates[0]
t.set_arg("a", t.get_arg("a").value)
print(p)
Since the second to last line sets an argument to itself, I was expecting that p stays the same in both print statements. However, 4 lines instead of 2 are padded to "x" both before and after it. I'm wondering if this is the expected behavior or a bug.
The workaround is quite simple since we just have to do t.get_arg("a").value.strip() to get rid of the extra lines, but I'm wondering if this can be fixed. Thank you!
One concern is that a fix might also break the behavior of previously written programs that rely on the fact that wikitextparser doubles newlines.
Running the following code snippet yields something unexpected
Since the second to last line sets an argument to itself, I was expecting that
pstays the same in both print statements. However, 4 lines instead of 2 are padded to "x" both before and after it. I'm wondering if this is the expected behavior or a bug.The workaround is quite simple since we just have to do
t.get_arg("a").value.strip()to get rid of the extra lines, but I'm wondering if this can be fixed. Thank you!One concern is that a fix might also break the behavior of previously written programs that rely on the fact that
wikitextparserdoubles newlines.