File vimd2h.py changed (mode: 100755) (index fe7dc7e..f6970ce) |
... |
... |
class Link(object): |
71 |
71 |
class VimDoc2HTML(object): |
class VimDoc2HTML(object): |
72 |
72 |
def __init__(self, tags, version=None): |
def __init__(self, tags, version=None): |
73 |
73 |
self._urls = { } |
self._urls = { } |
|
74 |
|
self._urlsCI = { } |
74 |
75 |
self._version = version |
self._version = version |
75 |
76 |
for line in RE_NEWLINE.split(tags): |
for line in RE_NEWLINE.split(tags): |
76 |
77 |
m = RE_TAGLINE.match(line) |
m = RE_TAGLINE.match(line) |
|
... |
... |
class VimDoc2HTML(object): |
92 |
93 |
elif special is not None: classattr = ' class="s"' |
elif special is not None: classattr = ' class="s"' |
93 |
94 |
link_plain = part1 + classattr + part2 |
link_plain = part1 + classattr + part2 |
94 |
95 |
self._urls[tag] = Link(link_pipe, link_plain) |
self._urls[tag] = Link(link_pipe, link_plain) |
|
96 |
|
self._urlsCI[tag.lower()] = True |
95 |
97 |
|
|
96 |
98 |
def maplink(self, tag, css_class=None): |
def maplink(self, tag, css_class=None): |
97 |
99 |
links = self._urls.get(tag) |
links = self._urls.get(tag) |
|
... |
... |
class VimDoc2HTML(object): |
100 |
102 |
else: return links.link_plain |
else: return links.link_plain |
101 |
103 |
elif css_class is not None: |
elif css_class is not None: |
102 |
104 |
if css_class == 'l': |
if css_class == 'l': |
103 |
|
print('Unresolved reference: |%s|' % tag) |
|
|
105 |
|
lowerTag = tag.lower() |
|
106 |
|
if lowerTag in self._urlsCI: |
|
107 |
|
print('Unresolved reference: |%s|' % tag) |
|
108 |
|
for key in self._urls: |
|
109 |
|
if key.lower() == lowerTag: |
|
110 |
|
print(' - tag with different case: |%s|' % key) |
|
111 |
|
else: |
|
112 |
|
print('Unresolved reference: |%s|' % tag) |
104 |
113 |
|
|
105 |
114 |
return '<span class="' + css_class + '">' + html_escape[tag] + \ |
return '<span class="' + css_class + '">' + html_escape[tag] + \ |
106 |
115 |
'</span>' |
'</span>' |