Fix search plugin link and block links to search page in changelog

develop
lethosor 2018-04-05 11:02:14 -04:00
parent 1badadf535
commit ef7dc06221
2 changed files with 23 additions and 1 deletions

@ -26,6 +26,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
are not of interest to users of stable builds only. are not of interest to users of stable builds only.
- Three ``[`` characters indicate the start of a block (possibly a comment) that - Three ``[`` characters indicate the start of a block (possibly a comment) that
spans multiple lines. Three ``]`` characters indicate the end of such a block. spans multiple lines. Three ``]`` characters indicate the end of such a block.
- ``!`` immediately before a blacklisted phrase (see gen_changelog.py) allows that occurrence only.
===end ===end
]]] ]]]
@ -38,7 +39,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes ## Fixes
- `liquids`: fixed "range" command to default to 1 for dimensions consistently - `liquids`: fixed "range" command to default to 1 for dimensions consistently
- `search`: fixed 4/6 keys in unit screen search - `search-plugin`: fixed 4/6 keys in unit screen search
================================================================================ ================================================================================
# 0.44.09-r1 # 0.44.09-r1

@ -19,6 +19,19 @@ CHANGELOG_SECTIONS = [
'Ruby', 'Ruby',
] ]
BLACKLIST = [
'`search`',
]
def find_all_indices(string, substr):
start = 0
while True:
i = string.find(substr, start)
if i == -1:
return
yield i
start = i + 1
class ChangelogEntry(object): class ChangelogEntry(object):
def __init__(self, text, section, stable_version, dev_version): def __init__(self, text, section, stable_version, dev_version):
text = text.lstrip('- ') text = text.lstrip('- ')
@ -57,6 +70,14 @@ def parse_changelog():
for line_id, line in enumerate(f.readlines()): for line_id, line in enumerate(f.readlines()):
line_id += 1 line_id += 1
for phrase in BLACKLIST:
for i in find_all_indices(line, phrase):
if i == 0 or line[i - 1] != '!':
raise ValueError(
'changelog.txt:%i: blacklisted phrase: %r' %
(line_id, phrase))
line = line.replace('!' + phrase, phrase)
if multiline: if multiline:
multiline += line multiline += line
elif '[[[' in line: elif '[[[' in line: