Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

562 revise navigation column in hugo output #565

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions hugo/src/main/scala/com/ossuminc/riddl/hugo/HugoPass.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,19 @@ case class HugoPass(
loadStaticAssets(inputPath, options)
}

private def makeNavigation(root: Root, contentRoot: Path): Unit = {

}

private def makeIndex(root: Root): Unit = {
Timer.time("Index Creation") {

val mdw = addFile(Seq.empty[String], "_index.md")
mdw.fileHead("Index", 10, Option("The main index to the content"))
mdw.h2("Root Overview")
val diagram = RootOverviewDiagram(root)
mdw.emitMermaidDiagram(diagram.generate)
mdw.h2("Domains")
val domains = root.domains
val domains = (root.domains ++ root.includes.flatMap(_.contents.filter[Domain]))
.sortBy(_.id.value)
.map(d => s"[${d.id.value}](${d.id.value.toLowerCase}/)")
mdw.list(domains)
Expand Down
13 changes: 2 additions & 11 deletions hugo/src/main/scala/com/ossuminc/riddl/hugo/PassUtilities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ trait PassUtilities {
def options: HugoCommand.Options
val inputFile: Option[Path] = options.inputFile
protected val messages: Messages.Accumulator

lazy val newline: String = System.getProperty("line.separator")


def makeFullName(definition: Definition): String = {
val defs = outputs.symbols.parentsOf(definition).reverse :+ definition
defs.map(_.id.format).mkString(".")
}

def makeParents(stack: Seq[Definition]): Seq[Definition] = {
private def makeParents(stack: Seq[Definition]): Seq[Definition] = {
// The stack goes from most nested to highest. We don't want to change the
// stack (its mutable) so we copy it to a Seq first, then reverse it, then
// drop all the root containers (file includes) to finally end up at a domin
Expand All @@ -32,13 +30,6 @@ trait PassUtilities {
makeParents(stack).map(_.id.format)
}

def makeBreadCrumbs(parents: Seq[Definition]): String = {
parents.map { defn =>
val link = makeDocLink(defn, parents.map(_.id.value))
s"[${defn.id.value}]($link)"
}.mkString("/")
}

def makeDocLink(definition: NamedValue): String = {
val parents = makeStringParents(outputs.symbols.parentsOf(definition))
makeDocLink(definition, parents)
Expand Down
Loading