~dmbaturin/soupault

1

title widget selects wrong

Details
Message ID
<4GN5k616VPz6tm9@submission01.posteo.de>
DKIM signature
pass
Download raw message
Looks like the Codeberg is out of date…

I’m having some issues with the title element widget. I’m using SVG for a logo and for accessibility, I’m using a `<title>` element inside of the SVG so it can a) be parsed by screen readers and b) be parsed by TUI web browsers that don’t display SVGs. The problem arises that the `Soup.select_one` selects the last in one (not the first like `document.querySelector`). On the `force` option, I can see a `<head>` is first selected and I believe the title should either behave like that or something like (not OCaml/PureScript pseudocode)

```purescript
selectTitle ∷ Effect (Maybe Element)
selectTitle =
  MaybeT (Soup.select_one "head > title") 
    <|> Maybe (Soup.select_one "title")
    # runMaybeT
```

where try the first with head, and then fallback to the second without head. 

I’d consider testing/PRing this myself, but 
a) I wanna use the Codeberg repo and NOT GitHub any longer due to privacy and ethical concern
b) I’ve never written OCaml and while it’s easy to read from my background, the tooling setup is not what I want to invest in figuring out to do this
c) I’d probably need a working Nix shell to test it which would require knowing part b; getting a Soupault package into Nix is in my medium-priority goals though. This would allow there to be a hack-ready environment for users without needing to fully ‘understand’ environemnt—just run `nix build`.

Anyways, I’m happy I’m finally getting to test out the project rather than just poking it from afar while I prioritize other things. I hope this is an easy fix.
Details
Message ID
<f48bb13b-cc6a-db4b-a458-f0394170f352@baturin.org>
In-Reply-To
<4GN5k616VPz6tm9@submission01.posteo.de> (view parent)
DKIM signature
pass
Download raw message
Hi toastal,

Wow, that's an interesting gotcha! Could you send me a complete page for
testing?
I think I already can see how I can make the select function behave
correctly, just need something to test with.

Regarding the codeberg repo, I need to make some automated solution for
keeping the repos is sync.
Do you know any good solutions? I was thinking of writing one myself
because I couldn't find any,
but I hope I was wrong and just couldn't find them.

On 7/11/21 7:26 PM, toastal wrote:
> Looks like the Codeberg is out of date…
>
> I’m having some issues with the title element widget. I’m using SVG for a logo and for accessibility, I’m using a `<title>` element inside of the SVG so it can a) be parsed by screen readers and b) be parsed by TUI web browsers that don’t display SVGs. The problem arises that the `Soup.select_one` selects the last in one (not the first like `document.querySelector`). On the `force` option, I can see a `<head>` is first selected and I believe the title should either behave like that or something like (not OCaml/PureScript pseudocode)
>
> ```purescript
> selectTitle ∷ Effect (Maybe Element)
> selectTitle =
>   MaybeT (Soup.select_one "head > title") 
>     <|> Maybe (Soup.select_one "title")
>     # runMaybeT
> ```
>
> where try the first with head, and then fallback to the second without head. 
>
> I’d consider testing/PRing this myself, but 
> a) I wanna use the Codeberg repo and NOT GitHub any longer due to privacy and ethical concern
> b) I’ve never written OCaml and while it’s easy to read from my background, the tooling setup is not what I want to invest in figuring out to do this
> c) I’d probably need a working Nix shell to test it which would require knowing part b; getting a Soupault package into Nix is in my medium-priority goals though. This would allow there to be a hack-ready environment for users without needing to fully ‘understand’ environemnt—just run `nix build`.
>
> Anyways, I’m happy I’m finally getting to test out the project rather than just poking it from afar while I prioritize other things. I hope this is an easy fix.
Reply to thread Export thread (mbox)