FHIR Chat · issue with URL containing & character · tooling

Stream: tooling

Topic: issue with URL containing & character


view this post on Zulip Jose Costa Teixeira (Nov 03 2020 at 08:42):

I want to add something to my template.
A small script at the end that does a GET <somegoogleforms>?parameter1&parameter2&parameter3

view this post on Zulip Jose Costa Teixeira (Nov 03 2020 at 08:44):

This is now giving me a lot of unable to parse character reference '"'' . what can I do to remove this?

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 16:34):

What kind of script? In the template where?

view this post on Zulip Jose Costa Teixeira (Nov 03 2020 at 16:50):

in one of my templates. It's the script to provide feedback which calls a url with a couple of parameters

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 19:24):

So the issue is that you want to substitute a URL into the rendered page, but you want the content to be parameterized - and you're trying to do that using Liquid and running into issues?

view this post on Zulip Jose Costa Teixeira (Nov 03 2020 at 20:00):

yes

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 21:26):

What's your liquid?

view this post on Zulip Jose Costa Teixeira (Nov 03 2020 at 22:27):

not sure if this is what you're asking, but this is the part of the code that adds the liquid

    {% if site.data.features.feedback.parameters %}
    {% for parm in site.data.features.feedback.parameters %}
    feedbackurl = feedbackurl + "&";
    feedbackurl = feedbackurl + {{ parm.name }} + '=' + {{ parm.value }}
    {% endfor %}
    {% endif %};

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 23:05):

Your & needs to be &

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 23:05):

blah. &amp;amp;

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 23:05):

blah &amp;

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 23:05):

I.e. escape it as required in HTML.

view this post on Zulip Jose Costa Teixeira (Nov 11 2020 at 21:05):

I did that, it resolves the qa issue, but now the url does not work because the & is encoded. The url should be
...&param1=x&param2=y but it is
...&amp;param1=x&amp;param2=y
How do I unencode it?

view this post on Zulip Lloyd McKenzie (Nov 11 2020 at 21:37):

What do you mean?

view this post on Zulip Jose Costa Teixeira (Nov 11 2020 at 21:50):

My script above creates a parametrized URL. If I change it to

 {% if site.data.features.feedback.parameters %}
    {% for parm in site.data.features.feedback.parameters %}
    feedbackurl = feedbackurl + "&amp;";
    feedbackurl = feedbackurl + {{ parm.name }} + '=' + {{ parm.value }}
    {% endfor %}
    {% endif %};

then my parametized url no longer works, because the & has become &amp;

view this post on Zulip Jose Costa Teixeira (Nov 11 2020 at 21:52):

so apparently i need to escape the URL to avoid QA issues, but after jekyll runs, i need it to be & and not &amp; -
this is not html content, it is a url.

view this post on Zulip Lloyd McKenzie (Nov 11 2020 at 22:01):

@Eric Haas :)

view this post on Zulip Eric Haas (Nov 11 2020 at 22:50):

have you looked at the URI Escape filter : https://jekyllrb.com/docs/liquid/filters/ ?

I am not sure what you are trying to achieve.... if you want the QA to ignore this URL then wrap it in a code block

e.g base?foo=bar&fo02=bar2

view this post on Zulip Jose Costa Teixeira (Nov 12 2020 at 10:56):

What I need: The final html must have, at the end of each page, a small script, and that script contains a "&"

view this post on Zulip Jose Costa Teixeira (Nov 12 2020 at 10:57):

If I escape it, it gets published as an escaped &amp;
If I don't escape it, it gives me a ton of QA errors

view this post on Zulip Jose Costa Teixeira (Nov 12 2020 at 10:58):

So I need a way to pass that "&" all the way through the publication without giving me the QA error

view this post on Zulip Jose Costa Teixeira (Nov 12 2020 at 19:40):

Any ideas @Eric Haas ?

view this post on Zulip Eric Haas (Nov 12 2020 at 20:14):

use a custom template?

view this post on Zulip Jose Costa Teixeira (Nov 12 2020 at 20:22):

This is in a custom template.


Last updated: Apr 12 2022 at 19:14 UTC