projects
/
lttng-docs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
docs2json: no errors/warnings with simple anchors
[lttng-docs.git]
/
tools
/
docs2json.py
diff --git
a/tools/docs2json.py
b/tools/docs2json.py
index 661ef6535b83074ef0568046b8b522cdacba7562..66977ffa14847ca2a2422e43755bbe13f8cd9f80 100755
(executable)
--- a/
tools/docs2json.py
+++ b/
tools/docs2json.py
@@
-206,6
+206,7
@@
def _get_sid_from_file(path, c):
_ilink_re = re.compile(r'\[[^\]]+\]\(([^)]+)\)', flags=re.M)
_elink_re = re.compile(r'<a(?:\s+[^>]+|\s*)>')
_ilink_re = re.compile(r'\[[^\]]+\]\(([^)]+)\)', flags=re.M)
_elink_re = re.compile(r'<a(?:\s+[^>]+|\s*)>')
+_name_re = re.compile(r'name="([^"]+)"')
_href_re = re.compile(r'href="([^"]+)"')
_classes_re = re.compile(r'class="([^"]+)"')
_href_re = re.compile(r'href="([^"]+)"')
_classes_re = re.compile(r'class="([^"]+)"')
@@
-223,8
+224,13
@@
def _register_section_info(registry, toc_ids, path, c):
for link in elinks:
href = _href_re.search(link)
for link in elinks:
href = _href_re.search(link)
+ name = _name_re.search(link)
classes = _classes_re.search(link)
classes = _classes_re.search(link)
+ if name and not href:
+ # simple anchor
+ continue
+
if classes is None:
_pwarn(path, 'External link has no "ext" class: "{}"'.format(link))
classes = []
if classes is None:
_pwarn(path, 'External link has no "ext" class: "{}"'.format(link))
classes = []
@@
-240,15
+246,15
@@
def _register_section_info(registry, toc_ids, path, c):
href = href.group(1)
if href.startswith('#') and 'int' not in classes:
href = href.group(1)
if href.startswith('#') and 'int' not in classes:
- _pwarn(path, 'External link starts with #: "{}"'.format(href
.group(1)
))
+ _pwarn(path, 'External link starts with #: "{}"'.format(href))
if 'int' in classes:
ilinks.append(href)
continue
section_info.add_out_link(_ExtLink(href))
if 'int' in classes:
ilinks.append(href)
continue
section_info.add_out_link(_ExtLink(href))
- el
s
e:
- _perror(path, 'External link with no "href" attribute: "{}"'.format(link))
+ el
if not nam
e:
+ _perror(path, 'External link with no "href"
or "name"
attribute: "{}"'.format(link))
ret = False
for link in ilinks:
ret = False
for link in ilinks:
This page took
0.039602 seconds
and
4
git commands to generate.