diff --git a/src/parse.py b/src/parse.py index 19c4505..6dbd3df 100644 --- a/src/parse.py +++ b/src/parse.py @@ -457,7 +457,9 @@ def parse_manual(self, scope, f): if ref == topref: ref.flags['display'] = heading ref.update() - symbol = re.sub(r'[^a-zA-Z0-9 ]', '', heading.lower()).replace(' ', '_') + # Symbol is used for URL fragment + symbol = re.sub(r'[^a-zA-Z0-9- ]', '', heading.lower()) + symbol = re.sub(r' +', '_', symbol).replace('_-_', '-') ref = Reference(self, file=path, line=n, type='section', scopes=[topref], symbol=symbol) ref.flags['display'] = heading ref.flags['level'] = level