-
Sam
Office hours starting in 15 minutes! https://socialcoop.meet.coop/sam-pku-dud-niv
-
lovetox
Sam, maybe im too stupid, but parsing blocks seems to be much more of a challenge then spans✎ -
lovetox
Sam, maybe im too stupid, but parsing blocks seems to be much more of a challenge than spans ✏
-
lovetox
but im not giving up
-
moparisthebest
only need a few more regexen
-
Zash
No not, the term is 'regexopodes'✎ -
Zash
No no, the term is 'regexopodes' ✏
-
Sam
lovetox: I think I had a harder time with quotes in particular as well because they don't have any convenient "end" marker and I wanted to keep the line lengths and spaces and what not.
-
lovetox
its the mixing that gets me
-
lovetox
blocks that have ends, blocks that dont have ends
-
lovetox
block where the end is defined as the start of another block
-
Sam
I mostly just ignore "plain" blocks I think, so it was really just quotes for me.
-
Sam
pre's were easy because you just scan until the end of the document or the end of whatever block you were already in
-
lovetox
who needs nested quotes
-
lovetox
if the xep aims at "good enough" maybe my parser should too
-
lovetox
seems weird for such a very simple styling language to support unlimited nested quotes
-
Sam
I think I always count the ">"s at the beginning of each line to get the quote level, then whenever that number gets smaller than whatever it was before I call that the end of a block.
-
Sam
Originally I'd done that recursively where I had a byte reader that understood quotes and would only read up to the end of its own quote, sipping the ">" bytes and then I could recursively create a new decoder inside of each block, but I changed that because I wanted it to be lossless and not throw away spaces and newlines.
-
Sam
*stripping the ">" bytes, I mean
-
Sam
I think… I rewrote this thing like 5 times before I found an API that I liked, so I barely remember what bits I ended up with.
-
lovetox
when clients quote, du they somehow identify the originator of the quote ?
-
lovetox
and how do they do that
-
Sam
Not that I've seen
-
Zash
Plz XEPify `<in-reply-to id=$stanza-id/>` and use that 😉
-
lovetox
sounds like something very basic i would want to have with a quote..
-
Zash
Or references I guess
-
Sam
I could go either way, but I'm with Zash. I think these quotes are mostly just to provide context in a MUC when multiple people are talking at once and it's not immediately clear which recent message you were relying to
-
Sam
If you need more, this can be done with some sort of threading XEP
-
Zash
`nick[:,]\n> lorem ipsum\n what you say‽` 🤷️
-
Sam
But a client would certainly be free to prepend "So and so said:" before the quote like email clients do
-
Sam
Yes, that :)
-
Zash
Yaxim has something too IIRC
-
lovetox
so > ´´´sometext
-
lovetox
this is a quote with a preformated block
-
lovetox
this is valid or not
-
Sam
yes that's valid
-
lovetox
and why do we need that? because its common to not quote the end ```
-
lovetox
?
-
Sam
It just made it easier because you didn't have to scan for an end token to know if the pre was valid
-
lovetox
i think i just use regex
-
lovetox
for blocks
-
lovetox
its easy to match a pre or quote block with regex
-
lovetox
the only problem is the pre without end inside the quote block ..
-
lovetox
hm or can i just write a regex for that too ..
-
Sam
lovetox: out of curiosity, what are you writing this for?
-
lovetox
for Gajim
-
Sam
oh right, I think I knew you did gajim stuff. cool.
-
lovetox
Sam in the xep is nothing said about empty blocks
-
lovetox
> ``` for example
-
lovetox
dont know if it should though
-
Sam
I think that's valid. It's not mentioned specifically, but I think the rules say that a pre-formatted block has to be started with "```" and runs until the end of the parent block or until the next line containing only "```", so it should be valid.
-
lovetox
so in the end now parse the blocks with regex
-
lovetox
works fine for some tests i made, tomorrow i will test all your test cases
-
Sam
Cool; glad it worked for you!