jdev - 2021-04-06

  1. Sam

    Office hours starting in 15 minutes! https://socialcoop.meet.coop/sam-pku-dud-niv

  2. lovetox

    Sam, maybe im too stupid, but parsing blocks seems to be much more of a challenge then spans

  3. lovetox

    Sam, maybe im too stupid, but parsing blocks seems to be much more of a challenge than spans

  4. lovetox

    but im not giving up

  5. moparisthebest

    only need a few more regexen

  6. Zash

    No not, the term is 'regexopodes'

  7. Zash

    No no, the term is 'regexopodes'

  8. 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.

  9. lovetox

    its the mixing that gets me

  10. lovetox

    blocks that have ends, blocks that dont have ends

  11. lovetox

    block where the end is defined as the start of another block

  12. Sam

    I mostly just ignore "plain" blocks I think, so it was really just quotes for me.

  13. 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

  14. lovetox

    who needs nested quotes

  15. lovetox

    if the xep aims at "good enough" maybe my parser should too

  16. lovetox

    seems weird for such a very simple styling language to support unlimited nested quotes

  17. 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.

  18. 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.

  19. Sam

    *stripping the ">" bytes, I mean

  20. 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.

  21. lovetox

    when clients quote, du they somehow identify the originator of the quote ?

  22. lovetox

    and how do they do that

  23. Sam

    Not that I've seen

  24. Zash

    Plz XEPify `<in-reply-to id=$stanza-id/>` and use that 😉

  25. lovetox

    sounds like something very basic i would want to have with a quote..

  26. Zash

    Or references I guess

  27. 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

  28. Sam

    If you need more, this can be done with some sort of threading XEP

  29. Zash

    `nick[:,]\n> lorem ipsum\n what you say‽` 🤷️

  30. Sam

    But a client would certainly be free to prepend "So and so said:" before the quote like email clients do

  31. Sam

    Yes, that :)

  32. Zash

    Yaxim has something too IIRC

  33. lovetox

    so > ´´´sometext

  34. lovetox

    this is a quote with a preformated block

  35. lovetox

    this is valid or not

  36. Sam

    yes that's valid

  37. lovetox

    and why do we need that? because its common to not quote the end ```

  38. lovetox


  39. Sam

    It just made it easier because you didn't have to scan for an end token to know if the pre was valid

  40. lovetox

    i think i just use regex

  41. lovetox

    for blocks

  42. lovetox

    its easy to match a pre or quote block with regex

  43. lovetox

    the only problem is the pre without end inside the quote block ..

  44. lovetox

    hm or can i just write a regex for that too ..

  45. Sam

    lovetox: out of curiosity, what are you writing this for?

  46. lovetox

    for Gajim

  47. Sam

    oh right, I think I knew you did gajim stuff. cool.

  48. lovetox

    Sam in the xep is nothing said about empty blocks

  49. lovetox

    > ``` for example

  50. lovetox

    dont know if it should though

  51. 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.

  52. lovetox

    so in the end now parse the blocks with regex

  53. lovetox

    works fine for some tests i made, tomorrow i will test all your test cases

  54. Sam

    Cool; glad it worked for you!