IRC channel logs

2024-07-05.log

back to list of logs

<lechner>Hi, where are some PEG grammars in S-exp style that I could take a look at, please?
<lechner>Hi, are PEG grammars slow?
<lechner>Which is better, PEG or Irregex?
<lechner>Hi, is it possible to precompile named "nonterminals" in PEG?
<lechner>i can define the patterns at the top level, but is there a way to do a let before lambda?
<lechner>I can compile anonymously with (compile (compile-peg-pattern ...)) but can't use those subpatterns after assigning them inside a let*
<dsmith>sneek, botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been aware for 2 months
<sneek>This system has been up 16 weeks, 2 days, 23 hours, 35 minutes
<dsmith>sneek, sneek?
<sneek>Its been said that Sneek is coaxial
<dsmith>sneek, sneek?
<sneek>From what I understand, Sneek is coaxial
<ray1729>Are there any "best practice" guidelines for implementing and distributing guile modules? Or is there a starter template for creating a new module?
<RavenJoad>dthompson: Is there a way to extend haunt's commonmark reader to accept specialty syntax? I want to generate a <span> element, but Commonmark has no way to do that, and writing raw HTML does not work.
<dthompson>RavenJoad: there's nothing built-in to guile-commonmark for this, unfortunately. the big missing feature is allowing arbitrary html markup, which is part of the commonmark spec.
<dthompson>see https://github.com/OrangeShark/guile-commonmark/issues/8
<dthompson>I haven't heard from OrangeShark in a long time... hope they're doing well.
<RavenJoad>That is what I was worried about. From cursory viewing, the texinfo-reader is similar. It does not allow easy extension with non-texinfo-default constructs.
<dthompson>does texinfo itself allow adding new syntax?
<dthompson>I wouldn't expect a parser for a well known format to allow arbitrary extension
<dthompson>like I don't think guile-commonmark should allow user extension, but it should conform to the spec it's implementing
<RavenJoad>I think you could create new environments, but that might just be an artifact from TeX itself.
<RavenJoad>I'm just trying to get sidenotes like those from here: https://danilafe.com/blog/sidenotes/. I already have the necessary HTML & CSS machinery working https://cgit.karl.hallsby.com/website.git/commit/?h=sidenotes-commentary&id=a0d660e1be2da99e9bab380378b97e7cce81e0c0. I just don't want to hand-write HTML or SXML.
<dthompson>markdown is disappointly lacking when it comes to things like footnotes
<dthompson>disappointingly*
<dthompson>embedding hand-written html into the document is as good as it gets
<dthompson>what we really need is something as good as scribble https://docs.racket-lang.org/scribble/getting-started.html
<RavenJoad>That's annoying. Perhaps that is something that will happen eventually. I will have to think about how to get sidenotes working then. I am finishing a post that would greatly benefit from having sidenotes.
<rlb>(Some markdown variants have footnotes -- so many variants...)
<dthompson>hacks are all I can really recommend, like post-processing the sxml that guile-commonmark generates. I do this to work around limitations.
<RavenJoad>Isn't Skribilo with skribe-reader close to Racket's scribble.
<dthompson>yeah it's close but the tooling needs work
<dthompson>like commonmark supports images, but not video. so I use the image syntax for videos anyway. then I post-process the sxml to check for <img> tags with a src attribute that ends in, say, ".mp4" and replace it with a <video> tag.
<RavenJoad>I use commonmark's > for "inline notes" right now, which translates to <blockquote>, but I don't think I have a way to attach a class to that HTML element through commonmark.
<RavenJoad>I should not be pushing skribilo too hard. All I'm trying to do is a simple rewrite. Something like (sidenote "tag" "inline" "sidenote body"), which could get expanded by the parser into the <span> sequence I need.
<dthompson>if you want, you can try to overload > to do your sidenotes by adding a special token after the ">" to mark it as a sidenote: > *sidenote* this is a sidenote
<dthompson>yes I know it's gross :)
<RavenJoad>It really is gross... I'm comfortable doing the SXML transforms now though. I've added quite a few features using (sxml transform) now; ToC, heading anchors, syntax highlighting, etc.
<dthompson>I made a really gross hack yesterday for embedding arbitrary sxml
<dthompson>![(p "this is horrible")](sxml)
<RavenJoad>That hack is perfect actually. I don't intend to use sidenotes TOO much.
<dthompson>this parses to (img (@ (src "sxml") (alt "(p \"this is horrible\")"))) and so I added code to check for images whose source is "sxml" and transform them. terrible terrible terrible
<dthompson>but now I can more easily to iframe embeds and stuff
<dthompson>s/to/do/
<dthompson>please someone polish up skribilo so I never have to do this again :P
<dthompson>or really just the skribe syntax support for emacs
<dthompson>I am finishing up a doozy of a blog post
<dthompson>to be published monday when people in the US will be paying more attention
<RavenJoad>Does the skribe example in haunt's manual still work? I am getting ice-9/eval.scm:155:9: In procedure string-length: Wrong type argument in position 1 (expecting string): ("This is a Skribe post") from haunt on that example.
<dthompson>maybe it doesn't! I haven't used skribe in ages
<dthompson>in the haunt repo there's an example skribe post
<RavenJoad>That one also breaks with the same error, but on the (h1 ...) instead. ice-9/eval.scm:155:9: In procedure string-length: Wrong type argument in position 1 (expecting string): ("Hello!")
<dthompson>interesting. it used to work reliably. wonder if something has changed with skribe.
<dthompson>well, I just checked and I can't reproduce that issue. example site builds fine.
<dthompson>not sure how to explain that.
<RavenJoad>I am using guix 425cf1f and haunt 0.3.0. I also cannot reproduce this error on the example site.
<RavenJoad>I found the problem. Your example uses (h1 [Hello!]), but for some reason that has a type error and I needed (h1 "Hello!") instead.
<dthompson>that's strange because (h1 [Hello!]) is valid skribe syntax
<dthompson>the square bracket notation means you don't have to escape quotation marks
<RavenJoad>It's more likely I have some weird thing in my site than anything else. But skribe syntax can do what I want, because the sidenote prefix is preserved down to SXML, so I can SXML-match and pre-post-order on that.
<RavenJoad>Actually, I take that back. I'm not 100% sure it will work.
<RavenJoad>This should work! (p [This is a Skribe ] '(sidenote "document!")) I get a sidenote SXML node that I can match against, so that should work!
<mwette>lechner: Did you notice that compile-peg-pattern returns a syntax object? Did you compile to use?
<RavenJoad>dthompson: All I want is a format that allows me to include arbitrary syntax and leaves it alone in the SXML, so that I can transform it myself. Commonmark and texinfo don't exactly allow that.
<dthompson>well if you end up doing skribe, I believe you can execute arbitrary scheme code so you can actually call a sidenote procedure that generates the relevant sxml rather than having to do it in a post-pass
<dthompson>that's the big advantage of skribe
<RavenJoad>That would be the better way. I just need to figure out how to register sidenote as a function to skribe in that case.