diff --git a/hyperglass/render/html.py b/hyperglass/render/html.py
index 47fecb1..5376c3f 100644
--- a/hyperglass/render/html.py
+++ b/hyperglass/render/html.py
@@ -105,26 +105,54 @@ ets/traceroute_nanog.pdf" target="_blank">click here.
}
-def generate_markdown(section, file_name):
+default_help = """
+---
+template: default_help
+---
+##### BGP Route
+Performs BGP table lookup based on IPv4/IPv6 prefix.
+
+##### BGP Community
+Performs BGP table lookup based on Extended or Large community value.
+
+##### BGP AS Path
+Performs BGP table lookup based on `AS_PATH` regular expression.
+
+##### Ping
+Sends 5 ICMP echo requests to the target.
+
+##### Traceroute
+Performs UDP Based traceroute to the target.
For information about how to \
+interpret traceroute results, click here.
+"""
+
+
+def generate_markdown(section, file_name=None):
"""
Renders markdown as HTML. If file_name exists in appropriate
directory, it will be imported and used. If not, the default values
will be used. Also renders the Front Matter values within each
template.
"""
- if section == "info":
- file = working_directory.joinpath(f"templates/info/{file_name}.md")
- defaults = default_info
+ if section == "help":
+ file = working_directory.joinpath("templates/info/help.md")
+ if file.exists():
+ with file.open(mode="r") as file_raw:
+ yaml_raw = file_raw.read()
+ else:
+ yaml_raw = default_help
elif section == "details":
file = working_directory.joinpath(f"templates/info/details/{file_name}.md")
- defaults = default_details
- if file.exists():
- with file.open(mode="r") as file_raw:
- yaml_raw = file_raw.read()
- else:
- yaml_raw = defaults[file_name]
+ if file.exists():
+ with file.open(mode="r") as file_raw:
+ yaml_raw = file_raw.read()
+ else:
+ yaml_raw = default_details[file_name]
_, frontmatter, content = yaml_raw.split("---", 2)
- html_classes = {"table": "ui compact table"}
+ html_classes = {"table": "table"}
markdown = Markdown(
extras={
"break-on-newline": True,
@@ -169,15 +197,17 @@ def render_html(template_name, **kwargs):
details_data = generate_markdown("details", details_name)
details_dict.update({details_name: details_data})
info_list = ["bgp_route", "bgp_aspath", "bgp_community", "ping", "traceroute"]
- info_dict = {}
- for info_name in info_list:
- info_data = generate_markdown("info", info_name)
- info_dict.update({info_name: info_data})
+ rendered_help = generate_markdown("help")
+ logger.debug(rendered_help)
try:
template_file = f"templates/{template_name}.html.j2"
template = env.get_template(template_file)
return template.render(
- params, info=info_dict, details=details_dict, networks=networks, **kwargs
+ params,
+ rendered_help=rendered_help,
+ details=details_dict,
+ networks=networks,
+ **kwargs,
)
except jinja2.TemplateNotFound as template_error:
logger.error(
diff --git a/hyperglass/render/templates/base.html.j2 b/hyperglass/render/templates/base.html.j2
index 75e8c7a..c5b729e 100644
--- a/hyperglass/render/templates/base.html.j2
+++ b/hyperglass/render/templates/base.html.j2
@@ -29,7 +29,7 @@
{% block content %}
{% endblock %}
-