aboutsummaryrefslogtreecommitdiff
path: root/vendor/gopkg.in
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in')
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/.travis.yml27
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/README.md20
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/block.go101
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/go.mod1
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/html.go21
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/inline.go18
-rw-r--r--vendor/gopkg.in/russross/blackfriday.v2/markdown.go94
7 files changed, 182 insertions, 100 deletions
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/.travis.yml b/vendor/gopkg.in/russross/blackfriday.v2/.travis.yml
index a4eb257..b0b525a 100644
--- a/vendor/gopkg.in/russross/blackfriday.v2/.travis.yml
+++ b/vendor/gopkg.in/russross/blackfriday.v2/.travis.yml
@@ -1,18 +1,17 @@
-# 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.
-
+sudo: false
language: go
-
go:
- - 1.5
- - 1.6
- - 1.7
-
+ - "1.10.x"
+ - "1.11.x"
+ - tip
+matrix:
+ fast_finish: true
+ allow_failures:
+ - go: tip
install:
- - go get -d -t -v ./...
- - go build -v ./...
-
+ - # 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).
script:
- - go test -v ./...
- - go test -run=^$ -bench=BenchmarkReference -benchmem
+ - go get -t -v ./...
+ - diff -u <(echo -n) <(gofmt -d -s .)
+ - go tool vet .
+ - go test -v ./...
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/README.md b/vendor/gopkg.in/russross/blackfriday.v2/README.md
index 2e0db35..d5a8649 100644
--- a/vendor/gopkg.in/russross/blackfriday.v2/README.md
+++ b/vendor/gopkg.in/russross/blackfriday.v2/README.md
@@ -34,9 +34,15 @@ Versions
--------
Currently maintained and recommended version of Blackfriday is `v2`. It's being
-developed on its own branch: https://github.com/russross/blackfriday/v2. You
-should install and import it via [gopkg.in][6] at
-`gopkg.in/russross/blackfriday.v2`.
+developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
+documentation is available at
+https://godoc.org/gopkg.in/russross/blackfriday.v2.
+
+It is `go get`-able via via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`,
+but we highly recommend using package management tool like [dep][7] or
+[Glide][8] and make use of semantic versioning. With package management you
+should import `github.com/russross/blackfriday` and specify that you're using
+version 2.0.0.
Version 2 offers a number of improvements over v1:
@@ -198,7 +204,7 @@ implements the following extensions:
Cat
: Fluffy animal everyone likes
-
+
Internet
: Vector of transmission for pictures of cats
@@ -209,7 +215,7 @@ implements the following extensions:
end of the document. A footnote looks like this:
This is a footnote.[^1]
-
+
[^1]: the footnote text.
* **Autolinking**. Blackfriday can find URLs that have not been
@@ -255,9 +261,11 @@ are a few of note:
* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
but for markdown.
-* [LaTeX output](https://bitbucket.org/ambrevar/blackfriday-latex):
+* [LaTeX output](https://github.com/Ambrevar/Blackfriday-LaTeX):
renders output as LaTeX.
+* [Blackfriday-Confluence](https://github.com/kentaro-m/blackfriday-confluence): provides a [Confluence Wiki Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) renderer.
+
Todo
----
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/block.go b/vendor/gopkg.in/russross/blackfriday.v2/block.go
index d7da33f..b860747 100644
--- a/vendor/gopkg.in/russross/blackfriday.v2/block.go
+++ b/vendor/gopkg.in/russross/blackfriday.v2/block.go
@@ -17,6 +17,7 @@ import (
"bytes"
"html"
"regexp"
+ "strings"
"github.com/shurcooL/sanitized_anchor_name"
)
@@ -568,8 +569,8 @@ func (*Markdown) isHRule(data []byte) bool {
// isFenceLine checks if there's a fence line (e.g., ``` or ``` go) at the beginning of data,
// and returns the end index if so, or 0 otherwise. It also returns the marker found.
-// If syntax is not nil, it gets set to the syntax specified in the fence line.
-func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker string) {
+// If info is not nil, it gets set to the syntax specified in the fence line.
+func isFenceLine(data []byte, info *string, oldmarker string) (end int, marker string) {
i, size := 0, 0
// skip up to three spaces
@@ -605,9 +606,9 @@ func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker
}
// TODO(shurcooL): It's probably a good idea to simplify the 2 code paths here
- // into one, always get the syntax, and discard it if the caller doesn't care.
- if syntax != nil {
- syn := 0
+ // into one, always get the info string, and discard it if the caller doesn't care.
+ if info != nil {
+ infoLength := 0
i = skipChar(data, i, ' ')
if i >= len(data) {
@@ -617,14 +618,14 @@ func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker
return 0, ""
}
- syntaxStart := i
+ infoStart := i
if data[i] == '{' {
i++
- syntaxStart++
+ infoStart++
for i < len(data) && data[i] != '}' && data[i] != '\n' {
- syn++
+ infoLength++
i++
}
@@ -634,31 +635,30 @@ func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker
// strip all whitespace at the beginning and the end
// of the {} block
- for syn > 0 && isspace(data[syntaxStart]) {
- syntaxStart++
- syn--
+ for infoLength > 0 && isspace(data[infoStart]) {
+ infoStart++
+ infoLength--
}
- for syn > 0 && isspace(data[syntaxStart+syn-1]) {
- syn--
+ for infoLength > 0 && isspace(data[infoStart+infoLength-1]) {
+ infoLength--
}
-
i++
+ i = skipChar(data, i, ' ')
} else {
- for i < len(data) && !isspace(data[i]) {
- syn++
+ for i < len(data) && !isverticalspace(data[i]) {
+ infoLength++
i++
}
}
- *syntax = string(data[syntaxStart : syntaxStart+syn])
+ *info = strings.TrimSpace(string(data[infoStart : infoStart+infoLength]))
}
- i = skipChar(data, i, ' ')
- if i >= len(data) || data[i] != '\n' {
- if i == len(data) {
- return i, marker
- }
+ if i == len(data) {
+ return i, marker
+ }
+ if i > len(data) || data[i] != '\n' {
return 0, ""
}
return i + 1, marker // Take newline into account.
@@ -668,14 +668,14 @@ func isFenceLine(data []byte, syntax *string, oldmarker string) (end int, marker
// or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects.
// If doRender is true, a final newline is mandatory to recognize the fenced code block.
func (p *Markdown) fencedCodeBlock(data []byte, doRender bool) int {
- var syntax string
- beg, marker := isFenceLine(data, &syntax, "")
+ var info string
+ beg, marker := isFenceLine(data, &info, "")
if beg == 0 || beg >= len(data) {
return 0
}
var work bytes.Buffer
- work.Write([]byte(syntax))
+ work.Write([]byte(info))
work.WriteByte('\n')
for {
@@ -1148,6 +1148,18 @@ func (p *Markdown) list(data []byte, flags ListType) int {
return i
}
+// Returns true if the list item is not the same type as its parent list
+func (p *Markdown) listTypeChanged(data []byte, flags *ListType) bool {
+ if p.dliPrefix(data) > 0 && *flags&ListTypeDefinition == 0 {
+ return true
+ } else if p.oliPrefix(data) > 0 && *flags&ListTypeOrdered == 0 {
+ return true
+ } else if p.uliPrefix(data) > 0 && (*flags&ListTypeOrdered != 0 || *flags&ListTypeDefinition != 0) {
+ return true
+ }
+ return false
+}
+
// Returns true if block ends with a blank line, descending if needed
// into lists and sublists.
func endsWithBlankLine(block *Node) bool {
@@ -1246,6 +1258,7 @@ func (p *Markdown) listItem(data []byte, flags *ListType) int {
// process the following lines
containsBlankLine := false
sublist := 0
+ codeBlockMarker := ""
gatherlines:
for line < len(data) {
@@ -1279,6 +1292,27 @@ gatherlines:
chunk := data[line+indentIndex : i]
+ if p.extensions&FencedCode != 0 {
+ // determine if in or out of codeblock
+ // if in codeblock, ignore normal list processing
+ _, marker := isFenceLine(chunk, nil, codeBlockMarker)
+ if marker != "" {
+ if codeBlockMarker == "" {
+ // start of codeblock
+ codeBlockMarker = marker
+ } else {
+ // end of codeblock.
+ codeBlockMarker = ""
+ }
+ }
+ // we are in a codeblock, write line, and continue
+ if codeBlockMarker != "" || marker != "" {
+ raw.Write(data[line+indentIndex : i])
+ line = i
+ continue gatherlines
+ }
+ }
+
// evaluate how this line fits in
switch {
// is this a nested list item?
@@ -1286,16 +1320,23 @@ gatherlines:
p.oliPrefix(chunk) > 0 ||
p.dliPrefix(chunk) > 0:
- if containsBlankLine {
- *flags |= ListItemContainsBlock
- }
-
// to be a nested list, it must be indented more
- // if not, it is the next item in the same list
+ // if not, it is either a different kind of list
+ // or the next item in the same list
if indent <= itemIndent {
+ if p.listTypeChanged(chunk, flags) {
+ *flags |= ListItemEndOfList
+ } else if containsBlankLine {
+ *flags |= ListItemContainsBlock
+ }
+
break gatherlines
}
+ if containsBlankLine {
+ *flags |= ListItemContainsBlock
+ }
+
// is this the first item in the nested list?
if sublist == 0 {
sublist = raw.Len()
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/go.mod b/vendor/gopkg.in/russross/blackfriday.v2/go.mod
new file mode 100644
index 0000000..620b74e
--- /dev/null
+++ b/vendor/gopkg.in/russross/blackfriday.v2/go.mod
@@ -0,0 +1 @@
+module github.com/russross/blackfriday/v2
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/html.go b/vendor/gopkg.in/russross/blackfriday.v2/html.go
index 25fb185..284c871 100644
--- a/vendor/gopkg.in/russross/blackfriday.v2/html.go
+++ b/vendor/gopkg.in/russross/blackfriday.v2/html.go
@@ -35,6 +35,7 @@ const (
Safelink // Only link to trusted protocols
NofollowLinks // Only link with rel="nofollow"
NoreferrerLinks // Only link with rel="noreferrer"
+ NoopenerLinks // Only link with rel="noopener"
HrefTargetBlank // Add a blank target
CompletePage // Generate a complete HTML page
UseXHTML // Generate XHTML output instead of HTML
@@ -87,6 +88,10 @@ type HTMLRendererParameters struct {
HeadingIDPrefix string
// If set, add this text to the back of each Heading ID, to ensure uniqueness.
HeadingIDSuffix string
+ // Increase heading levels: if the offset is 1, <h1> becomes <h2> etc.
+ // Negative offset is also valid.
+ // Resulting levels are clipped between 1 and 6.
+ HeadingLevelOffset int
Title string // Document title (used if CompletePage is set)
CSS string // Optional CSS file URL (used if CompletePage is set)
@@ -282,6 +287,9 @@ func appendLinkAttrs(attrs []string, flags HTMLFlags, link []byte) []string {
if flags&NoreferrerLinks != 0 {
val = append(val, "noreferrer")
}
+ if flags&NoopenerLinks != 0 {
+ val = append(val, "noopener")
+ }
if flags&HrefTargetBlank != 0 {
attrs = append(attrs, "target=\"_blank\"")
}
@@ -331,7 +339,7 @@ func (r *HTMLRenderer) tag(w io.Writer, name []byte, attrs []string) {
func footnoteRef(prefix string, node *Node) []byte {
urlFrag := prefix + string(slugify(node.Destination))
- anchor := fmt.Sprintf(`<a rel="footnote" href="#fn:%s">%d</a>`, urlFrag, node.NoteID)
+ anchor := fmt.Sprintf(`<a href="#fn:%s">%d</a>`, urlFrag, node.NoteID)
return []byte(fmt.Sprintf(`<sup class="footnote-ref" id="fnref:%s">%s</sup>`, urlFrag, anchor))
}
@@ -460,9 +468,10 @@ var (
)
func headingTagsFromLevel(level int) ([]byte, []byte) {
- switch level {
- case 1:
+ if level <= 1 {
return h1Tag, h1CloseTag
+ }
+ switch level {
case 2:
return h2Tag, h2CloseTag
case 3:
@@ -471,9 +480,8 @@ func headingTagsFromLevel(level int) ([]byte, []byte) {
return h4Tag, h4CloseTag
case 5:
return h5Tag, h5CloseTag
- default:
- return h6Tag, h6CloseTag
}
+ return h6Tag, h6CloseTag
}
func (r *HTMLRenderer) outHRTag(w io.Writer) {
@@ -651,7 +659,8 @@ func (r *HTMLRenderer) RenderNode(w io.Writer, node *Node, entering bool) WalkSt
r.out(w, node.Literal)
r.cr(w)
case Heading:
- openTag, closeTag := headingTagsFromLevel(node.Level)
+ headingLevel := r.HTMLRendererParameters.HeadingLevelOffset + node.Level
+ openTag, closeTag := headingTagsFromLevel(headingLevel)
if entering {
if node.IsTitleblock {
attrs = append(attrs, `class="title"`)
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/inline.go b/vendor/gopkg.in/russross/blackfriday.v2/inline.go
index 3d63310..4ed2907 100644
--- a/vendor/gopkg.in/russross/blackfriday.v2/inline.go
+++ b/vendor/gopkg.in/russross/blackfriday.v2/inline.go
@@ -23,8 +23,22 @@ var (
urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+`
anchorRe = regexp.MustCompile(`^(<a\shref="` + urlRe + `"(\stitle="[^"<>]+")?\s?>` + urlRe + `<\/a>)`)
- // TODO: improve this regexp to catch all possible entities:
- htmlEntityRe = regexp.MustCompile(`&[a-z]{2,5};`)
+ // https://www.w3.org/TR/html5/syntax.html#character-references
+ // highest unicode code point in 17 planes (2^20): 1,114,112d =
+ // 7 dec digits or 6 hex digits
+ // named entity references can be 2-31 characters with stuff like &lt;
+ // at one end and &CounterClockwiseContourIntegral; at the other. There
+ // are also sometimes numbers at the end, although this isn't inherent
+ // in the specification; there are never numbers anywhere else in
+ // current character references, though; see &frac34; and &blk12;, etc.
+ // https://www.w3.org/TR/html5/syntax.html#named-character-references
+ //
+ // entity := "&" (named group | number ref) ";"
+ // named group := [a-zA-Z]{2,31}[0-9]{0,2}
+ // number ref := "#" (dec ref | hex ref)
+ // dec ref := [0-9]{1,7}
+ // hex ref := ("x" | "X") [0-9a-fA-F]{1,6}
+ htmlEntityRe = regexp.MustCompile(`&([a-zA-Z]{2,31}[0-9]{0,2}|#([0-9]{1,7}|[xX][0-9a-fA-F]{1,6}));`)
)
// Functions to parse text within a block
diff --git a/vendor/gopkg.in/russross/blackfriday.v2/markdown.go b/vendor/gopkg.in/russross/blackfriday.v2/markdown.go
index ff61cb0..58d2e45 100644
--- a/vendor/gopkg.in/russross/blackfriday.v2/markdown.go
+++ b/vendor/gopkg.in/russross/blackfriday.v2/markdown.go
@@ -93,46 +93,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": 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{}{},
+ "blockquote": {},
+ "del": {},
+ "div": {},
+ "dl": {},
+ "fieldset": {},
+ "form": {},
+ "h1": {},
+ "h2": {},
+ "h3": {},
+ "h4": {},
+ "h5": {},
+ "h6": {},
+ "iframe": {},
+ "ins": {},
+ "math": {},
+ "noscript": {},
+ "ol": {},
+ "pre": {},
+ "p": {},
+ "script": {},
+ "style": {},
+ "table": {},
+ "ul": {},
// HTML5
- "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{}{},
+ "address": {},
+ "article": {},
+ "aside": {},
+ "canvas": {},
+ "figcaption": {},
+ "figure": {},
+ "footer": {},
+ "header": {},
+ "hgroup": {},
+ "main": {},
+ "nav": {},
+ "output": {},
+ "progress": {},
+ "section": {},
+ "video": {},
}
// Renderer is the rendering interface. This is mostly of interest if you are
@@ -480,11 +480,11 @@ func (p *Markdown) parseRefsToAST() {
// [^note]: This is the explanation.
//
// Footnotes should be placed at the end of the document in an ordered list.
-// Inline footnotes such as:
+// Finally, there are inline footnotes such as:
//
-// Inline footnotes^[Not supported.] also exist.
+// Inline footnotes^[Also supported.] provide a quick inline explanation,
+// but are rendered at the bottom of the document.
//
-// are not yet supported.
// reference holds all information necessary for a reference-style links or
// footnotes.
@@ -813,7 +813,17 @@ func ispunct(c byte) bool {
// Test if a character is a whitespace character.
func isspace(c byte) bool {
- return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v'
+ return ishorizontalspace(c) || isverticalspace(c)
+}
+
+// Test if a character is a horizontal whitespace character.
+func ishorizontalspace(c byte) bool {
+ return c == ' ' || c == '\t'
+}
+
+// Test if a character is a vertical character.
+func isverticalspace(c byte) bool {
+ return c == '\n' || c == '\r' || c == '\f' || c == '\v'
}
// Test if a character is letter.