~siiky/gmi.scm

Scheme Gemtex reader
Add support for CHICKEN 6
Bump version to 0.0.7
Update changelog

clone

read-only
https://git.sr.ht/~siiky/gmi.scm
read/write
git@git.sr.ht:~siiky/gmi.scm

You can also use your local clone with git send-email.

#gmi.scm

#Text

some text
"some text"

Just a string, not tagged in any way. Empty lines are kept.

#Headers

^(#+)\s+(.*)$
`(header ,(string-length $1) ,$2)

If *strict-gemtext-headers* is enabled, header lines of level > 3 are not considered headers.

##### title
"##### title"       ; (w/ *strict-gemtext-headers* enabled)
'(header 5 "title") ; (w/ *strict-gemtext-headers* disabled)
=> some-uri.gmi Optional alt text
'(link "some-uri.gmi" "Optional alt text")

If there's no alt text, the empty string is used:

=> some-uri.gmi
'(link "some-uri.gmi" "")

#Lists

* item 1
* item 2
'(list "item 1"
       "item 2")

#Code blocks

(pretend there's no space in between the three backticks)

`` `some optional alt text
some
pre-formatted
text
`` `
'(code "some optional alt text"
       "some"
       "pre-formatted"
       "text")

If there's no alt text, the empty string is used:

`` `some optional alt text
some
pre-formatted
text
`` `
'(code ""
       "some"
       "pre-formatted"
       "text")

#Example

# Factorial

There are two steps to compute the factorial of a number:

* Compute the list of integers from 1 up to the number
* Multiply all the integers of the list

=> https://en.wikipedia.org/wiki/Factorial
=> gemini://gemi.dev/cgi-bin/wp.cgi/view?Factorial Factorial (Gemipedia)

## Haskell code

Here's the code in Haskell:

`` `hs
fact n = prod [1..n]
`` `
'((header 1 "Factorial")
  ""
  "There are two steps to compute the factorial of a number:"
  ""
  (list "Compute the list of integers from 1 up to the number"
        "Multiply all the integers of the list")
  ""
  (link "https://en.wikipedia.org/wiki/Factorial" "")
  (link "gemini://gemi.dev/cgi-bin/wp.cgi/view?Factorial" "Factorial (Gemipedia)")
  ""
  (header 2 "Haskell code")
  ""
  "Here's the code in Haskell:"
  ""
  (code "hs"
        "fact n = prod [1..n]"))

#Output Patterns

(header level title)
(link uri alt-text)
(code alt-text . lines)
(list . items)
Do not follow this link