Explorer

html-ui.docs-page

description
/docs and /docs/<name>: the documents of definy (the String parts of the module docs on the main of the project docs, in Markdown). /docs lists them and /docs/<name> shows docs.<name> with markdown.to-html
type
Fn(language: String, name: String) -> @definy.service-io
expression
fn(language$0, name$1) =>
  @definy.read-branch-snapshot(
    project: "docs",
    branch: "main",
    then: fn(commit$2, commits$3) =>
      match $2 {
        #none(_) =>
          @html-ui.not-found(language: $0, path: @core.string-concat(left: "/docs/", right: $1)),
        #some(found$4) =>
          match @core.equal(left: $1, right: "") {
            true =>
              @html-ui.docs-index-page(language: $0, names: @definy.snapshot-part-names(commits: [$4])),
            false =>
              match @definy.snapshot-part-find(commits: [$4], name: @core.string-concat(left: "docs.", right: $1), index: 0) {
                #none(_) =>
                  @html-ui.not-found(language: $0, path: @core.string-concat(left: "/docs/", right: $1)),
                #some(part$5) =>
                  @definy.read-part-contents(
                    parts: [$5.part],
                    then: fn(parts$6) =>
                      match @core.list-get(list: $6, index: 0) {
                        #none(_) =>
                          @html-ui.not-found(language: $0, path: @core.string-concat(left: "/docs/", right: $1)),
                        #some(resolved$7) =>
                          match $7.content {
                            #none(_) =>
                              @html-ui.not-found(language: $0, path: @core.string-concat(left: "/docs/", right: $1)),
                            #some(content$8) =>
                              match $8.expression {
                                #none(_) =>
                                  @html-ui.not-found(language: $0, path: @core.string-concat(left: "/docs/", right: $1)),
                                #some(expression$9) =>
                                  match $9 {
                                    #string(text$10) =>
                                      @html-ui.docs-document-page(language: $0, name: $1, part_id: $5.part.id, text: $10),
                                    _ =>
                                      @html-ui.not-found(language: $0, path: @core.string-concat(left: "/docs/", right: $1))
                                  }
                              }
                          }
                      }
                  )
              }
          }
      }
  )
visibility
public
html-ui.docs-page (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: WyC0HRDfukdD7ogUnmKHeB93finxLFWTTT3hM6ess1E
content hash: 8FsOHnXdxPFU5KcbDJK9KCmzHQHIH73Tih51_15JTxk