Bugs with links, or wrong golang syntax?

Two questions.
I wrote this in the links’ hook:

{{ if eq $destination "#" }}
{{ else if or (eq .Text "...") (eq $destination "COMMENTS")}}
	<span class="inner-comments">[{{.Text}}]</span>

The exemple is

> dsfdsfds [...] [sfdsfds](COMMENTS)

[sfdsfds](COMMENTS) (signifying a commentary inside a quotation block) processes properly, but never [...].

  1. Why does eq .Text "..." not work ? I tried adding () to the the [...] and it doesn’t get recognized as anything else than a link.
  2. without the htmlunescape every single special character comes up as its html escape code. Why ? It’s supposed to be rendered already.

1) This is not a link:


2) This is a link with an empty destination:


3) Unless you have this in your site config…

typographer = false

The ... is an ellipsis, rendered to &hellip;

1 Like

Thanks. But if I use , what do I need to target it ?
if eq .Text "…" doesn’t seem to do the trick. Neither does the elipsis character either.

Funny though, do you know why it escapes the ellipsis and not, for instance, ᅫ ? Or , the unicode character just before, and probably less common ?
I’ll just use {{ else if eq $destination "#"}}. simple enough :+1:

Well, since ... is rendered to &hellip; you need to compare .Text to… &hellip;

No, it doesn’t.

The Goldmark typographer extension replaces a predefined set of punctuation characters with an HTML entity.


1 Like

What exactly are you trying to achieve?

well nothing anymore, it’s fine now :slight_smile:
I’m content of the way it works.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.