浏览代码

Not perfect, but slightly better template param space guessing (#155)

tags/v0.5
Ben Kurtovic 6 年前
父节点
当前提交
7308c8055e
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. +5
    -0
      mwparserfromhell/nodes/template.py

+ 5
- 0
mwparserfromhell/nodes/template.py 查看文件

@@ -136,6 +136,11 @@ class Template(Node):
component = str(param.value)
match = re.search(r"^(\s*).*?(\s*)$", component, FLAGS)
before, after = match.group(1), match.group(2)
if not use_names and component.isspace() and "\n" in before:
# If the value is empty, we expect newlines in the whitespace
# to be after the content, not before it:
before, after = before.split("\n", 1)
after = "\n" + after
before_theories[before] += 1
after_theories[after] += 1



正在加载...
取消
保存