1.1 --- a/moinformat/links/html.py Fri Feb 08 22:35:46 2019 +0100
1.2 +++ b/moinformat/links/html.py Fri Feb 08 22:36:21 2019 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 HTML linking scheme.
1.6
1.7 -Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2018, 2019 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -106,7 +106,6 @@
1.13 # Split the pagename into path components.
1.14
1.15 t = target.split("#", 1)
1.16 - p = t[0].rstrip("/").split("/")
1.17
1.18 # Determine the actual pagename referenced.
1.19 # Replace the root pagename if it appears.
1.20 @@ -173,6 +172,7 @@
1.21 encoding fragment identifiers.
1.22 """
1.23
1.24 + s = self.replace_whitespace(s)
1.25 parts = s.split("#", 1)
1.26
1.27 if len(parts) > 1:
1.28 @@ -180,6 +180,19 @@
1.29
1.30 return "#".join(map(quote, parts))
1.31
1.32 + # Whitespace conversion in pagenames.
1.33 +
1.34 + def replace_whitespace(self, pagename):
1.35 +
1.36 + "Map whitespace in 'pagename' to appropriate characters."
1.37 +
1.38 + wsmap = self.metadata.get("whitespace", self.default_whitespace_map)
1.39 +
1.40 + for old, new in wsmap:
1.41 + pagename = pagename.replace(old, new)
1.42 +
1.43 + return pagename
1.44 +
1.45 # Identifier encoding.
1.46
1.47 def make_id(self, s):