<p>
<span class="t">Tip:</span>You can avoid using <code>sudo</code> in
the previous and following commands if your user is part of the
- <a href="/docs/#doc-lttng-sessiond"><code>tracing</code> group</a>.
+ <a href="/docs/#doc-lttng-sessiond" class="int"><code>tracing</code> group</a>.
</p>
</div>
<a href="https://github.com/lttng/lttng-docs" class="ext">public</a>.
```
+Sometimes, however, it is necessary to write internal links in plain
+HTML, for example in tip blocks, since Markdown code is not processed.
+In these cases, add the `int` CSS class as a hint to prevent the static
+analyzer from complaining (`tools/checkdocs.py`).
+
#### abbreviations
def _check_file_links(toc_ids, path, c):
ilinkp = re.compile(r'\[[^\]]+\]\(([^)]+)\)', flags=re.M)
- elinkp = re.compile(r'href="([^"]+)"')
+ elinkp = re.compile(r'<a\s+[^>]+>')
ret = True
_perror(path, 'Dead internal link: "{}"'.format(link))
ret = False
+ hrefp = re.compile(r'href="([^"]+)"')
+ classesp = re.compile(r'class="([^"]+)"')
+
for link in elinks:
- if link.startswith('#'):
- _pwarn(path, 'External link starts with #: "{}"'.format(link))
+ href = hrefp.search(link)
+ classes = classesp.search(link)
+
+ if classes is None:
+ _pwarn(path, 'External link has no "ext" class: "{}"'.format(link))
+ else:
+ classes = classes.group(1).split(' ')
+
+ if 'int' not in classes and 'ext' not in classes:
+ _pwarn(path, 'External link has no "ext" class: "{}"'.format(link))
+
+ if href is not None:
+ if href.group(1).startswith('#'):
+ _pwarn(path, 'External link starts with #: "{}"'.format(href))
+ else:
+ _perror(path, 'External link with no "href": "{}"'.format(link))
ret = False
return ret