mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.39k stars 411 forks source link

Update URL regular expression for anchorizeURL to include parenthetical subtopics from wikipedia #507

Open SkyLeach opened 3 years ago

SkyLeach commented 3 years ago

I often use the emmet-quoted-text-url (default mapping of <C-y>A) to provide a hint to blog readers.

A large percentage of these blockquotes involve wikipedia and wikipedia encodes lexical contextual encapsulation parenthetically. Here is an example url: https://en.wikipedia.org/wiki/Lint_(software).

Here is what happens due to the current URL parsing:

Tools like this in computer science are known as linters (see: <blockquote class="quote">
<a href="https://en.wikipedia.org/wiki/Lint_">Lint - Wikipedia</a>
<br>
<p>Places [ edit ] Lint, Belgium , a municipality located in Antwerp, Belgium Linț, a village in Chețan...</p>
<cite>https://en.wikipedia.org/wiki/Lint_</cite>
</blockquote>
(software) )

As you can see, the top-level contextual definition (usually the first term defined on wikipedia) is the one returned because the parenthesis are excluded from the URL.

I think I could update the regex and issue a PR but wanted to make sure this was in line with the project philosophy before doing so. The regex in question is (I believe) inside of /autoload/emmet.vim on line 860 (linked).