Closed GoogleCodeExporter closed 9 years ago
That is an exceedingly polite report. Your example is a clear demonstration
that the "fix" to issue 96 was not the best, there are (or soon going to be)
millions of links with disambiguation. Why to URL-encode these very common
links, when the fix to issue 96 is obvious: pressing the space bar (before
typing the parenthesis that is not a part of the link).
* http://en.wikipedia.org/wiki/Vim_(text_editor)
* http://en.wikipedia.org/wiki/Vim_(text_editor),
* http://en.wikipedia.org/wiki/Vim_(text_editor);
* http://en.wikipedia.org/wiki/Vim_(text_editor).
* http://en.wikipedia.org/wiki/Vim_(text_editor)!
* http://en.wikipedia.org/wiki/Vim_(text_editor)?
None of them convert to a working link in HTML. As you very kindly say, this is
consistent, but inconvenient.
# http://en.wikipedia.org/wiki/Vim, http://en.wikipedia.org/wiki/Vim;
http://en.wikipedia.org/wiki/Vim. http://en.wikipedia.org/wiki/Vim?
http://en.wikipedia.org/wiki/Vim!
This one is less consistent, three of them work, two don't.
I second your suggestion to improve the documentation, the URL-encoding trick
is going to be necessary in same cases. It may be more suitable to put a link
in the vimwiki docs, since it would take too much space to say something useful
about URL encoding.
Original comment by tpospi...@gmail.com
on 30 Jan 2012 at 5:47
It is useful to have a test file for these web links. It seems 1.2 and current
development version behave identically on this file. And there is another very
inconvenient consistency, the unordered and the ordered lists in the first part
of the file both merge into a single unordered list in HTML. But that has
nothing to do with this issue of web links.
Original comment by tpospi...@gmail.com
on 30 Jan 2012 at 6:21
Attachments:
One can (sort of) have both correct handling of sensible links such as those
from Wikipedia, and also automatic exclusion of punctuation and parentheses
that (probably) do not belong to the link, even if there is no intervening
space (that was the non-issue 96). Of course, it is not going to work all the
time, but in simple cases it is OK.
The syntax highlighting is not OK, though (it shows the punctuation as part of
the link), it is only the conversion to HTML that happens correctly. This seems
to be Vim issue, not Vimwiki. One can see it on those lines that have many
links (from line 11 in the file attached above), it is strangely inconsistent.
Anyway, instead of practicing URL-escapes, one could just patch manually the
file plugin/vimwiki.vim because it is more or less one-line change. The problem
is the regular expression would probably not survive unharmed the trip through
this comment system... I'll try anyway.
Version 1.2, plugin/vimwiki.vim about line 317-318 (end of definition of
g:vimwiki_rxWeblink)
looks like
{{{
\'\+\S\+'.
\'[().,?\]]\@<!'
}}}
needs to be changed to
{{{
\'\S\S\{-}\%(([^ \t()]*)\)\=\ze[),;.!?]\=\%([ \t\]]\|$\)'
}}}
for a marked improvement in handling the links. As I wrote, the syntax
highlighting is not behaving when there are several links on the same line. But
that is not too bad, it will make people press the spacebar to separate the
link from the text that follows, that is a much more robust solution. Colon is
not autoexcluded, that would be confusing.
The attached file shows the improvement (but I also added some protocols, that
is why so many things at the bottom show as "links", but those are not handled
in any special way, so that is just a gimmick at the moment).
Original comment by tpospi...@gmail.com
on 30 Jan 2012 at 7:05
Attachments:
Super! I should resetup test environment and add your testlinks to it.
Should we close this issue?
Original comment by habamax
on 2 Feb 2012 at 6:51
Original comment by tpospi...@gmail.com
on 3 Feb 2012 at 4:36
Original issue reported on code.google.com by
jtbergem...@yahoo.de
on 27 Jan 2012 at 8:21