vimwiki-backup / vimwiki

Automatically exported from code.google.com/p/vimwiki
1 stars 1 forks source link

[http://example.com Discription] cannot be normalized #353

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the past, [http://example.com Discription] style url links can be 
successfully converted when :VimwikiAll2HTML. In this new version they can't. 
So I figure I'd use the + key to 'normalize' them (can somebody explain why 
make the changes?). 

After + is pressed with the cursor initially at '[', the example changes to:

[[[http://example.com]] Discription]

But the generated html is still not correct.

Am I getting the meaning of 'normalize' wrong? Can you please provide a 
solution? I am using 2.0.1 'stu'.

Thanks.

Original issue reported on code.google.com by Concrete...@gmail.com on 23 Jul 2012 at 6:45

GoogleCodeExporter commented 8 years ago
Sorry, the changed/normalized example should be:

[[[http://example.com]] Discription]

Original comment by Concrete...@gmail.com on 23 Jul 2012 at 6:46

GoogleCodeExporter commented 8 years ago
In short, this syntax is no longer supported.  Link normalization "converts 
words into Wikilinks; converts raw URLs into Wikilinks; and adds placeholder 
text to Wiki- or Weblinks that are missing descriptions".  In particular, link 
normalization does not recognize or operate on entities that fall outside the 
predefined set: words, wikilinks, raw urls, and weblinks.

Much discussion and effort went into simplifying and re-implementing links.  In 
this development, it was decided that the default syntax should contain only a 
minimal required set of syntaxes, which have been designed around [[-link and 
{{-link syntaxes.  

For greater insight into these matters, you can scan the discussions on the 
LinkProperties wiki page, in addition to various issues, and code revisions.

A solution akin to the third solution proposed in  
https://groups.google.com/d/msg/vimwiki/NdS9OBG2dys/Pz9dOELwjIoJ might be 
possible.  If you are interested, I will see if I can hack together the 
necessary mapping.

Original comment by stu.andrews on 23 Jul 2012 at 3:25

GoogleCodeExporter commented 8 years ago
Dear stu,

I understand the reasons behind the changes. I'd really appreciate your hack on 
this. 

By the way, what's the up-to-date syntax for links with description? 
[link](description) seems not to work.

Original comment by Concrete...@gmail.com on 23 Jul 2012 at 3:55

GoogleCodeExporter commented 8 years ago
[[link|description]] is the default.  The syntax [description](link) is only 
available when markdown syntax is selected.

If you have a minute, please see ":help vimwiki-syntax-links" and ":help 
vimwiki-syntax-schemes" and let me know if and how these descriptions can be 
improved.   

I will now look into creating a mapping that should help you.

Thanks,
- Stu

Original comment by stu.andrews on 24 Jul 2012 at 12:13

GoogleCodeExporter commented 8 years ago
Hi ConcreteVitamin,

Please let me know if the following mappings work.

These can be defined in your .vimrc file, each on a single line.  When 
copy-n-pasting, be sure not to include extra spaces where your browser wraps 
the line.

Call these with `<leader>qr` or `<leader>qp`.  As any search-and-replace, you 
will be asked before each replace operation.

 * [R]estrictive version

nnoremap <Leader>qr 
:%s/\%(\[\)\@<!\[\(\%(\%(\%(http\\|https\\|file\\|ftp\\|gopher\\|telnet\\|nntp\\
|ldap\\|rsync\\|imap\\|pop\\|irc\\|ircs\\|cvs\\|svn\\|svn+ssh\\|git\\|ssh\\|fish
\\|sftp\):\%(\/\/\)\)\\|\%(\%(mailto\\|news\\|xmpp\\|sip\\|sips\\|doi\\|urn\\|te
l\):\)\)\S\{-1,}\%(([^\s\t()]*)\)\=\)\%(\s\+\)\([^\\]\{-}\)\]/\[\[\1\|\2\]\]/gc<
CR>

 * [P]ermissive version

nnoremap <Leader>qp :%s/\%(\[\)\@<!\[\(.*\) \(.*\)\]/\[\[\1\|\2\]\]/gc<CR>

Original comment by stu.andrews on 24 Jul 2012 at 2:10

GoogleCodeExporter commented 8 years ago
Thanks for your hack! The Restrictive version works well (while the Permissive 
one does not), though I don't know how to batch-apply the command to all *.wiki.

As for :h vimwiki-syntax-links, here are some problems that I noticed:

1) The markup of a url with a description is not mentioned.
2) How to enable the markdown-style is not mentioned.

I want you and other contributors to vimwiki to know that vimwiki has helped me 
a lot, and it has become a meaningful part of my everyday life. Thank you all.

Original comment by Concrete...@gmail.com on 24 Jul 2012 at 11:58

GoogleCodeExporter commented 8 years ago
I've tried to load all *.wiki in buffers and :bufdo [the :s command]. However, 
this does not work. Can you please instruct me on how to batch-apply the 
command?

Original comment by Concrete...@gmail.com on 24 Jul 2012 at 12:40

GoogleCodeExporter commented 8 years ago
[Before you experiment further, please make a backup of your entire wiki]

I never used "[URL DESCR]" links.  However, if I was in your situation, I would 
not trust this mapping to work without error across 100's of files.  This is 
why I designed the mapping using the "[c]onfirm each substitution" flag of the 
search-n-replace command.

As a caveat, I must say that I am not experienced in the use of bufdo.  
However, after removing the confirm flag from the mapping (i.e. so that the it 
ends with "g<CR>" instead of "gc<CR>"), I was able to run the following bufdo 
command.  It successfully converted the links that I had entered into two 
buffers for testing.

:bufdo normal \qr

[***Again, please make a backup first***]

p.s. thanks for looking at the docs.  I will incorporate your suggestions in a 
future edit.

Original comment by stu.andrews on 24 Jul 2012 at 4:22

GoogleCodeExporter commented 8 years ago
This works because I use the default "mapleader" character "\" for <Leader>.

If "echo mapleader" displays another character, then you will need to replace 
the "\" character in my bufdo command above, with this other character.

Original comment by stu.andrews on 24 Jul 2012 at 4:30

GoogleCodeExporter commented 8 years ago
See ":help vimwiki-syntax" and ":help vimwiki-option-syntax" for more about 
using markdown syntax.  

Original comment by stu.andrews on 24 Jul 2012 at 4:33

GoogleCodeExporter commented 8 years ago

Original comment by stu.andrews on 26 Jul 2012 at 9:36