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

Bug: conversion of literals can replace the wrong content #133

Closed
lehni opened this issue Oct 4, 2020 · 4 comments · Fixed by #134
Closed

Bug: conversion of literals can replace the wrong content #133

lehni opened this issue Oct 4, 2020 · 4 comments · Fixed by #134
Assignees
Labels
type: enhancement Functionality that enhances existing features

Comments

@lehni
Copy link
Collaborator

lehni commented Oct 4, 2020

After having worked a bit with this part of the code, it just occurred to me that there could be this theoretical scenario where the use of replace() will replace the wrong part of the content, because it's run on the full result, not just the current element:

Input

p
  | Just some text mentioning
  code div#id
  | or perhaps it talks about
  code div.class
div(id="id")
div(class="class")

Expected Output

p
  | Just some text mentioning
  code div#id
  | or perhaps it talks about
  code div.class
#id
.class

Actual Output

p
  | Just some text mentioning
  code #id
  | or perhaps it talks about
  code .class
div#id
div.class

I have ideas for how to fix this, will work on that next.

@Shinigami92
Copy link
Member

Just in case, if you create a new PR, could you now use directly the repo instead of the fork? Then I can also help work and it's easier for me to checkout and review and also resolve merge conflicts 😄

@lehni
Copy link
Collaborator Author

lehni commented Oct 4, 2020

Yes I was thinking already that I should have done that yesterday. Will do so with this one!

@Shinigami92
Copy link
Member

Are these two things?

code div#id instead of code #id
and
div#id instead of #id <-- This one was known to me since initial project setup XD but I was too lazy cause a second format resolved it :D

@lehni
Copy link
Collaborator Author

lehni commented Oct 4, 2020

The point is that when you have div#id anywhere in your text content, it'll get replaced if it appears before the actual tag that was supposed to get replaced. This probably makes that clearer:

p
  | Just some text mentioning "div#id"
  | or perhaps it talks about "div.class"
div(id="id")
div(class="class")

The use of code tags in my example above doesn't have anything to do with the problem

lehni added a commit that referenced this issue Oct 4, 2020
lehni added a commit that referenced this issue Oct 4, 2020
lehni added a commit that referenced this issue Oct 5, 2020
@Shinigami92 Shinigami92 added the type: enhancement Functionality that enhances existing features label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Functionality that enhances existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants