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

HTML Notation is not parsed correct #57

Open
Falke-Design opened this issue Dec 19, 2020 · 6 comments
Open

HTML Notation is not parsed correct #57

Falke-Design opened this issue Dec 19, 2020 · 6 comments
Labels

Comments

@Falke-Design
Copy link
Member

There is a issue Leaflet/Leaflet#6208 where the ' is not correct parsed, the regex have to be changed:

Doc

@option zoomOutText: String = '−'

Regex:

\s*(?:)@(?:)((?:)\S+)(?:)(?:\s+(?:)((?:)[^;\n]+)){0,1}

When the ; is removed it works.

I tried do change it and select until the exact match ;\n with or without ; but the regex is to complicated for me.

@IvanSanchez
Copy link
Member

I'm not seeing that regexp in src/regexps.mjs. Are you sure that's the regexp being used?

@IvanSanchez
Copy link
Member

It might be autogenerated from

	global.leafDirective = xRegExp(`  \\s* ${  char  } (?<directive> \\S+ ) (\\s+ (?<content> [^;\\n]+ )){0,1} `, 'gnx');

It might be possible to trick the regexp by adding another ; at the end, i.e.

@option zoomOutText: String = '&#x2212;';

@Falke-Design
Copy link
Member Author

Yes sorry, it is autogenerated from there.

No your suggestion is not working,

It is working with the regex:

\s*(?:)@(?:)((?:)\S+)(?:)(?:\s+(?:)((?:).+[^;\n])){0,1}

I removed the + from the end added it before the negation [^;\n]

So it looks like:

global.leafDirective = xRegExp(`  \\s* ${  char  } (?<directive> \\S+ ) (\\s+ (?<content> .+[^;\\n])){0,1} `, 'gnx');

@IvanSanchez maybe you can test the regex on you projects, because the test suite are not working for me.

If it is working for you I will create a PR

@IvanSanchez
Copy link
Member

@Falke-Design It seems that I messed up the unit tests after tweaking the basic template a bit yesterday. Mea culpa.

Anyway, I tested your regexp, and unfortunately it breaks stuff, specifically:

    # 🍂property parent: TreeNode; Parent of this node.  Will be `nil` for a root node.
181,182c181,182
<               <td><code><a href='#treenode'>TreeNode</a></code></td>
<               <td>Parent of this node.  Will be <code>nil</code> for a root node.</td>
---
>               <td><code>TreeNode; Parent of this node.  Will be `nil` for a root node.</code></td>
>               <td></td>

That shorthand syntax (which is equivalent to writing two lines, one with the actual directive and another with the text) is used elsewhere, e.g.
https://github.com/Leaflet/Leaflet/blob/7db94fd1ec23f0967dd8b07a5e2e2b1554b6d8db/src/layer/vector/Circle.js#L39

@IvanSanchez
Copy link
Member

@Falke-Design Can you please try with the code from 5e4cdf9 ? That regexp should behave nicer (now stuff needs ; , space after a semicolon, to separate several directives in the same line).

It'd be nice to have a specific e2e test with the zoomControl stuff afterwards.

@Falke-Design
Copy link
Member Author

I would like to create tests but it is hard for me to understand this, because the most things not working correct and I don't know jasmine.

Maybe you can create a explanation how to create and run tests.

My failures:

  • npm run test not working Could not resolve entry module (rollup.config.js;).. If I call npm run rollup it is working also when I call jasmine
  • If jasmine is running it has 8 failures, is something missing?
  • npm run prepublish, update-markdown-leafdoc, update-html-leafdoc --> "src" not found", what is need that this works?
  • specRunner.html --> Error during loading: TypeError ... "multilang-extract-comments"
  • A ton of eslint erros but I understand that they are not fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants