Skip to content

Commit

Permalink
[site] Add dynamic section table
Browse files Browse the repository at this point in the history
Shortcode for inserting a generated table of content for the current
folder.
This can be used in Markdown files in order to have an always up-to-date
list of the content of the folder.

Supports a "type" parameter which can be set to "section" in order to
list only subsection. Will ignore other content such as normal pages.
Parameter "depth" controls the level to which the content is listed.
Defaults to two if not set.

Fixes lowRISC#1419

Signed-off-by: Tobias Wölfel <[email protected]>
  • Loading branch information
towoe committed Jun 4, 2020
1 parent 9bdd987 commit a47a415
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 104 deletions.
17 changes: 1 addition & 16 deletions _index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,4 @@ Unless otherwise noted, everything in the repository is covered by the Apache Li

## Documentation Sections

* [General]({{< relref "doc" >}})
* Project
* User Guides
* Reference Manuals
* Security
* [Hardware Dashboard]({{< relref "hw" >}})
* Design specifications
* Verification plans
* Results of tool-flows
* Comportable IPs
* Processor cores
* Top level designs
* [Software]({{< relref "sw" >}})
* READMEs of OpenTitan software
* [Tools]({{< relref "util" >}})
* READMEs of OpenTitan tools
{{% sectionContent type="section" depth="1" %}}
21 changes: 1 addition & 20 deletions doc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,4 @@
title: "General Documentation"
---

* [Project]({{< relref "doc/project" >}})
* How the OpenTitan project is organized
* Hardware development stages
* Hardware signoff checklist
* Governance
* RFC process
* Committers
* [User Guides]({{< relref "doc/ug" >}})
* How to get started with the repo
* How to emulate on an FPGA
* How hardware design is done in OpenTitan
* How verification is done in OpenTitan
* [Reference Manuals]({{< relref "doc/rm" >}})
* Defining comportable IP peripherals
* Coding style guides for Verilog, Python, Hjson, C/C++ and Markdown
* OpenTitan tools
* [Security Docs]({{< relref "doc/security" >}})
* Overview
* Use cases
* Logical security documents
{{% sectionContent %}}
43 changes: 1 addition & 42 deletions doc/ug/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,4 @@
title: "User Guides"
---

* Getting Started
* [Getting started]({{< relref "getting_started.md" >}})
* [Quickstart]({{< relref "quickstart.md" >}})
* [Notes on using GitHub and local git]({{< relref "github_notes.md" >}})
* [Directory Structure]({{< relref "directory_structure.md" >}})
* [Installing Build Requirements]({{< relref "install_instructions" >}})
* [Build software]({{< relref "getting_started_sw.md" >}})
* [Getting started with Verilator]({{< relref "getting_started_verilator.md" >}})
* [Getting started on FPGAs]({{< relref "getting_started_fpga.md" >}})
* [Obtaining an FPGA board]({{< relref "fpga_boards.md" >}})
* [Installing Xilinx Vivado]({{< relref "install_instructions#xilinx-vivado" >}})
* [Getting started with a design]({{< relref "getting_started_design.md" >}})
* [Getting started with verification]({{< relref "getting_started_dv.md" >}})
* [Building documentation]({{< relref "documentation.md" >}})
* [Work with hardware code in external repositories]({{< relref "vendor_hw.md" >}})
* [Design Methodology]({{< relref "design.md" >}})
* Language and Tool Selection
* Comportability and the Importance of Architectural Conformity
* Defining Design Complete: stages and tracking
* Documentation
* Usage of Register Tool
* Linting Methodology
* Assertions Methodology
* CDC Methodology
* DFT
* Generated Code
* FPGA vs ASIC
* [Design Verification Methodology]({{< relref "doc/ug/dv_methodology" >}})
* Language and Tool Selection
* Defining Verification Complete: Stages and Checklists
* Documentation
* Automation
* Code Reuse
* DV Efforts in OpenTitan
* Key Test Focus Areas
* Assertions
* Regressions
* Coverage Collection
* FPV
* Reviews
* Filing Issues
* Pending Work Items
{{% sectionContent %}}
5 changes: 5 additions & 0 deletions site/docs/assets/scss/_sectioncontent.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.sectioncontent {
li {
list-style-type: none;
}
}
1 change: 1 addition & 0 deletions site/docs/assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
@import "highlight";
@import "menu";
@import "parents";
@import "sectioncontent";
48 changes: 48 additions & 0 deletions site/docs/layouts/shortcodes/sectionContent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<div class="sectioncontent">
{{- $contentType := "all"}}
{{- if eq (.Get "type") "section" }}
{{- $contentType = "section" }}
{{- end}}
{{- $depthLimit := 2 }}
{{- with .Get "depth" }}
{{- $depthLimit = . }}
{{- end }}

{{- $startSection := .Page.Page }}
<ul>
{{- range .Page.Pages }}
{{- template "subsection-loop" dict "startSection" $startSection "currentSection" . "contentType" $contentType "depthLimit" $depthLimit "depthCnt" 0 }}
{{- end }}
</ul>
</div>

{{- define "subsection-loop" }}
{{- $startSection := .startSection }}
{{- $currentSection := .currentSection }}
{{- $contentType := .contentType }}
{{- $depthLimit := .depthLimit }}
{{- $depthCnt := add .depthCnt 1 }}

{{- with .startSection }}
<li>
{{- with $currentSection }}
{{- if (or (not (eq $contentType "section")) .IsSection) }}
{{- if .LinkTitle }}
<a href="{{.RelPermalink}}">{{- .LinkTitle }}</a>
{{- else }}
{{- replace .File.Dir .Parent.File.Dir "" | replaceRE "/" "-" | replaceRE "-$" ":" }}
<a href="{{.RelPermalink}}">{{- .File.TranslationBaseName }}</a>
{{- end }}
{{- end }}
{{- end }}
{{- if lt $depthCnt $depthLimit }}
<ul>
{{- $subsc := newScratch }}
{{- range $currentSection.Pages }}
{{- template "subsection-loop" dict "startSection" $startSection "currentSection" . "contentType" $contentType "depthLimit" $depthLimit "depthCnt" $depthCnt}}
{{- end }}
</ul>
{{- end }}
</li>
{{- end }}
{{- end }}
25 changes: 8 additions & 17 deletions sw/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@ More description and information can be found within the [Reference Manual]({{<

## Software READMEs

* General build instruction [README.md]({{< relref "sw/README.md" >}})
* Hello World example [README.md]({{< relref "sw/device/examples/hello_world/README.md" >}})
* Boot ROM Overview [README.md]({{< relref "sw/device/boot_rom/README.md" >}})
* SPI Flash [README.md]({{< relref "sw/host/spiflash/README.md" >}})
* Device Tests [README.md]({{< relref "sw/device/tests/README.md" >}})
* OpenTitan Software Library
* Standard Library [README.md]({{< relref "sw/device/lib/base/README.md" >}})
* Freestanding C Headers [README.md]({{< relref "sw/device/lib/base/freestanding/README.md" >}})
* Runtime Library [README.md]({{< relref "sw/device/lib/runtime/README.md" >}})
* Device-specific Symbols [README.md]({{< relref "sw/device/lib/arch/README.md" >}})
* DIF Library [README.md]({{< relref "sw/device/lib/dif/README.md" >}})
* CoreMark benchmark [README.md]({{< relref "sw/device/benchmarks/coremark/README.md" >}})
* Vendor in code see [HW vendor User Guide]({{< relref "doc/ug/vendor_hw.md" >}})
* [CoreMark](https://github.com/eembc/coremark)
* [RISC-V Compliance](https://github.com/riscv/riscv-compliance)
* [Google Test](https://github.com/google/googletest)
* [Cryptoc](https://chromium.googlesource.com/chromiumos/third_party/cryptoc/)
{{% sectionContent %}}

## Vendor in code see [HW vendor User Guide]({{< relref "doc/ug/vendor_hw.md" >}})

* [CoreMark](https://github.com/eembc/coremark)
* [RISC-V Compliance](https://github.com/riscv/riscv-compliance)
* [Google Test](https://github.com/google/googletest)
* [Cryptoc](https://chromium.googlesource.com/chromiumos/third_party/cryptoc/)
10 changes: 1 addition & 9 deletions util/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,4 @@ More description and information can be found within the [Reference Manual]({{<

## Utility READMEs

* Docker Container [README]({{< relref "util/container/README.md" >}})
* FPGA splice utility [README]({{< relref "util/fpga/README.md" >}})
* `build_docs.py` documentation build tool [user guide]({{< relref "doc/ug/documentation.md" >}})
* `reggen.py` register generator tool [README]({{< relref "util/reggen/README.md" >}})
* `spitest.py` script for interacting with SPI device code [README]({{< relref "util/simplespi/README.md" >}})
* `testplanner.py` utility for generating verification testplans from Hjson descriptors [README]({{< relref "util/dvsim/testplanner/README.md" >}})
* `tlgen.py` utility for TileLink bus matrix [README]({{< relref "util/tlgen/README.md" >}})
* `uvmdvgen.py` utility for generating testbenches for comportable IP [README]({{< relref "util/uvmdvgen/README.md" >}})
* `fpvgen.py` utility for generating FPV testbenches for comportable IP [README]({{< relref "util/fpvgen/README.md" >}})
{{% sectionContent %}}

0 comments on commit a47a415

Please sign in to comment.