[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Communication and Design at Guix
From: |
Julien Lepiller |
Subject: |
Re: Communication and Design at Guix |
Date: |
Tue, 15 Jan 2019 18:39:35 +0100 |
User-agent: |
Roundcube Webmail/1.3.8 |
Le 2019-01-15 14:56, Ricardo Wurmus a écrit :
swedebugia <address@hidden> writes:
I looked into the chicken docs and their html and css. They generate
their examples from source-code with this MIT chicken egg-script:
http://code.call-cc.org/svn/chicken-eggs/release/4/colorize/trunk/colorize.scm.
To use their approach with parens highlighting we would need to either
depend on chicken and this egg or port it to guile.
Are you aware of the guile-syntax-highlight package?
Hey, I use it for my blog, but it doesn't generate the same kind
of html:
<span class="syntax-open">(</span><span
class="syntax-symbol">foo</span><span class="syntax-close">)</span>
So I've just written a bit of scheme to convert that to nested
syntax-paren spans:
<span class="syntax-paren"><span class="syntax-open">(</span><span
class="syntax-symbol">foo</span><span
class="syntax-close">)</span></span>
(define (break-paren sxmls)
(match sxmls
('() (values '() '()))
((('span ('@ ('class "syntax-close")) _) tag ...)
(values '((span (@ (class "syntax-close")) ")")) tag))
((('span ('@ ('class "syntax-open")) _) tag ...)
(receive (inside outside)
(break-paren tag)
(receive (inside2 outside2)
(break-paren outside)
(values (cons `(span (@ (class "syntax-paren")) ,@(cons `(span
(@ (class "syntax-open")) "(") inside)) inside2) outside2))))
((tag ...)
(receive (inside outside)
(break-paren (cdr tag))
(values (cons (car tag) inside) outside)))))
(define (paren-grouper sxmls)
(match sxmls
('() '())
((('span ('@ ('class "syntax-open")) _) tag ...)
(receive (inside outside)
(break-paren tag)
(cons `(span (@ (class "syntax-paren")) ,@(cons `(span (@ (class
"syntax-open")) "(") inside)) (paren-grouper outside))))
((tag ...)
(begin
(cons (paren-matcher (list (car tag))) (paren-grouper (cdr
tag)))))))
(define (paren-matcher sxml)
(match sxml
((tag ('@ attrs ...) content ...)
`(,tag (@ ,attrs) ,@(paren-grouper content)))
((tag content ...)
`(,tag ,@(paren-grouper content)))))
You're supposed to call paren-matcher on a sxml tag. It tries to find
the matching parenthesis for each opening one and wraps the content
inside a span. That's it. You need (ice-9 receive) and (ice-9 match).
Not sure how much of that is actually needed. Maybe there's already an
option to do all that? With a bit of css, the result is here:
https://lepiller.eu/ma-configuration.html
- Re: Communication and Design at Guix, (continued)
- Re: Communication and Design at Guix, Ricardo Wurmus, 2019/01/10
- Re: Communication and Design at Guix, Ludovic Courtès, 2019/01/13
- Re: Communication and Design at Guix, L p R n d n, 2019/01/14
- Re: Communication and Design at Guix, zimoun, 2019/01/15
- Re: Communication and Design at Guix, nly, 2019/01/15
- Re: Communication and Design at Guix, Ricardo Wurmus, 2019/01/15
- Re: Communication and Design at Guix, Giovanni Biscuolo, 2019/01/16
- Re: Communication and Design at Guix, Ludovic Courtès, 2019/01/15
- Re: Communication and Design at Guix, swedebugia, 2019/01/14
- Re: Communication and Design at Guix, Ricardo Wurmus, 2019/01/15
- Re: Communication and Design at Guix,
Julien Lepiller <=
- Re: Communication and Design at Guix, Ludovic Courtès, 2019/01/15
- Re: Communication and Design at Guix, L p R n d n, 2019/01/10
Re: Communication and Design at Guix, L p R n d n, 2019/01/10
Re: Communication and Design at Guix, George Clemmer, 2019/01/16
Re: Communication and Design at Guix, swedebugia, 2019/01/16
Re: Communication and Design at Guix, L p R n d n, 2019/01/17