major changes
This commit is contained in:
parent
a3270f399d
commit
2b56832843
83 changed files with 7760 additions and 1244 deletions
40
vendor/github.com/russross/blackfriday/.travis.yml
generated
vendored
40
vendor/github.com/russross/blackfriday/.travis.yml
generated
vendored
|
|
@ -1,30 +1,18 @@
|
|||
sudo: false
|
||||
# Travis CI (http://travis-ci.org/) is a continuous integration service for
|
||||
# open source projects. This file configures it to run unit tests for
|
||||
# blackfriday.
|
||||
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.5.4
|
||||
- 1.6.2
|
||||
- tip
|
||||
matrix:
|
||||
include:
|
||||
- go: 1.2.2
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go test -v -race ./...
|
||||
- go: 1.3.3
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go test -v -race ./...
|
||||
- go: 1.4.3
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go test -v -race ./...
|
||||
allow_failures:
|
||||
- go: tip
|
||||
fast_finish: true
|
||||
- 1.2
|
||||
- 1.3
|
||||
- 1.4
|
||||
- 1.5
|
||||
|
||||
install:
|
||||
- # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
|
||||
- go get -d -t -v ./...
|
||||
- go build -v ./...
|
||||
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- diff -u <(echo -n) <(gofmt -d -s .)
|
||||
- go tool vet .
|
||||
- go test -v -race ./...
|
||||
- go test -v ./...
|
||||
|
|
|
|||
6
vendor/github.com/russross/blackfriday/README.md
generated
vendored
6
vendor/github.com/russross/blackfriday/README.md
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
Blackfriday [](https://travis-ci.org/russross/blackfriday) [](https://godoc.org/github.com/russross/blackfriday)
|
||||
Blackfriday [](https://travis-ci.org/russross/blackfriday)
|
||||
===========
|
||||
|
||||
Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
|
||||
|
|
@ -114,7 +114,7 @@ All features of Sundown are supported, including:
|
|||
know and send me the input that does it.
|
||||
|
||||
NOTE: "safety" in this context means *runtime safety only*. In order to
|
||||
protect yourself against JavaScript injection in untrusted content, see
|
||||
protect yourself agains JavaScript injection in untrusted content, see
|
||||
[this example](https://github.com/russross/blackfriday#sanitize-untrusted-content).
|
||||
|
||||
* **Fast processing**. It is fast enough to render on-demand in
|
||||
|
|
@ -242,8 +242,6 @@ are a few of note:
|
|||
point. In particular, it does not do any inline escaping, so input
|
||||
that happens to look like LaTeX code will be passed through without
|
||||
modification.
|
||||
|
||||
* [Md2Vim](https://github.com/FooSoft/md2vim): transforms markdown files into vimdoc format.
|
||||
|
||||
|
||||
Todo
|
||||
|
|
|
|||
76
vendor/github.com/russross/blackfriday/block.go
generated
vendored
76
vendor/github.com/russross/blackfriday/block.go
generated
vendored
|
|
@ -320,11 +320,6 @@ func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int {
|
|||
return size
|
||||
}
|
||||
|
||||
// check for HTML CDATA
|
||||
if size := p.htmlCDATA(out, data, doRender); size > 0 {
|
||||
return size
|
||||
}
|
||||
|
||||
// no special case recognized
|
||||
return 0
|
||||
}
|
||||
|
|
@ -402,10 +397,12 @@ func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int {
|
|||
return i
|
||||
}
|
||||
|
||||
func (p *parser) renderHTMLBlock(out *bytes.Buffer, data []byte, start int, doRender bool) int {
|
||||
// html block needs to end with a blank line
|
||||
if i := p.isEmpty(data[start:]); i > 0 {
|
||||
size := start + i
|
||||
// HTML comment, lax form
|
||||
func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int {
|
||||
i := p.inlineHtmlComment(out, data)
|
||||
// needs to end with a blank line
|
||||
if j := p.isEmpty(data[i:]); j > 0 {
|
||||
size := i + j
|
||||
if doRender {
|
||||
// trim trailing newlines
|
||||
end := size
|
||||
|
|
@ -419,35 +416,6 @@ func (p *parser) renderHTMLBlock(out *bytes.Buffer, data []byte, start int, doRe
|
|||
return 0
|
||||
}
|
||||
|
||||
// HTML comment, lax form
|
||||
func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int {
|
||||
i := p.inlineHTMLComment(out, data)
|
||||
return p.renderHTMLBlock(out, data, i, doRender)
|
||||
}
|
||||
|
||||
// HTML CDATA section
|
||||
func (p *parser) htmlCDATA(out *bytes.Buffer, data []byte, doRender bool) int {
|
||||
const cdataTag = "<![cdata["
|
||||
const cdataTagLen = len(cdataTag)
|
||||
if len(data) < cdataTagLen+1 {
|
||||
return 0
|
||||
}
|
||||
if !bytes.Equal(bytes.ToLower(data[:cdataTagLen]), []byte(cdataTag)) {
|
||||
return 0
|
||||
}
|
||||
i := cdataTagLen
|
||||
// scan for an end-of-comment marker, across lines if necessary
|
||||
for i < len(data) && !(data[i-2] == ']' && data[i-1] == ']' && data[i] == '>') {
|
||||
i++
|
||||
}
|
||||
i++
|
||||
// no end-of-comment marker
|
||||
if i >= len(data) {
|
||||
return 0
|
||||
}
|
||||
return p.renderHTMLBlock(out, data, i, doRender)
|
||||
}
|
||||
|
||||
// HR, which is the only self-closing block tag considered
|
||||
func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int {
|
||||
if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') {
|
||||
|
|
@ -464,7 +432,19 @@ func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int {
|
|||
}
|
||||
|
||||
if data[i] == '>' {
|
||||
return p.renderHTMLBlock(out, data, i+1, doRender)
|
||||
i++
|
||||
if j := p.isEmpty(data[i:]); j > 0 {
|
||||
size := i + j
|
||||
if doRender {
|
||||
// trim newlines
|
||||
end := size
|
||||
for end > 0 && data[end-1] == '\n' {
|
||||
end--
|
||||
}
|
||||
p.r.BlockHtml(out, data[:end])
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
|
|
@ -1153,7 +1133,6 @@ gatherlines:
|
|||
// and move on to the next line
|
||||
if p.isEmpty(data[line:i]) > 0 {
|
||||
containsBlankLine = true
|
||||
raw.Write(data[line:i])
|
||||
line = i
|
||||
continue
|
||||
}
|
||||
|
|
@ -1174,14 +1153,6 @@ gatherlines:
|
|||
p.dliPrefix(chunk) > 0:
|
||||
|
||||
if containsBlankLine {
|
||||
// end the list if the type changed after a blank line
|
||||
if indent <= itemIndent &&
|
||||
((*flags&LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) ||
|
||||
(*flags&LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0)) {
|
||||
|
||||
*flags |= LIST_ITEM_END_OF_LIST
|
||||
break gatherlines
|
||||
}
|
||||
*flags |= LIST_ITEM_CONTAINS_BLOCK
|
||||
}
|
||||
|
||||
|
|
@ -1229,10 +1200,17 @@ gatherlines:
|
|||
|
||||
// a blank line means this should be parsed as a block
|
||||
case containsBlankLine:
|
||||
raw.WriteByte('\n')
|
||||
*flags |= LIST_ITEM_CONTAINS_BLOCK
|
||||
}
|
||||
|
||||
containsBlankLine = false
|
||||
// if this line was preceeded by one or more blanks,
|
||||
// re-introduce the blank into the buffer
|
||||
if containsBlankLine {
|
||||
containsBlankLine = false
|
||||
raw.WriteByte('\n')
|
||||
|
||||
}
|
||||
|
||||
// add the line into the working buffer without prefix
|
||||
raw.Write(data[line+indent : i])
|
||||
|
|
|
|||
25
vendor/github.com/russross/blackfriday/inline.go
generated
vendored
25
vendor/github.com/russross/blackfriday/inline.go
generated
vendored
|
|
@ -240,8 +240,6 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
|||
i++
|
||||
}
|
||||
|
||||
brace := 0
|
||||
|
||||
// look for the matching closing bracket
|
||||
for level := 1; level > 0 && i < len(data); i++ {
|
||||
switch {
|
||||
|
|
@ -275,8 +273,8 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
|||
i++
|
||||
}
|
||||
|
||||
switch {
|
||||
// inline style link
|
||||
switch {
|
||||
case i < len(data) && data[i] == '(':
|
||||
// skip initial whitespace
|
||||
i++
|
||||
|
|
@ -287,27 +285,14 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
|||
|
||||
linkB := i
|
||||
|
||||
// look for link end: ' " ), check for new opening braces and take this
|
||||
// into account, this may lead for overshooting and probably will require
|
||||
// some fine-tuning.
|
||||
// look for link end: ' " )
|
||||
findlinkend:
|
||||
for i < len(data) {
|
||||
switch {
|
||||
case data[i] == '\\':
|
||||
i += 2
|
||||
|
||||
case data[i] == '(':
|
||||
brace++
|
||||
i++
|
||||
|
||||
case data[i] == ')':
|
||||
if brace <= 0 {
|
||||
break findlinkend
|
||||
}
|
||||
brace--
|
||||
i++
|
||||
|
||||
case data[i] == '\'' || data[i] == '"':
|
||||
case data[i] == ')' || data[i] == '\'' || data[i] == '"':
|
||||
break findlinkend
|
||||
|
||||
default:
|
||||
|
|
@ -575,7 +560,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
|||
return i
|
||||
}
|
||||
|
||||
func (p *parser) inlineHTMLComment(out *bytes.Buffer, data []byte) int {
|
||||
func (p *parser) inlineHtmlComment(out *bytes.Buffer, data []byte) int {
|
||||
if len(data) < 5 {
|
||||
return 0
|
||||
}
|
||||
|
|
@ -599,7 +584,7 @@ func leftAngle(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
|||
data = data[offset:]
|
||||
altype := LINK_TYPE_NOT_AUTOLINK
|
||||
end := tagLength(data, &altype)
|
||||
if size := p.inlineHTMLComment(out, data); size > 0 {
|
||||
if size := p.inlineHtmlComment(out, data); size > 0 {
|
||||
end = size
|
||||
}
|
||||
if end > 2 {
|
||||
|
|
|
|||
84
vendor/github.com/russross/blackfriday/markdown.go
generated
vendored
84
vendor/github.com/russross/blackfriday/markdown.go
generated
vendored
|
|
@ -25,7 +25,7 @@ import (
|
|||
"unicode/utf8"
|
||||
)
|
||||
|
||||
const VERSION = "1.5"
|
||||
const VERSION = "1.4"
|
||||
|
||||
// These are the supported markdown parsing extensions.
|
||||
// OR these values together to select multiple extensions.
|
||||
|
|
@ -105,46 +105,46 @@ const (
|
|||
// blockTags is a set of tags that are recognized as HTML block tags.
|
||||
// Any of these can be included in markdown text without special escaping.
|
||||
var blockTags = map[string]struct{}{
|
||||
"blockquote": {},
|
||||
"del": {},
|
||||
"div": {},
|
||||
"dl": {},
|
||||
"fieldset": {},
|
||||
"form": {},
|
||||
"h1": {},
|
||||
"h2": {},
|
||||
"h3": {},
|
||||
"h4": {},
|
||||
"h5": {},
|
||||
"h6": {},
|
||||
"iframe": {},
|
||||
"ins": {},
|
||||
"math": {},
|
||||
"noscript": {},
|
||||
"ol": {},
|
||||
"pre": {},
|
||||
"p": {},
|
||||
"script": {},
|
||||
"style": {},
|
||||
"table": {},
|
||||
"ul": {},
|
||||
"blockquote": struct{}{},
|
||||
"del": struct{}{},
|
||||
"div": struct{}{},
|
||||
"dl": struct{}{},
|
||||
"fieldset": struct{}{},
|
||||
"form": struct{}{},
|
||||
"h1": struct{}{},
|
||||
"h2": struct{}{},
|
||||
"h3": struct{}{},
|
||||
"h4": struct{}{},
|
||||
"h5": struct{}{},
|
||||
"h6": struct{}{},
|
||||
"iframe": struct{}{},
|
||||
"ins": struct{}{},
|
||||
"math": struct{}{},
|
||||
"noscript": struct{}{},
|
||||
"ol": struct{}{},
|
||||
"pre": struct{}{},
|
||||
"p": struct{}{},
|
||||
"script": struct{}{},
|
||||
"style": struct{}{},
|
||||
"table": struct{}{},
|
||||
"ul": struct{}{},
|
||||
|
||||
// HTML5
|
||||
"address": {},
|
||||
"article": {},
|
||||
"aside": {},
|
||||
"canvas": {},
|
||||
"figcaption": {},
|
||||
"figure": {},
|
||||
"footer": {},
|
||||
"header": {},
|
||||
"hgroup": {},
|
||||
"main": {},
|
||||
"nav": {},
|
||||
"output": {},
|
||||
"progress": {},
|
||||
"section": {},
|
||||
"video": {},
|
||||
"address": struct{}{},
|
||||
"article": struct{}{},
|
||||
"aside": struct{}{},
|
||||
"canvas": struct{}{},
|
||||
"figcaption": struct{}{},
|
||||
"figure": struct{}{},
|
||||
"footer": struct{}{},
|
||||
"header": struct{}{},
|
||||
"hgroup": struct{}{},
|
||||
"main": struct{}{},
|
||||
"nav": struct{}{},
|
||||
"output": struct{}{},
|
||||
"progress": struct{}{},
|
||||
"section": struct{}{},
|
||||
"video": struct{}{},
|
||||
}
|
||||
|
||||
// Renderer is the rendering interface.
|
||||
|
|
@ -635,12 +635,12 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse
|
|||
i++
|
||||
}
|
||||
linkOffset = i
|
||||
if i == len(data) {
|
||||
return
|
||||
}
|
||||
for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' {
|
||||
i++
|
||||
}
|
||||
if i == len(data) {
|
||||
return
|
||||
}
|
||||
linkEnd = i
|
||||
if data[linkOffset] == '<' && data[linkEnd-1] == '>' {
|
||||
linkOffset++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue