Skip to content

Commit

Permalink
swap out mkd, successfully...
Browse files Browse the repository at this point in the history
Signed-off-by: yuexin <yuecn41@gmail.com>
  • Loading branch information
yuex committed Sep 2, 2015
1 parent e5af33f commit ef44c9e
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ all:


install: install:
mkdir -pv ${ADDONS}/ftdetect mkdir -pv ${ADDONS}/ftdetect
cp -v ftdetect/mkd.vim ${ADDONS}/ftdetect/mkd.vim cp -v ftdetect/markdown.vim ${ADDONS}/ftdetect/markdown.vim
mkdir -pv ${ADDONS}/ftplugin mkdir -pv ${ADDONS}/ftplugin
cp -v ftplugin/mkd.vim ${ADDONS}/ftplugin/mkd.vim cp -v ftplugin/markdown.vim ${ADDONS}/ftplugin/markdown.vim
mkdir -pv ${ADDONS}/syntax mkdir -pv ${ADDONS}/syntax
cp -v syntax/mkd.vim ${ADDONS}/syntax/mkd.vim cp -v syntax/markdown.vim ${ADDONS}/syntax/markdown.vim
mkdir -pv ${ADDONS}/after/ftplugin mkdir -pv ${ADDONS}/after/ftplugin
cp -v after/ftplugin/mkd.vim ${ADDONS}/after/ftplugin/mkd.vim cp -v after/ftplugin/markdown.vim ${ADDONS}/after/ftplugin/markdown.vim
mkdir -pv ${REGISTRY} mkdir -pv ${REGISTRY}
cp -v registry/mkd.yaml ${REGISTRY}/mkd.yaml cp -v registry/markdown.yaml ${REGISTRY}/markdown.yaml
2 changes: 1 addition & 1 deletion README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To install without Pathogen using the Debian [vim-addon-manager](http://packages
git clone https://github.com/plasticboy/vim-markdown.git git clone https://github.com/plasticboy/vim-markdown.git
cd vim-markdown cd vim-markdown
sudo make install sudo make install
vim-addon-manager install mkd vim-addon-manager install markdown
``` ```


If you are not using any package manager, download the [tarball](https://github.com/plasticboy/vim-markdown/archive/master.tar.gz) and do this: If you are not using any package manager, download the [tarball](https://github.com/plasticboy/vim-markdown/archive/master.tar.gz) and do this:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions indent/mkd.vim → indent/markdown.vim
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,12 @@
if exists("b:did_indent") | finish | endif if exists("b:did_indent") | finish | endif
let b:did_indent = 1 let b:did_indent = 1


setlocal indentexpr=GetMkdIndent() setlocal indentexpr=GetMarkdownIndent()
setlocal nolisp setlocal nolisp
setlocal autoindent setlocal autoindent


" Only define the function once " Only define the function once
if exists("*GetMkdIndent") | finish | endif if exists("*GetMarkdownIndent") | finish | endif


function! s:is_li_start(line) function! s:is_li_start(line)
return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' && return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' &&
Expand All @@ -25,7 +25,7 @@ function! s:prevnonblank(lnum)
return i return i
endfunction endfunction


function GetMkdIndent() function GetMarkdownIndent()
let list_ind = 4 let list_ind = 4
" Find a non-blank line above the current line. " Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1) let lnum = prevnonblank(v:lnum - 1)
Expand Down
7 changes: 7 additions & 0 deletions registry/markdown.yaml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
addon: markdown
description: "Markdown syntax highlighting"
files:
- ftdetect/markdown.vim
- ftplugin/markdown.vim
- syntax/markdown.vim
- after/ftplugin/markdown.vim
7 changes: 0 additions & 7 deletions registry/mkd.yaml

This file was deleted.

File renamed without changes.
26 changes: 13 additions & 13 deletions test/map.vader
Original file line number Original file line Diff line number Diff line change
@@ -1,46 +1,46 @@
Given mkd; Given markdown;
a <http://b> c a <http://b> c


Execute (gx autolink): Execute (gx autolink):
let b:url = 'http://b' let b:url = 'http://b'
let b:line = getline(1) let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition') let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), '' AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, '<') + 1), b:url AssertEqual b:func(1, match(b:line, '<') + 1), b:url
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, '>') + 1), b:url AssertEqual b:func(1, match(b:line, '>') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), '' AssertEqual b:func(1, match(b:line, 'c') + 1), ''


Given mkd; Given markdown;
a http://b.bb c a http://b.bb c


Execute (gx implicit autolink): Execute (gx implicit autolink):
let b:url = 'http://b.bb' let b:url = 'http://b.bb'
let b:line = getline(1) let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition') let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), '' AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), '' AssertEqual b:func(1, match(b:line, 'c') + 1), ''


Given mkd; Given markdown;
[a]: http://b "c" [a]: http://b "c"


Execute (gx link reference definition): Execute (gx link reference definition):
let b:url = 'http://b' let b:url = 'http://b'
let b:line = getline(1) let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition') let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
" TODO would be cool if all of the following gave the link. " TODO would be cool if all of the following gave the link.
AssertEqual b:func(1, match(b:line, 'a') + 1), '' AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), '' AssertEqual b:func(1, match(b:line, 'c') + 1), ''


Given mkd; Given markdown;
a [b](c) d a [b](c) d


Execute (gx autolink): Execute (gx autolink):
let b:url = 'c' let b:url = 'c'
let b:line = getline(1) let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition') let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), '' AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, '[') + 1), b:url AssertEqual b:func(1, match(b:line, '[') + 1), b:url
AssertEqual b:func(1, match(b:line, 'b') + 1), b:url AssertEqual b:func(1, match(b:line, 'b') + 1), b:url
Expand All @@ -50,7 +50,7 @@ Execute (gx autolink):
AssertEqual b:func(1, match(b:line, ')') + 1), b:url AssertEqual b:func(1, match(b:line, ')') + 1), b:url
AssertEqual b:func(1, match(b:line, 'd') + 1), '' AssertEqual b:func(1, match(b:line, 'd') + 1), ''


Given mkd; Given markdown;
# a # a


b b
Expand All @@ -66,7 +66,7 @@ Execute (]] same level):
normal [[ normal [[
AssertEqual line('.'), 1 AssertEqual line('.'), 1


Given mkd; Given markdown;
# a # a


b b
Expand All @@ -82,7 +82,7 @@ Execute (]] different levels level):
normal [[ normal [[
AssertEqual line('.'), 1 AssertEqual line('.'), 1


Given mkd; Given markdown;
# a # a


b b
Expand All @@ -102,7 +102,7 @@ Execute (][ different levels level):
normal [] normal []
AssertEqual line('.'), 1 AssertEqual line('.'), 1


Given mkd; Given markdown;
# a # a


b b
Expand All @@ -113,7 +113,7 @@ Execute (]c):
normal ]c normal ]c
AssertEqual line('.'), 1 AssertEqual line('.'), 1


Given mkd; Given markdown;
# a # a


Execute (Toc does not set nomodifiable on other files): Execute (Toc does not set nomodifiable on other files):
Expand Down
36 changes: 18 additions & 18 deletions test/syntax.vader
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,12 @@
Given mkd; Given markdown;
a **b** c a **b** c


Execute (bold): Execute (bold):
AssertNotEqual SyntaxOf('a'), 'htmlBold' AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertEqual SyntaxOf('b'), 'htmlBold' AssertEqual SyntaxOf('b'), 'htmlBold'
AssertNotEqual SyntaxOf('c'), 'htmlBold' AssertNotEqual SyntaxOf('c'), 'htmlBold'


Given mkd; Given markdown;
a *b* c a *b* c


Execute (italic): Execute (italic):
Expand All @@ -16,14 +16,14 @@ Execute (italic):


# Links # Links


Given mkd; Given markdown;
[a](b) [a](b)


Execute (link with title): Execute (link with title):
AssertEqual SyntaxOf('a'), 'mkdLink' AssertEqual SyntaxOf('a'), 'mkdLink'
AssertEqual SyntaxOf('b'), 'mkdURL' AssertEqual SyntaxOf('b'), 'mkdURL'


Given mkd; Given markdown;
(a) (a)


(b) (b)
Expand All @@ -32,15 +32,15 @@ Execute (parenthesis not in link):
AssertNotEqual SyntaxOf('a'), 'mkdURL' AssertNotEqual SyntaxOf('a'), 'mkdURL'
AssertNotEqual SyntaxOf('b'), 'mkdURL' AssertNotEqual SyntaxOf('b'), 'mkdURL'


Given mkd; Given markdown;
[a](b) c [d](e) [a](b) c [d](e)


Execute (multiple links on a line): Execute (multiple links on a line):
AssertEqual SyntaxOf('c'), '' AssertEqual SyntaxOf('c'), ''


# Autolinks # Autolinks


Given mkd; Given markdown;
a <http://b> c a <http://b> c


Execute (autolink): Execute (autolink):
Expand All @@ -50,25 +50,25 @@ Execute (autolink):
AssertEqual SyntaxOf('>'), 'mkdDelimiter' AssertEqual SyntaxOf('>'), 'mkdDelimiter'
AssertNotEqual SyntaxOf('c'), 'mkdInlineURL' AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'


Given mkd; Given markdown;
<HtTp://a> <HtTp://a>


Execute (autolink with scheme case is insensitive): Execute (autolink with scheme case is insensitive):
AssertEqual SyntaxOf('a'), 'mkdInlineURL' AssertEqual SyntaxOf('a'), 'mkdInlineURL'


Given mkd; Given markdown;
<notascheme://a> <notascheme://a>


Execute (autolink without known scheme is not a link): Execute (autolink without known scheme is not a link):
AssertNotEqual SyntaxOf('n'), 'mkdInlineURL' AssertNotEqual SyntaxOf('n'), 'mkdInlineURL'


Given mkd; Given markdown;
<a> <a>


Execute (autolink without scheme is not a link): Execute (autolink without scheme is not a link):
AssertNotEqual SyntaxOf('a'), 'mkdInlineURL' AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'


Given mkd; Given markdown;
< http://a > < http://a >
<http://b c> <http://b c>
<http://d <http://d
Expand All @@ -81,23 +81,23 @@ Execute (autolink with space is not a link):
AssertNotEqual SyntaxOf('d'), 'mkdInlineURL' AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
AssertNotEqual SyntaxOf('e'), 'mkdInlineURL' AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'


Given mkd; Given markdown;
\<http://a> \<http://a>


Execute (autolinks can be backslash escaped): Execute (autolinks can be backslash escaped):
AssertNotEqual SyntaxOf('<'), 'mkdDelimiter' AssertNotEqual SyntaxOf('<'), 'mkdDelimiter'


# Code Blocks # Code Blocks


Given mkd; Given markdown;
~~~ ~~~
code code
~~~ ~~~


Execute (code blocks can be fenced with tildes): Execute (code blocks can be fenced with tildes):
AssertEqual SyntaxOf('c'), 'mkdCode' AssertEqual SyntaxOf('c'), 'mkdCode'


Given mkd; Given markdown;
~~~ruby ~~~ruby
code code
~~~ ~~~
Expand All @@ -107,7 +107,7 @@ Execute (code blocks can have a language specifier):


# Math # Math


Given mkd; Given markdown;
a $x$ b a $x$ b
c $$y$$ d c $$y$$ d
\$e\$ \$e\$
Expand All @@ -131,7 +131,7 @@ Execute (math):
AssertNotEqual SyntaxOf('x'), 'mkdMath' AssertNotEqual SyntaxOf('x'), 'mkdMath'
AssertNotEqual SyntaxOf('y'), 'mkdMath' AssertNotEqual SyntaxOf('y'), 'mkdMath'


Given mkd; Given markdown;
a a


$ $
Expand All @@ -149,7 +149,7 @@ Execute (multiline math):


# YAML frontmatter # YAML frontmatter


Given mkd; Given markdown;
--- ---
a: b a: b
--- ---
Expand All @@ -163,7 +163,7 @@ Execute (YAML frontmatter is controlled by the option):
syn off | syn on syn off | syn on
AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey' AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'


Given mkd; Given markdown;


--- ---
a: b a: b
Expand All @@ -174,7 +174,7 @@ Execute (YAML frontmatter only works if it's the first thing in the file):
syn off | syn on syn off | syn on
AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey' AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'


Given mkd; Given markdown;
--- ---
a: b a: b
--- ---
Expand Down

0 comments on commit ef44c9e

Please sign in to comment.