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

Make the glossary output less wide #460

Merged
merged 6 commits into from
Oct 21, 2023
Merged
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
21 changes: 0 additions & 21 deletions TODO.md

This file was deleted.

132 changes: 0 additions & 132 deletions config.toml

This file was deleted.

Empty file removed content/Root/_index.md
Empty file.
31 changes: 0 additions & 31 deletions content/_index.md

This file was deleted.

14 changes: 0 additions & 14 deletions content/glossary.md

This file was deleted.

15 changes: 0 additions & 15 deletions content/statistics.md

This file was deleted.

32 changes: 0 additions & 32 deletions content/substitutions/_index.md

This file was deleted.

37 changes: 0 additions & 37 deletions content/substitutions/referenced/_index.md

This file was deleted.

14 changes: 0 additions & 14 deletions content/todolist.md

This file was deleted.

15 changes: 8 additions & 7 deletions hugo/src/main/scala/com/reactific/riddl/hugo/HugoPass.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.collection.mutable

object HugoPass extends PassInfo {
val name: String = "hugo"
val geekDoc_version = "v0.40.1"
val geekDoc_version = "v0.41.2"
val geekDoc_file = "hugo-geekdoc.tar.gz"
val geekDoc_url = java.net.URI
.create(
Expand Down Expand Up @@ -94,12 +94,10 @@ case class HugoPass(input: PassInput, outputs: PassesOutput, state: HugoTranslat
case container: Definition =>
// Everything else is a container and definitely needs its own page
// and glossary entry.
state.addToGlossary(container, stack)
val (mkd, parents) = setUpContainer(container, state, stack)
container match {
case a: Application => mkd.emitApplication(a, stack)
case out: Output => state.addToGlossary(out, stack)
case in: Input => state.addToGlossary(in, stack)
case grp: Group => state.addToGlossary(grp, stack)
case t: Type => mkd.emitType(t, stack)
case s: State =>
val maybeType = refMap.definitionOf[Type](s.typ.pathId, s)
Expand All @@ -125,13 +123,16 @@ case class HugoPass(input: PassInput, outputs: PassesOutput, state: HugoTranslat
case s: Saga => mkd.emitSaga(s, parents)
case e: Epic => mkd.emitEpic(e, stack)
case uc: UseCase => mkd.emitUseCase(uc, stack)

// All of the bleow are handled above in the outer match statement, and within their
// respective containers
case _: Author | _: Enumerator | _: Field | _: Method | _: Term | _: Constant | _: Invariant | _: Replica |
_: Inlet | _: Outlet | _: Connector | _: SagaStep | _: User | _: Interaction | _: RootContainer |
_: Include[Definition] @unchecked =>
// All these are handled above in the outer match statement, and within their
// respective containers
case out: Output =>
case in: Input =>
case grp: Group =>
}
state.addToGlossary(container, stack)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,12 +968,12 @@ case class MarkdownWriter(filePath: Path, state: HugoTranslatorState) extends Te
else { "" }
}

private def emitTermRow(term: GlossaryEntry): Unit = {
val slink = makeIconLink("gdoc_github", "GitHub Link", term.sourceLink)
val trm = s"[${mono(term.term)}](${term.link})$slink"
val typ =
s"[${term.typ}](https://riddl.tech/concepts/${term.typ.toLowerCase}/)"
emitTableRow(trm, typ, term.brief)
private def emitTermRow(entry: GlossaryEntry): Unit = {
val source_link = makeIconLink("gdoc_github", "Source Link", entry.sourceLink)
val term = s"[${mono(entry.term)}](${entry.link})$source_link"
val concept_link =
s"[<small>${entry.kind.toLowerCase}</small>](https://riddl.tech/concepts/${entry.kind.toLowerCase}/)"
emitTableRow(term, concept_link, entry.brief)
}

def emitGlossary(
Expand Down Expand Up @@ -1041,7 +1041,7 @@ case class MarkdownWriter(filePath: Path, state: HugoTranslatorState) extends Te

case class GlossaryEntry(
term: String,
typ: String,
kind: String,
brief: String,
path: Seq[String],
link: String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class MarkdownWriterTest extends HugoTestBase {
|---
|| Term | Type | Brief Description |
|| :---: | :---: | :--- |
|| [`one`](A/B/one)[{{< icon "gdoc_github" >}}](https://example.com/blob/main/src/main/riddl/one "GitHub Link") | [Term](https://riddl.tech/concepts/term/) | The first term |
|| [`two`](A/B/C/two)[{{< icon "gdoc_github" >}}](https://example.com/blob/main/src/main/riddl/two "GitHub Link") | [Term](https://riddl.tech/concepts/term/) | The second term |
|| [`one`](A/B/one)[{{< icon "gdoc_github" >}}](https://example.com/blob/main/src/main/riddl/one "Source Link") | [<small>term</small>](https://riddl.tech/concepts/term/) | The first term |
|| [`two`](A/B/C/two)[{{< icon "gdoc_github" >}}](https://example.com/blob/main/src/main/riddl/two "Source Link") | [<small>term</small>](https://riddl.tech/concepts/term/) | The second term |
|""".stripMargin
output mustBe expected
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ object AST { // extends ast.AbstractDefinitions with ast.Definitions with ast.Op
with FunctionDefinition
with ProjectorDefinition {
override def format: String = s"${id.format}(${args.map(_.format).mkString(", ")}): ${typeEx.format}"
final val kind: String = "Field"
final val kind: String = "Method"
}

/** A type expression that contains an aggregation of fields
Expand Down
Loading