Commit 78d90f90 authored by GitHub Action's avatar GitHub Action
Browse files

Add links to terms decorated with `.HTML-Keyboard`

parent 15d8ac94
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -46,6 +46,10 @@
  color: #121619;
}

.HTML-Keyboard:hover {
    text-decoration: underline dotted;
  }

.HTML-Definition {
  font-style: italic;
}
+8 −0
Original line number Diff line number Diff line
@@ -762,6 +762,10 @@ body {
  color: rgb(62, 72, 79);
}

.HTML-Keyboard {
  font-size: 1.06em;
}

/* Headers
  ========================================================================== */

@@ -1454,6 +1458,10 @@ table.no-table-stripes tbody tr {
    color: #62eaea;
  }

  .HTML-Keyboard:hover {
    color: white;
  }

  pre {
    background-color: #e6e6e6;
    border-color: #252b2f;
+19 −0
Original line number Diff line number Diff line
@@ -829,6 +829,24 @@ def fix_custom_tags(soup: BeautifulSoup):
    return soup


def add_term_links(soup: BeautifulSoup):
    """
    Link Terms highlighted as HTML-Keyboard back to clause 3 term definitions
    """

    for term in soup.select(".HTML-Keyboard"):
        text = term.get_text(strip=False)

        a = soup.new_tag("a", href="./clause-3.html#3.1")
        a.string = text

        for k, v in term.attrs.items():
            a.attrs[k] = v

        term.replace_with(a)

    return soup

def fix_lists(soup: BeautifulSoup):
    """
    Fix lists that have been improperly nested due to markdown conversion.
@@ -1149,6 +1167,7 @@ def postprocess(html_dir: str, no_lazy_toc: bool = False):
                soup = move_figure_id_to_FL_elements(soup)
                soup = fix_custom_tags(soup)
                soup = fix_lists(soup)
                soup = add_term_links(soup)
                images, soup = extract_images_from_html(soup)
                for image_id, image_src in images.items():
                    images_mapping[image_src] = {