Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Params with text '-' as prefix are not rendered #16

Open
blues-man opened this issue Aug 30, 2021 · 8 comments
Open

Params with text '-' as prefix are not rendered #16

blues-man opened this issue Aug 30, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@blues-man
Copy link
Contributor

With 0.1.12 version, any text (not link) with - character that comes before a query param is not rendered.

Example:

?PROJECT=workshop&CLUSTER_SUBDOMAIN=apps.crc.testing

[source,text,role="copypaste",subs="+attributes"]
----
http://nationalparks-%PROJECT%.%CLUSTER_SUBDOMAIN%
----

Will be rendered as:

http://nationalparks-%PROJECT%.apps.crc.testing

Probably this regexp is not matching it correctly?

@blues-man blues-man added the bug Something isn't working label Aug 30, 2021
@hatmarch
Copy link
Contributor

The issue is in code that I believe @kameshsampath wrote. For some reason the code explicitly won't match anything that begins with -% or ends with %- if I'm reading the regex right. In our case the regex turns out like this

re = /(%25PROJECT%25|(?<!-)%PROJECT%(?!-))/gi

which causes %PROJECT% in your URL to not get replaced.

@hatmarch
Copy link
Contributor

Looks like this came in commit: db18c1d. Commit message implies it that it is to keep "placeholders in the code block" from being replaced

@blues-man, do you know what these placeholders might refer to and whether the starter-workshop makes use of this?

@evanshortiss
Copy link
Member

I just helped @danieloh30 workaround this. I have a fork that reverts the negative lookbehind part of the regex: https://github.com/evanshortiss/course-ui/blob/fix-url-hyphen-substitution/src/js/07-userparams-behaviour.js

It would be good to understand why this change was made as @hatmarch asks.

@danieloh30
Copy link

Thx for the help @evanshortiss I

As Evan said, it works for me. Hope this fix will be applied to the new version soon.

@evanshortiss
Copy link
Member

evanshortiss commented Aug 9, 2022

Oh, and BTW. To test this reverted regular expression with your content:

  1. change ui.bundle.url property in the dev-site.yml to https://github.com/evanshortiss/course-ui/releases/download/v0.1.13-prerelease/ui-bundle.zip
  2. run rm -rf .cache/ gh-pages node_modules inside your repository
  3. run npm install
  4. run npm run dev
  5. check the results in a web browser

@danieloh30
Copy link

good to know. I actually updated the url in dev-site.yml, then just ran npm run dev

@evanshortiss
Copy link
Member

You can probably be OK with just making that change, but I am recommending a clean slate to be safe 😉

@danieloh30
Copy link

I got you! I will follow your tip next time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants