Commit 8cb94cc1 authored by Jason Fox's avatar Jason Fox
Browse files

Add mobile nav

parent 29a5cc93
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
@@ -239,10 +239,36 @@ flex-item:has(#TOC):after {
  margin: auto;
}

.mobile-nav {
  display: none;
}

@media screen and (max-width: 600px) {
  #TOC {
    width: 100%;
    left: -100%;
    width: 100vw;
    left: -56vw;
    top: -40px;
  }

  .mobile-nav {
    background-color: #02488d;
    
    padding-bottom: 0.3em;
    font-size: 2em;
    font-family: "Maven Pro";
    display: block;
    left: -10px;
    position: absolute;
    top: 0px;
    width: 100vw;
    margin-left: 10px;
    padding-left: 20px;
    font-weight: 700;
    border-bottom: 1px white solid;
  }

  .mobile-nav a {
     color: rgb(255, 255, 255);
  }
}

+15 −0
Original line number Diff line number Diff line
@@ -17,6 +17,20 @@ informative_file = "clause-2"
files_with_references = [normative_file, informative_file]


def add_mobile_header(soup: BeautifulSoup,  document_title: str):
    h1 = soup.find("div", id="editor").find("h1")

    if h1: 
        div = soup.new_tag("div", attrs={"class": "mobile-nav"})

        link = soup.new_tag("a", href=".")
        link.string = document_title
        div.append(link)
        h1.insert_before(div)

    return soup


# region Helpers
def remove_code_blocks_with_only_images(soup: BeautifulSoup):
    """
@@ -1147,6 +1161,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_mobile_header(soup, document_title)
                images, soup = extract_images_from_html(soup)
                for image_id, image_src in images.items():
                    images_mapping[image_src] = {