#lang racket/base

(require
  "templates.rkt"
  racket/string)

(provide
  pages:not-found
  pages:home
  pages:about-me
  pages:about-feuforeve
  pages:fonts
  pages:gatel)

; Not found page
(define pages:not-found
  (pages:template
    #:title "Not found"
    #:content '(article (p "Sorry, there is nothing here."))
    #:author "404"
    #:error-code 404))

; Home page and other minor pages
(define pages:home
  (pages:template
    #:title "Feuforêve: Home"
    #:author "Feufochmar"
    #:date "2020-02-01"
    #:content
      '(article
        (p "I'm " (a ((href "/AboutMe")) "Feufochmar") " and this is my personnal website. ")
        (p "This website contains various generators I wrote. "
           "While most generators are executed server-side, a few are executed client-side and thus need Javascript. ")
        ;  various links to my other accounts - not displayed, only for checking purpose for those websites
        (p ((style "display: none;"))
          "You can find me on "
          (ul ((style "display: none;"))
            (li (a ((href "https://social.surfnet.space/@Feufochmar")(rel "me")) "Social.surfnet.space"))
            (li (a ((href "https://functional.cafe/@Feufochmar")(rel "me")) "Functional.cafe"))
            (li (a ((href "https://donphan.social/@Feufochmar")(rel "me")) "Donphan.social"))
            ))
        )
      ))

(define pages:about-me
  (pages:template
    #:title "About: Feufochmar"
    #:author "Feufochmar"
    #:date "2021-11-05"
    #:content
      '(article
        (h2 "Myself")
        (p "I'm a ghost haunting the labyrinth named Internet, and I like to write code and play video games. ")
        (p "You can also find me on "
            (a ((href "http://feufochmar.deviantart.com/")) "deviantArt") ", "
            (a ((href "https://twitter.com/Feufochmar")) "Twitter") ", "
            (a ((href "https://social.surfnet.space/Feufochmar")) "Mastodon") "."
            (br)
            "You can also contact me at " (code "contact [at] feuforeve [dot] fr") ".")
       )
    ))

(define pages:about-feuforeve
  (pages:template
    #:title "About: This website"
    #:author "Feufochmar"
    #:date "2021-11-05"
    #:content
      '(article
        (h2 "Website name")
        (p "The website name, "
            (a ((href "http://www.pokemon.com/fr/pokedex/feuforêve")) "Feuforêve")
            ", comes from the french name of the "
            (a ((href "http://www.pokemon.com")) "Pokémon") " "
            (a ((href "http://www.pokemon.com/us/pokedex/misdreavus")) "Misdreavus") ". "
            "This website has no relation with the mentionned company. ")
        (h2 "Cookie")
        (p "This website does not use cookie, unless for editing the notepad, but those are for me, not you, I don't share my cookies. ")
        (h2 "Personal Data")
        (p "IP addresses are automatically logged by the server because you visited those pages. Those are kept for up to a month for maintainance reasons. "
           "No other personal data are stored nor processed. ")
        (h2 "Other informations")
        (p "Please contact me at " (code "contact [at] feuforeve [dot] fr") " if you need other informations about this website. ")
       )
    ))

; Font page
(define (sample-text text font-css)
  `(p ,text (br)
      (span ((class ,font-css)) ,text)))

(define (character-show char-lst font-css)
  `(p
      ,@(map
          (lambda (c)
            `(span ((style "display: inline-block; padding-left: 5px;")) ,c (br) (span ((class ,font-css)) ,c)))
          (string-split char-lst " "))))

(define (font-example name)
  `(section ((class "font-example"))
    ,(sample-text "The quick brown dog jumps over the lazy fox." name)
    ,(sample-text "Voix ambiguë d'un coeur qui, au zéphyr, préfère les jattes de kiwis." name)
    ,(sample-text "Andre told Beleth they would work with Amdusias and Orobas." name)
    ,(sample-text "I'm Furfur, and I shall eradicate You." name)
    ,(character-show "0 1 2 3 4 5 6 7 8 9 () [] {} ! \" ' . , ? & $ %" name)
    ,(character-show "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" name)
    ,(character-show "a b c d e f g h i j k l m n o p q r s t u v w x y z" name)
    ,(character-show "Æ Þ Ð æ þ ð ß å â á à ä ã" name)
    ))

(define (font-paragraph name description css-class)
  `(details
     (summary (span ((class "font-section-title")) ,name " -  " (span ((class ,css-class)) ,name)))
     (p ,description (br) (a ((href ,(string-append "/fonts/" name ".otf"))) "Download"))
     (section
       (h3 "Sample")
       (section ((class "font-contents"))
         ,(font-example css-class))
       (section
         (h4 "Playfield")
         (p ((class "font-playfield"))
            (textarea ((class ,css-class)) "You can type what you want here."))))
     (section
       (h3 "Source file and licence")
       (p
         "The font is released under the "
        (a ((href "http://scripts.sil.org/OFL")) "SIL Open Font license") ". "
        "So you can also modify the font and share the result. "
        "Open the " (a ((href ,(string-append "/fonts/" name ".sfd"))) "source file") " "
        "in " (a ((href "https://fontforge.github.io/")) "fontforge") " and edit whatever you want."))
   ))

(define pages:fonts
  (pages:template
    #:title "Fonts I made"
    #:author "Feufochmar"
    #:date "2022-04-29"
    #:stylesheets '("/css/custom-fonts.css")
    #:content
    `(article
        (p "I'm the author of a few fonts. You can see here what they look like, try them and download them.")
        ,(font-paragraph
            "Prattling"
            "A font inspired by the Prattle scripts appearing in the Floraverse webcomic. "
            "prattling")
        ,(font-paragraph
            "Furfur"
            "A font inspired by what the character Furfur says in the Floraverse webcomic during the chapter V of Seeds. It heavily uses ligatures. "
            "furfur")
        ,(font-paragraph
            "Gaeian_Serif_A"
            "A serif font. "
            "gaeian_serif_a")
        ,(font-paragraph
            "Gatel"
            "A monospaced font. "
            "gatel")
       )
    ))

;(define (page:gatel:gatel-word word translit)
;  `(span (span ((class "gatel")) ,word) "(" ,translit ")"))

(define (page:gatel:gatel-letter-row character description)
  `(tr (td ((class "gatel")) ,character) (td ,description)))

;(define (page:gatel:plochete-letter-row character phoneme translit description)
;  `(tr (td ((class "gatel")) ,character) (td "/" ,phoneme "/") (td ,translit) (td ,description)))

(define (page:gatel:translit-letter letter translit)
  `(td (span ((class "gatel")) ,letter) (br) ,translit))

(define pages:gatel
  (pages:template
    #:title "Écriture des gatels et langue de Plochète."
    #:author "Feufochmar"
    #:date "2022-04-29"
    #:stylesheets '("/css/custom-fonts.css")
    #:content
    `(article
      (h2 "Écriture des gatels")
      (p "L'écriture des gatels, aussi nommé alphabet gatélien, est un système d'écriture née dans la cité de Karungtechi, "
         "un des foyers de l'espèce gatélienne située au nord de Mazacan. Suite aux nombreuses migrations des gatels aux travers des âges, "
         "ce système d'écriture s'est progressivement imposé comme le principal système d'écriture utilisé dans le monde de Galéya. ")
      (p "L'écriture des gatels est alphabétique, chaque lettre représentant un phonème. Suite aux évolutions, l'écriture compte au total 84 lettres, "
         "mais celle-ci sont des variations de 14 lettres de bases. La table suivante les liste."
         (table
           (tr (th "Lettre") (th "Description"))
           ,(page:gatel:gatel-letter-row "\ue020" "Cette lettre et ses variations correspondent habituellement aux consonnes nasales voisées.")
           ,(page:gatel:gatel-letter-row "\ue021" "Initialement introduite pour représenter les consonnes nasales sourdes des langues crihouines, cette lettre et ses variations sont souvent utilisées pour représenter des occulsives et fricatives prénasalisées.")
           ,(page:gatel:gatel-letter-row "\ue022" "Cette lettre et ses variations correspondent habituellement aux consonnes occlusives voisées.")
           ,(page:gatel:gatel-letter-row "\ue023" "Cette lettre et ses variations correspondent habituellement aux consonnes occlusives sourdes.")
           ,(page:gatel:gatel-letter-row "\ue024" "Cette lettre et ses variations correspondent habituellement aux consonnes fricatives voisées.")
           ,(page:gatel:gatel-letter-row "\ue025" "Cette lettre et ses variations correspondent habituellement aux consonnes fricatives sourdes.")
           ,(page:gatel:gatel-letter-row "\ue026" "Initialement introduite pour représenter les consonnes liquides voisées, cette lettre et ses variations correspondent habituellement aux consonnes latérales.")
           ,(page:gatel:gatel-letter-row "\ue027" "Initialement introduite pour représenter les consonnes liquides sourdes, cette lettre et ses variations correspondent habituellement aux consonnes rhotiques.")
           ,(page:gatel:gatel-letter-row "\ue028" "Cette lettre et ses variations correspondent habituellement aux consonnes spirantes voisées.")
           ,(page:gatel:gatel-letter-row "\ue029" "Cette lettre et ses variations correspondent habituellement aux voyelles fermées. ")
           ,(page:gatel:gatel-letter-row "\ue02a" "Cette lettre et ses variations correspondent habituellement aux voyelles ouvertes.")
           ,(page:gatel:gatel-letter-row "\ue02b" "Cette lettre et ses variations correspondent habituellement aux voyelles mi-fermées. Elles ne sont utilisées que dans les langues utilisant de nombreuses voyelles.")
           ,(page:gatel:gatel-letter-row "\ue02c" "Cette lettre et ses variations correspondent habituellement aux voyelles mi-ouvertes. Elles ne sont utilisées que dans les langues utilisant de nombreuses voyelles.")
           ,(page:gatel:gatel-letter-row "\ue02d" "Cette lettre et ses variations correspondent habituellement aux voyelles moyennes. Elles ne sont utilisées que dans les langues utilisant de nombreuses voyelles.")
           )
         )
      (p "Les autres lettres sont construites à partir de ces 14 bases de la façon suivante."
         (ul
           (li "En y ajoutant un koba (" (span ((class "gatel")) "\ue00d") ") ou un goljè (" (span ((class "gatel")) "\ue00e") "). Les deux sont exclusifs, et leur tracés sont fusionné à la lettre de base.")
           (li "En y ajoutant un téno (⋅).")
           )
         "La lettre de base représente habituelle une sonorité \"centrale\" : une consonne coronale ou une voyelle centrale. "
         "Le koba indique habituellement une consonne labiale ou une voyelle postérieure, et le goljè à l'inverse indique une consonne dorsale ou une voyelle antérieure. "
         "Le téno a par contre divers sens suivant la langue transcrite. Parmi ses usages, il peut être utilisé pour distinguer des points d'articulation intermédiaires entre deux lettres sans téno, une nasalisation des voyelles, ou la position de l'accent tonique.")
      (p "La table complète des lettres est la suivante, accompagnées de leur translittération usuelle."
         (table ((style "font-size:larger;"))
           (tr (th ((class "gatel")) "\ue020")
               ,(page:gatel:translit-letter "\ue020" "n") ,(page:gatel:translit-letter "\ue030" "m") ,(page:gatel:translit-letter "\ue040" "ŋ")
               ,(page:gatel:translit-letter "\ue050" "n\u0301") ,(page:gatel:translit-letter "\ue060" "m\u0301") ,(page:gatel:translit-letter "\ue070" "ŋ\u0301")
               )
           (tr (th ((class "gatel")) "\ue021")
               ,(page:gatel:translit-letter "\ue021" "n\u0308") ,(page:gatel:translit-letter "\ue031" "m\u0308") ,(page:gatel:translit-letter "\ue041" "ŋ\u0308")
               ,(page:gatel:translit-letter "\ue051" "n\u0308\u0301") ,(page:gatel:translit-letter "\ue061" "m\u0308\u0301") ,(page:gatel:translit-letter "\ue071" "ŋ\u0308\u0301")
               )
           (tr (th ((class "gatel")) "\ue022")
               ,(page:gatel:translit-letter "\ue022" "d") ,(page:gatel:translit-letter "\ue032" "b") ,(page:gatel:translit-letter "\ue042" "g")
               ,(page:gatel:translit-letter "\ue052" "d\u0301") ,(page:gatel:translit-letter "\ue062" "b\u0301") ,(page:gatel:translit-letter "\ue072" "g\u0301")
               )
           (tr (th ((class "gatel")) "\ue023")
               ,(page:gatel:translit-letter "\ue023" "t") ,(page:gatel:translit-letter "\ue033" "p") ,(page:gatel:translit-letter "\ue043" "k")
               ,(page:gatel:translit-letter "\ue053" "t\u0301") ,(page:gatel:translit-letter "\ue063" "p\u0301") ,(page:gatel:translit-letter "\ue073" "k\u0301")
               )
           (tr (th ((class "gatel")) "\ue024")
               ,(page:gatel:translit-letter "\ue024" "z") ,(page:gatel:translit-letter "\ue034" "v") ,(page:gatel:translit-letter "\ue044" "j")
               ,(page:gatel:translit-letter "\ue054" "z\u0301") ,(page:gatel:translit-letter "\ue064" "p\u0301") ,(page:gatel:translit-letter "\ue074" "j\u0301")
               )
           (tr (th ((class "gatel")) "\ue025")
               ,(page:gatel:translit-letter "\ue025" "s") ,(page:gatel:translit-letter "\ue035" "f") ,(page:gatel:translit-letter "\ue045" "x")
               ,(page:gatel:translit-letter "\ue055" "s\u0301") ,(page:gatel:translit-letter "\ue065" "f\u0301") ,(page:gatel:translit-letter "\ue075" "x\u0301")
               )
           (tr (th ((class "gatel")) "\ue026")
               ,(page:gatel:translit-letter "\ue026" "l") ,(page:gatel:translit-letter "\ue036" "c") ,(page:gatel:translit-letter "\ue046" "h")
               ,(page:gatel:translit-letter "\ue056" "l\u0301") ,(page:gatel:translit-letter "\ue066" "c\u0301") ,(page:gatel:translit-letter "\ue076" "h\u0301")
               )
           (tr (th ((class "gatel")) "\ue027")
               ,(page:gatel:translit-letter "\ue027" "r") ,(page:gatel:translit-letter "\ue037" "w") ,(page:gatel:translit-letter "\ue047" "q")
               ,(page:gatel:translit-letter "\ue057" "r\u0301") ,(page:gatel:translit-letter "\ue067" "w\u0301") ,(page:gatel:translit-letter "\ue077" "q\u0301")
               )
           (tr (th ((class "gatel")) "\ue028")
               ,(page:gatel:translit-letter "\ue028" "y\u0308") ,(page:gatel:translit-letter "\ue038" "u\u0308") ,(page:gatel:translit-letter "\ue048" "i\u0308")
               ,(page:gatel:translit-letter "\ue058" "y\u0308\u0301") ,(page:gatel:translit-letter "\ue068" "u\u0308\u0301") ,(page:gatel:translit-letter "\ue078" "i\u0308\u0301")
               )
           (tr (th ((class "gatel")) "\ue029")
               ,(page:gatel:translit-letter "\ue029" "y") ,(page:gatel:translit-letter "\ue039" "u") ,(page:gatel:translit-letter "\ue049" "i")
               ,(page:gatel:translit-letter "\ue059" "y\u0301") ,(page:gatel:translit-letter "\ue069" "u\u0301") ,(page:gatel:translit-letter "\ue079" "i\u0301")
               )
           (tr (th ((class "gatel")) "\ue02a")
               ,(page:gatel:translit-letter "\ue02a" "a") ,(page:gatel:translit-letter "\ue03a" "o") ,(page:gatel:translit-letter "\ue04a" "e")
               ,(page:gatel:translit-letter "\ue05a" "a\u0301") ,(page:gatel:translit-letter "\ue06a" "o\u0301") ,(page:gatel:translit-letter "\ue07a" "e\u0301")
               )
           (tr (th ((class "gatel")) "\ue02b")
               ,(page:gatel:translit-letter "\ue02b" "y\u0304") ,(page:gatel:translit-letter "\ue03b" "u\u0304") ,(page:gatel:translit-letter "\ue04b" "i\u0304")
               ,(page:gatel:translit-letter "\ue05b" "y\u0304\u0301") ,(page:gatel:translit-letter "\ue06b" "u\u0304\u0301") ,(page:gatel:translit-letter "\ue07b" "i\u0304\u0301")
               )
           (tr (th ((class "gatel")) "\ue02c")
               ,(page:gatel:translit-letter "\ue02c" "a\u0304") ,(page:gatel:translit-letter "\ue03c" "o\u0304") ,(page:gatel:translit-letter "\ue04c" "e\u0304")
               ,(page:gatel:translit-letter "\ue05c" "a\u0304\u0301") ,(page:gatel:translit-letter "\ue06c" "o\u0304\u0301") ,(page:gatel:translit-letter "\ue07c" "e\u0304\u0301")
               )
           (tr (th ((class "gatel")) "\ue02d")
               ,(page:gatel:translit-letter "\ue02d" "a\u0308") ,(page:gatel:translit-letter "\ue03d" "o\u0308") ,(page:gatel:translit-letter "\ue04d" "e\u0308")
               ,(page:gatel:translit-letter "\ue05d" "a\u0308\u0301") ,(page:gatel:translit-letter "\ue06d" "o\u0308\u0301") ,(page:gatel:translit-letter "\ue07d" "e\u0308\u0301")
               )
           )
         )
      )
    ))
