💾 Archived View for spam.works › users › emery › generate-gemini.dhall captured on 2023-11-04 at 16:05:22.

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

let Prelude =
      https://raw.githubusercontent.com/dhall-lang/dhall-lang/v20.2.0/Prelude/package.dhall
        sha256:a6036bc38d883450598d1de7c98ead113196fe2db02e9733855668b18096f07b

let XML = Prelude.XML

let Atom =
      https://git.sr.ht/~ehmry/dhall-atom/blob/trunk/package.dhall
        sha256:c4b68f2c8fcbdc2f73abff4317b8fb814b27567809a62497ab910395871fd392

let Article = ./article.dhall

let gemlog = ./gemlog.dhall

let baseUrl = "gemini.spam.works/~emery"

let feed =
      Atom.Feed::{
      , title = Atom.text "~emery"
      , authors = [ Atom.Person::{ name = "Emery" } ]
      , links =
        [ Atom.Link::{
          , href = "gemini://${baseUrl}/"
          , hreflang = Some "en"
          , type = Some "text"
          }
        , Atom.Link::{
          , href = "https://${baseUrl}/"
          , hreflang = Some "en"
          , type = Some "text/html"
          }
        , (Atom.Link.self "gemini://${baseUrl}/feed.atom")
          with type = Some "application/atom+xml"
        , (Atom.Link.self "https://${baseUrl}/feed.atom")
          with type = Some "application/atom+xml"
        ]
      , id = "urn:uuid:1dfa135b-eca3-46dd-aae0-f4570c89565d"
      , updated = Atom.Date_.raw env:ATOM_DATE as Text
      , generator = Some Atom.Generator::{
        , uri = Some "gemini://gemini.spam.works/~/emery/generate-gemini.dhall"
        , text = "custom Dhall generator"
        }
      , entries =
          Prelude.List.map
            Article.Type
            Atom.Entry.Type
            ( λ(article : Article.Type) →
                let gmiLink = "gemini://${baseUrl}/${article.file}"

                in  Atom.Entry::{
                    , title = Atom.text article.title
                    , updated = article.updated
                    , summary =
                        Prelude.Optional.map
                          Text
                          Atom.TextConstruct.Type
                          Atom.text
                          article.summary
                    , links =
                      [ Atom.Link::{ type = Some "text/gemini", href = gmiLink }
                      , Atom.Link::{
                        , href = "https://${baseUrl}/${article.file}"
                        , type = Some "text/html"
                        }
                      ]
                    , id = gmiLink
                    , contents =
                      [ Atom.Content::{
                        , type = "text/gemini"
                        , body = XML.text article.text
                        }
                      ]
                    }
            )
            gemlog
      }

in    Prelude.List.map
        Article.Type
        (Prelude.Map.Entry Text Text)
        ( λ(article : Article.Type) →
            { mapKey = article.file
            , mapValue =
                merge
                  { Some = λ(mimeType : Text) → article.text
                  , None =
                      ''
                      # ${article.title}

                      ${article.text}
                      ''
                  }
                  article.mimeType
            }
        )
        gemlog
    # toMap
        { `atom.feed` = Atom.Feed.render feed
        , `.molly` =
                ''
                DefaultLang = "en"
                [MimeOverrides]
                ".dhall$" = "text/x-dhall"
                ''
            ++  Prelude.Text.concatMap
                  Article.Type
                  ( λ(article : Article.Type) →
                      merge
                        { Some =
                            λ(mimeType : Text) →
                              ''
                              "${article.file}$" = "${mimeType}"
                              ''
                        , None = ""
                        }
                        article.mimeType
                  )
                  gemlog
        , `index.gmi` =
            ''
            # ~emery

            ## Code

            => https://git.sr.ht/~ehmry
            => https://github.com/ehmry
            => https://codeberg.org/eris
            => https://git.syndicate-lang.org/ehmry

            ## Gemlog

            => atom.feed

            ${Prelude.Text.concatMap
                Article.Type
                ( λ(article : Article.Type) →
                        "=> ${article.file}"
                    ++  ''
                         ${Atom.Date_.show article.updated} - ${article.title}
                        ''
                )
                gemlog}

            ## Contact
            => https://simplex.chat/contact#/?v=1-2&smp=smp%3A%2F%2FPQUV2eL0t7OStZOoAsPEV2QYWt4-xilbakvGUGOItUo%3D%40smp6.simplex.im%2FG9cqxWUJBH3vY4M5gZ00emf2KjcKEqBa%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEA-T-gEU4apqLolc-unYW5t1C-c1tDLDzp5YHzRkkzZwI%253D%26srv%3Dbylepyau3ty4czmn77q4fglvperknl4bi2eb2fdy2bh4jxtf32kf73yd.onion SimpleX address
            ''
        }