From 3cbc505fba895493d3f763f3d996a069766b3023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Tue, 24 Oct 2017 14:35:40 +0200 Subject: [PATCH 01/14] Update Documentation to reflect EOL of MathJax CDN --- doc/vimwiki.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index bc8db38..6b89238 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -1233,14 +1233,9 @@ LaTeX code). Note: the highlighting in Vim is automatic. For the rendering in HTML, you have two alternative options: -1. using the MathJax server for rendering (needs internet connection). -Add to your HTML template the following line: - - - -2. installing MathJax locally (faster, no internet required). Choose a -folder on your hard drive and save MathJax in it. Then add to your HTML -template the following line: +1. installing MathJax locally (Recommended: faster, no internet required). +Choose a folder on your hard drive and save MathJax in it. Then add to your +HTML template the following line: @@ -1255,6 +1250,11 @@ template folder. For instance, a sensible folder structure could be: In this case, would be "../mathjax" (without quotes). +2. Loading MathJax from a CDN-server (needs internet connection). +Add to your HTML template the following line: + + + ------------------------------------------------------------------------------ 5.9. Blockquotes *vimwiki-syntax-blockquotes* From 37e4dfc2883c0dec5862df128e7f421e0795ce03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Sun, 17 Sep 2017 01:10:14 +0100 Subject: [PATCH 02/14] Add License-File Vimwiki currently has not License-File, and the license is only mentioned in the help-file. We should change this. --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..be93eec --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2008-2010 Maxim Kim + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 742fc996928e6aa2f2053848aa151fdcccd0dfac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Wed, 25 Oct 2017 02:11:01 +0200 Subject: [PATCH 03/14] Add Copyright-attribution to Daniel Schemala --- LICENSE | 1 + doc/vimwiki.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/LICENSE b/LICENSE index be93eec..cdf8546 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2008-2010 Maxim Kim + 2013-2017 Daniel Schemala Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 6b89238..c5b227b 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3105,6 +3105,7 @@ The MIT Licence http://www.opensource.org/licenses/mit-license.php Copyright (c) 2008-2010 Maxim Kim + 2013-2017 Daniel Schemala Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From ec3d554c0b824f0e10f455b17645d6a722520c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Wed, 25 Oct 2017 13:10:23 +0200 Subject: [PATCH 04/14] Update list of contributers --- doc/vimwiki.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index c5b227b..06f95b8 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2854,6 +2854,19 @@ Contributors and their Github usernames in roughly chronological order: - @wangzq - Jinzhou Zhang (@lotabout) - Michael Riley (@optik-aper) + - Irfan Sharif (@irfansharif) + - John Conroy (@jconroy77) + - Christian Rondeau (@christianrondeau) + - Alex Thorne (@thornecc) + - Shafqat Bhuiyan (@priomsrb) + - Bradley Cicenas (@bcicen) + - Michael Thessel (@MichaelThessel) + - Michael F. Schönitzer (@nudin) + - @sqlwwx + - Guilherme Salazar (@salazar) + - Daniel Trnka (@trnila) + - Yuchen Pei (@ycpei) + - @maqiv ============================================================================== From cf8e3e731929b872d154d631d5b067e4c100cc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Wed, 25 Oct 2017 13:45:00 +0200 Subject: [PATCH 05/14] Unified spelling Licence -> License --- doc/vimwiki.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 06f95b8..323ccfe 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3114,7 +3114,7 @@ http://code.google.com/p/vimwiki/issues/list ============================================================================== 16. License *vimwiki-license* -The MIT Licence +The MIT License http://www.opensource.org/licenses/mit-license.php Copyright (c) 2008-2010 Maxim Kim From d9a73b71173b418bc1ae64217aa4e2c65272541f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ci=C4=99=C5=BCarkiewicz?= Date: Sat, 14 Oct 2017 23:12:47 -0700 Subject: [PATCH 06/14] Fix diary index generation with custom file extensions Fix #302 --- autoload/vimwiki/diary.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim index fcd176a..d6cd9e9 100644 --- a/autoload/vimwiki/diary.vim +++ b/autoload/vimwiki/diary.vim @@ -65,7 +65,7 @@ fun! s:read_captions(files) "{{{ let result = {} for fl in a:files " remove paths and extensions - let fl_key = fnamemodify(fl, ':t:r') + let fl_key = substitute(fnamemodify(fl, ':t'), VimwikiGet('ext').'$', '', '') if filereadable(fl) for line in readfile(fl, '', s:vimwiki_max_scan_for_caption) From eed4ceff1af6ae11f33ee589f7bf099fdc62fdd5 Mon Sep 17 00:00:00 2001 From: Drew Hays Date: Thu, 17 Aug 2017 23:53:40 -0700 Subject: [PATCH 07/14] Escape the 'dot' in extension substitution This escapes the `.` preceding an extension (e.g. `.wiki`) so that it doesn't accidentally match any character. For example: `[vimwiki](vimwiki)` was opening the `vi.wiki` page, because of this rule. --- autoload/vimwiki/base.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 0cd537a..4e3cde5 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1273,7 +1273,7 @@ function! vimwiki#base#follow_link(split, reuse, move_cursor, ...) "{{{ " remove the extension from the filename if exists, because non-vimwiki " markdown files usually include the extension in links - let lnk = substitute(lnk, VimwikiGet('ext').'$', '', '') + let lnk = substitute(lnk, '\'.VimwikiGet('ext').'$', '', '') endif let current_tab_page = tabpagenr() From 293e1f51eecfe93b9e519a5b10e059edf835ac35 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 18 Dec 2016 13:02:51 -0600 Subject: [PATCH 08/14] Added the option to open vimwiki in a pane. 1 tabedit 2 split 3 vsplit Similar to opening a tab,:: vimwiki#base#goto_index(v:count1, 1) we can now open a split with:: vimwiki#base#goto_index(v:count1, 2) and a vertical split with:: vimwiki#base#goto_index(v:count1, 3) --- autoload/vimwiki/base.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 4e3cde5..a246081 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1325,8 +1325,12 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{ let idx = 0 endif - if a:0 + if a:0 == 1 let cmd = 'tabedit' + elseif a:0 == 2 + let cmd = 'sp' + elseif a:0 == 3 + let cmd = 'vsp' else let cmd = 'edit' endif From 734d0143675e64966881ee62f89391d3c2b4c06d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 18 Dec 2016 13:02:51 -0600 Subject: [PATCH 09/14] Added the option to open vimwiki in a pane. 1 tabedit 2 split 3 vsplit Similar to opening a tab,:: vimwiki#base#goto_index(1, 1) we can now open a split with:: vimwiki#base#goto_index(1, 2) and a vertical split with:: vimwiki#base#goto_index(1, 3) --- autoload/vimwiki/base.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index a246081..07e3e72 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1325,16 +1325,18 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{ let idx = 0 endif - if a:0 == 1 + if a:1 == 1 let cmd = 'tabedit' - elseif a:0 == 2 - let cmd = 'sp' - elseif a:0 == 3 - let cmd = 'vsp' + elseif a:1 == 2 + let cmd = 'split' + elseif a:1 == 3 + let cmd = 'vsplit' else let cmd = 'edit' endif + echomsg 'Passed argument '.a:0.'. Using cmd '.cmd + call Validate_wiki_options(idx) call vimwiki#base#edit_file(cmd, \ VimwikiGet('path', idx).VimwikiGet('index', idx). From 95d4c095d0a615c9586df49d3bc0eedec8e4ea4d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 18 Dec 2016 13:02:51 -0600 Subject: [PATCH 10/14] Added the option to open vimwiki in a pane. 1 tabedit 2 split 3 vsplit Similar to opening a tab,:: vimwiki#base#goto_index(v:count1, 1) we can now open a split with:: vimwiki#base#goto_index(v:count1, 2) and a vertical split with:: vimwiki#base#goto_index(v:count1, 3) --- autoload/vimwiki/base.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 07e3e72..ecc322b 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1335,8 +1335,6 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{ let cmd = 'edit' endif - echomsg 'Passed argument '.a:0.'. Using cmd '.cmd - call Validate_wiki_options(idx) call vimwiki#base#edit_file(cmd, \ VimwikiGet('path', idx).VimwikiGet('index', idx). From 02e32489d7652189026c1d4b48bf88b6da98a739 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 18 Dec 2016 13:02:51 -0600 Subject: [PATCH 11/14] Added the option to open vimwiki in a pane. 1 tabedit 2 split 3 vsplit Similar to opening a tab,:: vimwiki#base#goto_index(v:count1, 1) we can now open a split with:: vimwiki#base#goto_index(v:count1, 2) and a vertical split with:: vimwiki#base#goto_index(v:count1, 3) --- autoload/vimwiki/base.vim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index ecc322b..6f81453 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1325,12 +1325,14 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{ let idx = 0 endif - if a:1 == 1 - let cmd = 'tabedit' - elseif a:1 == 2 - let cmd = 'split' - elseif a:1 == 3 - let cmd = 'vsplit' + if a:0 + if a:1 == 1 + let cmd = 'tabedit' + elseif a:1 == 2 + let cmd = 'split' + elseif a:1 == 3 + let cmd = 'vsplit' + endif else let cmd = 'edit' endif From b6d47e894d78bc9589a11cde501093fa04da1941 Mon Sep 17 00:00:00 2001 From: Daniel Etrata Date: Mon, 6 Nov 2017 21:08:52 -0600 Subject: [PATCH 12/14] Give vimwiki#diary#make_note similar functionality --- autoload/vimwiki/diary.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim index d6cd9e9..2bc702b 100644 --- a/autoload/vimwiki/diary.vim +++ b/autoload/vimwiki/diary.vim @@ -174,8 +174,14 @@ function! vimwiki#diary#make_note(wnum, ...) "{{{ call vimwiki#path#mkdir(VimwikiGet('path', idx).VimwikiGet('diary_rel_path', idx)) - if a:0 && a:1 == 1 - let cmd = 'tabedit' + if a:0 + if a:1 == 1 + let cmd = 'tabedit' + elseif a:2 == 2 + let cmd = 'split' + elseif a:3 == 3 + let cmd = 'vsplit' + endif else let cmd = 'edit' endif From 91c382a034062e23571058f6b4cc9976016906af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Fri, 10 Nov 2017 22:28:33 +0100 Subject: [PATCH 13/14] Use a safe substitution-function everywhere --- autoload/vimwiki/base.vim | 47 +++++++++++++++++------------- autoload/vimwiki/markdown_base.vim | 11 +++++-- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 6f81453..62140ab 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -8,6 +8,13 @@ if exists("g:loaded_vimwiki_auto") || &cp endif let g:loaded_vimwiki_auto = 1 +" s:safesubstitute +function! s:safesubstitute(text, search, replace, mode) "{{{ + " Substitute regexp but do not interpret replace + let escaped = escape(a:replace, '\&') + return substitute(a:text, a:search, escaped, a:mode) +endfunction " }}} + " s:vimwiki_get_known_syntaxes function! s:vimwiki_get_known_syntaxes() " {{{ " Getting all syntaxes that different wikis could have @@ -465,7 +472,7 @@ function! vimwiki#base#generate_links() "{{{ let abs_filepath = vimwiki#path#abs_path_of_link(link) if !s:is_diary_file(abs_filepath) call add(lines, bullet. - \ substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', '\='."'".link."'", '')) + \ s:safesubstitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', link, '')) endif endfor @@ -677,13 +684,13 @@ function! s:jump_to_anchor(anchor) "{{{ let segments = split(anchor, '#', 0) for segment in segments - let anchor_header = substitute( + let anchor_header = s:safesubstitute( \ g:vimwiki_{VimwikiGet('syntax')}_header_match, - \ '__Header__', "\\='".segment."'", '') - let anchor_bold = substitute(g:vimwiki_{VimwikiGet('syntax')}_bold_match, - \ '__Text__', "\\='".segment."'", '') - let anchor_tag = substitute(g:vimwiki_{VimwikiGet('syntax')}_tag_match, - \ '__Tag__', "\\='".segment."'", '') + \ '__Header__', segment, '') + let anchor_bold = s:safesubstitute(g:vimwiki_{VimwikiGet('syntax')}_bold_match, + \ '__Text__', segment, '') + let anchor_tag = s:safesubstitute(g:vimwiki_{VimwikiGet('syntax')}_tag_match, + \ '__Tag__', segment, '') if !search(anchor_tag, 'Wc') \ && !search(anchor_header, 'Wc') @@ -1176,8 +1183,8 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header, " write new listing let new_header = whitespaces_in_first_line - \ . substitute(g:vimwiki_rxH1_Template, - \ '__Header__', '\='."'".a:start_header."'", '') + \ . s:safesubstitute(g:vimwiki_rxH1_Template, + \ '__Header__', a:start_header, '') call append(start_lnum - 1, new_header) let start_lnum += 1 let lines_diff += 1 + len(a:strings) @@ -1832,9 +1839,9 @@ function! vimwiki#base#table_of_contents(create) for [lvl, link, desc] in headers let esc_link = substitute(link, "'", "''", 'g') let esc_desc = substitute(desc, "'", "''", 'g') - let link = substitute(g:vimwiki_WikiLinkTemplate2, '__LinkUrl__', - \ '\='."'".'#'.esc_link."'", '') - let link = substitute(link, '__LinkDescription__', '\='."'".esc_desc."'", '') + let link = s:safesubstitute(g:vimwiki_WikiLinkTemplate2, '__LinkUrl__', + \ '#'.esc_link, '') + let link = s:safesubstitute(link, '__LinkDescription__', esc_desc, '') call add(lines, startindent.repeat(indentstring, lvl-1).bullet.link) endfor @@ -1855,13 +1862,13 @@ endfunction function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{ let lnk = a:template if a:rxUrl != "" - let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", 'g') + let lnk = s:safesubstitute(lnk, '__LinkUrl__', a:rxUrl, 'g') endif if a:rxDesc != "" - let lnk = substitute(lnk, '__LinkDescription__', '\='."'".a:rxDesc."'", 'g') + let lnk = s:safesubstitute(lnk, '__LinkDescription__', a:rxDesc, 'g') endif if a:rxStyle != "" - let lnk = substitute(lnk, '__LinkStyle__', '\='."'".a:rxStyle."'", 'g') + let lnk = s:safesubstitute(lnk, '__LinkStyle__', a:rxStyle, 'g') endif return lnk endfunction " }}} @@ -1900,8 +1907,8 @@ function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) " {{{ if descr == "" let descr = s:clean_url(url) endif - let lnk = substitute(template, '__LinkDescription__', '\="'.descr.'"', '') - let lnk = substitute(lnk, '__LinkUrl__', '\="'.url.'"', '') + let lnk = s:safesubstitute(template, '__LinkDescription__', descr, '') + let lnk = s:safesubstitute(lnk, '__LinkUrl__', url, '') return lnk endfunction " }}} @@ -1909,7 +1916,7 @@ endfunction " }}} function! vimwiki#base#normalize_imagelink_helper(str, rxUrl, rxDesc, rxStyle, template) "{{{ let lnk = vimwiki#base#normalize_link_helper(a:str, a:rxUrl, a:rxDesc, a:template) let style = matchstr(a:str, a:rxStyle) - let lnk = substitute(lnk, '__LinkStyle__', '\="'.style.'"', '') + let lnk = s:safesubstitute(lnk, '__LinkStyle__', style, '') return lnk endfunction " }}} @@ -2001,8 +2008,8 @@ function! s:normalize_link_syntax_v() " {{{ if s:is_diary_file(expand("%:p")) let sub = s:normalize_link_in_diary(@") else - let sub = substitute(g:vimwiki_WikiLinkTemplate1, - \ '__LinkUrl__', '\=' . "'" . @" . "'", '') + let sub = s:safesubstitute(g:vimwiki_WikiLinkTemplate1, + \ '__LinkUrl__', @", '') endif " Put substitution in register " and change text diff --git a/autoload/vimwiki/markdown_base.vim b/autoload/vimwiki/markdown_base.vim index 06477d8..01f2c96 100644 --- a/autoload/vimwiki/markdown_base.vim +++ b/autoload/vimwiki/markdown_base.vim @@ -6,6 +6,13 @@ " MISC helper functions {{{ +" s:safesubstitute +function! s:safesubstitute(text, search, replace, mode) "{{{ + " Substitute regexp but do not interpret replace + let escaped = escape(a:replace, '\&') + return substitute(a:text, a:search, escaped, a:mode) +endfunction " }}} + " vimwiki#markdown_base#reset_mkd_refs function! vimwiki#markdown_base#reset_mkd_refs() "{{{ call VimwikiClear('markdown_refs') @@ -139,8 +146,8 @@ function! s:normalize_link_syntax_v() " {{{ try norm! gvy let visual_selection = @" - let link = substitute(g:vimwiki_Weblink1Template, '__LinkUrl__', '\='."'".visual_selection."'", '') - let link = substitute(link, '__LinkDescription__', '\='."'".visual_selection."'", '') + let link = Safesubstitute(g:vimwiki_Weblink1Template, '__LinkUrl__', visual_selection, '') + let link = Safesubstitute(link, '__LinkDescription__', visual_selection, '') call setreg('"', link, 'v') From 074d8827620c0d1d0535f21808862659c611ceb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Sat, 4 Nov 2017 03:26:33 +0100 Subject: [PATCH 14/14] Allow Backtick in Link --- autoload/vimwiki/base.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 6f81453..9fdfaf5 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -840,7 +840,7 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) "{{{ " then " [[test*file]]... " you'll have E77: Too many file names - let fname = escape(a:filename, '% *|#') + let fname = escape(a:filename, '% *|#`') let dir = fnamemodify(a:filename, ":p:h") let ok = vimwiki#path#mkdir(dir, 1)