From 0917dc876613fd71c9726a34bf0138b4f5121be9 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 18 Nov 2019 06:18:01 +1000 Subject: [PATCH] Update markdown parsing library to github.com/gomarkdown/markdown (#944) --- bridge/helper/helper.go | 10 +- go.mod | 9 +- go.sum | 19 +- .../github.com/gomarkdown/markdown/.gitignore | 13 + vendor/github.com/gomarkdown/markdown/.gitpod | 7 + .../gomarkdown/markdown/.travis.yml | 17 + .../gomarkdown/markdown/LICENSE.txt | 31 + .../github.com/gomarkdown/markdown/README.md | 325 + .../gomarkdown/markdown/ast/attribute.go | 10 + .../github.com/gomarkdown/markdown/ast/doc.go | 4 + .../gomarkdown/markdown/ast/node.go | 559 + .../gomarkdown/markdown/ast/print.go | 165 + .../markdown/changes-from-blackfriday.md | 27 + .../gomarkdown/markdown/codecov.yml | 8 + vendor/github.com/gomarkdown/markdown/doc.go | 35 + vendor/github.com/gomarkdown/markdown/fuzz.go | 9 + vendor/github.com/gomarkdown/markdown/go.mod | 5 + .../gomarkdown/markdown/html/callouts.go | 42 + .../gomarkdown/markdown/html/doc.go | 43 + .../gomarkdown/markdown/html/esc.go | 50 + .../gomarkdown/markdown/html/renderer.go | 1318 ++ .../gomarkdown/markdown/html/smartypants.go | 444 + .../gomarkdown/markdown/markdown.go | 85 + .../gomarkdown/markdown/parser/aside.go | 73 + .../gomarkdown/markdown/parser/attribute.go | 116 + .../gomarkdown/markdown/parser/block.go | 1978 ++ .../gomarkdown/markdown/parser/callout.go | 29 + .../gomarkdown/markdown/parser/caption.go | 70 + .../gomarkdown/markdown/parser/citation.go | 86 + .../gomarkdown/markdown/parser/esc.go | 20 + .../gomarkdown/markdown/parser/figures.go | 119 + .../gomarkdown/markdown/parser/include.go | 129 + .../gomarkdown/markdown/parser/inline.go | 1284 ++ .../gomarkdown/markdown/parser/matter.go | 36 + .../gomarkdown/markdown/parser/options.go | 32 + .../gomarkdown/markdown/parser/parser.go | 812 + .../gomarkdown/markdown/parser/ref.go | 89 + vendor/github.com/gomarkdown/markdown/todo.md | 7 + .../gomarkdown/markdown/tracking-perf.md | 189 + .../golang-commonmark/html/.gitlab-ci.yml | 16 - .../gitlab.com/golang-commonmark/html/LICENSE | 10 - .../golang-commonmark/html/README.md | 8 - .../gitlab.com/golang-commonmark/html/html.go | 211 - .../golang-commonmark/html/html5_entities.go | 2133 -- .../golang-commonmark/linkify/.gitlab-ci.yml | 19 - .../golang-commonmark/linkify/LICENSE | 10 - .../golang-commonmark/linkify/README.md | 12 - .../golang-commonmark/linkify/charset.go | 51 - .../golang-commonmark/linkify/email.go | 93 - .../golang-commonmark/linkify/generated.go | 18175 ---------------- .../golang-commonmark/linkify/linkify.go | 462 - .../golang-commonmark/linkify/url.go | 404 - .../golang-commonmark/linkify/util.go | 20 - .../golang-commonmark/markdown/.gitlab-ci.yml | 25 - .../golang-commonmark/markdown/AUTHORS | 1 - .../golang-commonmark/markdown/LICENSE | 10 - .../golang-commonmark/markdown/README.md | 64 - .../golang-commonmark/markdown/align.go | 26 - .../golang-commonmark/markdown/autolink.go | 70 - .../golang-commonmark/markdown/backticks.go | 60 - .../markdown/balance_pairs.go | 43 - .../golang-commonmark/markdown/blockquote.go | 233 - .../golang-commonmark/markdown/code.go | 37 - .../golang-commonmark/markdown/emphasis.go | 89 - .../golang-commonmark/markdown/entity.go | 35 - .../golang-commonmark/markdown/escape.go | 61 - .../golang-commonmark/markdown/fence.go | 102 - .../golang-commonmark/markdown/fuzz.go | 9 - .../golang-commonmark/markdown/heading.go | 59 - .../golang-commonmark/markdown/helpers.go | 164 - .../golang-commonmark/markdown/hr.go | 54 - .../golang-commonmark/markdown/html_block.go | 222 - .../golang-commonmark/markdown/html_inline.go | 57 - .../golang-commonmark/markdown/image.go | 131 - .../golang-commonmark/markdown/inline.go | 13 - .../golang-commonmark/markdown/lheading.go | 80 - .../golang-commonmark/markdown/link.go | 132 - .../golang-commonmark/markdown/linkify.go | 131 - .../golang-commonmark/markdown/list.go | 285 - .../golang-commonmark/markdown/markdown.go | 112 - .../golang-commonmark/markdown/newline.go | 46 - .../golang-commonmark/markdown/options.go | 77 - .../golang-commonmark/markdown/paragraph.go | 51 - .../markdown/parser_block.go | 159 - .../markdown/parser_inline.go | 106 - .../golang-commonmark/markdown/plugins.go | 158 - .../golang-commonmark/markdown/reference.go | 173 - .../golang-commonmark/markdown/render.go | 333 - .../markdown/replacements.go | 229 - .../golang-commonmark/markdown/smartquotes.go | 256 - .../golang-commonmark/markdown/state_block.go | 141 - .../golang-commonmark/markdown/state_core.go | 13 - .../markdown/state_inline.go | 116 - .../markdown/strikethrough.go | 101 - .../golang-commonmark/markdown/table.go | 229 - .../golang-commonmark/markdown/table_fsm.go | 108 - .../golang-commonmark/markdown/text.go | 52 - .../markdown/text_collapse.go | 42 - .../golang-commonmark/markdown/token.go | 753 - .../golang-commonmark/markdown/urlschema.go | 185 - .../golang-commonmark/markdown/util.go | 264 - .../golang-commonmark/markdown/writer.go | 69 - .../golang-commonmark/mdurl/.gitlab-ci.yml | 16 - .../golang-commonmark/mdurl/LICENSE | 10 - .../golang-commonmark/mdurl/README.md | 8 - .../golang-commonmark/mdurl/decode.go | 80 - .../golang-commonmark/mdurl/encode.go | 53 - .../golang-commonmark/mdurl/parse.go | 146 - .../gitlab.com/golang-commonmark/mdurl/url.go | 101 - .../golang-commonmark/mdurl/util.go | 36 - .../golang-commonmark/puny/.gitlab-ci.yml | 16 - .../gitlab.com/golang-commonmark/puny/LICENSE | 10 - .../golang-commonmark/puny/README.md | 8 - .../gitlab.com/golang-commonmark/puny/puny.go | 287 - .../x/text/unicode/rangetable/merge.go | 260 - .../x/text/unicode/rangetable/rangetable.go | 70 - .../x/text/unicode/rangetable/tables10.0.0.go | 6378 ------ .../x/text/unicode/rangetable/tables11.0.0.go | 7029 ------ .../x/text/unicode/rangetable/tables9.0.0.go | 5737 ----- vendor/modules.txt | 16 +- 120 files changed, 8282 insertions(+), 47873 deletions(-) create mode 100644 vendor/github.com/gomarkdown/markdown/.gitignore create mode 100644 vendor/github.com/gomarkdown/markdown/.gitpod create mode 100644 vendor/github.com/gomarkdown/markdown/.travis.yml create mode 100644 vendor/github.com/gomarkdown/markdown/LICENSE.txt create mode 100644 vendor/github.com/gomarkdown/markdown/README.md create mode 100644 vendor/github.com/gomarkdown/markdown/ast/attribute.go create mode 100644 vendor/github.com/gomarkdown/markdown/ast/doc.go create mode 100644 vendor/github.com/gomarkdown/markdown/ast/node.go create mode 100644 vendor/github.com/gomarkdown/markdown/ast/print.go create mode 100644 vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md create mode 100644 vendor/github.com/gomarkdown/markdown/codecov.yml create mode 100644 vendor/github.com/gomarkdown/markdown/doc.go create mode 100644 vendor/github.com/gomarkdown/markdown/fuzz.go create mode 100644 vendor/github.com/gomarkdown/markdown/go.mod create mode 100644 vendor/github.com/gomarkdown/markdown/html/callouts.go create mode 100644 vendor/github.com/gomarkdown/markdown/html/doc.go create mode 100644 vendor/github.com/gomarkdown/markdown/html/esc.go create mode 100644 vendor/github.com/gomarkdown/markdown/html/renderer.go create mode 100644 vendor/github.com/gomarkdown/markdown/html/smartypants.go create mode 100644 vendor/github.com/gomarkdown/markdown/markdown.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/aside.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/attribute.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/block.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/callout.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/caption.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/citation.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/esc.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/figures.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/include.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/inline.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/matter.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/options.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/parser.go create mode 100644 vendor/github.com/gomarkdown/markdown/parser/ref.go create mode 100644 vendor/github.com/gomarkdown/markdown/todo.md create mode 100644 vendor/github.com/gomarkdown/markdown/tracking-perf.md delete mode 100644 vendor/gitlab.com/golang-commonmark/html/.gitlab-ci.yml delete mode 100644 vendor/gitlab.com/golang-commonmark/html/LICENSE delete mode 100644 vendor/gitlab.com/golang-commonmark/html/README.md delete mode 100644 vendor/gitlab.com/golang-commonmark/html/html.go delete mode 100644 vendor/gitlab.com/golang-commonmark/html/html5_entities.go delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/.gitlab-ci.yml delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/LICENSE delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/README.md delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/charset.go delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/email.go delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/generated.go delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/linkify.go delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/url.go delete mode 100644 vendor/gitlab.com/golang-commonmark/linkify/util.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/.gitlab-ci.yml delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/AUTHORS delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/LICENSE delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/README.md delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/align.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/autolink.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/backticks.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/balance_pairs.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/blockquote.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/code.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/emphasis.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/entity.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/escape.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/fence.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/fuzz.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/heading.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/helpers.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/hr.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/html_block.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/html_inline.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/image.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/inline.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/lheading.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/link.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/linkify.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/list.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/markdown.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/newline.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/options.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/paragraph.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/parser_block.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/parser_inline.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/plugins.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/reference.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/render.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/replacements.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/smartquotes.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/state_block.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/state_core.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/state_inline.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/strikethrough.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/table.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/table_fsm.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/text.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/text_collapse.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/token.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/urlschema.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/util.go delete mode 100644 vendor/gitlab.com/golang-commonmark/markdown/writer.go delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/.gitlab-ci.yml delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/LICENSE delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/README.md delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/decode.go delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/encode.go delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/parse.go delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/url.go delete mode 100644 vendor/gitlab.com/golang-commonmark/mdurl/util.go delete mode 100644 vendor/gitlab.com/golang-commonmark/puny/.gitlab-ci.yml delete mode 100644 vendor/gitlab.com/golang-commonmark/puny/LICENSE delete mode 100644 vendor/gitlab.com/golang-commonmark/puny/README.md delete mode 100644 vendor/gitlab.com/golang-commonmark/puny/puny.go delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/merge.go delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/rangetable.go delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/tables9.0.0.go diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index dceb4848..66ba64cb 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -14,8 +14,9 @@ import ( "golang.org/x/image/webp" "github.com/42wim/matterbridge/bridge/config" + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/parser" "github.com/sirupsen/logrus" - "gitlab.com/golang-commonmark/markdown" ) // DownloadFile downloads the given non-authenticated URL. @@ -176,9 +177,12 @@ func ClipMessage(text string, length int) string { return text } +// ParseMarkdown takes in an input string as markdown and parses it to html func ParseMarkdown(input string) string { - md := markdown.New(markdown.XHTMLOutput(true), markdown.Breaks(true)) - res := md.RenderToString([]byte(input)) + extensions := parser.HardLineBreak + markdownParser := parser.NewWithExtensions(extensions) + parsedMarkdown := markdown.ToHTML([]byte(input), markdownParser, nil) + res := string(parsedMarkdown) res = strings.TrimPrefix(res, "

") res = strings.TrimSuffix(res, "

\n") return res diff --git a/go.mod b/go.mod index 76f41c16..8bcab865 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/dfordsoft/golib v0.0.0-20180902042739-76ee6ab99bec github.com/fsnotify/fsnotify v1.4.7 github.com/go-telegram-bot-api/telegram-bot-api v4.6.5-0.20181225215658-ec221ba9ea45+incompatible + github.com/gomarkdown/markdown v0.0.0-20190912180731-281270bc6d83 github.com/google/gops v0.3.6 github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4 // indirect github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f // indirect @@ -46,7 +47,6 @@ require ( github.com/russross/blackfriday v1.5.2 github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca github.com/shazow/ssh-chat v0.0.0-20190125184227-81d7e1686296 - github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/sirupsen/logrus v1.4.2 github.com/smartystreets/assertions v0.0.0-20180803164922-886ec427f6b9 // indirect github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect @@ -55,19 +55,12 @@ require ( github.com/technoweenie/multipartstreamer v1.0.1 // indirect github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect github.com/zfjagann/golang-ring v0.0.0-20190304061218-d34796e0a6c2 - gitlab.com/golang-commonmark/html v0.0.0-20180917080848-cfaf75183c4a // indirect - gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82 // indirect - gitlab.com/golang-commonmark/markdown v0.0.0-20181102083822-772775880e1f - gitlab.com/golang-commonmark/mdurl v0.0.0-20180912090424-e5bce34c34f2 // indirect - gitlab.com/golang-commonmark/puny v0.0.0-20180912090636-2cd490539afe // indirect - gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638 // indirect golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 // indirect golang.org/x/image v0.0.0-20190902063713-cb417be4ba39 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect golang.org/x/text v0.3.2 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect - gopkg.in/russross/blackfriday.v2 v2.0.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect ) diff --git a/go.sum b/go.sum index 460ae891..a6ea6c32 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gomarkdown/markdown v0.0.0-20190912180731-281270bc6d83 h1:w5VNUHB0SP2tr1+boQJWKvnyn3P61UFErZ2e2ih6x0A= +github.com/gomarkdown/markdown v0.0.0-20190912180731-281270bc6d83/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/gops v0.3.6 h1:6akvbMlpZrEYOuoebn2kR+ZJekbZqJ28fJXTs84+8to= @@ -203,8 +205,6 @@ github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7 h1:80VN+vGkqM773Br github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -247,18 +247,6 @@ github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6Ut github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/zfjagann/golang-ring v0.0.0-20190304061218-d34796e0a6c2 h1:UQwvu7FjUEdVYofx0U6bsc5odNE7wa5TSA0fl559GcA= github.com/zfjagann/golang-ring v0.0.0-20190304061218-d34796e0a6c2/go.mod h1:0MsIttMJIF/8Y7x0XjonJP7K99t3sR6bjj4m5S4JmqU= -gitlab.com/golang-commonmark/html v0.0.0-20180917080848-cfaf75183c4a h1:Ax7kdHNICZiIeFpmevmaEWb0Ae3BUj3zCTKhZHZ+zd0= -gitlab.com/golang-commonmark/html v0.0.0-20180917080848-cfaf75183c4a/go.mod h1:JT4uoTz0tfPoyVH88GZoWDNm5NHJI2VbUW+eyPClueI= -gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82 h1:oYrL81N608MLZhma3ruL8qTM4xcpYECGut8KSxRY59g= -gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82/go.mod h1:Gn+LZmCrhPECMD3SOKlE+BOHwhOYD9j7WT9NUtkCrC8= -gitlab.com/golang-commonmark/markdown v0.0.0-20181102083822-772775880e1f h1:jwXy/CsM4xS2aoiF2fHAlukmInWhd2TlWB+HDCyvzKc= -gitlab.com/golang-commonmark/markdown v0.0.0-20181102083822-772775880e1f/go.mod h1:SIHlEr9462fpIfTrVWf3GqQDxnA65Vm3BMMsUtuA6W0= -gitlab.com/golang-commonmark/mdurl v0.0.0-20180912090424-e5bce34c34f2 h1:wD/sPUgx2QJFPTyXZpJnLaROolfeKuruh06U4pRV0WY= -gitlab.com/golang-commonmark/mdurl v0.0.0-20180912090424-e5bce34c34f2/go.mod h1:wQk4rLkWrdOPjUAtqJRJ10hIlseLSVYWP95PLrjDF9s= -gitlab.com/golang-commonmark/puny v0.0.0-20180912090636-2cd490539afe h1:5kUPFAF52umOUPH12MuNUmyVTseJRNBftDl/KfsvX3I= -gitlab.com/golang-commonmark/puny v0.0.0-20180912090636-2cd490539afe/go.mod h1:P9LSM1KVzrIstFgUaveuwiAm8PK5VTB3yJEU8kqlbrU= -gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638 h1:uPZaMiz6Sz0PZs3IZJWpU5qHKGNy///1pacZC9txiUI= -gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638/go.mod h1:EGRJaqe2eO9XGmFtQCvV3Lm9NLico3UhFwUpCG/+mVU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -266,6 +254,7 @@ go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -326,8 +315,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/russross/blackfriday.v2 v2.0.0 h1:+FlnIV8DSQnT7NZ43hcVKcdJdzZoeCmJj4Ql8gq5keA= -gopkg.in/russross/blackfriday.v2 v2.0.0/go.mod h1:6sSBNz/GtOm/pJTuh5UmBK2ZHfmnxGbl2NZg1UliSOI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/vendor/github.com/gomarkdown/markdown/.gitignore b/vendor/github.com/gomarkdown/markdown/.gitignore new file mode 100644 index 00000000..8f15b677 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/.gitignore @@ -0,0 +1,13 @@ +*.out +*.swp +*.8 +*.6 +_obj +_test* +markdown +tags +fuzz-workdir/ +markdown-fuzz.zip +coverage.txt +testdata/*_got.md +testdata/*_ast.txt diff --git a/vendor/github.com/gomarkdown/markdown/.gitpod b/vendor/github.com/gomarkdown/markdown/.gitpod new file mode 100644 index 00000000..ad5feff6 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/.gitpod @@ -0,0 +1,7 @@ +checkoutLocation: "src/github.com/gomarkdown/markdown" +workspaceLocation: "." +tasks: + - command: > + cd /workspace/src/github.com/gomarkdown/markdown && + go get -v ./... && + go test -c diff --git a/vendor/github.com/gomarkdown/markdown/.travis.yml b/vendor/github.com/gomarkdown/markdown/.travis.yml new file mode 100644 index 00000000..4ec5d7b0 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/.travis.yml @@ -0,0 +1,17 @@ +dist: bionic +language: go + +go: + - "1.12.x" + +install: + - go build -v ./... + +script: + - go test -v ./... + - go test -run=^$ -bench=BenchmarkReference -benchmem + - ./s/test_with_codecoverage.sh + - ./s/ci_fuzzit.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/gomarkdown/markdown/LICENSE.txt b/vendor/github.com/gomarkdown/markdown/LICENSE.txt new file mode 100644 index 00000000..68804610 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/LICENSE.txt @@ -0,0 +1,31 @@ +Markdown is distributed under the Simplified BSD License: + +Copyright © 2011 Russ Ross +Copyright © 2018 Krzysztof Kowalczyk +Copyright © 2018 Authors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with + the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gomarkdown/markdown/README.md b/vendor/github.com/gomarkdown/markdown/README.md new file mode 100644 index 00000000..3bca71db --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/README.md @@ -0,0 +1,325 @@ +# Markdown Parser and HTML Renderer for Go + +[![GoDoc](https://godoc.org/github.com/gomarkdown/markdown?status.svg)](https://godoc.org/github.com/gomarkdown/markdown) [![codecov](https://codecov.io/gh/gomarkdown/markdown/branch/master/graph/badge.svg)](https://codecov.io/gh/gomarkdown/markdown) + +Package `github.com/gomarkdown/markdown` is a very fast Go library for parsing [Markdown](https://daringfireball.net/projects/markdown/) documents and rendering them to HTML. + +It's fast and supports common extensions. + +## Installation + + go get -u github.com/gomarkdown/markdown + +API Docs: + +- https://godoc.org/github.com/gomarkdown/markdown : top level package +- https://godoc.org/github.com/gomarkdown/markdown/ast : defines abstract syntax tree of parsed markdown document +- https://godoc.org/github.com/gomarkdown/markdown/parser : parser +- https://godoc.org/github.com/gomarkdown/markdown/html : html renderer + +## Usage + +To convert markdown text to HTML using reasonable defaults: + +```go +md := []byte("## markdown document") +output := markdown.ToHTML(md, nil, nil) +``` + +## Customizing markdown parser + +Markdown format is loosely specified and there are multiple extensions invented after original specification was created. + +The parser supports several [extensions](https://godoc.org/github.com/gomarkdown/markdown/parser#Extensions). + +Default parser uses most common `parser.CommonExtensions` but you can easily use parser with custom extension: + +```go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/parser" +) + +extensions := parser.CommonExtensions | parser.AutoHeadingIDs +parser := parser.NewWithExtensions(extensions) + +md := []byte("markdown text") +html := markdown.ToHTML(md, parser, nil) +``` + +## Customizing HTML renderer + +Similarly, HTML renderer can be configured with different [options](https://godoc.org/github.com/gomarkdown/markdown/html#RendererOptions) + +Here's how to use a custom renderer: + +```go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" +) + +htmlFlags := html.CommonFlags | html.HrefTargetBlank +opts := html.RendererOptions{Flags: htmlFlags} +renderer := html.NewRenderer(opts) + +md := []byte("markdown text") +html := markdown.ToHTML(md, nil, renderer) +``` + +HTML renderer also supports reusing most of the logic and overriding rendering of only specifc nodes. + +You can provide [RenderNodeFunc](https://godoc.org/github.com/gomarkdown/markdown/html#RenderNodeFunc) in [RendererOptions](https://godoc.org/github.com/gomarkdown/markdown/html#RendererOptions). + +The function is called for each node in AST, you can implement custom rendering logic and tell HTML renderer to skip rendering this node. + +Here's the simplest example that drops all code blocks from the output: + +````go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/html" +) + +// return (ast.GoToNext, true) to tell html renderer to skip rendering this node +// (because you've rendered it) +func renderHookDropCodeBlock(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) { + // skip all nodes that are not CodeBlock nodes + if _, ok := node.(*ast.CodeBlock); !ok { + return ast.GoToNext, false + } + // custom rendering logic for ast.CodeBlock. By doing nothing it won't be + // present in the output + return ast.GoToNext, true +} + +opts := html.RendererOptions{ + Flags: html.CommonFlags, + RenderNodeHook: renderHookDropCodeBlock, +} +renderer := html.NewRenderer(opts) +md := "test\n```\nthis code block will be dropped from output\n```\ntext" +html := markdown.ToHTML([]byte(s), nil, renderer) +```` + +## Sanitize untrusted content + +We don't protect against malicious content. When dealing with user-provided +markdown, run renderer HTML through HTML sanitizer such as [Bluemonday](https://github.com/microcosm-cc/bluemonday). + +Here's an example of simple usage with Bluemonday: + +```go +import ( + "github.com/microcosm-cc/bluemonday" + "github.com/gomarkdown/markdown" +) + +// ... +maybeUnsafeHTML := markdown.ToHTML(md, nil, nil) +html := bluemonday.UGCPolicy().SanitizeBytes(maybeUnsafeHTML) +``` + +## mdtohtml command-line tool + +https://github.com/gomarkdown/mdtohtml is a command-line markdown to html +converter built using this library. + +You can also use it as an example of how to use the library. + +You can install it with: + + go get -u github.com/gomarkdown/mdtohtml + +To run: `mdtohtml input-file [output-file]` + +## Features + +- **Compatibility**. The Markdown v1.0.3 test suite passes with + the `--tidy` option. Without `--tidy`, the differences are + mostly in whitespace and entity escaping, where this package is + more consistent and cleaner. + +- **Common extensions**, including table support, fenced code + blocks, autolinks, strikethroughs, non-strict emphasis, etc. + +- **Safety**. Markdown is paranoid when parsing, making it safe + to feed untrusted user input without fear of bad things + happening. The test suite stress tests this and there are no + known inputs that make it crash. If you find one, please let me + 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 + [this example](https://github.com/gomarkdown/markdown#sanitize-untrusted-content). + +- **Fast**. It is fast enough to render on-demand in + most web applications without having to cache the output. + +- **Thread safety**. You can run multiple parsers in different + goroutines without ill effect. There is no dependence on global + shared state. + +- **Minimal dependencies**. Only depends on standard library packages in Go. + +- **Standards compliant**. Output successfully validates using the + W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional. + +## Extensions + +In addition to the standard markdown syntax, this package +implements the following extensions: + +- **Intra-word emphasis supression**. The `_` character is + commonly used inside words when discussing code, so having + markdown interpret it as an emphasis command is usually the + wrong thing. We let you treat all emphasis markers as + normal characters when they occur inside a word. + +- **Tables**. Tables can be created by drawing them in the input + using a simple syntax: + + ``` + Name | Age + --------|------ + Bob | 27 + Alice | 23 + ``` + + Table footers are supported as well and can be added with equal signs (`=`): + + ``` + Name | Age + --------|------ + Bob | 27 + Alice | 23 + ========|====== + Total | 50 + ``` + +- **Fenced code blocks**. In addition to the normal 4-space + indentation to mark code blocks, you can explicitly mark them + and supply a language (to make syntax highlighting simple). Just + mark it like this: + + ```go + func getTrue() bool { + return true + } + ``` + + You can use 3 or more backticks to mark the beginning of the + block, and the same number to mark the end of the block. + +- **Definition lists**. A simple definition list is made of a single-line + term followed by a colon and the definition for that term. + + Cat + : Fluffy animal everyone likes + + Internet + : Vector of transmission for pictures of cats + + Terms must be separated from the previous definition by a blank line. + +- **Footnotes**. A marker in the text that will become a superscript number; + a footnote definition that will be placed in a list of footnotes at the + end of the document. A footnote looks like this: + + This is a footnote.[^1] + + [^1]: the footnote text. + +- **Autolinking**. We can find URLs that have not been + explicitly marked as links and turn them into links. + +- **Strikethrough**. Use two tildes (`~~`) to mark text that + should be crossed out. + +- **Hard line breaks**. With this extension enabled newlines in the input + translate into line breaks in the output. This extension is off by default. + +- **Non blocking space**. With this extension enabled spaces preceeded by an backslash n the input + translate non-blocking spaces in the output. This extension is off by default. + +- **Smart quotes**. Smartypants-style punctuation substitution is + supported, turning normal double- and single-quote marks into + curly quotes, etc. + +- **LaTeX-style dash parsing** is an additional option, where `--` + is translated into `–`, and `---` is translated into + `—`. This differs from most smartypants processors, which + turn a single hyphen into an ndash and a double hyphen into an + mdash. + +- **Smart fractions**, where anything that looks like a fraction + is translated into suitable HTML (instead of just a few special + cases like most smartypant processors). For example, `4/5` + becomes `45`, which renders as + 45. + +- **MathJaX Support** is an additional feature which is supported by + many markdown editor. It translate inline math equation quoted by `$` + and display math block quoted by `$$` into MathJax compatible format. + hyphen `_` won't break LaTeX render within a math element any more. + + ``` + $$ + \left[ \begin{array}{a} a^l_1 \\ ⋮ \\ a^l_{d_l} \end{array}\right] + = \sigma( + \left[ \begin{matrix} + w^l_{1,1} & ⋯ & w^l_{1,d_{l-1}} \\ + ⋮ & ⋱ & ⋮ \\ + w^l_{d_l,1} & ⋯ & w^l_{d_l,d_{l-1}} \\ + \end{matrix}\right] · + \left[ \begin{array}{x} a^{l-1}_1 \\ ⋮ \\ ⋮ \\ a^{l-1}_{d_{l-1}} \end{array}\right] + + \left[ \begin{array}{b} b^l_1 \\ ⋮ \\ b^l_{d_l} \end{array}\right]) + $$ + ``` + +- **Ordered list start number**. With this extension enabled an ordered list will start with the + the number that was used to start it. + +- **Super and subscript**. With this extension enabled sequences between ^ will indicate + superscript and ~ will become a subscript. For example: H~2~O is a liquid, 2^10^ is 1024. + +- **Block level attributes**, allow setting attributes (ID, classes and key/value pairs) on block + level elements. The attribute must be enclosed with braces and be put on a line before the + element. + + ``` + {#id3 .myclass fontsize="tiny"} + # Header 1 + ``` + + Will convert into `

Header 1

`. + +- **Mmark support**, see for all new syntax elements this adds. + +## Todo + +- port https://github.com/russross/blackfriday/issues/348 +- port [LaTeX output](https://github.com/Ambrevar/Blackfriday-LaTeX): + renders output as LaTeX. +- port https://github.com/shurcooL/github_flavored_markdown to markdown +- port [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt, + but for markdown. +- More unit testing +- Improve unicode support. It does not understand all unicode + rules (about what constitutes a letter, a punctuation symbol, + etc.), so it may fail to detect word boundaries correctly in + some instances. It is safe on all utf-8 input. + +## History + +markdown is a fork of v2 of https://github.com/russross/blackfriday that is: + +- actively maintained (sadly in Feb 2018 blackfriday was inactive for 5 months with many bugs and pull requests accumulated) +- refactored API (split into ast/parser/html sub-packages) + +Blackfriday itself was based on C implementation [sundown](https://github.com/vmg/sundown) which in turn was based on [libsoldout](http://fossil.instinctive.eu/libsoldout/home). + +## License + +[Simplified BSD License](LICENSE.txt) diff --git a/vendor/github.com/gomarkdown/markdown/ast/attribute.go b/vendor/github.com/gomarkdown/markdown/ast/attribute.go new file mode 100644 index 00000000..002c6a2e --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/attribute.go @@ -0,0 +1,10 @@ +package ast + +// An attribute can be attached to block elements. They are specified as +// {#id .classs key="value"} where quotes for values are mandatory, multiple +// key/value pairs are separated by whitespace. +type Attribute struct { + ID []byte + Classes [][]byte + Attrs map[string][]byte +} diff --git a/vendor/github.com/gomarkdown/markdown/ast/doc.go b/vendor/github.com/gomarkdown/markdown/ast/doc.go new file mode 100644 index 00000000..376dc67c --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/doc.go @@ -0,0 +1,4 @@ +/* +Package ast defines tree representation of a parsed markdown document. +*/ +package ast diff --git a/vendor/github.com/gomarkdown/markdown/ast/node.go b/vendor/github.com/gomarkdown/markdown/ast/node.go new file mode 100644 index 00000000..e6fcba9a --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/node.go @@ -0,0 +1,559 @@ +package ast + +// ListType contains bitwise or'ed flags for list and list item objects. +type ListType int + +// These are the possible flag values for the ListItem renderer. +// Multiple flag values may be ORed together. +// These are mostly of interest if you are writing a new output format. +const ( + ListTypeOrdered ListType = 1 << iota + ListTypeDefinition + ListTypeTerm + + ListItemContainsBlock + ListItemBeginningOfList // TODO: figure out if this is of any use now + ListItemEndOfList +) + +// CellAlignFlags holds a type of alignment in a table cell. +type CellAlignFlags int + +// These are the possible flag values for the table cell renderer. +// Only a single one of these values will be used; they are not ORed together. +// These are mostly of interest if you are writing a new output format. +const ( + TableAlignmentLeft CellAlignFlags = 1 << iota + TableAlignmentRight + TableAlignmentCenter = (TableAlignmentLeft | TableAlignmentRight) +) + +func (a CellAlignFlags) String() string { + switch a { + case TableAlignmentLeft: + return "left" + case TableAlignmentRight: + return "right" + case TableAlignmentCenter: + return "center" + default: + return "" + } +} + +// DocumentMatters holds the type of a {front,main,back}matter in the document +type DocumentMatters int + +// These are all possible Document divisions. +const ( + DocumentMatterNone DocumentMatters = iota + DocumentMatterFront + DocumentMatterMain + DocumentMatterBack +) + +// CitationTypes holds the type of a citation, informative, normative or suppressed +type CitationTypes int + +const ( + CitationTypeNone CitationTypes = iota + CitationTypeSuppressed + CitationTypeInformative + CitationTypeNormative +) + +// Node defines an ast node +type Node interface { + AsContainer() *Container + AsLeaf() *Leaf + GetParent() Node + SetParent(newParent Node) + GetChildren() []Node + SetChildren(newChildren []Node) +} + +// Container is a type of node that can contain children +type Container struct { + Parent Node + Children []Node + + Literal []byte // Text contents of the leaf nodes + Content []byte // Markdown content of the block nodes + + *Attribute // Block level attribute +} + +// AsContainer returns itself as *Container +func (c *Container) AsContainer() *Container { + return c +} + +// AsLeaf returns nil +func (c *Container) AsLeaf() *Leaf { + return nil +} + +// GetParent returns parent node +func (c *Container) GetParent() Node { + return c.Parent +} + +// SetParent sets the parent node +func (c *Container) SetParent(newParent Node) { + c.Parent = newParent +} + +// GetChildren returns children nodes +func (c *Container) GetChildren() []Node { + return c.Children +} + +// SetChildren sets children node +func (c *Container) SetChildren(newChildren []Node) { + c.Children = newChildren +} + +// Leaf is a type of node that cannot have children +type Leaf struct { + Parent Node + + Literal []byte // Text contents of the leaf nodes + Content []byte // Markdown content of the block nodes + + *Attribute // Block level attribute +} + +// AsContainer returns nil +func (l *Leaf) AsContainer() *Container { + return nil +} + +// AsLeaf returns itself as *Leaf +func (l *Leaf) AsLeaf() *Leaf { + return l +} + +// GetParent returns parent node +func (l *Leaf) GetParent() Node { + return l.Parent +} + +// SetParent sets the parent nodd +func (l *Leaf) SetParent(newParent Node) { + l.Parent = newParent +} + +// GetChildren returns nil because Leaf cannot have children +func (l *Leaf) GetChildren() []Node { + return nil +} + +// SetChildren will panic becuase Leaf cannot have children +func (l *Leaf) SetChildren(newChildren []Node) { + panic("leaf node cannot have children") +} + +// Document represents markdown document node, a root of ast +type Document struct { + Container +} + +// DocumentMatter represents markdown node that signals a document +// division: frontmatter, mainmatter or backmatter. +type DocumentMatter struct { + Container + + Matter DocumentMatters +} + +// BlockQuote represents markdown block quote node +type BlockQuote struct { + Container +} + +// Aside represents an markdown aside node. +type Aside struct { + Container +} + +// List represents markdown list node +type List struct { + Container + + ListFlags ListType + Tight bool // Skip

s around list item data if true + BulletChar byte // '*', '+' or '-' in bullet lists + Delimiter byte // '.' or ')' after the number in ordered lists + Start int // for ordered lists this indicates the starting number if > 0 + RefLink []byte // If not nil, turns this list item into a footnote item and triggers different rendering + IsFootnotesList bool // This is a list of footnotes +} + +// ListItem represents markdown list item node +type ListItem struct { + Container + + ListFlags ListType + Tight bool // Skip

s around list item data if true + BulletChar byte // '*', '+' or '-' in bullet lists + Delimiter byte // '.' or ')' after the number in ordered lists + RefLink []byte // If not nil, turns this list item into a footnote item and triggers different rendering + IsFootnotesList bool // This is a list of footnotes +} + +// Paragraph represents markdown paragraph node +type Paragraph struct { + Container +} + +// Math represents markdown MathAjax inline node +type Math struct { + Leaf +} + +// MathBlock represents markdown MathAjax block node +type MathBlock struct { + Container +} + +// Heading represents markdown heading node +type Heading struct { + Container + + Level int // This holds the heading level number + HeadingID string // This might hold heading ID, if present + IsTitleblock bool // Specifies whether it's a title block + IsSpecial bool // We are a special heading (starts with .#) +} + +// HorizontalRule represents markdown horizontal rule node +type HorizontalRule struct { + Leaf +} + +// Emph represents markdown emphasis node +type Emph struct { + Container +} + +// Strong represents markdown strong node +type Strong struct { + Container +} + +// Del represents markdown del node +type Del struct { + Container +} + +// Link represents markdown link node +type Link struct { + Container + + Destination []byte // Destination is what goes into a href + Title []byte // Title is the tooltip thing that goes in a title attribute + NoteID int // NoteID contains a serial number of a footnote, zero if it's not a footnote + Footnote Node // If it's a footnote, this is a direct link to the footnote Node. Otherwise nil. + DeferredID []byte // If a deferred link this holds the original ID. +} + +// CrossReference is a reference node. +type CrossReference struct { + Container + + Destination []byte // Destination is where the reference points to +} + +// Citation is a citation node. +type Citation struct { + Leaf + + Destination [][]byte // Destination is where the citation points to. Multiple ones are allowed. + Type []CitationTypes // 1:1 mapping of destination and citation type + Suffix [][]byte // Potential citation suffix, i.e. [@!RFC1035, p. 144] +} + +// Image represents markdown image node +type Image struct { + Container + + Destination []byte // Destination is what goes into a href + Title []byte // Title is the tooltip thing that goes in a title attribute +} + +// Text represents markdown text node +type Text struct { + Leaf +} + +// HTMLBlock represents markdown html node +type HTMLBlock struct { + Leaf +} + +// CodeBlock represents markdown code block node +type CodeBlock struct { + Leaf + + IsFenced bool // Specifies whether it's a fenced code block or an indented one + Info []byte // This holds the info string + FenceChar byte + FenceLength int + FenceOffset int +} + +// Softbreak represents markdown softbreak node +// Note: not used currently +type Softbreak struct { + Leaf +} + +// Hardbreak represents markdown hard break node +type Hardbreak struct { + Leaf +} + +// NonBlockingSpace represents markdown non-blocking space node +type NonBlockingSpace struct { + Leaf +} + +// Code represents markdown code node +type Code struct { + Leaf +} + +// HTMLSpan represents markdown html span node +type HTMLSpan struct { + Leaf +} + +// Table represents markdown table node +type Table struct { + Container +} + +// TableCell represents markdown table cell node +type TableCell struct { + Container + + IsHeader bool // This tells if it's under the header row + Align CellAlignFlags // This holds the value for align attribute +} + +// TableHeader represents markdown table head node +type TableHeader struct { + Container +} + +// TableBody represents markdown table body node +type TableBody struct { + Container +} + +// TableRow represents markdown table row node +type TableRow struct { + Container +} + +// TableFooter represents markdown table foot node +type TableFooter struct { + Container +} + +// Caption represents a figure, code or quote caption +type Caption struct { + Container +} + +// CaptionFigure is a node (blockquote or codeblock) that has a caption +type CaptionFigure struct { + Container + + HeadingID string // This might hold heading ID, if present +} + +// Callout is a node that can exist both in text (where it is an actual node) and in a code block. +type Callout struct { + Leaf + + ID []byte // number of this callout +} + +// Index is a node that contains an Index item and an optional, subitem. +type Index struct { + Leaf + + Primary bool + Item []byte + Subitem []byte + ID string // ID of the index +} + +// Subscript is a subscript node +type Subscript struct { + Leaf +} + +// Subscript is a superscript node +type Superscript struct { + Leaf +} + +// Footnotes is a node that contains all footnotes +type Footnotes struct { + Container +} + +func removeNodeFromArray(a []Node, node Node) []Node { + n := len(a) + for i := 0; i < n; i++ { + if a[i] == node { + return append(a[:i], a[i+1:]...) + } + } + return nil +} + +// AppendChild appends child to children of parent +// It panics if either node is nil. +func AppendChild(parent Node, child Node) { + RemoveFromTree(child) + child.SetParent(parent) + newChildren := append(parent.GetChildren(), child) + parent.SetChildren(newChildren) +} + +// RemoveFromTree removes this node from tree +func RemoveFromTree(n Node) { + if n.GetParent() == nil { + return + } + // important: don't clear n.Children if n has no parent + // we're called from AppendChild and that might happen on a node + // that accumulated Children but hasn't been inserted into the tree + n.SetChildren(nil) + p := n.GetParent() + newChildren := removeNodeFromArray(p.GetChildren(), n) + if newChildren != nil { + p.SetChildren(newChildren) + } +} + +// GetLastChild returns last child of node n +// It's implemented as stand-alone function to keep Node interface small +func GetLastChild(n Node) Node { + a := n.GetChildren() + if len(a) > 0 { + return a[len(a)-1] + } + return nil +} + +// GetFirstChild returns first child of node n +// It's implemented as stand-alone function to keep Node interface small +func GetFirstChild(n Node) Node { + a := n.GetChildren() + if len(a) > 0 { + return a[0] + } + return nil +} + +// GetNextNode returns next sibling of node n (node after n) +// We can't make it part of Container or Leaf because we loose Node identity +func GetNextNode(n Node) Node { + parent := n.GetParent() + if parent == nil { + return nil + } + a := parent.GetChildren() + len := len(a) - 1 + for i := 0; i < len; i++ { + if a[i] == n { + return a[i+1] + } + } + return nil +} + +// GetPrevNode returns previous sibling of node n (node before n) +// We can't make it part of Container or Leaf because we loose Node identity +func GetPrevNode(n Node) Node { + parent := n.GetParent() + if parent == nil { + return nil + } + a := parent.GetChildren() + len := len(a) + for i := 1; i < len; i++ { + if a[i] == n { + return a[i-1] + } + } + return nil +} + +// WalkStatus allows NodeVisitor to have some control over the tree traversal. +// It is returned from NodeVisitor and different values allow Node.Walk to +// decide which node to go to next. +type WalkStatus int + +const ( + // GoToNext is the default traversal of every node. + GoToNext WalkStatus = iota + // SkipChildren tells walker to skip all children of current node. + SkipChildren + // Terminate tells walker to terminate the traversal. + Terminate +) + +// NodeVisitor is a callback to be called when traversing the syntax tree. +// Called twice for every node: once with entering=true when the branch is +// first visited, then with entering=false after all the children are done. +type NodeVisitor interface { + Visit(node Node, entering bool) WalkStatus +} + +// NodeVisitorFunc casts a function to match NodeVisitor interface +type NodeVisitorFunc func(node Node, entering bool) WalkStatus + +// Walk traverses tree recursively +func Walk(n Node, visitor NodeVisitor) WalkStatus { + isContainer := n.AsContainer() != nil + status := visitor.Visit(n, true) // entering + if status == Terminate { + // even if terminating, close container node + if isContainer { + visitor.Visit(n, false) + } + return status + } + if isContainer && status != SkipChildren { + children := n.GetChildren() + for _, n := range children { + status = Walk(n, visitor) + if status == Terminate { + return status + } + } + } + if isContainer { + status = visitor.Visit(n, false) // exiting + if status == Terminate { + return status + } + } + return GoToNext +} + +// Visit calls visitor function +func (f NodeVisitorFunc) Visit(node Node, entering bool) WalkStatus { + return f(node, entering) +} + +// WalkFunc is like Walk but accepts just a callback function +func WalkFunc(n Node, f NodeVisitorFunc) { + visitor := NodeVisitorFunc(f) + Walk(n, visitor) +} diff --git a/vendor/github.com/gomarkdown/markdown/ast/print.go b/vendor/github.com/gomarkdown/markdown/ast/print.go new file mode 100644 index 00000000..75daf911 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/ast/print.go @@ -0,0 +1,165 @@ +package ast + +import ( + "bytes" + "fmt" + "io" + "strings" +) + +// Print is for debugging. It prints a string representation of parsed +// markdown doc (result of parser.Parse()) to dst. +// +// To make output readable, it shortens text output. +func Print(dst io.Writer, doc Node) { + PrintWithPrefix(dst, doc, " ") +} + +// PrintWithPrefix is like Print but allows customizing prefix used for +// indentation. By default it's 2 spaces. You can change it to e.g. tab +// by passing "\t" +func PrintWithPrefix(w io.Writer, doc Node, prefix string) { + // for more compact output, don't print outer Document + if _, ok := doc.(*Document); ok { + for _, c := range doc.GetChildren() { + printRecur(w, c, prefix, 0) + } + } else { + printRecur(w, doc, prefix, 0) + } +} + +// ToString is like Dump but returns result as a string +func ToString(doc Node) string { + var buf bytes.Buffer + Print(&buf, doc) + return buf.String() +} + +func contentToString(d1 []byte, d2 []byte) string { + if d1 != nil { + return string(d1) + } + if d2 != nil { + return string(d2) + } + return "" +} + +func getContent(node Node) string { + if c := node.AsContainer(); c != nil { + return contentToString(c.Literal, c.Content) + } + leaf := node.AsLeaf() + return contentToString(leaf.Literal, leaf.Content) +} + +func shortenString(s string, maxLen int) string { + // for cleaner, one-line ouput, replace some white-space chars + // with their escaped version + s = strings.Replace(s, "\n", `\n`, -1) + s = strings.Replace(s, "\r", `\r`, -1) + s = strings.Replace(s, "\t", `\t`, -1) + if maxLen < 0 { + return s + } + if len(s) < maxLen { + return s + } + // add "..." to indicate truncation + return s[:maxLen-3] + "..." +} + +// get a short name of the type of v which excludes package name +// and strips "()" from the end +func getNodeType(node Node) string { + s := fmt.Sprintf("%T", node) + s = strings.TrimSuffix(s, "()") + if idx := strings.Index(s, "."); idx != -1 { + return s[idx+1:] + } + return s +} + +func printDefault(w io.Writer, indent string, typeName string, content string) { + content = strings.TrimSpace(content) + if len(content) > 0 { + fmt.Fprintf(w, "%s%s '%s'\n", indent, typeName, content) + } else { + fmt.Fprintf(w, "%s%s\n", indent, typeName) + } +} + +func getListFlags(f ListType) string { + var s string + if f&ListTypeOrdered != 0 { + s += "ordered " + } + if f&ListTypeDefinition != 0 { + s += "definition " + } + if f&ListTypeTerm != 0 { + s += "term " + } + if f&ListItemContainsBlock != 0 { + s += "has_block " + } + if f&ListItemBeginningOfList != 0 { + s += "start " + } + if f&ListItemEndOfList != 0 { + s += "end " + } + s = strings.TrimSpace(s) + return s +} + +func printRecur(w io.Writer, node Node, prefix string, depth int) { + if node == nil { + return + } + indent := strings.Repeat(prefix, depth) + + content := shortenString(getContent(node), 40) + typeName := getNodeType(node) + switch v := node.(type) { + case *Link: + content := "url=" + string(v.Destination) + printDefault(w, indent, typeName, content) + case *Image: + content := "url=" + string(v.Destination) + printDefault(w, indent, typeName, content) + case *List: + if v.Start > 1 { + content += fmt.Sprintf("start=%d ", v.Start) + } + if v.Tight { + content += "tight " + } + if v.IsFootnotesList { + content += "footnotes " + } + flags := getListFlags(v.ListFlags) + if len(flags) > 0 { + content += "flags=" + flags + " " + } + printDefault(w, indent, typeName, content) + case *ListItem: + if v.Tight { + content += "tight " + } + if v.IsFootnotesList { + content += "footnotes " + } + flags := getListFlags(v.ListFlags) + if len(flags) > 0 { + content += "flags=" + flags + " " + } + printDefault(w, indent, typeName, content) + default: + printDefault(w, indent, typeName, content) + } + for _, child := range node.GetChildren() { + printRecur(w, child, prefix, depth+1) + } +} diff --git a/vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md b/vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md new file mode 100644 index 00000000..b618dfef --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/changes-from-blackfriday.md @@ -0,0 +1,27 @@ +## Changes from blackfriday + +This library is derived from blackfriday library. Here's a list of changes. + +**Redesigned API** + +- split into 3 separate packages: ast, parser and html (for html renderer). This makes the API more manageable. It also separates e.g. parser option from renderer options +- changed how AST node is represented from union-like representation (manually keeping track of the type of the node) to using interface{} (which is a Go way to combine an arbitrary value with its type) + +**Allow re-using most of html renderer logic** + +You can implement your own renderer by implementing `Renderer` interface. + +Implementing a full renderer is a lot of work and often you just want to tweak html rendering of few node typs. + +I've added a way to hook `Renderer.Render` function in html renderer with a custom function that can take over rendering of specific nodes. + +I use it myself to do syntax-highlighting of code snippets. + +**Speed up go test** + +Running `go test` was really slow (17 secs) because it did a poor man's version of fuzzing by feeding the parser all subsets of test strings in order to find panics +due to incorrect parsing logic. + +I've moved that logic to `cmd/crashtest`, so that it can be run on CI but not slow down regular development. + +Now `go test` is blazing fast. diff --git a/vendor/github.com/gomarkdown/markdown/codecov.yml b/vendor/github.com/gomarkdown/markdown/codecov.yml new file mode 100644 index 00000000..f681ff11 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: + default: + # basic + target: 60% + threshold: 2% + base: auto diff --git a/vendor/github.com/gomarkdown/markdown/doc.go b/vendor/github.com/gomarkdown/markdown/doc.go new file mode 100644 index 00000000..9fb77e02 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/doc.go @@ -0,0 +1,35 @@ +/* +Package markdown implements markdown parser and HTML renderer. + +It parses markdown into AST format which can be serialized to HTML +(using html.Renderer) or possibly other formats (using alternate renderers). + +Convert markdown to HTML + +The simplest way to convert markdown document to HTML + + md := []byte("## markdown document") + html := markdown.ToHTML(md, nil, nil) + +Customizing parsing and HTML rendering + +You can customize parser and HTML renderer: + + import ( + "github.com/gomarkdown/markdown/parser" + "github.com/gomarkdown/markdown/renderer" + "github.com/gomarkdown/markdown" + ) + extensions := parser.CommonExtensions | parser.AutoHeadingIDs + p := parser.NewWithExensions(extensions) + + htmlFlags := html.CommonFlags | html.HrefTargetBlank + opts := html.RendererOptions{Flags: htmlFlags} + renderer := html.NewRenderer(opts) + + md := []byte("markdown text") + html := markdown.ToHTML(md, p, renderer) + +For a cmd-line tool see https://github.com/gomarkdown/mdtohtml +*/ +package markdown diff --git a/vendor/github.com/gomarkdown/markdown/fuzz.go b/vendor/github.com/gomarkdown/markdown/fuzz.go new file mode 100644 index 00000000..704182b8 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/fuzz.go @@ -0,0 +1,9 @@ +// +build gofuzz + +package markdown + +// Fuzz is to be used by https://github.com/dvyukov/go-fuzz +func Fuzz(data []byte) int { + Parse(data, nil) + return 0 +} diff --git a/vendor/github.com/gomarkdown/markdown/go.mod b/vendor/github.com/gomarkdown/markdown/go.mod new file mode 100644 index 00000000..899e3237 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/go.mod @@ -0,0 +1,5 @@ +module github.com/gomarkdown/markdown + +go 1.12 + +require golang.org/dl v0.0.0-20190829154251-82a15e2f2ead // indirect diff --git a/vendor/github.com/gomarkdown/markdown/html/callouts.go b/vendor/github.com/gomarkdown/markdown/html/callouts.go new file mode 100644 index 00000000..e377af22 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/callouts.go @@ -0,0 +1,42 @@ +package html + +import ( + "bytes" + "io" + + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/parser" +) + +// EscapeHTMLCallouts writes html-escaped d to w. It escapes &, <, > and " characters, *but* +// expands callouts <> with the callout HTML, i.e. by calling r.callout() with a newly created +// ast.Callout node. +func (r *Renderer) EscapeHTMLCallouts(w io.Writer, d []byte) { + ld := len(d) +Parse: + for i := 0; i < ld; i++ { + for _, comment := range r.opts.Comments { + if !bytes.HasPrefix(d[i:], comment) { + break + } + + lc := len(comment) + if i+lc < ld { + if id, consumed := parser.IsCallout(d[i+lc:]); consumed > 0 { + // We have seen a callout + callout := &ast.Callout{ID: id} + r.callout(w, callout) + i += consumed + lc - 1 + continue Parse + } + } + } + + escSeq := Escaper[d[i]] + if escSeq != nil { + w.Write(escSeq) + } else { + w.Write([]byte{d[i]}) + } + } +} diff --git a/vendor/github.com/gomarkdown/markdown/html/doc.go b/vendor/github.com/gomarkdown/markdown/html/doc.go new file mode 100644 index 00000000..f837c63d --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/doc.go @@ -0,0 +1,43 @@ +/* +Package html implements HTML renderer of parsed markdown document. + +Configuring and customizing a renderer + +A renderer can be configured with multiple options: + + import "github.com/gomarkdown/markdown/html" + + flags := html.CommonFlags | html.CompletePage | html.HrefTargetBlank + opts := html.RenderOptions{ + TItle: "A custom title", + Flags: flags, + } + renderer := html.NewRenderer(opts) + +You can also re-use most of the logic and customize rendering of selected nodes +by providing node render hook. +This is most useful for rendering nodes that allow for design choices, like +links or code blocks. + + import ( + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/ast" + ) + + // a very dummy render hook that will output "code_replacements" instead of + // ${content} emitted by html.Renderer + func renderHookCodeBlock(w io.Writer, node *ast.Node, entering bool) (ast.WalkStatus, bool) { + _, ok := node.Data.(*ast.CodeBlockData) + if !ok { + return ast.GoToNext, false + } + io.WriteString(w, "code_replacement") + return ast.GoToNext, true + } + + opts := html.RendererOptions{ + RenderNodeHook: renderHookCodeBlock, + } + renderer := html.NewRenderer(opts) +*/ +package html diff --git a/vendor/github.com/gomarkdown/markdown/html/esc.go b/vendor/github.com/gomarkdown/markdown/html/esc.go new file mode 100644 index 00000000..89ec9a27 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/esc.go @@ -0,0 +1,50 @@ +package html + +import ( + "html" + "io" +) + +var Escaper = [256][]byte{ + '&': []byte("&"), + '<': []byte("<"), + '>': []byte(">"), + '"': []byte("""), +} + +// EscapeHTML writes html-escaped d to w. It escapes &, <, > and " characters. +func EscapeHTML(w io.Writer, d []byte) { + var start, end int + n := len(d) + for end < n { + escSeq := Escaper[d[end]] + if escSeq != nil { + w.Write(d[start:end]) + w.Write(escSeq) + start = end + 1 + } + end++ + } + if start < n && end <= n { + w.Write(d[start:end]) + } +} + +func escLink(w io.Writer, text []byte) { + unesc := html.UnescapeString(string(text)) + EscapeHTML(w, []byte(unesc)) +} + +// Escape writes the text to w, but skips the escape character. +func Escape(w io.Writer, text []byte) { + esc := false + for i := 0; i < len(text); i++ { + if text[i] == '\\' { + esc = !esc + } + if esc && text[i] == '\\' { + continue + } + w.Write([]byte{text[i]}) + } +} diff --git a/vendor/github.com/gomarkdown/markdown/html/renderer.go b/vendor/github.com/gomarkdown/markdown/html/renderer.go new file mode 100644 index 00000000..367f7dfa --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/renderer.go @@ -0,0 +1,1318 @@ +package html + +import ( + "bytes" + "fmt" + "io" + "regexp" + "sort" + "strconv" + "strings" + + "github.com/gomarkdown/markdown/ast" +) + +// Flags control optional behavior of HTML renderer. +type Flags int + +// IDTag is the tag used for tag identification, it defaults to "id", some renderers +// may wish to override this and use e.g. "anchor". +var IDTag = "id" + +// HTML renderer configuration options. +const ( + FlagsNone Flags = 0 + SkipHTML Flags = 1 << iota // Skip preformatted HTML blocks + SkipImages // Skip embedded images + SkipLinks // Skip all links + Safelink // Only link to trusted protocols + NofollowLinks // Only link with rel="nofollow" + NoreferrerLinks // Only link with rel="noreferrer" + HrefTargetBlank // Add a blank target + CompletePage // Generate a complete HTML page + UseXHTML // Generate XHTML output instead of HTML + FootnoteReturnLinks // Generate a link at the end of a footnote to return to the source + FootnoteNoHRTag // Do not output an HR after starting a footnote list. + Smartypants // Enable smart punctuation substitutions + SmartypantsFractions // Enable smart fractions (with Smartypants) + SmartypantsDashes // Enable smart dashes (with Smartypants) + SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants) + SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering + SmartypantsQuotesNBSP // Enable « French guillemets » (with Smartypants) + TOC // Generate a table of contents + + CommonFlags Flags = Smartypants | SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes +) + +var ( + htmlTagRe = regexp.MustCompile("(?i)^" + htmlTag) +) + +const ( + htmlTag = "(?:" + openTag + "|" + closeTag + "|" + htmlComment + "|" + + processingInstruction + "|" + declaration + "|" + cdata + ")" + closeTag = "]" + openTag = "<" + tagName + attribute + "*" + "\\s*/?>" + attribute = "(?:" + "\\s+" + attributeName + attributeValueSpec + "?)" + attributeValue = "(?:" + unquotedValue + "|" + singleQuotedValue + "|" + doubleQuotedValue + ")" + attributeValueSpec = "(?:" + "\\s*=" + "\\s*" + attributeValue + ")" + attributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*" + cdata = "" + declaration = "]*>" + doubleQuotedValue = "\"[^\"]*\"" + htmlComment = "|" + processingInstruction = "[<][?].*?[?][>]" + singleQuotedValue = "'[^']*'" + tagName = "[A-Za-z][A-Za-z0-9-]*" + unquotedValue = "[^\"'=<>`\\x00-\\x20]+" +) + +// RenderNodeFunc allows reusing most of Renderer logic and replacing +// rendering of some nodes. If it returns false, Renderer.RenderNode +// will execute its logic. If it returns true, Renderer.RenderNode will +// skip rendering this node and will return WalkStatus +type RenderNodeFunc func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) + +// RendererOptions is a collection of supplementary parameters tweaking +// the behavior of various parts of HTML renderer. +type RendererOptions struct { + // Prepend this text to each relative URL. + AbsolutePrefix string + // Add this text to each footnote anchor, to ensure uniqueness. + FootnoteAnchorPrefix string + // Show this text inside the tag for a footnote return link, if the + // FootnoteReturnLinks flag is enabled. If blank, the string + // [return] is used. + FootnoteReturnLinkContents string + // CitationFormatString defines how a citation is rendered. If blnck, the string + // [%s] is used. Where %s will be substituted with the citation target. + CitationFormatString string + // If set, add this text to the front of each Heading ID, to ensure uniqueness. + HeadingIDPrefix string + // If set, add this text to the back of each Heading ID, to ensure uniqueness. + HeadingIDSuffix string + + Title string // Document title (used if CompletePage is set) + CSS string // Optional CSS file URL (used if CompletePage is set) + Icon string // Optional icon file URL (used if CompletePage is set) + Head []byte // Optional head data injected in the section (used if CompletePage is set) + + Flags Flags // Flags allow customizing this renderer's behavior + + // if set, called at the start of RenderNode(). Allows replacing + // rendering of some nodes + RenderNodeHook RenderNodeFunc + + // Comments is a list of comments the renderer should detect when + // parsing code blocks and detecting callouts. + Comments [][]byte + + // Generator is a meta tag that is inserted in the generated HTML so show what rendered it. It should not include the closing tag. + // Defaults (note content quote is not closed) to ` " or ">" + + // Track heading IDs to prevent ID collision in a single generation. + headingIDs map[string]int + + lastOutputLen int + disableTags int + + sr *SPRenderer + + documentMatter ast.DocumentMatters // keep track of front/main/back matter. +} + +// NewRenderer creates and configures an Renderer object, which +// satisfies the Renderer interface. +func NewRenderer(opts RendererOptions) *Renderer { + // configure the rendering engine + closeTag := ">" + if opts.Flags&UseXHTML != 0 { + closeTag = " />" + } + + if opts.FootnoteReturnLinkContents == "" { + opts.FootnoteReturnLinkContents = `[return]` + } + if opts.CitationFormatString == "" { + opts.CitationFormatString = `[%s]` + } + if opts.Generator == "" { + opts.Generator = ` = len(tagname) { + break + } + + if strings.ToLower(string(tag[i]))[0] != tagname[j] { + return false, -1 + } + } + + if i == len(tag) { + return false, -1 + } + + rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>') + if rightAngle >= i { + return true, rightAngle + } + + return false, -1 +} + +func isRelativeLink(link []byte) (yes bool) { + // a tag begin with '#' + if link[0] == '#' { + return true + } + + // link begin with '/' but not '//', the second maybe a protocol relative link + if len(link) >= 2 && link[0] == '/' && link[1] != '/' { + return true + } + + // only the root '/' + if len(link) == 1 && link[0] == '/' { + return true + } + + // current directory : begin with "./" + if bytes.HasPrefix(link, []byte("./")) { + return true + } + + // parent directory : begin with "../" + if bytes.HasPrefix(link, []byte("../")) { + return true + } + + return false +} + +func (r *Renderer) ensureUniqueHeadingID(id string) string { + for count, found := r.headingIDs[id]; found; count, found = r.headingIDs[id] { + tmp := fmt.Sprintf("%s-%d", id, count+1) + + if _, tmpFound := r.headingIDs[tmp]; !tmpFound { + r.headingIDs[id] = count + 1 + id = tmp + } else { + id = id + "-1" + } + } + + if _, found := r.headingIDs[id]; !found { + r.headingIDs[id] = 0 + } + + return id +} + +func (r *Renderer) addAbsPrefix(link []byte) []byte { + if r.opts.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' { + newDest := r.opts.AbsolutePrefix + if link[0] != '/' { + newDest += "/" + } + newDest += string(link) + return []byte(newDest) + } + return link +} + +func appendLinkAttrs(attrs []string, flags Flags, link []byte) []string { + if isRelativeLink(link) { + return attrs + } + var val []string + if flags&NofollowLinks != 0 { + val = append(val, "nofollow") + } + if flags&NoreferrerLinks != 0 { + val = append(val, "noreferrer") + } + if flags&HrefTargetBlank != 0 { + attrs = append(attrs, `target="_blank"`) + } + if len(val) == 0 { + return attrs + } + attr := fmt.Sprintf("rel=%q", strings.Join(val, " ")) + return append(attrs, attr) +} + +func isMailto(link []byte) bool { + return bytes.HasPrefix(link, []byte("mailto:")) +} + +func needSkipLink(flags Flags, dest []byte) bool { + if flags&SkipLinks != 0 { + return true + } + return flags&Safelink != 0 && !isSafeLink(dest) && !isMailto(dest) +} + +func isSmartypantable(node ast.Node) bool { + switch node.GetParent().(type) { + case *ast.Link, *ast.CodeBlock, *ast.Code: + return false + } + return true +} + +func appendLanguageAttr(attrs []string, info []byte) []string { + if len(info) == 0 { + return attrs + } + endOfLang := bytes.IndexAny(info, "\t ") + if endOfLang < 0 { + endOfLang = len(info) + } + s := `class="language-` + string(info[:endOfLang]) + `"` + return append(attrs, s) +} + +func (r *Renderer) outTag(w io.Writer, name string, attrs []string) { + s := name + if len(attrs) > 0 { + s += " " + strings.Join(attrs, " ") + } + io.WriteString(w, s+">") + r.lastOutputLen = 1 +} + +func footnoteRef(prefix string, node *ast.Link) string { + urlFrag := prefix + string(slugify(node.Destination)) + nStr := strconv.Itoa(node.NoteID) + anchor := `` + nStr + `` + return `` + anchor + `` +} + +func footnoteItem(prefix string, slug []byte) string { + return `

  • ` +} + +func footnoteReturnLink(prefix, returnLink string, slug []byte) string { + return ` ` + returnLink + `` +} + +func listItemOpenCR(listItem *ast.ListItem) bool { + if ast.GetPrevNode(listItem) == nil { + return false + } + ld := listItem.Parent.(*ast.List) + return !ld.Tight && ld.ListFlags&ast.ListTypeDefinition == 0 +} + +func skipParagraphTags(para *ast.Paragraph) bool { + parent := para.Parent + grandparent := parent.GetParent() + if grandparent == nil || !isList(grandparent) { + return false + } + isParentTerm := isListItemTerm(parent) + grandparentListData := grandparent.(*ast.List) + tightOrTerm := grandparentListData.Tight || isParentTerm + return tightOrTerm +} + +func (r *Renderer) out(w io.Writer, d []byte) { + r.lastOutputLen = len(d) + if r.disableTags > 0 { + d = htmlTagRe.ReplaceAll(d, []byte{}) + } + w.Write(d) +} + +func (r *Renderer) outs(w io.Writer, s string) { + r.lastOutputLen = len(s) + if r.disableTags > 0 { + s = htmlTagRe.ReplaceAllString(s, "") + } + io.WriteString(w, s) +} + +func (r *Renderer) cr(w io.Writer) { + if r.lastOutputLen > 0 { + r.outs(w, "\n") + } +} + +var ( + openHTags = []string{"", "", "", "", ""} +) + +func headingOpenTagFromLevel(level int) string { + if level < 1 || level > 5 { + return " 5 { + return "" + } + return closeHTags[level-1] +} + +func (r *Renderer) outHRTag(w io.Writer, attrs []string) { + hr := tagWithAttributes("") +} + +func (r *Renderer) text(w io.Writer, text *ast.Text) { + if r.opts.Flags&Smartypants != 0 { + var tmp bytes.Buffer + EscapeHTML(&tmp, text.Literal) + r.sr.Process(w, tmp.Bytes()) + } else { + _, parentIsLink := text.Parent.(*ast.Link) + if parentIsLink { + escLink(w, text.Literal) + } else { + EscapeHTML(w, text.Literal) + } + } +} + +func (r *Renderer) hardBreak(w io.Writer, node *ast.Hardbreak) { + r.outOneOf(w, r.opts.Flags&UseXHTML == 0, "
    ", "
    ") + r.cr(w) +} + +func (r *Renderer) nonBlockingSpace(w io.Writer, node *ast.NonBlockingSpace) { + r.outs(w, " ") +} + +func (r *Renderer) outOneOf(w io.Writer, outFirst bool, first string, second string) { + if outFirst { + r.outs(w, first) + } else { + r.outs(w, second) + } +} + +func (r *Renderer) outOneOfCr(w io.Writer, outFirst bool, first string, second string) { + if outFirst { + r.cr(w) + r.outs(w, first) + } else { + r.outs(w, second) + r.cr(w) + } +} + +func (r *Renderer) htmlSpan(w io.Writer, span *ast.HTMLSpan) { + if r.opts.Flags&SkipHTML == 0 { + r.out(w, span.Literal) + } +} + +func (r *Renderer) linkEnter(w io.Writer, link *ast.Link) { + var attrs []string + dest := link.Destination + dest = r.addAbsPrefix(dest) + var hrefBuf bytes.Buffer + hrefBuf.WriteString("href=\"") + escLink(&hrefBuf, dest) + hrefBuf.WriteByte('"') + attrs = append(attrs, hrefBuf.String()) + if link.NoteID != 0 { + r.outs(w, footnoteRef(r.opts.FootnoteAnchorPrefix, link)) + return + } + + attrs = appendLinkAttrs(attrs, r.opts.Flags, dest) + if len(link.Title) > 0 { + var titleBuff bytes.Buffer + titleBuff.WriteString("title=\"") + EscapeHTML(&titleBuff, link.Title) + titleBuff.WriteByte('"') + attrs = append(attrs, titleBuff.String()) + } + r.outTag(w, "") + } +} + +func (r *Renderer) link(w io.Writer, link *ast.Link, entering bool) { + // mark it but don't link it if it is not a safe link: no smartypants + if needSkipLink(r.opts.Flags, link.Destination) { + r.outOneOf(w, entering, "", "") + return + } + + if entering { + r.linkEnter(w, link) + } else { + r.linkExit(w, link) + } +} + +func (r *Renderer) imageEnter(w io.Writer, image *ast.Image) { + dest := image.Destination + dest = r.addAbsPrefix(dest) + if r.disableTags == 0 { + //if options.safe && potentiallyUnsafe(dest) { + //out(w, ``)
+		//} else {
+		r.outs(w, `<img src=`) + } +} + +func (r *Renderer) paragraphEnter(w io.Writer, para *ast.Paragraph) { + // TODO: untangle this clusterfuck about when the newlines need + // to be added and when not. + prev := ast.GetPrevNode(para) + if prev != nil { + switch prev.(type) { + case *ast.HTMLBlock, *ast.List, *ast.Paragraph, *ast.Heading, *ast.CaptionFigure, *ast.CodeBlock, *ast.BlockQuote, *ast.Aside, *ast.HorizontalRule: + r.cr(w) + } + } + + if prev == nil { + _, isParentBlockQuote := para.Parent.(*ast.BlockQuote) + if isParentBlockQuote { + r.cr(w) + } + _, isParentAside := para.Parent.(*ast.Aside) + if isParentAside { + r.cr(w) + } + } + + tag := tagWithAttributes("") + if !(isListItem(para.Parent) && ast.GetNextNode(para) == nil) { + r.cr(w) + } +} + +func (r *Renderer) paragraph(w io.Writer, para *ast.Paragraph, entering bool) { + if skipParagraphTags(para) { + return + } + if entering { + r.paragraphEnter(w, para) + } else { + r.paragraphExit(w, para) + } +} +func (r *Renderer) image(w io.Writer, node *ast.Image, entering bool) { + if entering { + r.imageEnter(w, node) + } else { + r.imageExit(w, node) + } +} + +func (r *Renderer) code(w io.Writer, node *ast.Code) { + r.outs(w, "") + EscapeHTML(w, node.Literal) + r.outs(w, "") +} + +func (r *Renderer) htmlBlock(w io.Writer, node *ast.HTMLBlock) { + if r.opts.Flags&SkipHTML != 0 { + return + } + r.cr(w) + r.out(w, node.Literal) + r.cr(w) +} + +func (r *Renderer) headingEnter(w io.Writer, nodeData *ast.Heading) { + var attrs []string + var class string + // TODO(miek): add helper functions for coalescing these classes. + if nodeData.IsTitleblock { + class = "title" + } + if nodeData.IsSpecial { + if class != "" { + class += " special" + } else { + class = "special" + } + } + if class != "" { + attrs = []string{`class="` + class + `"`} + } + if nodeData.HeadingID != "" { + id := r.ensureUniqueHeadingID(nodeData.HeadingID) + if r.opts.HeadingIDPrefix != "" { + id = r.opts.HeadingIDPrefix + id + } + if r.opts.HeadingIDSuffix != "" { + id = id + r.opts.HeadingIDSuffix + } + attrID := `id="` + id + `"` + attrs = append(attrs, attrID) + } + attrs = append(attrs, BlockAttrs(nodeData)...) + r.cr(w) + r.outTag(w, headingOpenTagFromLevel(nodeData.Level), attrs) +} + +func (r *Renderer) headingExit(w io.Writer, heading *ast.Heading) { + r.outs(w, headingCloseTagFromLevel(heading.Level)) + if !(isListItem(heading.Parent) && ast.GetNextNode(heading) == nil) { + r.cr(w) + } +} + +func (r *Renderer) heading(w io.Writer, node *ast.Heading, entering bool) { + if entering { + r.headingEnter(w, node) + } else { + r.headingExit(w, node) + } +} + +func (r *Renderer) horizontalRule(w io.Writer, node *ast.HorizontalRule) { + r.cr(w) + r.outHRTag(w, BlockAttrs(node)) + r.cr(w) +} + +func (r *Renderer) listEnter(w io.Writer, nodeData *ast.List) { + // TODO: attrs don't seem to be set + var attrs []string + + if nodeData.IsFootnotesList { + r.outs(w, "\n
    \n\n") + if r.opts.Flags&FootnoteNoHRTag == 0 { + r.outHRTag(w, nil) + r.cr(w) + } + } + r.cr(w) + if isListItem(nodeData.Parent) { + grand := nodeData.Parent.GetParent() + if isListTight(grand) { + r.cr(w) + } + } + + openTag := " 0 { + attrs = append(attrs, fmt.Sprintf(`start="%d"`, nodeData.Start)) + } + openTag = "\n") + } +} + +func (r *Renderer) list(w io.Writer, list *ast.List, entering bool) { + if entering { + r.listEnter(w, list) + } else { + r.listExit(w, list) + } +} + +func (r *Renderer) listItemEnter(w io.Writer, listItem *ast.ListItem) { + if listItemOpenCR(listItem) { + r.cr(w) + } + if listItem.RefLink != nil { + slug := slugify(listItem.RefLink) + r.outs(w, footnoteItem(r.opts.FootnoteAnchorPrefix, slug)) + return + } + + openTag := "
  • " + if listItem.ListFlags&ast.ListTypeDefinition != 0 { + openTag = "
    " + } + if listItem.ListFlags&ast.ListTypeTerm != 0 { + openTag = "
    " + } + r.outs(w, openTag) +} + +func (r *Renderer) listItemExit(w io.Writer, listItem *ast.ListItem) { + if listItem.RefLink != nil && r.opts.Flags&FootnoteReturnLinks != 0 { + slug := slugify(listItem.RefLink) + prefix := r.opts.FootnoteAnchorPrefix + link := r.opts.FootnoteReturnLinkContents + s := footnoteReturnLink(prefix, link, slug) + r.outs(w, s) + } + + closeTag := "
  • " + if listItem.ListFlags&ast.ListTypeDefinition != 0 { + closeTag = "" + } + if listItem.ListFlags&ast.ListTypeTerm != 0 { + closeTag = "" + } + r.outs(w, closeTag) + r.cr(w) +} + +func (r *Renderer) listItem(w io.Writer, listItem *ast.ListItem, entering bool) { + if entering { + r.listItemEnter(w, listItem) + } else { + r.listItemExit(w, listItem) + } +} + +func (r *Renderer) codeBlock(w io.Writer, codeBlock *ast.CodeBlock) { + var attrs []string + // TODO(miek): this can add multiple class= attribute, they should be coalesced into one. + // This is probably true for some other elements as well + attrs = appendLanguageAttr(attrs, codeBlock.Info) + attrs = append(attrs, BlockAttrs(codeBlock)...) + r.cr(w) + + r.outs(w, "
    ")
    +	code := tagWithAttributes("")
    +	r.outs(w, "
    ") + if !isListItem(codeBlock.Parent) { + r.cr(w) + } +} + +func (r *Renderer) caption(w io.Writer, caption *ast.Caption, entering bool) { + if entering { + r.outs(w, "
    ") + return + } + r.outs(w, "
    ") +} + +func (r *Renderer) captionFigure(w io.Writer, figure *ast.CaptionFigure, entering bool) { + // TODO(miek): copy more generic ways of mmark over to here. + fig := "` + } else { + fig += ">" + } + r.outOneOf(w, entering, fig, "\n\n") +} + +func (r *Renderer) tableCell(w io.Writer, tableCell *ast.TableCell, entering bool) { + if !entering { + r.outOneOf(w, tableCell.IsHeader, "", "") + r.cr(w) + return + } + + // entering + var attrs []string + openTag := "") + // XXX: this is to adhere to a rather silly test. Should fix test. + if ast.GetFirstChild(node) == nil { + r.cr(w) + } + } else { + r.outs(w, "") + r.cr(w) + } +} + +func (r *Renderer) matter(w io.Writer, node *ast.DocumentMatter, entering bool) { + if !entering { + return + } + if r.documentMatter != ast.DocumentMatterNone { + r.outs(w, "\n") + } + switch node.Matter { + case ast.DocumentMatterFront: + r.outs(w, `
    `) + case ast.DocumentMatterMain: + r.outs(w, `
    `) + case ast.DocumentMatterBack: + r.outs(w, `
    `) + } + r.documentMatter = node.Matter +} + +func (r *Renderer) citation(w io.Writer, node *ast.Citation) { + for i, c := range node.Destination { + attr := []string{`class="none"`} + switch node.Type[i] { + case ast.CitationTypeNormative: + attr[0] = `class="normative"` + case ast.CitationTypeInformative: + attr[0] = `class="informative"` + case ast.CitationTypeSuppressed: + attr[0] = `class="suppressed"` + } + r.outTag(w, "`+r.opts.CitationFormatString+``, c, c)) + r.outs(w, "") + } +} + +func (r *Renderer) callout(w io.Writer, node *ast.Callout) { + attr := []string{`class="callout"`} + r.outTag(w, "") +} + +func (r *Renderer) index(w io.Writer, node *ast.Index) { + // there is no in-text representation. + attr := []string{`class="index"`, fmt.Sprintf(`id="%s"`, node.ID)} + r.outTag(w, "") +} + +// RenderNode renders a markdown node to HTML +func (r *Renderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus { + if r.opts.RenderNodeHook != nil { + status, didHandle := r.opts.RenderNodeHook(w, node, entering) + if didHandle { + return status + } + } + switch node := node.(type) { + case *ast.Text: + r.text(w, node) + case *ast.Softbreak: + r.cr(w) + // TODO: make it configurable via out(renderer.softbreak) + case *ast.Hardbreak: + r.hardBreak(w, node) + case *ast.NonBlockingSpace: + r.nonBlockingSpace(w, node) + case *ast.Emph: + r.outOneOf(w, entering, "", "") + case *ast.Strong: + r.outOneOf(w, entering, "", "") + case *ast.Del: + r.outOneOf(w, entering, "", "") + case *ast.BlockQuote: + tag := tagWithAttributes("") + case *ast.Aside: + tag := tagWithAttributes("") + case *ast.Link: + r.link(w, node, entering) + case *ast.CrossReference: + link := &ast.Link{Destination: append([]byte("#"), node.Destination...)} + r.link(w, link, entering) + case *ast.Citation: + r.citation(w, node) + case *ast.Image: + if r.opts.Flags&SkipImages != 0 { + return ast.SkipChildren + } + r.image(w, node, entering) + case *ast.Code: + r.code(w, node) + case *ast.CodeBlock: + r.codeBlock(w, node) + case *ast.Caption: + r.caption(w, node, entering) + case *ast.CaptionFigure: + r.captionFigure(w, node, entering) + case *ast.Document: + // do nothing + case *ast.Paragraph: + r.paragraph(w, node, entering) + case *ast.HTMLSpan: + r.htmlSpan(w, node) + case *ast.HTMLBlock: + r.htmlBlock(w, node) + case *ast.Heading: + r.heading(w, node, entering) + case *ast.HorizontalRule: + r.horizontalRule(w, node) + case *ast.List: + r.list(w, node, entering) + case *ast.ListItem: + r.listItem(w, node, entering) + case *ast.Table: + tag := tagWithAttributes("") + case *ast.TableCell: + r.tableCell(w, node, entering) + case *ast.TableHeader: + r.outOneOfCr(w, entering, "", "") + case *ast.TableBody: + r.tableBody(w, node, entering) + case *ast.TableRow: + r.outOneOfCr(w, entering, "", "") + case *ast.TableFooter: + r.outOneOfCr(w, entering, "", "") + case *ast.Math: + r.outOneOf(w, true, `\(`, `\)`) + EscapeHTML(w, node.Literal) + r.outOneOf(w, false, `\(`, `\)`) + case *ast.MathBlock: + r.outOneOf(w, entering, `

    \[`, `\]

    `) + if entering { + EscapeHTML(w, node.Literal) + } + case *ast.DocumentMatter: + r.matter(w, node, entering) + case *ast.Callout: + r.callout(w, node) + case *ast.Index: + r.index(w, node) + case *ast.Subscript: + r.outOneOf(w, true, "", "") + if entering { + Escape(w, node.Literal) + } + r.outOneOf(w, false, "", "") + case *ast.Superscript: + r.outOneOf(w, true, "", "") + if entering { + Escape(w, node.Literal) + } + r.outOneOf(w, false, "", "") + case *ast.Footnotes: + // nothing by default; just output the list. + default: + panic(fmt.Sprintf("Unknown node %T", node)) + } + return ast.GoToNext +} + +// RenderHeader writes HTML document preamble and TOC if requested. +func (r *Renderer) RenderHeader(w io.Writer, ast ast.Node) { + r.writeDocumentHeader(w) + if r.opts.Flags&TOC != 0 { + r.writeTOC(w, ast) + } +} + +// RenderFooter writes HTML document footer. +func (r *Renderer) RenderFooter(w io.Writer, _ ast.Node) { + if r.documentMatter != ast.DocumentMatterNone { + r.outs(w, "
    \n") + } + + if r.opts.Flags&CompletePage == 0 { + return + } + io.WriteString(w, "\n\n\n") +} + +func (r *Renderer) writeDocumentHeader(w io.Writer) { + if r.opts.Flags&CompletePage == 0 { + return + } + ending := "" + if r.opts.Flags&UseXHTML != 0 { + io.WriteString(w, "\n") + io.WriteString(w, "\n") + ending = " /" + } else { + io.WriteString(w, "\n") + io.WriteString(w, "\n") + } + io.WriteString(w, "\n") + io.WriteString(w, " ") + if r.opts.Flags&Smartypants != 0 { + r.sr.Process(w, []byte(r.opts.Title)) + } else { + EscapeHTML(w, []byte(r.opts.Title)) + } + io.WriteString(w, "\n") + io.WriteString(w, r.opts.Generator) + io.WriteString(w, "\"") + io.WriteString(w, ending) + io.WriteString(w, ">\n") + io.WriteString(w, " \n") + if r.opts.CSS != "" { + io.WriteString(w, " \n") + } + if r.opts.Icon != "" { + io.WriteString(w, " \n") + } + if r.opts.Head != nil { + w.Write(r.opts.Head) + } + io.WriteString(w, "\n") + io.WriteString(w, "\n\n") +} + +func (r *Renderer) writeTOC(w io.Writer, doc ast.Node) { + buf := bytes.Buffer{} + + inHeading := false + tocLevel := 0 + headingCount := 0 + + ast.WalkFunc(doc, func(node ast.Node, entering bool) ast.WalkStatus { + if nodeData, ok := node.(*ast.Heading); ok && !nodeData.IsTitleblock { + inHeading = entering + if !entering { + buf.WriteString("") + return ast.GoToNext + } + nodeData.HeadingID = fmt.Sprintf("toc_%d", headingCount) + if nodeData.Level == tocLevel { + buf.WriteString("\n\n
  • ") + } else if nodeData.Level < tocLevel { + for nodeData.Level < tocLevel { + tocLevel-- + buf.WriteString("
  • \n") + } + buf.WriteString("\n\n
  • ") + } else { + for nodeData.Level > tocLevel { + tocLevel++ + buf.WriteString("\n") + } + + if buf.Len() > 0 { + io.WriteString(w, "\n") + } + r.lastOutputLen = buf.Len() +} + +func isList(node ast.Node) bool { + _, ok := node.(*ast.List) + return ok +} + +func isListTight(node ast.Node) bool { + if list, ok := node.(*ast.List); ok { + return list.Tight + } + return false +} + +func isListItem(node ast.Node) bool { + _, ok := node.(*ast.ListItem) + return ok +} + +func isListItemTerm(node ast.Node) bool { + data, ok := node.(*ast.ListItem) + return ok && data.ListFlags&ast.ListTypeTerm != 0 +} + +// TODO: move to internal package +func skipSpace(data []byte, i int) int { + n := len(data) + for i < n && isSpace(data[i]) { + i++ + } + return i +} + +// TODO: move to internal package +var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")} +var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")} + +func isSafeLink(link []byte) bool { + for _, path := range validPaths { + if len(link) >= len(path) && bytes.Equal(link[:len(path)], path) { + if len(link) == len(path) { + return true + } else if isAlnum(link[len(path)]) { + return true + } + } + } + + for _, prefix := range validUris { + // TODO: handle unicode here + // case-insensitive prefix test + if len(link) > len(prefix) && bytes.Equal(bytes.ToLower(link[:len(prefix)]), prefix) && isAlnum(link[len(prefix)]) { + return true + } + } + + return false +} + +// TODO: move to internal package +// Create a url-safe slug for fragments +func slugify(in []byte) []byte { + if len(in) == 0 { + return in + } + out := make([]byte, 0, len(in)) + sym := false + + for _, ch := range in { + if isAlnum(ch) { + sym = false + out = append(out, ch) + } else if sym { + continue + } else { + out = append(out, '-') + sym = true + } + } + var a, b int + var ch byte + for a, ch = range out { + if ch != '-' { + break + } + } + for b = len(out) - 1; b > 0; b-- { + if out[b] != '-' { + break + } + } + return out[a : b+1] +} + +// TODO: move to internal package +// isAlnum returns true if c is a digit or letter +// TODO: check when this is looking for ASCII alnum and when it should use unicode +func isAlnum(c byte) bool { + return (c >= '0' && c <= '9') || isLetter(c) +} + +// isSpace returns true if c is a white-space charactr +func isSpace(c byte) bool { + return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v' +} + +// isLetter returns true if c is ascii letter +func isLetter(c byte) bool { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') +} + +// isPunctuation returns true if c is a punctuation symbol. +func isPunctuation(c byte) bool { + for _, r := range []byte("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") { + if c == r { + return true + } + } + return false +} + +// BlockAttrs takes a node and checks if it has block level attributes set. If so it +// will return a slice each containing a "key=value(s)" string. +func BlockAttrs(node ast.Node) []string { + var attr *ast.Attribute + if c := node.AsContainer(); c != nil && c.Attribute != nil { + attr = c.Attribute + } + if l := node.AsLeaf(); l != nil && l.Attribute != nil { + attr = l.Attribute + } + if attr == nil { + return nil + } + + var s []string + if attr.ID != nil { + s = append(s, fmt.Sprintf(`%s="%s"`, IDTag, attr.ID)) + } + + classes := "" + for _, c := range attr.Classes { + classes += " " + string(c) + } + if classes != "" { + s = append(s, fmt.Sprintf(`class="%s"`, classes[1:])) // skip space we added. + } + + // sort the attributes so it remain stable between runs + var keys = []string{} + for k, _ := range attr.Attrs { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + s = append(s, fmt.Sprintf(`%s="%s"`, k, attr.Attrs[k])) + } + + return s +} + +func tagWithAttributes(name string, attrs []string) string { + s := name + if len(attrs) > 0 { + s += " " + strings.Join(attrs, " ") + } + return s + ">" +} diff --git a/vendor/github.com/gomarkdown/markdown/html/smartypants.go b/vendor/github.com/gomarkdown/markdown/html/smartypants.go new file mode 100644 index 00000000..a09866b0 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/html/smartypants.go @@ -0,0 +1,444 @@ +package html + +import ( + "bytes" + "io" +) + +// SmartyPants rendering + +// SPRenderer is a struct containing state of a Smartypants renderer. +type SPRenderer struct { + inSingleQuote bool + inDoubleQuote bool + callbacks [256]smartCallback +} + +func wordBoundary(c byte) bool { + return c == 0 || isSpace(c) || isPunctuation(c) +} + +func tolower(c byte) byte { + if c >= 'A' && c <= 'Z' { + return c - 'A' + 'a' + } + return c +} + +func isdigit(c byte) bool { + return c >= '0' && c <= '9' +} + +func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote byte, isOpen *bool, addNBSP bool) bool { + // edge of the buffer is likely to be a tag that we don't get to see, + // so we treat it like text sometimes + + // enumerate all sixteen possibilities for (previousChar, nextChar) + // each can be one of {0, space, punct, other} + switch { + case previousChar == 0 && nextChar == 0: + // context is not any help here, so toggle + *isOpen = !*isOpen + case isSpace(previousChar) && nextChar == 0: + // [ "] might be [ "foo...] + *isOpen = true + case isPunctuation(previousChar) && nextChar == 0: + // [!"] hmm... could be [Run!"] or [("...] + *isOpen = false + case /* isnormal(previousChar) && */ nextChar == 0: + // [a"] is probably a close + *isOpen = false + case previousChar == 0 && isSpace(nextChar): + // [" ] might be [...foo" ] + *isOpen = false + case isSpace(previousChar) && isSpace(nextChar): + // [ " ] context is not any help here, so toggle + *isOpen = !*isOpen + case isPunctuation(previousChar) && isSpace(nextChar): + // [!" ] is probably a close + *isOpen = false + case /* isnormal(previousChar) && */ isSpace(nextChar): + // [a" ] this is one of the easy cases + *isOpen = false + case previousChar == 0 && isPunctuation(nextChar): + // ["!] hmm... could be ["$1.95] or ["!...] + *isOpen = false + case isSpace(previousChar) && isPunctuation(nextChar): + // [ "!] looks more like [ "$1.95] + *isOpen = true + case isPunctuation(previousChar) && isPunctuation(nextChar): + // [!"!] context is not any help here, so toggle + *isOpen = !*isOpen + case /* isnormal(previousChar) && */ isPunctuation(nextChar): + // [a"!] is probably a close + *isOpen = false + case previousChar == 0 /* && isnormal(nextChar) */ : + // ["a] is probably an open + *isOpen = true + case isSpace(previousChar) /* && isnormal(nextChar) */ : + // [ "a] this is one of the easy cases + *isOpen = true + case isPunctuation(previousChar) /* && isnormal(nextChar) */ : + // [!"a] is probably an open + *isOpen = true + default: + // [a'b] maybe a contraction? + *isOpen = false + } + + // Note that with the limited lookahead, this non-breaking + // space will also be appended to single double quotes. + if addNBSP && !*isOpen { + out.WriteString(" ") + } + + out.WriteByte('&') + if *isOpen { + out.WriteByte('l') + } else { + out.WriteByte('r') + } + out.WriteByte(quote) + out.WriteString("quo;") + + if addNBSP && *isOpen { + out.WriteString(" ") + } + + return true +} + +func (r *SPRenderer) smartSingleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 2 { + t1 := tolower(text[1]) + + if t1 == '\'' { + nextChar := byte(0) + if len(text) >= 3 { + nextChar = text[2] + } + if smartQuoteHelper(out, previousChar, nextChar, 'd', &r.inDoubleQuote, false) { + return 1 + } + } + + if (t1 == 's' || t1 == 't' || t1 == 'm' || t1 == 'd') && (len(text) < 3 || wordBoundary(text[2])) { + out.WriteString("’") + return 0 + } + + if len(text) >= 3 { + t2 := tolower(text[2]) + + if ((t1 == 'r' && t2 == 'e') || (t1 == 'l' && t2 == 'l') || (t1 == 'v' && t2 == 'e')) && + (len(text) < 4 || wordBoundary(text[3])) { + out.WriteString("’") + return 0 + } + } + } + + nextChar := byte(0) + if len(text) > 1 { + nextChar = text[1] + } + if smartQuoteHelper(out, previousChar, nextChar, 's', &r.inSingleQuote, false) { + return 0 + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartParens(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 3 { + t1 := tolower(text[1]) + t2 := tolower(text[2]) + + if t1 == 'c' && t2 == ')' { + out.WriteString("©") + return 2 + } + + if t1 == 'r' && t2 == ')' { + out.WriteString("®") + return 2 + } + + if len(text) >= 4 && t1 == 't' && t2 == 'm' && text[3] == ')' { + out.WriteString("™") + return 3 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartDash(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 2 { + if text[1] == '-' { + out.WriteString("—") + return 1 + } + + if wordBoundary(previousChar) && wordBoundary(text[1]) { + out.WriteString("–") + return 0 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartDashLatex(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 3 && text[1] == '-' && text[2] == '-' { + out.WriteString("—") + return 2 + } + if len(text) >= 2 && text[1] == '-' { + out.WriteString("–") + return 1 + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartAmpVariant(out *bytes.Buffer, previousChar byte, text []byte, quote byte, addNBSP bool) int { + if bytes.HasPrefix(text, []byte(""")) { + nextChar := byte(0) + if len(text) >= 7 { + nextChar = text[6] + } + if smartQuoteHelper(out, previousChar, nextChar, quote, &r.inDoubleQuote, addNBSP) { + return 5 + } + } + + if bytes.HasPrefix(text, []byte("�")) { + return 3 + } + + out.WriteByte('&') + return 0 +} + +func (r *SPRenderer) smartAmp(angledQuotes, addNBSP bool) func(*bytes.Buffer, byte, []byte) int { + var quote byte = 'd' + if angledQuotes { + quote = 'a' + } + + return func(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartAmpVariant(out, previousChar, text, quote, addNBSP) + } +} + +func (r *SPRenderer) smartPeriod(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 3 && text[1] == '.' && text[2] == '.' { + out.WriteString("…") + return 2 + } + + if len(text) >= 5 && text[1] == ' ' && text[2] == '.' && text[3] == ' ' && text[4] == '.' { + out.WriteString("…") + return 4 + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartBacktick(out *bytes.Buffer, previousChar byte, text []byte) int { + if len(text) >= 2 && text[1] == '`' { + nextChar := byte(0) + if len(text) >= 3 { + nextChar = text[2] + } + if smartQuoteHelper(out, previousChar, nextChar, 'd', &r.inDoubleQuote, false) { + return 1 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartNumberGeneric(out *bytes.Buffer, previousChar byte, text []byte) int { + if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { + // is it of the form digits/digits(word boundary)?, i.e., \d+/\d+\b + // note: check for regular slash (/) or fraction slash (⁄, 0x2044, or 0xe2 81 84 in utf-8) + // and avoid changing dates like 1/23/2005 into fractions. + numEnd := 0 + for len(text) > numEnd && isdigit(text[numEnd]) { + numEnd++ + } + if numEnd == 0 { + out.WriteByte(text[0]) + return 0 + } + denStart := numEnd + 1 + if len(text) > numEnd+3 && text[numEnd] == 0xe2 && text[numEnd+1] == 0x81 && text[numEnd+2] == 0x84 { + denStart = numEnd + 3 + } else if len(text) < numEnd+2 || text[numEnd] != '/' { + out.WriteByte(text[0]) + return 0 + } + denEnd := denStart + for len(text) > denEnd && isdigit(text[denEnd]) { + denEnd++ + } + if denEnd == denStart { + out.WriteByte(text[0]) + return 0 + } + if len(text) == denEnd || wordBoundary(text[denEnd]) && text[denEnd] != '/' { + out.WriteString("") + out.Write(text[:numEnd]) + out.WriteString("") + out.Write(text[denStart:denEnd]) + out.WriteString("") + return denEnd - 1 + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartNumber(out *bytes.Buffer, previousChar byte, text []byte) int { + if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { + if text[0] == '1' && text[1] == '/' && text[2] == '2' { + if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' { + out.WriteString("½") + return 2 + } + } + + if text[0] == '1' && text[1] == '/' && text[2] == '4' { + if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 5 && tolower(text[3]) == 't' && tolower(text[4]) == 'h') { + out.WriteString("¼") + return 2 + } + } + + if text[0] == '3' && text[1] == '/' && text[2] == '4' { + if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 6 && tolower(text[3]) == 't' && tolower(text[4]) == 'h' && tolower(text[5]) == 's') { + out.WriteString("¾") + return 2 + } + } + } + + out.WriteByte(text[0]) + return 0 +} + +func (r *SPRenderer) smartDoubleQuoteVariant(out *bytes.Buffer, previousChar byte, text []byte, quote byte) int { + nextChar := byte(0) + if len(text) > 1 { + nextChar = text[1] + } + if !smartQuoteHelper(out, previousChar, nextChar, quote, &r.inDoubleQuote, false) { + out.WriteString(""") + } + + return 0 +} + +func (r *SPRenderer) smartDoubleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartDoubleQuoteVariant(out, previousChar, text, 'd') +} + +func (r *SPRenderer) smartAngledDoubleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartDoubleQuoteVariant(out, previousChar, text, 'a') +} + +func (r *SPRenderer) smartLeftAngle(out *bytes.Buffer, previousChar byte, text []byte) int { + i := 0 + + for i < len(text) && text[i] != '>' { + i++ + } + + out.Write(text[:i+1]) + return i +} + +type smartCallback func(out *bytes.Buffer, previousChar byte, text []byte) int + +// NewSmartypantsRenderer constructs a Smartypants renderer object. +func NewSmartypantsRenderer(flags Flags) *SPRenderer { + var ( + r SPRenderer + + smartAmpAngled = r.smartAmp(true, false) + smartAmpAngledNBSP = r.smartAmp(true, true) + smartAmpRegular = r.smartAmp(false, false) + smartAmpRegularNBSP = r.smartAmp(false, true) + + addNBSP = flags&SmartypantsQuotesNBSP != 0 + ) + + if flags&SmartypantsAngledQuotes == 0 { + r.callbacks['"'] = r.smartDoubleQuote + if !addNBSP { + r.callbacks['&'] = smartAmpRegular + } else { + r.callbacks['&'] = smartAmpRegularNBSP + } + } else { + r.callbacks['"'] = r.smartAngledDoubleQuote + if !addNBSP { + r.callbacks['&'] = smartAmpAngled + } else { + r.callbacks['&'] = smartAmpAngledNBSP + } + } + r.callbacks['\''] = r.smartSingleQuote + r.callbacks['('] = r.smartParens + if flags&SmartypantsDashes != 0 { + if flags&SmartypantsLatexDashes == 0 { + r.callbacks['-'] = r.smartDash + } else { + r.callbacks['-'] = r.smartDashLatex + } + } + r.callbacks['.'] = r.smartPeriod + if flags&SmartypantsFractions == 0 { + r.callbacks['1'] = r.smartNumber + r.callbacks['3'] = r.smartNumber + } else { + for ch := '1'; ch <= '9'; ch++ { + r.callbacks[ch] = r.smartNumberGeneric + } + } + r.callbacks['<'] = r.smartLeftAngle + r.callbacks['`'] = r.smartBacktick + return &r +} + +// Process is the entry point of the Smartypants renderer. +func (r *SPRenderer) Process(w io.Writer, text []byte) { + mark := 0 + for i := 0; i < len(text); i++ { + if action := r.callbacks[text[i]]; action != nil { + if i > mark { + w.Write(text[mark:i]) + } + previousChar := byte(0) + if i > 0 { + previousChar = text[i-1] + } + var tmp bytes.Buffer + i += action(&tmp, previousChar, text[i:]) + w.Write(tmp.Bytes()) + mark = i + 1 + } + } + if mark < len(text) { + w.Write(text[mark:]) + } +} diff --git a/vendor/github.com/gomarkdown/markdown/markdown.go b/vendor/github.com/gomarkdown/markdown/markdown.go new file mode 100644 index 00000000..fd5c1cfb --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/markdown.go @@ -0,0 +1,85 @@ +package markdown + +import ( + "bytes" + "io" + + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/parser" +) + +// Renderer is an interface for implementing custom renderers. +type Renderer interface { + // RenderNode renders markdown node to w. + // It's called once for a leaf node. + // It's called twice for non-leaf nodes: + // * first with entering=true + // * then with entering=false + // + // Return value is a way to tell the calling walker to adjust its walk + // pattern: e.g. it can terminate the traversal by returning Terminate. Or it + // can ask the walker to skip a subtree of this node by returning SkipChildren. + // The typical behavior is to return GoToNext, which asks for the usual + // traversal to the next node. + RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus + + // RenderHeader is a method that allows the renderer to produce some + // content preceding the main body of the output document. The header is + // understood in the broad sense here. For example, the default HTML + // renderer will write not only the HTML document preamble, but also the + // table of contents if it was requested. + // + // The method will be passed an entire document tree, in case a particular + // implementation needs to inspect it to produce output. + // + // The output should be written to the supplied writer w. If your + // implementation has no header to write, supply an empty implementation. + RenderHeader(w io.Writer, ast ast.Node) + + // RenderFooter is a symmetric counterpart of RenderHeader. + RenderFooter(w io.Writer, ast ast.Node) +} + +// Parse parsers a markdown document using provided parser. If parser is nil, +// we use parser configured with parser.CommonExtensions. +// +// It returns AST (abstract syntax tree) that can be converted to another +// format using Render function. +func Parse(markdown []byte, p *parser.Parser) ast.Node { + if p == nil { + p = parser.New() + } + return p.Parse(markdown) +} + +// Render uses renderer to convert parsed markdown document into a different format. +// +// To convert to HTML, pass html.Renderer +func Render(doc ast.Node, renderer Renderer) []byte { + var buf bytes.Buffer + renderer.RenderHeader(&buf, doc) + ast.WalkFunc(doc, func(node ast.Node, entering bool) ast.WalkStatus { + return renderer.RenderNode(&buf, node, entering) + }) + renderer.RenderFooter(&buf, doc) + return buf.Bytes() +} + +// ToHTML converts markdownDoc to HTML. +// +// You can optionally pass a parser and renderer. This allows to customize +// a parser, use a customized html render or use completely custom renderer. +// +// If you pass nil for both, we use parser configured with parser.CommonExtensions +// and html.Renderer configured with html.CommonFlags. +func ToHTML(markdown []byte, p *parser.Parser, renderer Renderer) []byte { + doc := Parse(markdown, p) + if renderer == nil { + opts := html.RendererOptions{ + Flags: html.CommonFlags, + } + renderer = html.NewRenderer(opts) + } + return Render(doc, renderer) +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/aside.go b/vendor/github.com/gomarkdown/markdown/parser/aside.go new file mode 100644 index 00000000..96e25fe0 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/aside.go @@ -0,0 +1,73 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// returns aisde prefix length +func (p *Parser) asidePrefix(data []byte) int { + i := 0 + n := len(data) + for i < 3 && i < n && data[i] == ' ' { + i++ + } + if i+1 < n && data[i] == 'A' && data[i+1] == '>' { + if i+2 < n && data[i+2] == ' ' { + return i + 3 + } + return i + 2 + } + return 0 +} + +// aside ends with at least one blank line +// followed by something without a aside prefix +func (p *Parser) terminateAside(data []byte, beg, end int) bool { + if p.isEmpty(data[beg:]) <= 0 { + return false + } + if end >= len(data) { + return true + } + return p.asidePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0 +} + +// parse a aside fragment +func (p *Parser) aside(data []byte) int { + var raw bytes.Buffer + beg, end := 0, 0 + // identical to quote + for beg < len(data) { + end = beg + // Step over whole lines, collecting them. While doing that, check for + // fenced code and if one's found, incorporate it altogether, + // irregardless of any contents inside it + for end < len(data) && data[end] != '\n' { + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data[end:], false); i > 0 { + // -1 to compensate for the extra end++ after the loop: + end += i - 1 + break + } + } + end++ + } + end = skipCharN(data, end, '\n', 1) + if pre := p.asidePrefix(data[beg:]); pre > 0 { + // skip the prefix + beg += pre + } else if p.terminateAside(data, beg, end) { + break + } + // this line is part of the aside + raw.Write(data[beg:end]) + beg = end + } + + block := p.addBlock(&ast.Aside{}) + p.block(raw.Bytes()) + p.finalize(block) + return end +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/attribute.go b/vendor/github.com/gomarkdown/markdown/parser/attribute.go new file mode 100644 index 00000000..5fdb0709 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/attribute.go @@ -0,0 +1,116 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// attribute parses a (potential) block attribute and adds it to p. +func (p *Parser) attribute(data []byte) []byte { + if len(data) < 3 { + return data + } + i := 0 + if data[i] != '{' { + return data + } + i++ + + // last character must be a } otherwise it's not an attribute + end := skipUntilChar(data, i, '\n') + if data[end-1] != '}' { + return data + } + + i = skipSpace(data, i) + b := &ast.Attribute{Attrs: make(map[string][]byte)} + + esc := false + quote := false + trail := 0 +Loop: + for ; i < len(data); i++ { + switch data[i] { + case ' ', '\t', '\f', '\v': + if quote { + continue + } + chunk := data[trail+1 : i] + if len(chunk) == 0 { + trail = i + continue + } + switch { + case chunk[0] == '.': + b.Classes = append(b.Classes, chunk[1:]) + case chunk[0] == '#': + b.ID = chunk[1:] + default: + k, v := keyValue(chunk) + if k != nil && v != nil { + b.Attrs[string(k)] = v + } else { + // this is illegal in an attribute + return data + } + } + trail = i + case '"': + if esc { + esc = !esc + continue + } + quote = !quote + case '\\': + esc = !esc + case '}': + if esc { + esc = !esc + continue + } + chunk := data[trail+1 : i] + if len(chunk) == 0 { + return data + } + switch { + case chunk[0] == '.': + b.Classes = append(b.Classes, chunk[1:]) + case chunk[0] == '#': + b.ID = chunk[1:] + default: + k, v := keyValue(chunk) + if k != nil && v != nil { + b.Attrs[string(k)] = v + } else { + return data + } + } + i++ + break Loop + default: + esc = false + } + } + + p.attr = b + return data[i:] +} + +// key="value" quotes are mandatory. +func keyValue(data []byte) ([]byte, []byte) { + chunk := bytes.SplitN(data, []byte{'='}, 2) + if len(chunk) != 2 { + return nil, nil + } + key := chunk[0] + value := chunk[1] + + if len(value) < 3 || len(key) == 0 { + return nil, nil + } + if value[0] != '"' || value[len(value)-1] != '"' { + return key, nil + } + return key, value[1 : len(value)-1] +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/block.go b/vendor/github.com/gomarkdown/markdown/parser/block.go new file mode 100644 index 00000000..18a2dd89 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/block.go @@ -0,0 +1,1978 @@ +package parser + +import ( + "bytes" + "html" + "regexp" + "strconv" + "unicode" + + "github.com/gomarkdown/markdown/ast" +) + +// Parsing block-level elements. + +const ( + charEntity = "&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});" + escapable = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]" +) + +var ( + reBackslashOrAmp = regexp.MustCompile("[\\&]") + reEntityOrEscapedChar = regexp.MustCompile("(?i)\\\\" + escapable + "|" + charEntity) + + // 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. + 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{}{}, + + // 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{}{}, + } +) + +// sanitizeAnchorName returns a sanitized anchor name for the given text. +// Taken from https://github.com/shurcooL/sanitized_anchor_name/blob/master/main.go#L14:1 +func sanitizeAnchorName(text string) string { + var anchorName []rune + var futureDash = false + for _, r := range text { + switch { + case unicode.IsLetter(r) || unicode.IsNumber(r): + if futureDash && len(anchorName) > 0 { + anchorName = append(anchorName, '-') + } + futureDash = false + anchorName = append(anchorName, unicode.ToLower(r)) + default: + futureDash = true + } + } + return string(anchorName) +} + +// Parse block-level data. +// Note: this function and many that it calls assume that +// the input buffer ends with a newline. +func (p *Parser) block(data []byte) { + // this is called recursively: enforce a maximum depth + if p.nesting >= p.maxNesting { + return + } + p.nesting++ + + // parse out one block-level construct at a time + for len(data) > 0 { + // attributes that can be specific before a block element: + // + // {#id .class1 .class2 key="value"} + if p.extensions&Attributes != 0 { + data = p.attribute(data) + } + + if p.extensions&Includes != 0 { + f := p.readInclude + path, address, consumed := p.isInclude(data) + if consumed == 0 { + path, address, consumed = p.isCodeInclude(data) + f = p.readCodeInclude + } + if consumed > 0 { + included := f(p.includeStack.Last(), path, address) + p.includeStack.Push(path) + p.block(included) + p.includeStack.Pop() + data = data[consumed:] + continue + } + } + + // user supplied parser function + if p.Opts.ParserHook != nil { + node, blockdata, consumed := p.Opts.ParserHook(data) + if consumed > 0 { + data = data[consumed:] + + if node != nil { + p.addBlock(node) + if blockdata != nil { + p.block(blockdata) + p.finalize(node) + } + } + continue + } + } + + // prefixed heading: + // + // # Heading 1 + // ## Heading 2 + // ... + // ###### Heading 6 + if p.isPrefixHeading(data) { + data = data[p.prefixHeading(data):] + continue + } + + // prefixed special heading: + // (there are no levels.) + // + // .# Abstract + if p.isPrefixSpecialHeading(data) { + data = data[p.prefixSpecialHeading(data):] + continue + } + + // block of preformatted HTML: + // + //
    + // ... + //
    + if data[0] == '<' { + if i := p.html(data, true); i > 0 { + data = data[i:] + continue + } + } + + // title block + // + // % stuff + // % more stuff + // % even more stuff + if p.extensions&Titleblock != 0 { + if data[0] == '%' { + if i := p.titleBlock(data, true); i > 0 { + data = data[i:] + continue + } + } + } + + // blank lines. note: returns the # of bytes to skip + if i := p.isEmpty(data); i > 0 { + data = data[i:] + continue + } + + // indented code block: + // + // func max(a, b int) int { + // if a > b { + // return a + // } + // return b + // } + if p.codePrefix(data) > 0 { + data = data[p.code(data):] + continue + } + + // fenced code block: + // + // ``` go + // func fact(n int) int { + // if n <= 1 { + // return n + // } + // return n * fact(n-1) + // } + // ``` + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data, true); i > 0 { + data = data[i:] + continue + } + } + + // horizontal rule: + // + // ------ + // or + // ****** + // or + // ______ + if p.isHRule(data) { + p.addBlock(&ast.HorizontalRule{}) + i := skipUntilChar(data, 0, '\n') + data = data[i:] + continue + } + + // block quote: + // + // > A big quote I found somewhere + // > on the web + if p.quotePrefix(data) > 0 { + data = data[p.quote(data):] + continue + } + + // aside: + // + // A> The proof is too large to fit + // A> in the margin. + if p.extensions&Mmark != 0 { + if p.asidePrefix(data) > 0 { + data = data[p.aside(data):] + continue + } + } + + // figure block: + // + // !--- + // ![Alt Text](img.jpg "This is an image") + // ![Alt Text](img2.jpg "This is a second image") + // !--- + if p.extensions&Mmark != 0 { + if i := p.figureBlock(data, true); i > 0 { + data = data[i:] + continue + } + } + + // table: + // + // Name | Age | Phone + // ------|-----|--------- + // Bob | 31 | 555-1234 + // Alice | 27 | 555-4321 + if p.extensions&Tables != 0 { + if i := p.table(data); i > 0 { + data = data[i:] + continue + } + } + + // an itemized/unordered list: + // + // * Item 1 + // * Item 2 + // + // also works with + or - + if p.uliPrefix(data) > 0 { + data = data[p.list(data, 0, 0):] + continue + } + + // a numbered/ordered list: + // + // 1. Item 1 + // 2. Item 2 + if i := p.oliPrefix(data); i > 0 { + start := 0 + if i > 2 && p.extensions&OrderedListStart != 0 { + s := string(data[:i-2]) + start, _ = strconv.Atoi(s) + if start == 1 { + start = 0 + } + } + data = data[p.list(data, ast.ListTypeOrdered, start):] + continue + } + + // definition lists: + // + // Term 1 + // : Definition a + // : Definition b + // + // Term 2 + // : Definition c + if p.extensions&DefinitionLists != 0 { + if p.dliPrefix(data) > 0 { + data = data[p.list(data, ast.ListTypeDefinition, 0):] + continue + } + } + + if p.extensions&MathJax != 0 { + if i := p.blockMath(data); i > 0 { + data = data[i:] + continue + } + } + + // document matters: + // + // {frontmatter}/{mainmatter}/{backmatter} + if p.extensions&Mmark != 0 { + if i := p.documentMatter(data); i > 0 { + data = data[i:] + continue + } + } + + // anything else must look like a normal paragraph + // note: this finds underlined headings, too + idx := p.paragraph(data) + data = data[idx:] + } + + p.nesting-- +} + +func (p *Parser) addBlock(n ast.Node) ast.Node { + p.closeUnmatchedBlocks() + + if p.attr != nil { + if c := n.AsContainer(); c != nil { + c.Attribute = p.attr + } + if l := n.AsLeaf(); l != nil { + l.Attribute = p.attr + } + p.attr = nil + } + return p.addChild(n) +} + +func (p *Parser) isPrefixHeading(data []byte) bool { + if data[0] != '#' { + return false + } + + if p.extensions&SpaceHeadings != 0 { + level := skipCharN(data, 0, '#', 6) + if level == len(data) || data[level] != ' ' { + return false + } + } + return true +} + +func (p *Parser) prefixHeading(data []byte) int { + level := skipCharN(data, 0, '#', 6) + i := skipChar(data, level, ' ') + end := skipUntilChar(data, i, '\n') + skip := end + id := "" + if p.extensions&HeadingIDs != 0 { + j, k := 0, 0 + // find start/end of heading id + for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { + } + for k = j + 1; k < end && data[k] != '}'; k++ { + } + // extract heading id iff found + if j < end && k < end { + id = string(data[j+2 : k]) + end = j + skip = k + 1 + for end > 0 && data[end-1] == ' ' { + end-- + } + } + } + for end > 0 && data[end-1] == '#' { + if isBackslashEscaped(data, end-1) { + break + } + end-- + } + for end > 0 && data[end-1] == ' ' { + end-- + } + if end > i { + if id == "" && p.extensions&AutoHeadingIDs != 0 { + id = sanitizeAnchorName(string(data[i:end])) + } + block := &ast.Heading{ + HeadingID: id, + Level: level, + } + block.Content = data[i:end] + p.addBlock(block) + } + return skip +} + +func (p *Parser) isPrefixSpecialHeading(data []byte) bool { + if p.extensions|Mmark == 0 { + return false + } + if len(data) < 4 { + return false + } + if data[0] != '.' { + return false + } + if data[1] != '#' { + return false + } + if data[2] == '#' { // we don't support level, so nack this. + return false + } + + if p.extensions&SpaceHeadings != 0 { + if data[2] != ' ' { + return false + } + } + return true +} + +func (p *Parser) prefixSpecialHeading(data []byte) int { + i := skipChar(data, 2, ' ') // ".#" skipped + end := skipUntilChar(data, i, '\n') + skip := end + id := "" + if p.extensions&HeadingIDs != 0 { + j, k := 0, 0 + // find start/end of heading id + for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { + } + for k = j + 1; k < end && data[k] != '}'; k++ { + } + // extract heading id iff found + if j < end && k < end { + id = string(data[j+2 : k]) + end = j + skip = k + 1 + for end > 0 && data[end-1] == ' ' { + end-- + } + } + } + for end > 0 && data[end-1] == '#' { + if isBackslashEscaped(data, end-1) { + break + } + end-- + } + for end > 0 && data[end-1] == ' ' { + end-- + } + if end > i { + if id == "" && p.extensions&AutoHeadingIDs != 0 { + id = sanitizeAnchorName(string(data[i:end])) + } + block := &ast.Heading{ + HeadingID: id, + IsSpecial: true, + Level: 1, // always level 1. + } + block.Literal = data[i:end] + block.Content = data[i:end] + p.addBlock(block) + } + return skip +} + +func (p *Parser) isUnderlinedHeading(data []byte) int { + // test of level 1 heading + if data[0] == '=' { + i := skipChar(data, 1, '=') + i = skipChar(data, i, ' ') + if i < len(data) && data[i] == '\n' { + return 1 + } + return 0 + } + + // test of level 2 heading + if data[0] == '-' { + i := skipChar(data, 1, '-') + i = skipChar(data, i, ' ') + if i < len(data) && data[i] == '\n' { + return 2 + } + return 0 + } + + return 0 +} + +func (p *Parser) titleBlock(data []byte, doRender bool) int { + if data[0] != '%' { + return 0 + } + splitData := bytes.Split(data, []byte("\n")) + var i int + for idx, b := range splitData { + if !bytes.HasPrefix(b, []byte("%")) { + i = idx // - 1 + break + } + } + + data = bytes.Join(splitData[0:i], []byte("\n")) + consumed := len(data) + data = bytes.TrimPrefix(data, []byte("% ")) + data = bytes.Replace(data, []byte("\n% "), []byte("\n"), -1) + block := &ast.Heading{ + Level: 1, + IsTitleblock: true, + } + block.Content = data + p.addBlock(block) + + return consumed +} + +func (p *Parser) html(data []byte, doRender bool) int { + var i, j int + + // identify the opening tag + if data[0] != '<' { + return 0 + } + curtag, tagfound := p.htmlFindTag(data[1:]) + + // handle special cases + if !tagfound { + // check for an HTML comment + if size := p.htmlComment(data, doRender); size > 0 { + return size + } + + // check for an
    tag + if size := p.htmlHr(data, doRender); size > 0 { + return size + } + + // no special case recognized + return 0 + } + + // look for an unindented matching closing tag + // followed by a blank line + found := false + /* + closetag := []byte("\n") + j = len(curtag) + 1 + for !found { + // scan for a closing tag at the beginning of a line + if skip := bytes.Index(data[j:], closetag); skip >= 0 { + j += skip + len(closetag) + } else { + break + } + + // see if it is the only thing on the line + if skip := p.isEmpty(data[j:]); skip > 0 { + // see if it is followed by a blank line/eof + j += skip + if j >= len(data) { + found = true + i = j + } else { + if skip := p.isEmpty(data[j:]); skip > 0 { + j += skip + found = true + i = j + } + } + } + } + */ + + // if not found, try a second pass looking for indented match + // but not if tag is "ins" or "del" (following original Markdown.pl) + if !found && curtag != "ins" && curtag != "del" { + i = 1 + for i < len(data) { + i++ + for i < len(data) && !(data[i-1] == '<' && data[i] == '/') { + i++ + } + + if i+2+len(curtag) >= len(data) { + break + } + + j = p.htmlFindEnd(curtag, data[i-1:]) + + if j > 0 { + i += j - 1 + found = true + break + } + } + } + + if !found { + return 0 + } + + // the end of the block has been found + if doRender { + // trim newlines + end := backChar(data, i, '\n') + htmlBLock := &ast.HTMLBlock{ast.Leaf{Content: data[:end]}} + p.addBlock(htmlBLock) + finalizeHTMLBlock(htmlBLock) + } + + return i +} + +func finalizeHTMLBlock(block *ast.HTMLBlock) { + block.Literal = block.Content + block.Content = nil +} + +// HTML comment, lax form +func (p *Parser) htmlComment(data []byte, doRender bool) int { + i := p.inlineHTMLComment(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 := backChar(data, size, '\n') + htmlBLock := &ast.HTMLBlock{ast.Leaf{Content: data[:end]}} + p.addBlock(htmlBLock) + finalizeHTMLBlock(htmlBLock) + } + return size + } + return 0 +} + +// HR, which is the only self-closing block tag considered +func (p *Parser) htmlHr(data []byte, doRender bool) int { + if len(data) < 4 { + return 0 + } + if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') { + return 0 + } + if data[3] != ' ' && data[3] != '/' && data[3] != '>' { + // not an
    tag after all; at least not a valid one + return 0 + } + i := 3 + for i < len(data) && data[i] != '>' && data[i] != '\n' { + i++ + } + if i < len(data) && data[i] == '>' { + i++ + if j := p.isEmpty(data[i:]); j > 0 { + size := i + j + if doRender { + // trim newlines + end := backChar(data, size, '\n') + htmlBlock := &ast.HTMLBlock{ast.Leaf{Content: data[:end]}} + p.addBlock(htmlBlock) + finalizeHTMLBlock(htmlBlock) + } + return size + } + } + return 0 +} + +func (p *Parser) htmlFindTag(data []byte) (string, bool) { + i := skipAlnum(data, 0) + key := string(data[:i]) + if _, ok := blockTags[key]; ok { + return key, true + } + return "", false +} + +func (p *Parser) htmlFindEnd(tag string, data []byte) int { + // assume data[0] == '<' && data[1] == '/' already tested + if tag == "hr" { + return 2 + } + // check if tag is a match + closetag := []byte("") + if !bytes.HasPrefix(data, closetag) { + return 0 + } + i := len(closetag) + + // check that the rest of the line is blank + skip := 0 + if skip = p.isEmpty(data[i:]); skip == 0 { + return 0 + } + i += skip + skip = 0 + + if i >= len(data) { + return i + } + + if p.extensions&LaxHTMLBlocks != 0 { + return i + } + if skip = p.isEmpty(data[i:]); skip == 0 { + // following line must be blank + return 0 + } + + return i + skip +} + +func (*Parser) isEmpty(data []byte) int { + // it is okay to call isEmpty on an empty buffer + if len(data) == 0 { + return 0 + } + + var i int + for i = 0; i < len(data) && data[i] != '\n'; i++ { + if data[i] != ' ' && data[i] != '\t' { + return 0 + } + } + i = skipCharN(data, i, '\n', 1) + return i +} + +func (*Parser) isHRule(data []byte) bool { + i := 0 + + // skip up to three spaces + for i < 3 && data[i] == ' ' { + i++ + } + + // look at the hrule char + if data[i] != '*' && data[i] != '-' && data[i] != '_' { + return false + } + c := data[i] + + // the whole line must be the char or whitespace + n := 0 + for i < len(data) && data[i] != '\n' { + switch { + case data[i] == c: + n++ + case data[i] != ' ': + return false + } + i++ + } + + return n >= 3 +} + +// 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) { + i, size := 0, 0 + + n := len(data) + // skip up to three spaces + for i < n && i < 3 && data[i] == ' ' { + i++ + } + + // check for the marker characters: ~ or ` + if i >= n { + return 0, "" + } + if data[i] != '~' && data[i] != '`' { + return 0, "" + } + + c := data[i] + + // the whole line must be the same char or whitespace + for i < n && data[i] == c { + size++ + i++ + } + + // the marker char must occur at least 3 times + if size < 3 { + return 0, "" + } + marker = string(data[i-size : i]) + + // if this is the end marker, it must match the beginning marker + if oldmarker != "" && marker != oldmarker { + return 0, "" + } + + // 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 + i = skipChar(data, i, ' ') + + if i >= n { + if i == n { + return i, marker + } + return 0, "" + } + + syntaxStart := i + + if data[i] == '{' { + i++ + syntaxStart++ + + for i < n && data[i] != '}' && data[i] != '\n' { + syn++ + i++ + } + + if i >= n || data[i] != '}' { + return 0, "" + } + + // strip all whitespace at the beginning and the end + // of the {} block + for syn > 0 && isSpace(data[syntaxStart]) { + syntaxStart++ + syn-- + } + + for syn > 0 && isSpace(data[syntaxStart+syn-1]) { + syn-- + } + + i++ + } else { + for i < n && !isSpace(data[i]) { + syn++ + i++ + } + } + + *syntax = string(data[syntaxStart : syntaxStart+syn]) + } + + i = skipChar(data, i, ' ') + if i >= n || data[i] != '\n' { + if i == n { + return i, marker + } + return 0, "" + } + return i + 1, marker // Take newline into account. +} + +// fencedCodeBlock returns the end index if data contains a fenced code block at the beginning, +// 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 *Parser) fencedCodeBlock(data []byte, doRender bool) int { + var syntax string + beg, marker := isFenceLine(data, &syntax, "") + if beg == 0 || beg >= len(data) { + return 0 + } + + var work bytes.Buffer + work.WriteString(syntax) + work.WriteByte('\n') + + for { + // safe to assume beg < len(data) + + // check for the end of the code block + fenceEnd, _ := isFenceLine(data[beg:], nil, marker) + if fenceEnd != 0 { + beg += fenceEnd + break + } + + // copy the current line + end := skipUntilChar(data, beg, '\n') + 1 + + // did we reach the end of the buffer without a closing marker? + if end >= len(data) { + return 0 + } + + // verbatim copy to the working buffer + if doRender { + work.Write(data[beg:end]) + } + beg = end + } + + if doRender { + codeBlock := &ast.CodeBlock{ + IsFenced: true, + } + codeBlock.Content = work.Bytes() // TODO: get rid of temp buffer + + if p.extensions&Mmark == 0 { + p.addBlock(codeBlock) + finalizeCodeBlock(codeBlock) + return beg + } + + // Check for caption and if found make it a figure. + if captionContent, id, consumed := p.caption(data[beg:], []byte("Figure: ")); consumed > 0 { + figure := &ast.CaptionFigure{} + caption := &ast.Caption{} + figure.HeadingID = id + p.Inline(caption, captionContent) + + p.addBlock(figure) + codeBlock.AsLeaf().Attribute = figure.AsContainer().Attribute + p.addChild(codeBlock) + finalizeCodeBlock(codeBlock) + p.addChild(caption) + p.finalize(figure) + + beg += consumed + + return beg + } + + // Still here, normal block + p.addBlock(codeBlock) + finalizeCodeBlock(codeBlock) + } + + return beg +} + +func unescapeChar(str []byte) []byte { + if str[0] == '\\' { + return []byte{str[1]} + } + return []byte(html.UnescapeString(string(str))) +} + +func unescapeString(str []byte) []byte { + if reBackslashOrAmp.Match(str) { + return reEntityOrEscapedChar.ReplaceAllFunc(str, unescapeChar) + } + return str +} + +func finalizeCodeBlock(code *ast.CodeBlock) { + c := code.Content + if code.IsFenced { + newlinePos := bytes.IndexByte(c, '\n') + firstLine := c[:newlinePos] + rest := c[newlinePos+1:] + code.Info = unescapeString(bytes.Trim(firstLine, "\n")) + code.Literal = rest + } else { + code.Literal = c + } + code.Content = nil +} + +func (p *Parser) table(data []byte) int { + i, columns, table := p.tableHeader(data) + if i == 0 { + return 0 + } + + p.addBlock(&ast.TableBody{}) + + for i < len(data) { + pipes, rowStart := 0, i + for ; i < len(data) && data[i] != '\n'; i++ { + if data[i] == '|' { + pipes++ + } + } + + if pipes == 0 { + i = rowStart + break + } + + // include the newline in data sent to tableRow + i = skipCharN(data, i, '\n', 1) + + if p.tableFooter(data[rowStart:i]) { + continue + } + + p.tableRow(data[rowStart:i], columns, false) + } + if captionContent, id, consumed := p.caption(data[i:], []byte("Table: ")); consumed > 0 { + caption := &ast.Caption{} + p.Inline(caption, captionContent) + + // Some switcheroo to re-insert the parsed table as a child of the captionfigure. + figure := &ast.CaptionFigure{} + figure.HeadingID = id + table2 := &ast.Table{} + // Retain any block level attributes. + table2.AsContainer().Attribute = table.AsContainer().Attribute + children := table.GetChildren() + ast.RemoveFromTree(table) + + table2.SetChildren(children) + ast.AppendChild(figure, table2) + ast.AppendChild(figure, caption) + + p.addChild(figure) + p.finalize(figure) + + i += consumed + } + + return i +} + +// check if the specified position is preceded by an odd number of backslashes +func isBackslashEscaped(data []byte, i int) bool { + backslashes := 0 + for i-backslashes-1 >= 0 && data[i-backslashes-1] == '\\' { + backslashes++ + } + return backslashes&1 == 1 +} + +// tableHeaders parses the header. If recognized it will also add a table. +func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlags, table ast.Node) { + i := 0 + colCount := 1 + for i = 0; i < len(data) && data[i] != '\n'; i++ { + if data[i] == '|' && !isBackslashEscaped(data, i) { + colCount++ + } + } + + // doesn't look like a table header + if colCount == 1 { + return + } + + // include the newline in the data sent to tableRow + j := skipCharN(data, i, '\n', 1) + header := data[:j] + + // column count ignores pipes at beginning or end of line + if data[0] == '|' { + colCount-- + } + if i > 2 && data[i-1] == '|' && !isBackslashEscaped(data, i-1) { + colCount-- + } + + columns = make([]ast.CellAlignFlags, colCount) + + // move on to the header underline + i++ + if i >= len(data) { + return + } + + if data[i] == '|' && !isBackslashEscaped(data, i) { + i++ + } + i = skipChar(data, i, ' ') + + // each column header is of form: / *:?-+:? *|/ with # dashes + # colons >= 3 + // and trailing | optional on last column + col := 0 + n := len(data) + for i < n && data[i] != '\n' { + dashes := 0 + + if data[i] == ':' { + i++ + columns[col] |= ast.TableAlignmentLeft + dashes++ + } + for i < n && data[i] == '-' { + i++ + dashes++ + } + if i < n && data[i] == ':' { + i++ + columns[col] |= ast.TableAlignmentRight + dashes++ + } + for i < n && data[i] == ' ' { + i++ + } + if i == n { + return + } + // end of column test is messy + switch { + case dashes < 3: + // not a valid column + return + + case data[i] == '|' && !isBackslashEscaped(data, i): + // marker found, now skip past trailing whitespace + col++ + i++ + for i < n && data[i] == ' ' { + i++ + } + + // trailing junk found after last column + if col >= colCount && i < len(data) && data[i] != '\n' { + return + } + + case (data[i] != '|' || isBackslashEscaped(data, i)) && col+1 < colCount: + // something else found where marker was required + return + + case data[i] == '\n': + // marker is optional for the last column + col++ + + default: + // trailing junk found after last column + return + } + } + if col != colCount { + return + } + + table = &ast.Table{} + p.addBlock(table) + p.addBlock(&ast.TableHeader{}) + p.tableRow(header, columns, true) + size = skipCharN(data, i, '\n', 1) + return +} + +func (p *Parser) tableRow(data []byte, columns []ast.CellAlignFlags, header bool) { + p.addBlock(&ast.TableRow{}) + i, col := 0, 0 + + if data[i] == '|' && !isBackslashEscaped(data, i) { + i++ + } + + n := len(data) + for col = 0; col < len(columns) && i < n; col++ { + for i < n && data[i] == ' ' { + i++ + } + + cellStart := i + + for i < n && (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' { + i++ + } + + cellEnd := i + + // skip the end-of-cell marker, possibly taking us past end of buffer + i++ + + for cellEnd > cellStart && cellEnd-1 < n && data[cellEnd-1] == ' ' { + cellEnd-- + } + + block := &ast.TableCell{ + IsHeader: header, + Align: columns[col], + } + block.Content = data[cellStart:cellEnd] + p.addBlock(block) + } + + // pad it out with empty columns to get the right number + for ; col < len(columns); col++ { + block := &ast.TableCell{ + IsHeader: header, + Align: columns[col], + } + p.addBlock(block) + } + + // silently ignore rows with too many cells +} + +// tableFooter parses the (optional) table footer. +func (p *Parser) tableFooter(data []byte) bool { + colCount := 1 + for i := 0; i < len(data) && data[i] != '\n'; i++ { + if data[i] == '|' && !isBackslashEscaped(data, i) { + colCount++ + continue + } + // remaining data must be the = character + if data[i] != '=' { + return false + } + } + + // doesn't look like a table footer + if colCount == 1 { + return false + } + + p.addBlock(&ast.TableFooter{}) + + return true +} + +// returns blockquote prefix length +func (p *Parser) quotePrefix(data []byte) int { + i := 0 + n := len(data) + for i < 3 && i < n && data[i] == ' ' { + i++ + } + if i < n && data[i] == '>' { + if i+1 < n && data[i+1] == ' ' { + return i + 2 + } + return i + 1 + } + return 0 +} + +// blockquote ends with at least one blank line +// followed by something without a blockquote prefix +func (p *Parser) terminateBlockquote(data []byte, beg, end int) bool { + if p.isEmpty(data[beg:]) <= 0 { + return false + } + if end >= len(data) { + return true + } + return p.quotePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0 +} + +// parse a blockquote fragment +func (p *Parser) quote(data []byte) int { + var raw bytes.Buffer + beg, end := 0, 0 + for beg < len(data) { + end = beg + // Step over whole lines, collecting them. While doing that, check for + // fenced code and if one's found, incorporate it altogether, + // irregardless of any contents inside it + for end < len(data) && data[end] != '\n' { + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data[end:], false); i > 0 { + // -1 to compensate for the extra end++ after the loop: + end += i - 1 + break + } + } + end++ + } + end = skipCharN(data, end, '\n', 1) + if pre := p.quotePrefix(data[beg:]); pre > 0 { + // skip the prefix + beg += pre + } else if p.terminateBlockquote(data, beg, end) { + break + } + // this line is part of the blockquote + raw.Write(data[beg:end]) + beg = end + } + + if p.extensions&Mmark == 0 { + block := p.addBlock(&ast.BlockQuote{}) + p.block(raw.Bytes()) + p.finalize(block) + return end + } + + if captionContent, id, consumed := p.caption(data[end:], []byte("Quote: ")); consumed > 0 { + figure := &ast.CaptionFigure{} + caption := &ast.Caption{} + figure.HeadingID = id + p.Inline(caption, captionContent) + + p.addBlock(figure) // this discard any attributes + block := &ast.BlockQuote{} + block.AsContainer().Attribute = figure.AsContainer().Attribute + p.addChild(block) + p.block(raw.Bytes()) + p.finalize(block) + + p.addChild(caption) + p.finalize(figure) + + end += consumed + + return end + } + + block := p.addBlock(&ast.BlockQuote{}) + p.block(raw.Bytes()) + p.finalize(block) + + return end +} + +// returns prefix length for block code +func (p *Parser) codePrefix(data []byte) int { + n := len(data) + if n >= 1 && data[0] == '\t' { + return 1 + } + if n >= 4 && data[3] == ' ' && data[2] == ' ' && data[1] == ' ' && data[0] == ' ' { + return 4 + } + return 0 +} + +func (p *Parser) code(data []byte) int { + var work bytes.Buffer + + i := 0 + for i < len(data) { + beg := i + + i = skipUntilChar(data, i, '\n') + i = skipCharN(data, i, '\n', 1) + + blankline := p.isEmpty(data[beg:i]) > 0 + if pre := p.codePrefix(data[beg:i]); pre > 0 { + beg += pre + } else if !blankline { + // non-empty, non-prefixed line breaks the pre + i = beg + break + } + + // verbatim copy to the working buffer + if blankline { + work.WriteByte('\n') + } else { + work.Write(data[beg:i]) + } + } + + // trim all the \n off the end of work + workbytes := work.Bytes() + + eol := backChar(workbytes, len(workbytes), '\n') + + if eol != len(workbytes) { + work.Truncate(eol) + } + + work.WriteByte('\n') + + codeBlock := &ast.CodeBlock{ + IsFenced: false, + } + // TODO: get rid of temp buffer + codeBlock.Content = work.Bytes() + p.addBlock(codeBlock) + finalizeCodeBlock(codeBlock) + + return i +} + +// returns unordered list item prefix +func (p *Parser) uliPrefix(data []byte) int { + // start with up to 3 spaces + i := skipCharN(data, 0, ' ', 3) + + if i >= len(data)-1 { + return 0 + } + // need one of {'*', '+', '-'} followed by a space or a tab + if (data[i] != '*' && data[i] != '+' && data[i] != '-') || + (data[i+1] != ' ' && data[i+1] != '\t') { + return 0 + } + return i + 2 +} + +// returns ordered list item prefix +func (p *Parser) oliPrefix(data []byte) int { + // start with up to 3 spaces + i := skipCharN(data, 0, ' ', 3) + + // count the digits + start := i + for i < len(data) && data[i] >= '0' && data[i] <= '9' { + i++ + } + if start == i || i >= len(data)-1 { + return 0 + } + + // we need >= 1 digits followed by a dot and a space or a tab + if data[i] != '.' || !(data[i+1] == ' ' || data[i+1] == '\t') { + return 0 + } + return i + 2 +} + +// returns definition list item prefix +func (p *Parser) dliPrefix(data []byte) int { + if len(data) < 2 { + return 0 + } + // need a ':' followed by a space or a tab + if data[0] != ':' || !(data[1] == ' ' || data[1] == '\t') { + return 0 + } + i := skipChar(data, 0, ' ') + return i + 2 +} + +// parse ordered or unordered list block +func (p *Parser) list(data []byte, flags ast.ListType, start int) int { + i := 0 + flags |= ast.ListItemBeginningOfList + list := &ast.List{ + ListFlags: flags, + Tight: true, + Start: start, + } + block := p.addBlock(list) + + for i < len(data) { + skip := p.listItem(data[i:], &flags) + if flags&ast.ListItemContainsBlock != 0 { + list.Tight = false + } + i += skip + if skip == 0 || flags&ast.ListItemEndOfList != 0 { + break + } + flags &= ^ast.ListItemBeginningOfList + } + + above := block.GetParent() + finalizeList(list) + p.tip = above + return i +} + +// Returns true if the list item is not the same type as its parent list +func (p *Parser) listTypeChanged(data []byte, flags *ast.ListType) bool { + if p.dliPrefix(data) > 0 && *flags&ast.ListTypeDefinition == 0 { + return true + } else if p.oliPrefix(data) > 0 && *flags&ast.ListTypeOrdered == 0 { + return true + } else if p.uliPrefix(data) > 0 && (*flags&ast.ListTypeOrdered != 0 || *flags&ast.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 ast.Node) bool { + // TODO: figure this out. Always false now. + for block != nil { + //if block.lastLineBlank { + //return true + //} + switch block.(type) { + case *ast.List, *ast.ListItem: + block = ast.GetLastChild(block) + default: + return false + } + } + return false +} + +func finalizeList(list *ast.List) { + items := list.Parent.GetChildren() + lastItemIdx := len(items) - 1 + for i, item := range items { + isLastItem := i == lastItemIdx + // check for non-final list item ending with blank line: + if !isLastItem && endsWithBlankLine(item) { + list.Tight = false + break + } + // recurse into children of list item, to see if there are spaces + // between any of them: + subItems := item.GetParent().GetChildren() + lastSubItemIdx := len(subItems) - 1 + for j, subItem := range subItems { + isLastSubItem := j == lastSubItemIdx + if (!isLastItem || !isLastSubItem) && endsWithBlankLine(subItem) { + list.Tight = false + break + } + } + } +} + +// Parse a single list item. +// Assumes initial prefix is already removed if this is a sublist. +func (p *Parser) listItem(data []byte, flags *ast.ListType) int { + // keep track of the indentation of the first line + itemIndent := 0 + if data[0] == '\t' { + itemIndent += 4 + } else { + for itemIndent < 3 && data[itemIndent] == ' ' { + itemIndent++ + } + } + + var bulletChar byte = '*' + i := p.uliPrefix(data) + if i == 0 { + i = p.oliPrefix(data) + } else { + bulletChar = data[i-2] + } + if i == 0 { + i = p.dliPrefix(data) + // reset definition term flag + if i > 0 { + *flags &= ^ast.ListTypeTerm + } + } + if i == 0 { + // if in definition list, set term flag and continue + if *flags&ast.ListTypeDefinition != 0 { + *flags |= ast.ListTypeTerm + } else { + return 0 + } + } + + // skip leading whitespace on first line + i = skipChar(data, i, ' ') + + // find the end of the line + line := i + for i > 0 && i < len(data) && data[i-1] != '\n' { + i++ + } + + // get working buffer + var raw bytes.Buffer + + // put the first line into the working buffer + raw.Write(data[line:i]) + line = i + + // process the following lines + containsBlankLine := false + sublist := 0 + +gatherlines: + for line < len(data) { + i++ + + // find the end of this line + for i < len(data) && data[i-1] != '\n' { + i++ + } + + // if it is an empty line, guess that it is part of this item + // and move on to the next line + if p.isEmpty(data[line:i]) > 0 { + containsBlankLine = true + line = i + continue + } + + // calculate the indentation + indent := 0 + indentIndex := 0 + if data[line] == '\t' { + indentIndex++ + indent += 4 + } else { + for indent < 4 && line+indent < i && data[line+indent] == ' ' { + indent++ + indentIndex++ + } + } + + chunk := data[line+indentIndex : i] + + // evaluate how this line fits in + switch { + // is this a nested list item? + case (p.uliPrefix(chunk) > 0 && !p.isHRule(chunk)) || p.oliPrefix(chunk) > 0 || p.dliPrefix(chunk) > 0: + + // to be a nested list, it must be indented more + // 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 |= ast.ListItemEndOfList + } else if containsBlankLine { + *flags |= ast.ListItemContainsBlock + } + + break gatherlines + } + + if containsBlankLine { + *flags |= ast.ListItemContainsBlock + } + + // is this the first item in the nested list? + if sublist == 0 { + sublist = raw.Len() + // in the case of dliPrefix we are too late and need to search back for the definition item, which + // should be on the previous line, we then adjust sublist to start there. + if p.dliPrefix(chunk) > 0 { + sublist = backUntilChar(raw.Bytes(), raw.Len()-1, '\n') + } + } + + // is this a nested prefix heading? + case p.isPrefixHeading(chunk), p.isPrefixSpecialHeading(chunk): + // if the heading is not indented, it is not nested in the list + // and thus ends the list + if containsBlankLine && indent < 4 { + *flags |= ast.ListItemEndOfList + break gatherlines + } + *flags |= ast.ListItemContainsBlock + + // anything following an empty line is only part + // of this item if it is indented 4 spaces + // (regardless of the indentation of the beginning of the item) + case containsBlankLine && indent < 4: + if *flags&ast.ListTypeDefinition != 0 && i < len(data)-1 { + // is the next item still a part of this list? + next := i + for next < len(data) && data[next] != '\n' { + next++ + } + for next < len(data)-1 && data[next] == '\n' { + next++ + } + if i < len(data)-1 && data[i] != ':' && next < len(data)-1 && data[next] != ':' { + *flags |= ast.ListItemEndOfList + } + } else { + *flags |= ast.ListItemEndOfList + } + break gatherlines + + // a blank line means this should be parsed as a block + case containsBlankLine: + raw.WriteByte('\n') + *flags |= ast.ListItemContainsBlock + } + + // if this line was preceded 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+indentIndex : i]) + + line = i + } + + rawBytes := raw.Bytes() + + listItem := &ast.ListItem{ + ListFlags: *flags, + Tight: false, + BulletChar: bulletChar, + Delimiter: '.', // Only '.' is possible in Markdown, but ')' will also be possible in CommonMark + } + p.addBlock(listItem) + + // render the contents of the list item + if *flags&ast.ListItemContainsBlock != 0 && *flags&ast.ListTypeTerm == 0 { + // intermediate render of block item, except for definition term + if sublist > 0 { + p.block(rawBytes[:sublist]) + p.block(rawBytes[sublist:]) + } else { + p.block(rawBytes) + } + } else { + // intermediate render of inline item + para := &ast.Paragraph{} + if sublist > 0 { + para.Content = rawBytes[:sublist] + } else { + para.Content = rawBytes + } + p.addChild(para) + if sublist > 0 { + p.block(rawBytes[sublist:]) + } + } + return line +} + +// render a single paragraph that has already been parsed out +func (p *Parser) renderParagraph(data []byte) { + if len(data) == 0 { + return + } + + // trim leading spaces + beg := skipChar(data, 0, ' ') + + end := len(data) + // trim trailing newline + if data[len(data)-1] == '\n' { + end-- + } + + // trim trailing spaces + for end > beg && data[end-1] == ' ' { + end-- + } + para := &ast.Paragraph{} + para.Content = data[beg:end] + p.addBlock(para) +} + +// blockMath handle block surround with $$ +func (p *Parser) blockMath(data []byte) int { + if len(data) <= 4 || data[0] != '$' || data[1] != '$' || data[2] == '$' { + return 0 + } + + // find next $$ + var end int + for end = 2; end+1 < len(data) && (data[end] != '$' || data[end+1] != '$'); end++ { + } + + // $$ not match + if end+1 == len(data) { + return 0 + } + + // render the display math + mathBlock := &ast.MathBlock{} + mathBlock.Literal = data[2:end] + p.addBlock(mathBlock) + + return end + 2 +} + +func (p *Parser) paragraph(data []byte) int { + // prev: index of 1st char of previous line + // line: index of 1st char of current line + // i: index of cursor/end of current line + var prev, line, i int + tabSize := tabSizeDefault + if p.extensions&TabSizeEight != 0 { + tabSize = tabSizeDouble + } + // keep going until we find something to mark the end of the paragraph + for i < len(data) { + // mark the beginning of the current line + prev = line + current := data[i:] + line = i + + // did we find a reference or a footnote? If so, end a paragraph + // preceding it and report that we have consumed up to the end of that + // reference: + if refEnd := isReference(p, current, tabSize); refEnd > 0 { + p.renderParagraph(data[:i]) + return i + refEnd + } + + // did we find a blank line marking the end of the paragraph? + if n := p.isEmpty(current); n > 0 { + // did this blank line followed by a definition list item? + if p.extensions&DefinitionLists != 0 { + if i < len(data)-1 && data[i+1] == ':' { + listLen := p.list(data[prev:], ast.ListTypeDefinition, 0) + return prev + listLen + } + } + + p.renderParagraph(data[:i]) + return i + n + } + + // an underline under some text marks a heading, so our paragraph ended on prev line + if i > 0 { + if level := p.isUnderlinedHeading(current); level > 0 { + // render the paragraph + p.renderParagraph(data[:prev]) + + // ignore leading and trailing whitespace + eol := i - 1 + for prev < eol && data[prev] == ' ' { + prev++ + } + for eol > prev && data[eol-1] == ' ' { + eol-- + } + + id := "" + if p.extensions&AutoHeadingIDs != 0 { + id = sanitizeAnchorName(string(data[prev:eol])) + } + + block := &ast.Heading{ + Level: level, + HeadingID: id, + } + block.Content = data[prev:eol] + p.addBlock(block) + + // find the end of the underline + return skipUntilChar(data, i, '\n') + } + } + + // if the next line starts a block of HTML, then the paragraph ends here + if p.extensions&LaxHTMLBlocks != 0 { + if data[i] == '<' && p.html(current, false) > 0 { + // rewind to before the HTML block + p.renderParagraph(data[:i]) + return i + } + } + + // if there's a prefixed heading or a horizontal rule after this, paragraph is over + if p.isPrefixHeading(current) || p.isPrefixSpecialHeading(current) || p.isHRule(current) { + p.renderParagraph(data[:i]) + return i + } + + // if there's a fenced code block, paragraph is over + if p.extensions&FencedCode != 0 { + if p.fencedCodeBlock(current, false) > 0 { + p.renderParagraph(data[:i]) + return i + } + } + + // if there's a figure block, paragraph is over + if p.extensions&Mmark != 0 { + if p.figureBlock(current, false) > 0 { + p.renderParagraph(data[:i]) + return i + } + } + + // if there's a definition list item, prev line is a definition term + if p.extensions&DefinitionLists != 0 { + if p.dliPrefix(current) != 0 { + ret := p.list(data[prev:], ast.ListTypeDefinition, 0) + return ret + prev + } + } + + // if there's a list after this, paragraph is over + if p.extensions&NoEmptyLineBeforeBlock != 0 { + if p.uliPrefix(current) != 0 || + p.oliPrefix(current) != 0 || + p.quotePrefix(current) != 0 || + p.codePrefix(current) != 0 { + p.renderParagraph(data[:i]) + return i + } + } + + // otherwise, scan to the beginning of the next line + nl := bytes.IndexByte(data[i:], '\n') + if nl >= 0 { + i += nl + 1 + } else { + i += len(data[i:]) + } + } + + p.renderParagraph(data[:i]) + return i +} + +// skipChar advances i as long as data[i] == c +func skipChar(data []byte, i int, c byte) int { + n := len(data) + for i < n && data[i] == c { + i++ + } + return i +} + +// like skipChar but only skips up to max characters +func skipCharN(data []byte, i int, c byte, max int) int { + n := len(data) + for i < n && max > 0 && data[i] == c { + i++ + max-- + } + return i +} + +// skipUntilChar advances i as long as data[i] != c +func skipUntilChar(data []byte, i int, c byte) int { + n := len(data) + for i < n && data[i] != c { + i++ + } + return i +} + +func skipAlnum(data []byte, i int) int { + n := len(data) + for i < n && isAlnum(data[i]) { + i++ + } + return i +} + +func skipSpace(data []byte, i int) int { + n := len(data) + for i < n && isSpace(data[i]) { + i++ + } + return i +} + +func backChar(data []byte, i int, c byte) int { + for i > 0 && data[i-1] == c { + i-- + } + return i +} + +func backUntilChar(data []byte, i int, c byte) int { + for i > 0 && data[i-1] != c { + i-- + } + return i +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/callout.go b/vendor/github.com/gomarkdown/markdown/parser/callout.go new file mode 100644 index 00000000..15858aa9 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/callout.go @@ -0,0 +1,29 @@ +package parser + +import ( + "bytes" + "strconv" +) + +// IsCallout detects a callout in the following format: <> Where N is a integer > 0. +func IsCallout(data []byte) (id []byte, consumed int) { + if !bytes.HasPrefix(data, []byte("<<")) { + return nil, 0 + } + start := 2 + end := bytes.Index(data[start:], []byte(">>")) + if end < 0 { + return nil, 0 + } + + b := data[start : start+end] + b = bytes.TrimSpace(b) + i, err := strconv.Atoi(string(b)) + if err != nil { + return nil, 0 + } + if i <= 0 { + return nil, 0 + } + return b, start + end + 2 // 2 for >> +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/caption.go b/vendor/github.com/gomarkdown/markdown/parser/caption.go new file mode 100644 index 00000000..54d3f741 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/caption.go @@ -0,0 +1,70 @@ +package parser + +import ( + "bytes" +) + +// caption checks for a caption, it returns the caption data and a potential "headingID". +func (p *Parser) caption(data, caption []byte) ([]byte, string, int) { + if !bytes.HasPrefix(data, caption) { + return nil, "", 0 + } + j := len(caption) + data = data[j:] + end := p.linesUntilEmpty(data) + + data = data[:end] + + id, start := captionID(data) + if id != "" { + return data[:start], id, end + j + } + + return data, "", end + j +} + +// linesUntilEmpty scans lines up to the first empty line. +func (p *Parser) linesUntilEmpty(data []byte) int { + line, i := 0, 0 + + for line < len(data) { + i++ + + // find the end of this line + for i < len(data) && data[i-1] != '\n' { + i++ + } + + if p.isEmpty(data[line:i]) == 0 { + line = i + continue + } + + break + } + return i +} + +// captionID checks if the caption *ends* in {#....}. If so the text after {# is taken to be +// the ID/anchor of the entire figure block. +func captionID(data []byte) (string, int) { + end := len(data) + + j, k := 0, 0 + // find start/end of heading id + for j = 0; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { + } + for k = j + 1; k < end && data[k] != '}'; k++ { + } + // remains must be whitespace. + for l := k + 1; l < end; l++ { + if !isSpace(data[l]) { + return "", 0 + } + } + + if j > 0 && k > 0 && j+2 < k { + return string(data[j+2 : k]), j + } + return "", 0 +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/citation.go b/vendor/github.com/gomarkdown/markdown/parser/citation.go new file mode 100644 index 00000000..8ea1fbee --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/citation.go @@ -0,0 +1,86 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// citation parses a citation. In its most simple form [@ref], we allow multiple +// being separated by semicolons and a sub reference inside ala pandoc: [@ref, p. 23]. +// Each citation can have a modifier: !, ? or - wich mean: +// +// ! - normative +// ? - formative +// - - suppressed +// +// The suffix starts after a comma, we strip any whitespace before and after. If the output +// allows for it, this can be rendered. +func citation(p *Parser, data []byte, offset int) (int, ast.Node) { + // look for the matching closing bracket + i := offset + 1 + for level := 1; level > 0 && i < len(data); i++ { + switch { + case data[i] == '\n': + // no newlines allowed. + return 0, nil + + case data[i-1] == '\\': + continue + + case data[i] == '[': + level++ + + case data[i] == ']': + level-- + if level <= 0 { + i-- // compensate for extra i++ in for loop + } + } + } + + if i >= len(data) { + return 0, nil + } + + node := &ast.Citation{} + + citations := bytes.Split(data[1:i], []byte(";")) + for _, citation := range citations { + var suffix []byte + citation = bytes.TrimSpace(citation) + j := 0 + if citation[j] != '@' { + // not a citation, drop out entirely. + return 0, nil + } + if c := bytes.Index(citation, []byte(",")); c > 0 { + part := citation[:c] + suff := citation[c+1:] + part = bytes.TrimSpace(part) + suff = bytes.TrimSpace(suff) + + citation = part + suffix = suff + } + + citeType := ast.CitationTypeInformative + j = 1 + switch citation[j] { + case '!': + citeType = ast.CitationTypeNormative + j++ + case '?': + citeType = ast.CitationTypeInformative + j++ + case '-': + citeType = ast.CitationTypeSuppressed + j++ + } + node.Destination = append(node.Destination, citation[j:]) + node.Type = append(node.Type, citeType) + node.Suffix = append(node.Suffix, suffix) + } + + return i + 1, node +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/esc.go b/vendor/github.com/gomarkdown/markdown/parser/esc.go new file mode 100644 index 00000000..0a79aa35 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/esc.go @@ -0,0 +1,20 @@ +package parser + +// isEscape returns true if byte i is prefixed by an odd number of backslahses. +func isEscape(data []byte, i int) bool { + if i == 0 { + return false + } + if i == 1 { + return data[0] == '\\' + } + j := i - 1 + for ; j >= 0; j-- { + if data[j] != '\\' { + break + } + } + j++ + // odd number of backslahes means escape + return (i-j)%2 != 0 +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/figures.go b/vendor/github.com/gomarkdown/markdown/parser/figures.go new file mode 100644 index 00000000..6615449c --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/figures.go @@ -0,0 +1,119 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +// sFigureLine checks if there's a figure line (e.g., !--- ) at the beginning of data, +// and returns the end index if so, or 0 otherwise. +func sFigureLine(data []byte, oldmarker string) (end int, marker string) { + i, size := 0, 0 + + n := len(data) + // skip up to three spaces + for i < n && i < 3 && data[i] == ' ' { + i++ + } + + // check for the marker characters: ! + if i+1 >= n { + return 0, "" + } + if data[i] != '!' || data[i+1] != '-' { + return 0, "" + } + i++ + + c := data[i] // i.e. the - + + // the whole line must be the same char or whitespace + for i < n && data[i] == c { + size++ + i++ + } + + // the marker char must occur at least 3 times + if size < 3 { + return 0, "" + } + marker = string(data[i-size : i]) + + // if this is the end marker, it must match the beginning marker + if oldmarker != "" && marker != oldmarker { + return 0, "" + } + + // there is no syntax modifier although it might be an idea to re-use this space for something? + + i = skipChar(data, i, ' ') + if i >= n || data[i] != '\n' { + if i == n { + return i, marker + } + return 0, "" + } + return i + 1, marker // Take newline into account. +} + +// figureBlock returns the end index if data contains a figure block at the beginning, +// 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 figure block. +func (p *Parser) figureBlock(data []byte, doRender bool) int { + beg, marker := sFigureLine(data, "") + if beg == 0 || beg >= len(data) { + return 0 + } + + var raw bytes.Buffer + + for { + // safe to assume beg < len(data) + + // check for the end of the code block + figEnd, _ := sFigureLine(data[beg:], marker) + if figEnd != 0 { + beg += figEnd + break + } + + // copy the current line + end := skipUntilChar(data, beg, '\n') + 1 + + // did we reach the end of the buffer without a closing marker? + if end >= len(data) { + return 0 + } + + // verbatim copy to the working buffer + if doRender { + raw.Write(data[beg:end]) + } + beg = end + } + + if !doRender { + return beg + } + + figure := &ast.CaptionFigure{} + p.addBlock(figure) + p.block(raw.Bytes()) + + defer p.finalize(figure) + + if captionContent, id, consumed := p.caption(data[beg:], []byte("Figure: ")); consumed > 0 { + caption := &ast.Caption{} + p.Inline(caption, captionContent) + + figure.HeadingID = id + + p.addChild(caption) + + beg += consumed + } + + p.finalize(figure) + return beg +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/include.go b/vendor/github.com/gomarkdown/markdown/parser/include.go new file mode 100644 index 00000000..2448a685 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/include.go @@ -0,0 +1,129 @@ +package parser + +import ( + "bytes" + "path" + "path/filepath" +) + +// isInclude parses {{...}}[...], that contains a path between the {{, the [...] syntax contains +// an address to select which lines to include. It is treated as an opaque string and just given +// to readInclude. +func (p *Parser) isInclude(data []byte) (filename string, address []byte, consumed int) { + i := skipCharN(data, 0, ' ', 3) // start with up to 3 spaces + if len(data[i:]) < 3 { + return "", nil, 0 + } + if data[i] != '{' || data[i+1] != '{' { + return "", nil, 0 + } + start := i + 2 + + // find the end delimiter + i = skipUntilChar(data, i, '}') + if i+1 >= len(data) { + return "", nil, 0 + } + end := i + i++ + if data[i] != '}' { + return "", nil, 0 + } + filename = string(data[start:end]) + + if i+1 < len(data) && data[i+1] == '[' { // potential address specification + start := i + 2 + + end = skipUntilChar(data, start, ']') + if end >= len(data) { + return "", nil, 0 + } + address = data[start:end] + return filename, address, end + 1 + } + + return filename, address, i + 1 +} + +func (p *Parser) readInclude(from, file string, address []byte) []byte { + if p.Opts.ReadIncludeFn != nil { + return p.Opts.ReadIncludeFn(from, file, address) + } + + return nil +} + +// isCodeInclude parses <{{...}} which is similar to isInclude the returned bytes are, however wrapped in a code block. +func (p *Parser) isCodeInclude(data []byte) (filename string, address []byte, consumed int) { + i := skipCharN(data, 0, ' ', 3) // start with up to 3 spaces + if len(data[i:]) < 3 { + return "", nil, 0 + } + if data[i] != '<' { + return "", nil, 0 + } + start := i + + filename, address, consumed = p.isInclude(data[i+1:]) + if consumed == 0 { + return "", nil, 0 + } + return filename, address, start + consumed + 1 +} + +// readCodeInclude acts like include except the returned bytes are wrapped in a fenced code block. +func (p *Parser) readCodeInclude(from, file string, address []byte) []byte { + data := p.readInclude(from, file, address) + if data == nil { + return nil + } + ext := path.Ext(file) + buf := &bytes.Buffer{} + buf.Write([]byte("```")) + if ext != "" { // starts with a dot + buf.WriteString(" " + ext[1:] + "\n") + } else { + buf.WriteByte('\n') + } + buf.Write(data) + buf.WriteString("```\n") + return buf.Bytes() +} + +// incStack hold the current stack of chained includes. Each value is the containing +// path of the file being parsed. +type incStack struct { + stack []string +} + +func newIncStack() *incStack { + return &incStack{stack: []string{}} +} + +// Push updates i with new. +func (i *incStack) Push(new string) { + if path.IsAbs(new) { + i.stack = append(i.stack, path.Dir(new)) + return + } + last := "" + if len(i.stack) > 0 { + last = i.stack[len(i.stack)-1] + } + i.stack = append(i.stack, path.Dir(filepath.Join(last, new))) +} + +// Pop pops the last value. +func (i *incStack) Pop() { + if len(i.stack) == 0 { + return + } + i.stack = i.stack[:len(i.stack)-1] +} + +func (i *incStack) Last() string { + if len(i.stack) == 0 { + return "" + } + return i.stack[len(i.stack)-1] +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/inline.go b/vendor/github.com/gomarkdown/markdown/parser/inline.go new file mode 100644 index 00000000..81766b85 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/inline.go @@ -0,0 +1,1284 @@ +package parser + +import ( + "bytes" + "regexp" + "strconv" + + "github.com/gomarkdown/markdown/ast" +) + +// Parsing of inline elements + +var ( + urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+` + anchorRe = regexp.MustCompile(`^(]+")?\s?>` + urlRe + `<\/a>)`) + + // TODO: improve this regexp to catch all possible entities: + htmlEntityRe = regexp.MustCompile(`&[a-z]{2,5};`) +) + +// Inline parses text within a block. +// Each function returns the number of consumed chars. +func (p *Parser) Inline(currBlock ast.Node, data []byte) { + // handlers might call us recursively: enforce a maximum depth + if p.nesting >= p.maxNesting || len(data) == 0 { + return + } + p.nesting++ + beg, end := 0, 0 + + n := len(data) + for end < n { + handler := p.inlineCallback[data[end]] + if handler == nil { + end++ + continue + } + consumed, node := handler(p, data, end) + if consumed == 0 { + // no action from the callback + end++ + continue + } + // copy inactive chars into the output + ast.AppendChild(currBlock, newTextNode(data[beg:end])) + if node != nil { + ast.AppendChild(currBlock, node) + } + beg = end + consumed + end = beg + } + + if beg < n { + if data[end-1] == '\n' { + end-- + } + ast.AppendChild(currBlock, newTextNode(data[beg:end])) + } + p.nesting-- +} + +// single and double emphasis parsing +func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + c := data[0] + + n := len(data) + if n > 2 && data[1] != c { + // whitespace cannot follow an opening emphasis; + // strikethrough only takes two characters '~~' + if isSpace(data[1]) { + return 0, nil + } + if p.extensions&SuperSubscript != 0 && c == '~' { + // potential subscript, no spaces, except when escaped, helperEmphasis does + // not check that for us, so walk the bytes and check. + ret := skipUntilChar(data[1:], 0, c) + if ret == 0 { + return 0, nil + } + ret++ // we started with data[1:] above. + for i := 1; i < ret; i++ { + if isSpace(data[i]) && !isEscape(data, i) { + return 0, nil + } + } + sub := &ast.Subscript{} + sub.Literal = data[1:ret] + return ret + 1, sub + } + ret, node := helperEmphasis(p, data[1:], c) + if ret == 0 { + return 0, nil + } + + return ret + 1, node + } + + if n > 3 && data[1] == c && data[2] != c { + if isSpace(data[2]) { + return 0, nil + } + ret, node := helperDoubleEmphasis(p, data[2:], c) + if ret == 0 { + return 0, nil + } + + return ret + 2, node + } + + if n > 4 && data[1] == c && data[2] == c && data[3] != c { + if c == '~' || isSpace(data[3]) { + return 0, nil + } + ret, node := helperTripleEmphasis(p, data, 3, c) + if ret == 0 { + return 0, nil + } + + return ret + 3, node + } + + return 0, nil +} + +func codeSpan(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + // count the number of backticks in the delimiter + nb := skipChar(data, 0, '`') + + // find the next delimiter + i, end := 0, 0 + for end = nb; end < len(data) && i < nb; end++ { + if data[end] == '`' { + i++ + } else { + i = 0 + } + } + + // no matching delimiter? + if i < nb && end >= len(data) { + return 0, nil + } + + // trim outside whitespace + fBegin := nb + for fBegin < end && data[fBegin] == ' ' { + fBegin++ + } + + fEnd := end - nb + for fEnd > fBegin && data[fEnd-1] == ' ' { + fEnd-- + } + + // render the code span + if fBegin != fEnd { + code := &ast.Code{} + code.Literal = data[fBegin:fEnd] + return end, code + } + + return end, nil +} + +// newline preceded by two spaces becomes
    +func maybeLineBreak(p *Parser, data []byte, offset int) (int, ast.Node) { + origOffset := offset + offset = skipChar(data, offset, ' ') + + if offset < len(data) && data[offset] == '\n' { + if offset-origOffset >= 2 { + return offset - origOffset + 1, &ast.Hardbreak{} + } + return offset - origOffset, nil + } + return 0, nil +} + +// newline without two spaces works when HardLineBreak is enabled +func lineBreak(p *Parser, data []byte, offset int) (int, ast.Node) { + if p.extensions&HardLineBreak != 0 { + return 1, &ast.Hardbreak{} + } + return 0, nil +} + +type linkType int + +const ( + linkNormal linkType = iota + linkImg + linkDeferredFootnote + linkInlineFootnote + linkCitation +) + +func isReferenceStyleLink(data []byte, pos int, t linkType) bool { + if t == linkDeferredFootnote { + return false + } + return pos < len(data)-1 && data[pos] == '[' && data[pos+1] != '^' +} + +func maybeImage(p *Parser, data []byte, offset int) (int, ast.Node) { + if offset < len(data)-1 && data[offset+1] == '[' { + return link(p, data, offset) + } + return 0, nil +} + +func maybeInlineFootnoteOrSuper(p *Parser, data []byte, offset int) (int, ast.Node) { + if offset < len(data)-1 && data[offset+1] == '[' { + return link(p, data, offset) + } + + if p.extensions&SuperSubscript != 0 { + ret := skipUntilChar(data[offset:], 1, '^') + if ret == 0 { + return 0, nil + } + for i := offset; i < offset+ret; i++ { + if isSpace(data[i]) && !isEscape(data, i) { + return 0, nil + } + } + sup := &ast.Superscript{} + sup.Literal = data[offset+1 : offset+ret] + return offset + ret, sup + } + + return 0, nil +} + +// '[': parse a link or an image or a footnote or a citation +func link(p *Parser, data []byte, offset int) (int, ast.Node) { + // no links allowed inside regular links, footnote, and deferred footnotes + if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') { + return 0, nil + } + + var t linkType + switch { + // special case: ![^text] == deferred footnote (that follows something with + // an exclamation point) + case p.extensions&Footnotes != 0 && len(data)-1 > offset && data[offset+1] == '^': + t = linkDeferredFootnote + // ![alt] == image + case offset >= 0 && data[offset] == '!': + t = linkImg + offset++ + // [@citation], [@-citation], [@?citation], [@!citation] + case p.extensions&Mmark != 0 && len(data)-1 > offset && data[offset+1] == '@': + t = linkCitation + // [text] == regular link + // ^[text] == inline footnote + // [^refId] == deferred footnote + case p.extensions&Footnotes != 0: + if offset >= 0 && data[offset] == '^' { + t = linkInlineFootnote + offset++ + } else if len(data)-1 > offset && data[offset+1] == '^' { + t = linkDeferredFootnote + } + default: + t = linkNormal + } + + data = data[offset:] + + if t == linkCitation { + return citation(p, data, 0) + } + + var ( + i = 1 + noteID int + title, link, linkID, altContent []byte + textHasNl = false + ) + + if t == linkDeferredFootnote { + i++ + } + + // look for the matching closing bracket + for level := 1; level > 0 && i < len(data); i++ { + switch { + case data[i] == '\n': + textHasNl = true + + case data[i-1] == '\\': + continue + + case data[i] == '[': + level++ + + case data[i] == ']': + level-- + if level <= 0 { + i-- // compensate for extra i++ in for loop + } + } + } + + if i >= len(data) { + return 0, nil + } + + txtE := i + i++ + var footnoteNode ast.Node + + // skip any amount of whitespace or newline + // (this is much more lax than original markdown syntax) + i = skipSpace(data, i) + + // inline style link + switch { + case i < len(data) && data[i] == '(': + // skip initial whitespace + i++ + + i = skipSpace(data, i) + + linkB := i + + // look for link end: ' " ) + findlinkend: + for i < len(data) { + switch { + case data[i] == '\\': + i += 2 + + case data[i] == ')' || data[i] == '\'' || data[i] == '"': + break findlinkend + + default: + i++ + } + } + + if i >= len(data) { + return 0, nil + } + linkE := i + + // look for title end if present + titleB, titleE := 0, 0 + if data[i] == '\'' || data[i] == '"' { + i++ + titleB = i + + findtitleend: + for i < len(data) { + switch { + case data[i] == '\\': + i += 2 + + case data[i] == ')': + break findtitleend + + default: + i++ + } + } + + if i >= len(data) { + return 0, nil + } + + // skip whitespace after title + titleE = i - 1 + for titleE > titleB && isSpace(data[titleE]) { + titleE-- + } + + // check for closing quote presence + if data[titleE] != '\'' && data[titleE] != '"' { + titleB, titleE = 0, 0 + linkE = i + } + } + + // remove whitespace at the end of the link + for linkE > linkB && isSpace(data[linkE-1]) { + linkE-- + } + + // remove optional angle brackets around the link + if data[linkB] == '<' { + linkB++ + } + if data[linkE-1] == '>' { + linkE-- + } + + // build escaped link and title + if linkE > linkB { + link = data[linkB:linkE] + } + + if titleE > titleB { + title = data[titleB:titleE] + } + + i++ + + // reference style link + case isReferenceStyleLink(data, i, t): + var id []byte + altContentConsidered := false + + // look for the id + i++ + linkB := i + i = skipUntilChar(data, i, ']') + + if i >= len(data) { + return 0, nil + } + linkE := i + + // find the reference + if linkB == linkE { + if textHasNl { + var b bytes.Buffer + + for j := 1; j < txtE; j++ { + switch { + case data[j] != '\n': + b.WriteByte(data[j]) + case data[j-1] != ' ': + b.WriteByte(' ') + } + } + + id = b.Bytes() + } else { + id = data[1:txtE] + altContentConsidered = true + } + } else { + id = data[linkB:linkE] + } + + // find the reference with matching id + lr, ok := p.getRef(string(id)) + if !ok { + return 0, nil + } + + // keep link and title from reference + linkID = id + link = lr.link + title = lr.title + if altContentConsidered { + altContent = lr.text + } + i++ + + // shortcut reference style link or reference or inline footnote + default: + var id []byte + + // craft the id + if textHasNl { + var b bytes.Buffer + + for j := 1; j < txtE; j++ { + switch { + case data[j] != '\n': + b.WriteByte(data[j]) + case data[j-1] != ' ': + b.WriteByte(' ') + } + } + + id = b.Bytes() + } else { + if t == linkDeferredFootnote { + id = data[2:txtE] // get rid of the ^ + } else { + id = data[1:txtE] + } + } + + footnoteNode = &ast.ListItem{} + if t == linkInlineFootnote { + // create a new reference + noteID = len(p.notes) + 1 + + var fragment []byte + if len(id) > 0 { + if len(id) < 16 { + fragment = make([]byte, len(id)) + } else { + fragment = make([]byte, 16) + } + copy(fragment, slugify(id)) + } else { + fragment = append([]byte("footnote-"), []byte(strconv.Itoa(noteID))...) + } + + ref := &reference{ + noteID: noteID, + hasBlock: false, + link: fragment, + title: id, + footnote: footnoteNode, + } + + p.notes = append(p.notes, ref) + p.refsRecord[string(ref.link)] = struct{}{} + + link = ref.link + title = ref.title + } else { + // find the reference with matching id + lr, ok := p.getRef(string(id)) + if !ok { + return 0, nil + } + + if t == linkDeferredFootnote && !p.isFootnote(lr) { + lr.noteID = len(p.notes) + 1 + lr.footnote = footnoteNode + p.notes = append(p.notes, lr) + p.refsRecord[string(lr.link)] = struct{}{} + } + + // keep link and title from reference + link = lr.link + // if inline footnote, title == footnote contents + title = lr.title + noteID = lr.noteID + } + + // rewind the whitespace + i = txtE + 1 + } + + var uLink []byte + if t == linkNormal || t == linkImg { + if len(link) > 0 { + var uLinkBuf bytes.Buffer + unescapeText(&uLinkBuf, link) + uLink = uLinkBuf.Bytes() + } + + // links need something to click on and somewhere to go + if len(uLink) == 0 || (t == linkNormal && txtE <= 1) { + return 0, nil + } + } + + // call the relevant rendering function + switch t { + case linkNormal: + link := &ast.Link{ + Destination: normalizeURI(uLink), + Title: title, + DeferredID: linkID, + } + if len(altContent) > 0 { + ast.AppendChild(link, newTextNode(altContent)) + } else { + // links cannot contain other links, so turn off link parsing + // temporarily and recurse + insideLink := p.insideLink + p.insideLink = true + p.Inline(link, data[1:txtE]) + p.insideLink = insideLink + } + return i, link + + case linkImg: + image := &ast.Image{ + Destination: uLink, + Title: title, + } + ast.AppendChild(image, newTextNode(data[1:txtE])) + return i + 1, image + + case linkInlineFootnote, linkDeferredFootnote: + link := &ast.Link{ + Destination: link, + Title: title, + NoteID: noteID, + Footnote: footnoteNode, + } + if t == linkDeferredFootnote { + link.DeferredID = data[2:txtE] + } + if t == linkInlineFootnote { + i++ + } + return i, link + + default: + return 0, nil + } +} + +func (p *Parser) inlineHTMLComment(data []byte) int { + if len(data) < 5 { + return 0 + } + if data[0] != '<' || data[1] != '!' || data[2] != '-' || data[3] != '-' { + return 0 + } + i := 5 + // scan for an end-of-comment marker, across lines if necessary + for i < len(data) && !(data[i-2] == '-' && data[i-1] == '-' && data[i] == '>') { + i++ + } + // no end-of-comment marker + if i >= len(data) { + return 0 + } + return i + 1 +} + +func stripMailto(link []byte) []byte { + if bytes.HasPrefix(link, []byte("mailto://")) { + return link[9:] + } else if bytes.HasPrefix(link, []byte("mailto:")) { + return link[7:] + } else { + return link + } +} + +// autolinkType specifies a kind of autolink that gets detected. +type autolinkType int + +// These are the possible flag values for the autolink renderer. +const ( + notAutolink autolinkType = iota + normalAutolink + emailAutolink +) + +// '<' when tags or autolinks are allowed +func leftAngle(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + if p.extensions&Mmark != 0 { + id, consumed := IsCallout(data) + if consumed > 0 { + node := &ast.Callout{} + node.ID = id + return consumed, node + } + } + + altype, end := tagLength(data) + if size := p.inlineHTMLComment(data); size > 0 { + end = size + } + if end <= 2 { + return end, nil + } + if altype == notAutolink { + htmlTag := &ast.HTMLSpan{} + htmlTag.Literal = data[:end] + return end, htmlTag + } + + var uLink bytes.Buffer + unescapeText(&uLink, data[1:end+1-2]) + if uLink.Len() <= 0 { + return end, nil + } + link := uLink.Bytes() + node := &ast.Link{ + Destination: link, + } + if altype == emailAutolink { + node.Destination = append([]byte("mailto:"), link...) + } + ast.AppendChild(node, newTextNode(stripMailto(link))) + return end, node +} + +// '\\' backslash escape +var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~") + +func escape(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + if len(data) <= 1 { + return 2, nil + } + + if p.extensions&NonBlockingSpace != 0 && data[1] == ' ' { + return 2, &ast.NonBlockingSpace{} + } + + if p.extensions&BackslashLineBreak != 0 && data[1] == '\n' { + return 2, &ast.Hardbreak{} + } + + if bytes.IndexByte(escapeChars, data[1]) < 0 { + return 0, nil + } + + return 2, newTextNode(data[1:2]) +} + +func unescapeText(ob *bytes.Buffer, src []byte) { + i := 0 + for i < len(src) { + org := i + for i < len(src) && src[i] != '\\' { + i++ + } + + if i > org { + ob.Write(src[org:i]) + } + + if i+1 >= len(src) { + break + } + + ob.WriteByte(src[i+1]) + i += 2 + } +} + +// '&' escaped when it doesn't belong to an entity +// valid entities are assumed to be anything matching &#?[A-Za-z0-9]+; +func entity(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + end := skipCharN(data, 1, '#', 1) + end = skipAlnum(data, end) + + if end < len(data) && data[end] == ';' { + end++ // real entity + } else { + return 0, nil // lone '&' + } + + ent := data[:end] + // undo & escaping or it will be converted to &amp; by another + // escaper in the renderer + if bytes.Equal(ent, []byte("&")) { + ent = []byte{'&'} + } + + return end, newTextNode(ent) +} + +func linkEndsWithEntity(data []byte, linkEnd int) bool { + entityRanges := htmlEntityRe.FindAllIndex(data[:linkEnd], -1) + return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd +} + +// hasPrefixCaseInsensitive is a custom implementation of +// strings.HasPrefix(strings.ToLower(s), prefix) +// we rolled our own because ToLower pulls in a huge machinery of lowercasing +// anything from Unicode and that's very slow. Since this func will only be +// used on ASCII protocol prefixes, we can take shortcuts. +func hasPrefixCaseInsensitive(s, prefix []byte) bool { + if len(s) < len(prefix) { + return false + } + delta := byte('a' - 'A') + for i, b := range prefix { + if b != s[i] && b != s[i]+delta { + return false + } + } + return true +} + +var protocolPrefixes = [][]byte{ + []byte("http://"), + []byte("https://"), + []byte("ftp://"), + []byte("file://"), + []byte("mailto:"), +} + +const shortestPrefix = 6 // len("ftp://"), the shortest of the above + +func maybeAutoLink(p *Parser, data []byte, offset int) (int, ast.Node) { + // quick check to rule out most false hits + if p.insideLink || len(data) < offset+shortestPrefix { + return 0, nil + } + for _, prefix := range protocolPrefixes { + endOfHead := offset + 8 // 8 is the len() of the longest prefix + if endOfHead > len(data) { + endOfHead = len(data) + } + if hasPrefixCaseInsensitive(data[offset:endOfHead], prefix) { + return autoLink(p, data, offset) + } + } + return 0, nil +} + +func autoLink(p *Parser, data []byte, offset int) (int, ast.Node) { + // Now a more expensive check to see if we're not inside an anchor element + anchorStart := offset + offsetFromAnchor := 0 + for anchorStart > 0 && data[anchorStart] != '<' { + anchorStart-- + offsetFromAnchor++ + } + + anchorStr := anchorRe.Find(data[anchorStart:]) + if anchorStr != nil { + anchorClose := &ast.HTMLSpan{} + anchorClose.Literal = anchorStr[offsetFromAnchor:] + return len(anchorStr) - offsetFromAnchor, anchorClose + } + + // scan backward for a word boundary + rewind := 0 + for offset-rewind > 0 && rewind <= 7 && isLetter(data[offset-rewind-1]) { + rewind++ + } + if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters + return 0, nil + } + + origData := data + data = data[offset-rewind:] + + if !isSafeLink(data) { + return 0, nil + } + + linkEnd := 0 + for linkEnd < len(data) && !isEndOfLink(data[linkEnd]) { + linkEnd++ + } + + // Skip punctuation at the end of the link + if (data[linkEnd-1] == '.' || data[linkEnd-1] == ',') && data[linkEnd-2] != '\\' { + linkEnd-- + } + + // But don't skip semicolon if it's a part of escaped entity: + if data[linkEnd-1] == ';' && data[linkEnd-2] != '\\' && !linkEndsWithEntity(data, linkEnd) { + linkEnd-- + } + + // See if the link finishes with a punctuation sign that can be closed. + var copen byte + switch data[linkEnd-1] { + case '"': + copen = '"' + case '\'': + copen = '\'' + case ')': + copen = '(' + case ']': + copen = '[' + case '}': + copen = '{' + default: + copen = 0 + } + + if copen != 0 { + bufEnd := offset - rewind + linkEnd - 2 + + openDelim := 1 + + /* Try to close the final punctuation sign in this same line; + * if we managed to close it outside of the URL, that means that it's + * not part of the URL. If it closes inside the URL, that means it + * is part of the URL. + * + * Examples: + * + * foo http://www.pokemon.com/Pikachu_(Electric) bar + * => http://www.pokemon.com/Pikachu_(Electric) + * + * foo (http://www.pokemon.com/Pikachu_(Electric)) bar + * => http://www.pokemon.com/Pikachu_(Electric) + * + * foo http://www.pokemon.com/Pikachu_(Electric)) bar + * => http://www.pokemon.com/Pikachu_(Electric)) + * + * (foo http://www.pokemon.com/Pikachu_(Electric)) bar + * => foo http://www.pokemon.com/Pikachu_(Electric) + */ + + for bufEnd >= 0 && origData[bufEnd] != '\n' && openDelim != 0 { + if origData[bufEnd] == data[linkEnd-1] { + openDelim++ + } + + if origData[bufEnd] == copen { + openDelim-- + } + + bufEnd-- + } + + if openDelim == 0 { + linkEnd-- + } + } + + var uLink bytes.Buffer + unescapeText(&uLink, data[:linkEnd]) + + if uLink.Len() > 0 { + node := &ast.Link{ + Destination: uLink.Bytes(), + } + ast.AppendChild(node, newTextNode(uLink.Bytes())) + return linkEnd, node + } + + return linkEnd, nil +} + +func isEndOfLink(char byte) bool { + return isSpace(char) || char == '<' +} + +var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")} +var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")} + +func isSafeLink(link []byte) bool { + nLink := len(link) + for _, path := range validPaths { + nPath := len(path) + linkPrefix := link[:nPath] + if nLink >= nPath && bytes.Equal(linkPrefix, path) { + if nLink == nPath { + return true + } else if isAlnum(link[nPath]) { + return true + } + } + } + + for _, prefix := range validUris { + // TODO: handle unicode here + // case-insensitive prefix test + nPrefix := len(prefix) + if nLink > nPrefix { + linkPrefix := bytes.ToLower(link[:nPrefix]) + if bytes.Equal(linkPrefix, prefix) && isAlnum(link[nPrefix]) { + return true + } + } + } + + return false +} + +// return the length of the given tag, or 0 is it's not valid +func tagLength(data []byte) (autolink autolinkType, end int) { + var i, j int + + // a valid tag can't be shorter than 3 chars + if len(data) < 3 { + return notAutolink, 0 + } + + // begins with a '<' optionally followed by '/', followed by letter or number + if data[0] != '<' { + return notAutolink, 0 + } + if data[1] == '/' { + i = 2 + } else { + i = 1 + } + + if !isAlnum(data[i]) { + return notAutolink, 0 + } + + // scheme test + autolink = notAutolink + + // try to find the beginning of an URI + for i < len(data) && (isAlnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') { + i++ + } + + if i > 1 && i < len(data) && data[i] == '@' { + if j = isMailtoAutoLink(data[i:]); j != 0 { + return emailAutolink, i + j + } + } + + if i > 2 && i < len(data) && data[i] == ':' { + autolink = normalAutolink + i++ + } + + // complete autolink test: no whitespace or ' or " + switch { + case i >= len(data): + autolink = notAutolink + case autolink != notAutolink: + j = i + + for i < len(data) { + if data[i] == '\\' { + i += 2 + } else if data[i] == '>' || data[i] == '\'' || data[i] == '"' || isSpace(data[i]) { + break + } else { + i++ + } + + } + + if i >= len(data) { + return autolink, 0 + } + if i > j && data[i] == '>' { + return autolink, i + 1 + } + + // one of the forbidden chars has been found + autolink = notAutolink + } + i += bytes.IndexByte(data[i:], '>') + if i < 0 { + return autolink, 0 + } + return autolink, i + 1 +} + +// look for the address part of a mail autolink and '>' +// this is less strict than the original markdown e-mail address matching +func isMailtoAutoLink(data []byte) int { + nb := 0 + + // address is assumed to be: [-@._a-zA-Z0-9]+ with exactly one '@' + for i, c := range data { + if isAlnum(c) { + continue + } + + switch c { + case '@': + nb++ + + case '-', '.', '_': + break + + case '>': + if nb == 1 { + return i + 1 + } + return 0 + default: + return 0 + } + } + + return 0 +} + +// look for the next emph char, skipping other constructs +func helperFindEmphChar(data []byte, c byte) int { + i := 0 + + for i < len(data) { + for i < len(data) && data[i] != c && data[i] != '`' && data[i] != '[' { + i++ + } + if i >= len(data) { + return 0 + } + // do not count escaped chars + if i != 0 && data[i-1] == '\\' { + i++ + continue + } + if data[i] == c { + return i + } + + if data[i] == '`' { + // skip a code span + tmpI := 0 + i++ + for i < len(data) && data[i] != '`' { + if tmpI == 0 && data[i] == c { + tmpI = i + } + i++ + } + if i >= len(data) { + return tmpI + } + i++ + } else if data[i] == '[' { + // skip a link + tmpI := 0 + i++ + for i < len(data) && data[i] != ']' { + if tmpI == 0 && data[i] == c { + tmpI = i + } + i++ + } + i++ + for i < len(data) && (data[i] == ' ' || data[i] == '\n') { + i++ + } + if i >= len(data) { + return tmpI + } + if data[i] != '[' && data[i] != '(' { // not a link + if tmpI > 0 { + return tmpI + } + continue + } + cc := data[i] + i++ + for i < len(data) && data[i] != cc { + if tmpI == 0 && data[i] == c { + return i + } + i++ + } + if i >= len(data) { + return tmpI + } + i++ + } + } + return 0 +} + +func helperEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) { + i := 0 + + // skip one symbol if coming from emph3 + if len(data) > 1 && data[0] == c && data[1] == c { + i = 1 + } + + for i < len(data) { + length := helperFindEmphChar(data[i:], c) + if length == 0 { + return 0, nil + } + i += length + if i >= len(data) { + return 0, nil + } + + if i+1 < len(data) && data[i+1] == c { + i++ + continue + } + + if data[i] == c && !isSpace(data[i-1]) { + + if p.extensions&NoIntraEmphasis != 0 { + if !(i+1 == len(data) || isSpace(data[i+1]) || isPunctuation(data[i+1])) { + continue + } + } + + emph := &ast.Emph{} + p.Inline(emph, data[:i]) + return i + 1, emph + } + } + + return 0, nil +} + +func helperDoubleEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) { + i := 0 + + for i < len(data) { + length := helperFindEmphChar(data[i:], c) + if length == 0 { + return 0, nil + } + i += length + + if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !isSpace(data[i-1]) { + var node ast.Node = &ast.Strong{} + if c == '~' { + node = &ast.Del{} + } + p.Inline(node, data[:i]) + return i + 2, node + } + i++ + } + return 0, nil +} + +func helperTripleEmphasis(p *Parser, data []byte, offset int, c byte) (int, ast.Node) { + i := 0 + origData := data + data = data[offset:] + + for i < len(data) { + length := helperFindEmphChar(data[i:], c) + if length == 0 { + return 0, nil + } + i += length + + // skip whitespace preceded symbols + if data[i] != c || isSpace(data[i-1]) { + continue + } + + switch { + case i+2 < len(data) && data[i+1] == c && data[i+2] == c: + // triple symbol found + strong := &ast.Strong{} + em := &ast.Emph{} + ast.AppendChild(strong, em) + p.Inline(em, data[:i]) + return i + 3, strong + case i+1 < len(data) && data[i+1] == c: + // double symbol found, hand over to emph1 + length, node := helperEmphasis(p, origData[offset-2:], c) + if length == 0 { + return 0, nil + } + return length - 2, node + default: + // single symbol found, hand over to emph2 + length, node := helperDoubleEmphasis(p, origData[offset-1:], c) + if length == 0 { + return 0, nil + } + return length - 1, node + } + } + return 0, nil +} + +// math handle inline math wrapped with '$' +func math(p *Parser, data []byte, offset int) (int, ast.Node) { + data = data[offset:] + + // too short, or block math + if len(data) <= 2 || data[1] == '$' { + return 0, nil + } + + // find next '$' + var end int + for end = 1; end < len(data) && data[end] != '$'; end++ { + } + + // $ not match + if end == len(data) { + return 0, nil + } + + // create inline math node + math := &ast.Math{} + math.Literal = data[1:end] + return end + 1, math +} + +func newTextNode(d []byte) *ast.Text { + return &ast.Text{ast.Leaf{Literal: d}} +} + +func normalizeURI(s []byte) []byte { + return s // TODO: implement +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/matter.go b/vendor/github.com/gomarkdown/markdown/parser/matter.go new file mode 100644 index 00000000..92686357 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/matter.go @@ -0,0 +1,36 @@ +package parser + +import ( + "bytes" + + "github.com/gomarkdown/markdown/ast" +) + +func (p *Parser) documentMatter(data []byte) int { + if data[0] != '{' { + return 0 + } + + consumed := 0 + matter := ast.DocumentMatterNone + if bytes.HasPrefix(data, []byte("{frontmatter}")) { + consumed = len("{frontmatter}") + matter = ast.DocumentMatterFront + } + if bytes.HasPrefix(data, []byte("{mainmatter}")) { + consumed = len("{mainmatter}") + matter = ast.DocumentMatterMain + } + if bytes.HasPrefix(data, []byte("{backmatter}")) { + consumed = len("{backmatter}") + matter = ast.DocumentMatterBack + } + if consumed == 0 { + return 0 + } + node := &ast.DocumentMatter{Matter: matter} + p.addBlock(node) + p.finalize(node) + + return consumed +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/options.go b/vendor/github.com/gomarkdown/markdown/parser/options.go new file mode 100644 index 00000000..d3d0c088 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/options.go @@ -0,0 +1,32 @@ +package parser + +import ( + "github.com/gomarkdown/markdown/ast" +) + +// Flags control optional behavior of parser. +type Flags int + +// Options is a collection of supplementary parameters tweaking the behavior of various parts of the parser. +type Options struct { + ParserHook BlockFunc + ReadIncludeFn ReadIncludeFunc + + Flags Flags // Flags allow customizing parser's behavior +} + +// Parser renderer configuration options. +const ( + FlagsNone Flags = 0 + SkipFootnoteList Flags = 1 << iota // Skip adding the footnote list (regardless if they are parsed) +) + +// BlockFunc allows to registration of a parser function. If successful it +// returns an ast.Node, a buffer that should be parsed as a block and the the number of bytes consumed. +type BlockFunc func(data []byte) (ast.Node, []byte, int) + +// ReadIncludeFunc should read the file under path and returns the read bytes, +// from will be set to the name of the current file being parsed. Initially +// this will be empty. address is the optional address specifier of which lines +// of the file to return. If this function is not set no data will be read. +type ReadIncludeFunc func(from, path string, address []byte) []byte diff --git a/vendor/github.com/gomarkdown/markdown/parser/parser.go b/vendor/github.com/gomarkdown/markdown/parser/parser.go new file mode 100644 index 00000000..c7302dfd --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/parser.go @@ -0,0 +1,812 @@ +/* +Package parser implements parser for markdown text that generates AST (abstract syntax tree). +*/ +package parser + +import ( + "bytes" + "fmt" + "strings" + "unicode/utf8" + + "github.com/gomarkdown/markdown/ast" +) + +// Extensions is a bitmask of enabled parser extensions. +type Extensions int + +// Bit flags representing markdown parsing extensions. +// Use | (or) to specify multiple extensions. +const ( + NoExtensions Extensions = 0 + NoIntraEmphasis Extensions = 1 << iota // Ignore emphasis markers inside words + Tables // Parse tables + FencedCode // Parse fenced code blocks + Autolink // Detect embedded URLs that are not explicitly marked + Strikethrough // Strikethrough text using ~~test~~ + LaxHTMLBlocks // Loosen up HTML block parsing rules + SpaceHeadings // Be strict about prefix heading rules + HardLineBreak // Translate newlines into line breaks + NonBlockingSpace // Translate backspace spaces into line non-blocking spaces + TabSizeEight // Expand tabs to eight spaces instead of four + Footnotes // Pandoc-style footnotes + NoEmptyLineBeforeBlock // No need to insert an empty line to start a (code, quote, ordered list, unordered list) block + HeadingIDs // specify heading IDs with {#id} + Titleblock // Titleblock ala pandoc + AutoHeadingIDs // Create the heading ID from the text + BackslashLineBreak // Translate trailing backslashes into line breaks + DefinitionLists // Parse definition lists + MathJax // Parse MathJax + OrderedListStart // Keep track of the first number used when starting an ordered list. + Attributes // Block Attributes + SuperSubscript // Super- and subscript support: 2^10^, H~2~O. + EmptyLinesBreakList // 2 empty lines break out of list + Includes // Support including other files. + Mmark // Support Mmark syntax, see https://mmark.nl/syntax + + CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode | + Autolink | Strikethrough | SpaceHeadings | HeadingIDs | + BackslashLineBreak | DefinitionLists | MathJax +) + +// The size of a tab stop. +const ( + tabSizeDefault = 4 + tabSizeDouble = 8 +) + +// for each character that triggers a response when parsing inline data. +type inlineParser func(p *Parser, data []byte, offset int) (int, ast.Node) + +// ReferenceOverrideFunc is expected to be called with a reference string and +// return either a valid Reference type that the reference string maps to or +// nil. If overridden is false, the default reference logic will be executed. +// See the documentation in Options for more details on use-case. +type ReferenceOverrideFunc func(reference string) (ref *Reference, overridden bool) + +// Parser is a type that holds extensions and the runtime state used by +// Parse, and the renderer. You can not use it directly, construct it with New. +type Parser struct { + + // ReferenceOverride is an optional function callback that is called every + // time a reference is resolved. It can be set before starting parsing. + // + // In Markdown, the link reference syntax can be made to resolve a link to + // a reference instead of an inline URL, in one of the following ways: + // + // * [link text][refid] + // * [refid][] + // + // Usually, the refid is defined at the bottom of the Markdown document. If + // this override function is provided, the refid is passed to the override + // function first, before consulting the defined refids at the bottom. If + // the override function indicates an override did not occur, the refids at + // the bottom will be used to fill in the link details. + ReferenceOverride ReferenceOverrideFunc + + Opts Options + + // after parsing, this is AST root of parsed markdown text + Doc ast.Node + + extensions Extensions + + refs map[string]*reference + refsRecord map[string]struct{} + inlineCallback [256]inlineParser + nesting int + maxNesting int + insideLink bool + indexCnt int // incremented after every index + + // Footnotes need to be ordered as well as available to quickly check for + // presence. If a ref is also a footnote, it's stored both in refs and here + // in notes. Slice is nil if footnotes not enabled. + notes []*reference + + tip ast.Node // = doc + oldTip ast.Node + lastMatchedContainer ast.Node // = doc + allClosed bool + + // Attributes are attached to block level elements. + attr *ast.Attribute + + includeStack *incStack +} + +// New creates a markdown parser with CommonExtensions. +// +// You can then call `doc := p.Parse(markdown)` to parse markdown document +// and `markdown.Render(doc, renderer)` to convert it to another format with +// a renderer. +func New() *Parser { + return NewWithExtensions(CommonExtensions) +} + +// NewWithExtensions creates a markdown parser with given extensions. +func NewWithExtensions(extension Extensions) *Parser { + p := Parser{ + refs: make(map[string]*reference), + refsRecord: make(map[string]struct{}), + maxNesting: 16, + insideLink: false, + Doc: &ast.Document{}, + extensions: extension, + allClosed: true, + includeStack: newIncStack(), + } + p.tip = p.Doc + p.oldTip = p.Doc + p.lastMatchedContainer = p.Doc + + p.inlineCallback[' '] = maybeLineBreak + p.inlineCallback['*'] = emphasis + p.inlineCallback['_'] = emphasis + if p.extensions&Strikethrough != 0 { + p.inlineCallback['~'] = emphasis + } + p.inlineCallback['`'] = codeSpan + p.inlineCallback['\n'] = lineBreak + p.inlineCallback['['] = link + p.inlineCallback['<'] = leftAngle + p.inlineCallback['\\'] = escape + p.inlineCallback['&'] = entity + p.inlineCallback['!'] = maybeImage + if p.extensions&Mmark != 0 { + p.inlineCallback['('] = maybeShortRefOrIndex + } + p.inlineCallback['^'] = maybeInlineFootnoteOrSuper + if p.extensions&Autolink != 0 { + p.inlineCallback['h'] = maybeAutoLink + p.inlineCallback['m'] = maybeAutoLink + p.inlineCallback['f'] = maybeAutoLink + p.inlineCallback['H'] = maybeAutoLink + p.inlineCallback['M'] = maybeAutoLink + p.inlineCallback['F'] = maybeAutoLink + } + if p.extensions&MathJax != 0 { + p.inlineCallback['$'] = math + } + + return &p +} + +func (p *Parser) getRef(refid string) (ref *reference, found bool) { + if p.ReferenceOverride != nil { + r, overridden := p.ReferenceOverride(refid) + if overridden { + if r == nil { + return nil, false + } + return &reference{ + link: []byte(r.Link), + title: []byte(r.Title), + noteID: 0, + hasBlock: false, + text: []byte(r.Text)}, true + } + } + // refs are case insensitive + ref, found = p.refs[strings.ToLower(refid)] + return ref, found +} + +func (p *Parser) isFootnote(ref *reference) bool { + _, ok := p.refsRecord[string(ref.link)] + return ok +} + +func (p *Parser) finalize(block ast.Node) { + p.tip = block.GetParent() +} + +func (p *Parser) addChild(node ast.Node) ast.Node { + for !canNodeContain(p.tip, node) { + p.finalize(p.tip) + } + ast.AppendChild(p.tip, node) + p.tip = node + return node +} + +func canNodeContain(n ast.Node, v ast.Node) bool { + switch n.(type) { + case *ast.List: + return isListItem(v) + case *ast.Document, *ast.BlockQuote, *ast.Aside, *ast.ListItem, *ast.CaptionFigure: + return !isListItem(v) + case *ast.Table: + switch v.(type) { + case *ast.TableHeader, *ast.TableBody, *ast.TableFooter: + return true + default: + return false + } + case *ast.TableHeader, *ast.TableBody, *ast.TableFooter: + _, ok := v.(*ast.TableRow) + return ok + case *ast.TableRow: + _, ok := v.(*ast.TableCell) + return ok + } + return false +} + +func (p *Parser) closeUnmatchedBlocks() { + if p.allClosed { + return + } + for p.oldTip != p.lastMatchedContainer { + parent := p.oldTip.GetParent() + p.finalize(p.oldTip) + p.oldTip = parent + } + p.allClosed = true +} + +// Reference represents the details of a link. +// See the documentation in Options for more details on use-case. +type Reference struct { + // Link is usually the URL the reference points to. + Link string + // Title is the alternate text describing the link in more detail. + Title string + // Text is the optional text to override the ref with if the syntax used was + // [refid][] + Text string +} + +// Parse generates AST (abstract syntax tree) representing markdown document. +// +// The result is a root of the tree whose underlying type is *ast.Document +// +// You can then convert AST to html using html.Renderer, to some other format +// using a custom renderer or transform the tree. +func (p *Parser) Parse(input []byte) ast.Node { + p.block(input) + // Walk the tree and finish up some of unfinished blocks + for p.tip != nil { + p.finalize(p.tip) + } + // Walk the tree again and process inline markdown in each block + ast.WalkFunc(p.Doc, func(node ast.Node, entering bool) ast.WalkStatus { + switch node.(type) { + case *ast.Paragraph, *ast.Heading, *ast.TableCell: + p.Inline(node, node.AsContainer().Content) + node.AsContainer().Content = nil + } + return ast.GoToNext + }) + + if p.Opts.Flags&SkipFootnoteList == 0 { + p.parseRefsToAST() + } + return p.Doc +} + +func (p *Parser) parseRefsToAST() { + if p.extensions&Footnotes == 0 || len(p.notes) == 0 { + return + } + p.tip = p.Doc + list := &ast.List{ + IsFootnotesList: true, + ListFlags: ast.ListTypeOrdered, + } + p.addBlock(&ast.Footnotes{}) + block := p.addBlock(list) + flags := ast.ListItemBeginningOfList + // Note: this loop is intentionally explicit, not range-form. This is + // because the body of the loop will append nested footnotes to p.notes and + // we need to process those late additions. Range form would only walk over + // the fixed initial set. + for i := 0; i < len(p.notes); i++ { + ref := p.notes[i] + p.addChild(ref.footnote) + block := ref.footnote + listItem := block.(*ast.ListItem) + listItem.ListFlags = flags | ast.ListTypeOrdered + listItem.RefLink = ref.link + if ref.hasBlock { + flags |= ast.ListItemContainsBlock + p.block(ref.title) + } else { + p.Inline(block, ref.title) + } + flags &^= ast.ListItemBeginningOfList | ast.ListItemContainsBlock + } + above := list.Parent + finalizeList(list) + p.tip = above + + ast.WalkFunc(block, func(node ast.Node, entering bool) ast.WalkStatus { + switch node.(type) { + case *ast.Paragraph, *ast.Heading: + p.Inline(node, node.AsContainer().Content) + node.AsContainer().Content = nil + } + return ast.GoToNext + }) +} + +// +// Link references +// +// This section implements support for references that (usually) appear +// as footnotes in a document, and can be referenced anywhere in the document. +// The basic format is: +// +// [1]: http://www.google.com/ "Google" +// [2]: http://www.github.com/ "Github" +// +// Anywhere in the document, the reference can be linked by referring to its +// label, i.e., 1 and 2 in this example, as in: +// +// This library is hosted on [Github][2], a git hosting site. +// +// Actual footnotes as specified in Pandoc and supported by some other Markdown +// libraries such as php-markdown are also taken care of. They look like this: +// +// This sentence needs a bit of further explanation.[^note] +// +// [^note]: This is the explanation. +// +// Footnotes should be placed at the end of the document in an ordered list. +// Inline footnotes such as: +// +// Inline footnotes^[Not supported.] also exist. +// +// are not yet supported. + +// reference holds all information necessary for a reference-style links or +// footnotes. +// +// Consider this markdown with reference-style links: +// +// [link][ref] +// +// [ref]: /url/ "tooltip title" +// +// It will be ultimately converted to this HTML: +// +//

    link

    +// +// And a reference structure will be populated as follows: +// +// p.refs["ref"] = &reference{ +// link: "/url/", +// title: "tooltip title", +// } +// +// Alternatively, reference can contain information about a footnote. Consider +// this markdown: +// +// Text needing a footnote.[^a] +// +// [^a]: This is the note +// +// A reference structure will be populated as follows: +// +// p.refs["a"] = &reference{ +// link: "a", +// title: "This is the note", +// noteID: , +// } +// +// TODO: As you can see, it begs for splitting into two dedicated structures +// for refs and for footnotes. +type reference struct { + link []byte + title []byte + noteID int // 0 if not a footnote ref + hasBlock bool + footnote ast.Node // a link to the Item node within a list of footnotes + + text []byte // only gets populated by refOverride feature with Reference.Text +} + +func (r *reference) String() string { + return fmt.Sprintf("{link: %q, title: %q, text: %q, noteID: %d, hasBlock: %v}", + r.link, r.title, r.text, r.noteID, r.hasBlock) +} + +// Check whether or not data starts with a reference link. +// If so, it is parsed and stored in the list of references +// (in the render struct). +// Returns the number of bytes to skip to move past it, +// or zero if the first line is not a reference. +func isReference(p *Parser, data []byte, tabSize int) int { + // up to 3 optional leading spaces + if len(data) < 4 { + return 0 + } + i := 0 + for i < 3 && data[i] == ' ' { + i++ + } + + noteID := 0 + + // id part: anything but a newline between brackets + if data[i] != '[' { + return 0 + } + i++ + if p.extensions&Footnotes != 0 { + if i < len(data) && data[i] == '^' { + // we can set it to anything here because the proper noteIds will + // be assigned later during the second pass. It just has to be != 0 + noteID = 1 + i++ + } + } + idOffset := i + for i < len(data) && data[i] != '\n' && data[i] != '\r' && data[i] != ']' { + i++ + } + if i >= len(data) || data[i] != ']' { + return 0 + } + idEnd := i + // footnotes can have empty ID, like this: [^], but a reference can not be + // empty like this: []. Break early if it's not a footnote and there's no ID + if noteID == 0 && idOffset == idEnd { + return 0 + } + // spacer: colon (space | tab)* newline? (space | tab)* + i++ + if i >= len(data) || data[i] != ':' { + return 0 + } + i++ + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + if i < len(data) && (data[i] == '\n' || data[i] == '\r') { + i++ + if i < len(data) && data[i] == '\n' && data[i-1] == '\r' { + i++ + } + } + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + if i >= len(data) { + return 0 + } + + var ( + linkOffset, linkEnd int + titleOffset, titleEnd int + lineEnd int + raw []byte + hasBlock bool + ) + + if p.extensions&Footnotes != 0 && noteID != 0 { + linkOffset, linkEnd, raw, hasBlock = scanFootnote(p, data, i, tabSize) + lineEnd = linkEnd + } else { + linkOffset, linkEnd, titleOffset, titleEnd, lineEnd = scanLinkRef(p, data, i) + } + if lineEnd == 0 { + return 0 + } + + // a valid ref has been found + + ref := &reference{ + noteID: noteID, + hasBlock: hasBlock, + } + + if noteID > 0 { + // reusing the link field for the id since footnotes don't have links + ref.link = data[idOffset:idEnd] + // if footnote, it's not really a title, it's the contained text + ref.title = raw + } else { + ref.link = data[linkOffset:linkEnd] + ref.title = data[titleOffset:titleEnd] + } + + // id matches are case-insensitive + id := string(bytes.ToLower(data[idOffset:idEnd])) + + p.refs[id] = ref + + return lineEnd +} + +func scanLinkRef(p *Parser, data []byte, i int) (linkOffset, linkEnd, titleOffset, titleEnd, lineEnd int) { + // link: whitespace-free sequence, optionally between angle brackets + if data[i] == '<' { + i++ + } + linkOffset = i + for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' { + i++ + } + linkEnd = i + if linkEnd < len(data) && data[linkOffset] == '<' && data[linkEnd-1] == '>' { + linkOffset++ + linkEnd-- + } + + // optional spacer: (space | tab)* (newline | '\'' | '"' | '(' ) + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + if i < len(data) && data[i] != '\n' && data[i] != '\r' && data[i] != '\'' && data[i] != '"' && data[i] != '(' { + return + } + + // compute end-of-line + if i >= len(data) || data[i] == '\r' || data[i] == '\n' { + lineEnd = i + } + if i+1 < len(data) && data[i] == '\r' && data[i+1] == '\n' { + lineEnd++ + } + + // optional (space|tab)* spacer after a newline + if lineEnd > 0 { + i = lineEnd + 1 + for i < len(data) && (data[i] == ' ' || data[i] == '\t') { + i++ + } + } + + // optional title: any non-newline sequence enclosed in '"() alone on its line + if i+1 < len(data) && (data[i] == '\'' || data[i] == '"' || data[i] == '(') { + i++ + titleOffset = i + + // look for EOL + for i < len(data) && data[i] != '\n' && data[i] != '\r' { + i++ + } + if i+1 < len(data) && data[i] == '\n' && data[i+1] == '\r' { + titleEnd = i + 1 + } else { + titleEnd = i + } + + // step back + i-- + for i > titleOffset && (data[i] == ' ' || data[i] == '\t') { + i-- + } + if i > titleOffset && (data[i] == '\'' || data[i] == '"' || data[i] == ')') { + lineEnd = titleEnd + titleEnd = i + } + } + + return +} + +// The first bit of this logic is the same as Parser.listItem, but the rest +// is much simpler. This function simply finds the entire block and shifts it +// over by one tab if it is indeed a block (just returns the line if it's not). +// blockEnd is the end of the section in the input buffer, and contents is the +// extracted text that was shifted over one tab. It will need to be rendered at +// the end of the document. +func scanFootnote(p *Parser, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { + if i == 0 || len(data) == 0 { + return + } + + // skip leading whitespace on first line + for i < len(data) && data[i] == ' ' { + i++ + } + + blockStart = i + + // find the end of the line + blockEnd = i + for i < len(data) && data[i-1] != '\n' { + i++ + } + + // get working buffer + var raw bytes.Buffer + + // put the first line into the working buffer + raw.Write(data[blockEnd:i]) + blockEnd = i + + // process the following lines + containsBlankLine := false + +gatherLines: + for blockEnd < len(data) { + i++ + + // find the end of this line + for i < len(data) && data[i-1] != '\n' { + i++ + } + + // if it is an empty line, guess that it is part of this item + // and move on to the next line + if p.isEmpty(data[blockEnd:i]) > 0 { + containsBlankLine = true + blockEnd = i + continue + } + + n := 0 + if n = isIndented(data[blockEnd:i], indentSize); n == 0 { + // this is the end of the block. + // we don't want to include this last line in the index. + break gatherLines + } + + // if there were blank lines before this one, insert a new one now + if containsBlankLine { + raw.WriteByte('\n') + containsBlankLine = false + } + + // get rid of that first tab, write to buffer + raw.Write(data[blockEnd+n : i]) + hasBlock = true + + blockEnd = i + } + + if data[blockEnd-1] != '\n' { + raw.WriteByte('\n') + } + + contents = raw.Bytes() + + return +} + +// isPunctuation returns true if c is a punctuation symbol. +func isPunctuation(c byte) bool { + for _, r := range []byte("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") { + if c == r { + return true + } + } + return false +} + +// isSpace returns true if c is a white-space charactr +func isSpace(c byte) bool { + return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v' +} + +// isLetter returns true if c is ascii letter +func isLetter(c byte) bool { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') +} + +// isAlnum returns true if c is a digit or letter +// TODO: check when this is looking for ASCII alnum and when it should use unicode +func isAlnum(c byte) bool { + return (c >= '0' && c <= '9') || isLetter(c) +} + +// TODO: this is not used +// Replace tab characters with spaces, aligning to the next TAB_SIZE column. +// always ends output with a newline +func expandTabs(out *bytes.Buffer, line []byte, tabSize int) { + // first, check for common cases: no tabs, or only tabs at beginning of line + i, prefix := 0, 0 + slowcase := false + for i = 0; i < len(line); i++ { + if line[i] == '\t' { + if prefix == i { + prefix++ + } else { + slowcase = true + break + } + } + } + + // no need to decode runes if all tabs are at the beginning of the line + if !slowcase { + for i = 0; i < prefix*tabSize; i++ { + out.WriteByte(' ') + } + out.Write(line[prefix:]) + return + } + + // the slow case: we need to count runes to figure out how + // many spaces to insert for each tab + column := 0 + i = 0 + for i < len(line) { + start := i + for i < len(line) && line[i] != '\t' { + _, size := utf8.DecodeRune(line[i:]) + i += size + column++ + } + + if i > start { + out.Write(line[start:i]) + } + + if i >= len(line) { + break + } + + for { + out.WriteByte(' ') + column++ + if column%tabSize == 0 { + break + } + } + + i++ + } +} + +// Find if a line counts as indented or not. +// Returns number of characters the indent is (0 = not indented). +func isIndented(data []byte, indentSize int) int { + if len(data) == 0 { + return 0 + } + if data[0] == '\t' { + return 1 + } + if len(data) < indentSize { + return 0 + } + for i := 0; i < indentSize; i++ { + if data[i] != ' ' { + return 0 + } + } + return indentSize +} + +// Create a url-safe slug for fragments +func slugify(in []byte) []byte { + if len(in) == 0 { + return in + } + out := make([]byte, 0, len(in)) + sym := false + + for _, ch := range in { + if isAlnum(ch) { + sym = false + out = append(out, ch) + } else if sym { + continue + } else { + out = append(out, '-') + sym = true + } + } + var a, b int + var ch byte + for a, ch = range out { + if ch != '-' { + break + } + } + for b = len(out) - 1; b > 0; b-- { + if out[b] != '-' { + break + } + } + return out[a : b+1] +} + +func isListItem(d ast.Node) bool { + _, ok := d.(*ast.ListItem) + return ok +} diff --git a/vendor/github.com/gomarkdown/markdown/parser/ref.go b/vendor/github.com/gomarkdown/markdown/parser/ref.go new file mode 100644 index 00000000..0b59a196 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/ref.go @@ -0,0 +1,89 @@ +package parser + +import ( + "bytes" + "fmt" + + "github.com/gomarkdown/markdown/ast" +) + +// parse '(#r)', where r does not contain spaces. Or. +// (!item) (!item, subitem), for an index, (!!item) signals primary. +func maybeShortRefOrIndex(p *Parser, data []byte, offset int) (int, ast.Node) { + if len(data[offset:]) < 4 { + return 0, nil + } + // short ref first + data = data[offset:] + i := 1 + switch data[i] { + case '#': // cross ref + i++ + Loop: + for i < len(data) { + c := data[i] + switch { + case c == ')': + break Loop + case !isAlnum(c): + if c == '_' || c == '-' || c == ':' { + i++ + continue + } + i = 0 + break Loop + } + i++ + } + if i >= len(data) { + return 0, nil + } + if data[i] != ')' { + return 0, nil + } + + id := data[2:i] + node := &ast.CrossReference{} + node.Destination = id + + return i + 1, node + + case '!': // index + i++ + start := i + i = skipUntilChar(data, start, ')') + + // did we reach the end of the buffer without a closing marker? + if i >= len(data) { + return 0, nil + } + + if len(data[start:i]) < 1 { + return 0, nil + } + + idx := &ast.Index{} + + idx.ID = fmt.Sprintf("idxref:%d", p.indexCnt) + p.indexCnt++ + + idx.Primary = data[start] == '!' + buf := data[start:i] + + if idx.Primary { + buf = buf[1:] + } + items := bytes.Split(buf, []byte(",")) + switch len(items) { + case 1: + idx.Item = bytes.TrimSpace(items[0]) + return i + 1, idx + case 2: + idx.Item = bytes.TrimSpace(items[0]) + idx.Subitem = bytes.TrimSpace(items[1]) + return i + 1, idx + } + } + + return 0, nil +} diff --git a/vendor/github.com/gomarkdown/markdown/todo.md b/vendor/github.com/gomarkdown/markdown/todo.md new file mode 100644 index 00000000..be8bb55c --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/todo.md @@ -0,0 +1,7 @@ +# Things to do + +[ ] docs: add examples like https://godoc.org/github.com/dgrijalva/jwt-go (put in foo_example_test.go). Or see https://github.com/garyburd/redigo/blob/master/redis/zpop_example_test.go#L5 / https://godoc.org/github.com/garyburd/redigo/redis or https://godoc.org/github.com/go-redis/redis + +[ ] figure out expandTabs and parser.TabSizeEight. Are those used? + +[ ] SoftbreakData is not used diff --git a/vendor/github.com/gomarkdown/markdown/tracking-perf.md b/vendor/github.com/gomarkdown/markdown/tracking-perf.md new file mode 100644 index 00000000..40b95183 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/tracking-perf.md @@ -0,0 +1,189 @@ +## Tracking perf changes + +Initial performance: +``` +goos: darwin +goarch: amd64 +pkg: github.com/gomarkdown/markdown +BenchmarkEscapeHTML-8 2000000 823 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 5033 ns/op 9872 B/op 56 allocs/op +BenchmarkReferenceAmps-8 100000 19538 ns/op 26776 B/op 150 allocs/op +BenchmarkReferenceAutoLinks-8 100000 17574 ns/op 24544 B/op 132 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 50977 ns/op 76752 B/op 243 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 8546 ns/op 12864 B/op 65 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 9000 ns/op 14912 B/op 70 allocs/op +BenchmarkReferenceCodeSpans-8 200000 8856 ns/op 14992 B/op 69 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 6599 ns/op 11312 B/op 57 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 15483 ns/op 23536 B/op 98 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6839 ns/op 12150 B/op 62 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 19940 ns/op 28488 B/op 117 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 7455 ns/op 13440 B/op 64 allocs/op +BenchmarkReferenceLinksInline-8 100000 16425 ns/op 23664 B/op 147 allocs/op +BenchmarkReferenceLinksReference-8 30000 54895 ns/op 66464 B/op 416 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 17647 ns/op 23776 B/op 158 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 9367 ns/op 14832 B/op 95 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 129772 ns/op 130848 B/op 378 allocs/op +BenchmarkReferenceMarkdownSyntax-8 3000 502365 ns/op 461411 B/op 1411 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 7028 ns/op 12688 B/op 64 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 79686 ns/op 107520 B/op 374 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 10020 ns/op 17792 B/op 78 allocs/op +BenchmarkReferenceTabs-8 200000 12025 ns/op 18224 B/op 81 allocs/op +BenchmarkReferenceTidyness-8 200000 8985 ns/op 14432 B/op 71 allocs/op +PASS +ok github.com/gomarkdown/markdown 45.375s +``` + +After switching to using interface{} for Node.Data: +``` +BenchmarkEscapeHTML-8 2000000 929 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 5126 ns/op 9248 B/op 56 allocs/op +BenchmarkReferenceAmps-8 100000 19927 ns/op 17880 B/op 154 allocs/op +BenchmarkReferenceAutoLinks-8 100000 20732 ns/op 17360 B/op 141 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 50267 ns/op 38128 B/op 244 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 8988 ns/op 10912 B/op 67 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 8611 ns/op 12256 B/op 74 allocs/op +BenchmarkReferenceCodeSpans-8 200000 8256 ns/op 11248 B/op 69 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 6739 ns/op 9856 B/op 57 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 15503 ns/op 15600 B/op 104 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6874 ns/op 10278 B/op 62 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 22271 ns/op 18552 B/op 121 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 8315 ns/op 10736 B/op 64 allocs/op +BenchmarkReferenceLinksInline-8 100000 16155 ns/op 16912 B/op 152 allocs/op +BenchmarkReferenceLinksReference-8 30000 52387 ns/op 38192 B/op 445 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 17111 ns/op 16592 B/op 167 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 9164 ns/op 12048 B/op 97 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 129262 ns/op 87264 B/op 416 allocs/op +BenchmarkReferenceMarkdownSyntax-8 3000 496873 ns/op 293906 B/op 1559 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 6854 ns/op 10192 B/op 64 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 79633 ns/op 55024 B/op 447 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 9637 ns/op 12176 B/op 78 allocs/op +BenchmarkReferenceTabs-8 100000 12164 ns/op 13776 B/op 87 allocs/op +BenchmarkReferenceTidyness-8 200000 8677 ns/op 11296 B/op 75 allocs/op +``` + +Not necessarily faster, but uses less bytes per op (but sometimes more allocs). + +After tweaking the API: +``` +$ ./s/run-bench.sh + +go test -bench=. -test.benchmem +goos: darwin +goarch: amd64 +pkg: github.com/gomarkdown/markdown +BenchmarkEscapeHTML-8 2000000 834 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3486 ns/op 6160 B/op 27 allocs/op +BenchmarkReferenceAmps-8 100000 18158 ns/op 14792 B/op 125 allocs/op +BenchmarkReferenceAutoLinks-8 100000 16824 ns/op 14272 B/op 112 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 44066 ns/op 35040 B/op 215 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 6868 ns/op 7824 B/op 38 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 7157 ns/op 9168 B/op 45 allocs/op +BenchmarkReferenceCodeSpans-8 200000 6663 ns/op 8160 B/op 40 allocs/op +BenchmarkReferenceHardWrappedPara-8 300000 4821 ns/op 6768 B/op 28 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 13033 ns/op 12512 B/op 75 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 300000 4998 ns/op 7190 B/op 33 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 17696 ns/op 15464 B/op 92 allocs/op +BenchmarkReferenceInlineHTMLComments-8 300000 5506 ns/op 7648 B/op 35 allocs/op +BenchmarkReferenceLinksInline-8 100000 14450 ns/op 13824 B/op 123 allocs/op +BenchmarkReferenceLinksReference-8 30000 52561 ns/op 35104 B/op 416 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 15616 ns/op 13504 B/op 138 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 7772 ns/op 8960 B/op 68 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 121436 ns/op 84176 B/op 387 allocs/op +BenchmarkReferenceMarkdownSyntax-8 3000 487404 ns/op 290818 B/op 1530 allocs/op +BenchmarkReferenceNestedBlockquotes-8 300000 5098 ns/op 7104 B/op 35 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 74422 ns/op 51936 B/op 418 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 7888 ns/op 9088 B/op 49 allocs/op +BenchmarkReferenceTabs-8 200000 10061 ns/op 10688 B/op 58 allocs/op +BenchmarkReferenceTidyness-8 200000 7152 ns/op 8208 B/op 46 allocs/op +ok github.com/gomarkdown/markdown 40.809s +``` + +After refactoring Renderer: +``` +BenchmarkEscapeHTML-8 2000000 883 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3717 ns/op 6208 B/op 29 allocs/op +BenchmarkReferenceAmps-8 100000 19135 ns/op 14680 B/op 123 allocs/op +BenchmarkReferenceAutoLinks-8 100000 17142 ns/op 14176 B/op 110 allocs/op +BenchmarkReferenceBackslashEscapes-8 30000 54616 ns/op 35088 B/op 217 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 7993 ns/op 7872 B/op 40 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 8285 ns/op 9216 B/op 47 allocs/op +BenchmarkReferenceCodeSpans-8 200000 7684 ns/op 8208 B/op 42 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 5595 ns/op 6816 B/op 30 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 16444 ns/op 12560 B/op 77 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 5415 ns/op 7238 B/op 35 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 100000 19867 ns/op 15512 B/op 94 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 6026 ns/op 7696 B/op 37 allocs/op +BenchmarkReferenceLinksInline-8 100000 14864 ns/op 13664 B/op 120 allocs/op +BenchmarkReferenceLinksReference-8 30000 52479 ns/op 34816 B/op 401 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 15812 ns/op 13472 B/op 135 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 7767 ns/op 8880 B/op 68 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 131065 ns/op 84048 B/op 386 allocs/op +BenchmarkReferenceMarkdownSyntax-8 2000 515604 ns/op 289953 B/op 1501 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 5655 ns/op 7152 B/op 37 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 20000 84188 ns/op 51984 B/op 420 allocs/op +BenchmarkReferenceStrongAndEm-8 200000 8664 ns/op 9136 B/op 51 allocs/op +BenchmarkReferenceTabs-8 100000 11110 ns/op 10736 B/op 60 allocs/op +BenchmarkReferenceTidyness-8 200000 7628 ns/op 8256 B/op 48 allocs/op +ok github.com/gomarkdown/markdown 40.841s +``` + +After Node refactor to have Children array: +``` +BenchmarkEscapeHTML-8 2000000 901 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3905 ns/op 6224 B/op 31 allocs/op +BenchmarkReferenceAmps-8 100000 22216 ns/op 15560 B/op 157 allocs/op +BenchmarkReferenceAutoLinks-8 100000 20335 ns/op 14824 B/op 146 allocs/op +BenchmarkReferenceBackslashEscapes-8 20000 69174 ns/op 37392 B/op 316 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 8443 ns/op 7968 B/op 48 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 9250 ns/op 9392 B/op 58 allocs/op +BenchmarkReferenceCodeSpans-8 200000 8515 ns/op 8432 B/op 54 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 5738 ns/op 6856 B/op 34 allocs/op +BenchmarkReferenceHorizontalRules-8 100000 20864 ns/op 13648 B/op 93 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6187 ns/op 7310 B/op 40 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 50000 23793 ns/op 16128 B/op 114 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 7060 ns/op 7840 B/op 44 allocs/op +BenchmarkReferenceLinksInline-8 100000 18432 ns/op 14496 B/op 153 allocs/op +BenchmarkReferenceLinksReference-8 20000 67666 ns/op 37136 B/op 502 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 19324 ns/op 13984 B/op 162 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 200000 8998 ns/op 9320 B/op 83 allocs/op +BenchmarkReferenceMarkdownBasics-8 10000 160908 ns/op 88152 B/op 518 allocs/op +BenchmarkReferenceMarkdownSyntax-8 2000 707160 ns/op 303801 B/op 2044 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 6740 ns/op 7248 B/op 45 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 10000 115808 ns/op 55052 B/op 626 allocs/op +BenchmarkReferenceStrongAndEm-8 100000 10540 ns/op 9416 B/op 72 allocs/op +BenchmarkReferenceTabs-8 100000 13171 ns/op 10968 B/op 77 allocs/op +BenchmarkReferenceTidyness-8 200000 8903 ns/op 8404 B/op 62 allocs/op +PASS +ok github.com/gomarkdown/markdown 43.477s +``` +It's slower (but opens up possibilities for further improvements). + +After refactoring to make ast.Node a top-level thing. +``` +BenchmarkEscapeHTML-8 2000000 829 ns/op 0 B/op 0 allocs/op +BenchmarkSmartDoubleQuotes-8 300000 3998 ns/op 6192 B/op 31 allocs/op +BenchmarkReferenceAmps-8 50000 27389 ns/op 15480 B/op 153 allocs/op +BenchmarkReferenceAutoLinks-8 50000 23106 ns/op 14656 B/op 137 allocs/op +BenchmarkReferenceBackslashEscapes-8 10000 112435 ns/op 36696 B/op 315 allocs/op +BenchmarkReferenceBlockquotesWithCodeBlocks-8 200000 9227 ns/op 7856 B/op 46 allocs/op +BenchmarkReferenceCodeBlocks-8 200000 10469 ns/op 9248 B/op 54 allocs/op +BenchmarkReferenceCodeSpans-8 200000 10522 ns/op 8368 B/op 54 allocs/op +BenchmarkReferenceHardWrappedPara-8 200000 6354 ns/op 6784 B/op 34 allocs/op +BenchmarkReferenceHorizontalRules-8 50000 32393 ns/op 13952 B/op 87 allocs/op +BenchmarkReferenceInlineHTMLAdvances-8 200000 6894 ns/op 7238 B/op 40 allocs/op +BenchmarkReferenceInlineHTMLSimple-8 50000 32942 ns/op 15864 B/op 110 allocs/op +BenchmarkReferenceInlineHTMLComments-8 200000 8181 ns/op 7776 B/op 44 allocs/op +BenchmarkReferenceLinksInline-8 100000 21679 ns/op 14400 B/op 148 allocs/op +BenchmarkReferenceLinksReference-8 20000 83928 ns/op 36688 B/op 473 allocs/op +BenchmarkReferenceLinksShortcut-8 100000 22053 ns/op 13872 B/op 153 allocs/op +BenchmarkReferenceLiterQuotesInTitles-8 100000 10784 ns/op 9296 B/op 81 allocs/op +BenchmarkReferenceMarkdownBasics-8 5000 237097 ns/op 87760 B/op 480 allocs/op +BenchmarkReferenceMarkdownSyntax-8 1000 1465402 ns/op 300769 B/op 1896 allocs/op +BenchmarkReferenceNestedBlockquotes-8 200000 7461 ns/op 7152 B/op 45 allocs/op +BenchmarkReferenceOrderedAndUnorderedLists-8 5000 212256 ns/op 53724 B/op 553 allocs/op +BenchmarkReferenceStrongAndEm-8 100000 13018 ns/op 9264 B/op 72 allocs/op +BenchmarkReferenceTabs-8 100000 15005 ns/op 10752 B/op 71 allocs/op +BenchmarkReferenceTidyness-8 200000 10308 ns/op 8292 B/op 58 allocs/op +PASS +ok github.com/gomarkdown/markdown 42.176s +``` diff --git a/vendor/gitlab.com/golang-commonmark/html/.gitlab-ci.yml b/vendor/gitlab.com/golang-commonmark/html/.gitlab-ci.yml deleted file mode 100644 index aaf2cbdd..00000000 --- a/vendor/gitlab.com/golang-commonmark/html/.gitlab-ci.yml +++ /dev/null @@ -1,16 +0,0 @@ -image: golang:1.11 - -stages: - - build - - test - -build: - stage: build - script: - - go build ./... - -test: - stage: test - script: - - test -z "$(gofmt -l . | tee /dev/stderr)" - - go test ./... diff --git a/vendor/gitlab.com/golang-commonmark/html/LICENSE b/vendor/gitlab.com/golang-commonmark/html/LICENSE deleted file mode 100644 index 9cdcd201..00000000 --- a/vendor/gitlab.com/golang-commonmark/html/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2015, The Authors -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/gitlab.com/golang-commonmark/html/README.md b/vendor/gitlab.com/golang-commonmark/html/README.md deleted file mode 100644 index 1fbc8ea8..00000000 --- a/vendor/gitlab.com/golang-commonmark/html/README.md +++ /dev/null @@ -1,8 +0,0 @@ -html [![License](https://img.shields.io/badge/licence-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause) [![GoDoc](http://godoc.org/gitlab.com/golang-commonmark/html?status.svg)](http://godoc.org/gitlab.com/golang-commonmark/html) [![Pipeline status](https://gitlab.com/golang-commonmark/html/badges/master/pipeline.svg)](https://gitlab.com/golang-commonmark/html/commits/master) -==== - -Package html provides functions for escaping/unescaping HTML text and for parsing HTML entities. - -## Install - - go get -u gitlab.com/golang-commonmark/html diff --git a/vendor/gitlab.com/golang-commonmark/html/html.go b/vendor/gitlab.com/golang-commonmark/html/html.go deleted file mode 100644 index 25bf7d82..00000000 --- a/vendor/gitlab.com/golang-commonmark/html/html.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package html provides functions for escaping/unescaping HTML text and for parsing HTML entities. -package html - -import ( - "io" - "strconv" - "strings" - "unicode/utf8" -) - -const BadEntity = string(utf8.RuneError) - -var htmlEscapeReplacer = strings.NewReplacer( - "&", "&", - "<", "<", - ">", ">", - `"`, """, -) - -func EscapeString(s string) string { - return htmlEscapeReplacer.Replace(s) -} - -func WriteEscapedString(w io.Writer, s string) error { - _, err := htmlEscapeReplacer.WriteString(w, s) - return err -} - -func isValidEntityCode(c int64) bool { - switch { - case !utf8.ValidRune(rune(c)): - return false - - // never used - case c >= 0xfdd0 && c <= 0xfdef: - return false - case c&0xffff == 0xffff || c&0xffff == 0xfffe: - return false - // control codes - case c >= 0x00 && c <= 0x08: - return false - case c == 0x0b: - return false - case c >= 0x0e && c <= 0x1f: - return false - case c >= 0x7f && c <= 0x9f: - return false - } - - return true -} - -func letter(b byte) bool { return b >= 'a' && b <= 'z' || b >= 'A' && b <= 'Z' } - -func digit(b byte) bool { return b >= '0' && b <= '9' } - -func alphanum(b byte) bool { return letter(b) || digit(b) } - -func hexDigit(b byte) bool { - return digit(b) || b >= 'a' && b <= 'f' || b >= 'A' && b <= 'F' -} - -func ParseEntity(s string) (string, int) { - st := 0 - var n int - - for i := 1; i < len(s); i++ { - b := s[i] - - switch st { - case 0: // initial state - switch { - case b == '#': - st = 1 - case letter(b): - n = 1 - st = 2 - default: - return "", 0 - } - - case 1: // &# - switch { - case b == 'x' || b == 'X': - st = 3 - case digit(b): - n = 1 - st = 4 - default: - return "", 0 - } - - case 2: // &q - switch { - case alphanum(b): - n++ - if n > 31 { - return "", 0 - } - case b == ';': - if e, ok := entities[s[i-n:i]]; ok { - return e, i + 1 - } - return "", 0 - default: - return "", 0 - } - - case 3: // &#x - switch { - case hexDigit(b): - n = 1 - st = 5 - default: - return "", 0 - } - - case 4: // � - switch { - case digit(b): - n++ - if n > 8 { - return "", 0 - } - case b == ';': - c, _ := strconv.ParseInt(s[i-n:i], 10, 32) - if !isValidEntityCode(c) { - return BadEntity, i + 1 - } - return string(rune(c)), i + 1 - default: - return "", 0 - } - - case 5: // � - switch { - case hexDigit(b): - n++ - if n > 8 { - return "", 0 - } - case b == ';': - c, err := strconv.ParseInt(s[i-n:i], 16, 32) - if err != nil { - return BadEntity, i + 1 - } - if !isValidEntityCode(c) { - return BadEntity, i + 1 - } - return string(rune(c)), i + 1 - default: - return "", 0 - } - } - } - - return "", 0 -} - -func UnescapeString(s string) string { - i := strings.IndexByte(s, '&') - if i < 0 { - return s - } - - anyChanges := false - var entityStr string - var entityLen int - for i < len(s) { - if s[i] == '&' { - entityStr, entityLen = ParseEntity(s[i:]) - if entityLen > 0 { - anyChanges = true - break - } - } - i++ - } - - if !anyChanges { - return s - } - - buf := make([]byte, len(s)-entityLen+len(entityStr)) - copy(buf[:i], s) - n := copy(buf[i:], entityStr) - j := i + n - i += entityLen - for i < len(s) { - b := s[i] - if b == '&' { - entityStr, entityLen = ParseEntity(s[i:]) - if entityLen > 0 { - n = copy(buf[j:], entityStr) - j += n - i += entityLen - continue - } - } - - buf[j] = b - j++ - i++ - } - - return string(buf[:j]) -} diff --git a/vendor/gitlab.com/golang-commonmark/html/html5_entities.go b/vendor/gitlab.com/golang-commonmark/html/html5_entities.go deleted file mode 100644 index 200512ab..00000000 --- a/vendor/gitlab.com/golang-commonmark/html/html5_entities.go +++ /dev/null @@ -1,2133 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package html - -var entities = map[string]string{ - "AElig": "\u00C6", - "AMP": "\u0026", - "Aacute": "\u00C1", - "Abreve": "\u0102", - "Acirc": "\u00C2", - "Acy": "\u0410", - "Afr": "\U0001D504", - "Agrave": "\u00C0", - "Alpha": "\u0391", - "Amacr": "\u0100", - "And": "\u2A53", - "Aogon": "\u0104", - "Aopf": "\U0001D538", - "ApplyFunction": "\u2061", - "Aring": "\u00C5", - "Ascr": "\U0001D49C", - "Assign": "\u2254", - "Atilde": "\u00C3", - "Auml": "\u00C4", - "Backslash": "\u2216", - "Barv": "\u2AE7", - "Barwed": "\u2306", - "Bcy": "\u0411", - "Because": "\u2235", - "Bernoullis": "\u212C", - "Beta": "\u0392", - "Bfr": "\U0001D505", - "Bopf": "\U0001D539", - "Breve": "\u02D8", - "Bscr": "\u212C", - "Bumpeq": "\u224E", - "CHcy": "\u0427", - "COPY": "\u00A9", - "Cacute": "\u0106", - "Cap": "\u22D2", - "CapitalDifferentialD": "\u2145", - "Cayleys": "\u212D", - "Ccaron": "\u010C", - "Ccedil": "\u00C7", - "Ccirc": "\u0108", - "Cconint": "\u2230", - "Cdot": "\u010A", - "Cedilla": "\u00B8", - "CenterDot": "\u00B7", - "Cfr": "\u212D", - "Chi": "\u03A7", - "CircleDot": "\u2299", - "CircleMinus": "\u2296", - "CirclePlus": "\u2295", - "CircleTimes": "\u2297", - "ClockwiseContourIntegral": "\u2232", - "CloseCurlyDoubleQuote": "\u201D", - "CloseCurlyQuote": "\u2019", - "Colon": "\u2237", - "Colone": "\u2A74", - "Congruent": "\u2261", - "Conint": "\u222F", - "ContourIntegral": "\u222E", - "Copf": "\u2102", - "Coproduct": "\u2210", - "CounterClockwiseContourIntegral": "\u2233", - "Cross": "\u2A2F", - "Cscr": "\U0001D49E", - "Cup": "\u22D3", - "CupCap": "\u224D", - "DD": "\u2145", - "DDotrahd": "\u2911", - "DJcy": "\u0402", - "DScy": "\u0405", - "DZcy": "\u040F", - "Dagger": "\u2021", - "Darr": "\u21A1", - "Dashv": "\u2AE4", - "Dcaron": "\u010E", - "Dcy": "\u0414", - "Del": "\u2207", - "Delta": "\u0394", - "Dfr": "\U0001D507", - "DiacriticalAcute": "\u00B4", - "DiacriticalDot": "\u02D9", - "DiacriticalDoubleAcute": "\u02DD", - "DiacriticalGrave": "\u0060", - "DiacriticalTilde": "\u02DC", - "Diamond": "\u22C4", - "DifferentialD": "\u2146", - "Dopf": "\U0001D53B", - "Dot": "\u00A8", - "DotDot": "\u20DC", - "DotEqual": "\u2250", - "DoubleContourIntegral": "\u222F", - "DoubleDot": "\u00A8", - "DoubleDownArrow": "\u21D3", - "DoubleLeftArrow": "\u21D0", - "DoubleLeftRightArrow": "\u21D4", - "DoubleLeftTee": "\u2AE4", - "DoubleLongLeftArrow": "\u27F8", - "DoubleLongLeftRightArrow": "\u27FA", - "DoubleLongRightArrow": "\u27F9", - "DoubleRightArrow": "\u21D2", - "DoubleRightTee": "\u22A8", - "DoubleUpArrow": "\u21D1", - "DoubleUpDownArrow": "\u21D5", - "DoubleVerticalBar": "\u2225", - "DownArrow": "\u2193", - "DownArrowBar": "\u2913", - "DownArrowUpArrow": "\u21F5", - "DownBreve": "\u0311", - "DownLeftRightVector": "\u2950", - "DownLeftTeeVector": "\u295E", - "DownLeftVector": "\u21BD", - "DownLeftVectorBar": "\u2956", - "DownRightTeeVector": "\u295F", - "DownRightVector": "\u21C1", - "DownRightVectorBar": "\u2957", - "DownTee": "\u22A4", - "DownTeeArrow": "\u21A7", - "Downarrow": "\u21D3", - "Dscr": "\U0001D49F", - "Dstrok": "\u0110", - "ENG": "\u014A", - "ETH": "\u00D0", - "Eacute": "\u00C9", - "Ecaron": "\u011A", - "Ecirc": "\u00CA", - "Ecy": "\u042D", - "Edot": "\u0116", - "Efr": "\U0001D508", - "Egrave": "\u00C8", - "Element": "\u2208", - "Emacr": "\u0112", - "EmptySmallSquare": "\u25FB", - "EmptyVerySmallSquare": "\u25AB", - "Eogon": "\u0118", - "Eopf": "\U0001D53C", - "Epsilon": "\u0395", - "Equal": "\u2A75", - "EqualTilde": "\u2242", - "Equilibrium": "\u21CC", - "Escr": "\u2130", - "Esim": "\u2A73", - "Eta": "\u0397", - "Euml": "\u00CB", - "Exists": "\u2203", - "ExponentialE": "\u2147", - "Fcy": "\u0424", - "Ffr": "\U0001D509", - "FilledSmallSquare": "\u25FC", - "FilledVerySmallSquare": "\u25AA", - "Fopf": "\U0001D53D", - "ForAll": "\u2200", - "Fouriertrf": "\u2131", - "Fscr": "\u2131", - "GJcy": "\u0403", - "GT": "\u003E", - "Gamma": "\u0393", - "Gammad": "\u03DC", - "Gbreve": "\u011E", - "Gcedil": "\u0122", - "Gcirc": "\u011C", - "Gcy": "\u0413", - "Gdot": "\u0120", - "Gfr": "\U0001D50A", - "Gg": "\u22D9", - "Gopf": "\U0001D53E", - "GreaterEqual": "\u2265", - "GreaterEqualLess": "\u22DB", - "GreaterFullEqual": "\u2267", - "GreaterGreater": "\u2AA2", - "GreaterLess": "\u2277", - "GreaterSlantEqual": "\u2A7E", - "GreaterTilde": "\u2273", - "Gscr": "\U0001D4A2", - "Gt": "\u226B", - "HARDcy": "\u042A", - "Hacek": "\u02C7", - "Hat": "\u005E", - "Hcirc": "\u0124", - "Hfr": "\u210C", - "HilbertSpace": "\u210B", - "Hopf": "\u210D", - "HorizontalLine": "\u2500", - "Hscr": "\u210B", - "Hstrok": "\u0126", - "HumpDownHump": "\u224E", - "HumpEqual": "\u224F", - "IEcy": "\u0415", - "IJlig": "\u0132", - "IOcy": "\u0401", - "Iacute": "\u00CD", - "Icirc": "\u00CE", - "Icy": "\u0418", - "Idot": "\u0130", - "Ifr": "\u2111", - "Igrave": "\u00CC", - "Im": "\u2111", - "Imacr": "\u012A", - "ImaginaryI": "\u2148", - "Implies": "\u21D2", - "Int": "\u222C", - "Integral": "\u222B", - "Intersection": "\u22C2", - "InvisibleComma": "\u2063", - "InvisibleTimes": "\u2062", - "Iogon": "\u012E", - "Iopf": "\U0001D540", - "Iota": "\u0399", - "Iscr": "\u2110", - "Itilde": "\u0128", - "Iukcy": "\u0406", - "Iuml": "\u00CF", - "Jcirc": "\u0134", - "Jcy": "\u0419", - "Jfr": "\U0001D50D", - "Jopf": "\U0001D541", - "Jscr": "\U0001D4A5", - "Jsercy": "\u0408", - "Jukcy": "\u0404", - "KHcy": "\u0425", - "KJcy": "\u040C", - "Kappa": "\u039A", - "Kcedil": "\u0136", - "Kcy": "\u041A", - "Kfr": "\U0001D50E", - "Kopf": "\U0001D542", - "Kscr": "\U0001D4A6", - "LJcy": "\u0409", - "LT": "\u003C", - "Lacute": "\u0139", - "Lambda": "\u039B", - "Lang": "\u27EA", - "Laplacetrf": "\u2112", - "Larr": "\u219E", - "Lcaron": "\u013D", - "Lcedil": "\u013B", - "Lcy": "\u041B", - "LeftAngleBracket": "\u27E8", - "LeftArrow": "\u2190", - "LeftArrowBar": "\u21E4", - "LeftArrowRightArrow": "\u21C6", - "LeftCeiling": "\u2308", - "LeftDoubleBracket": "\u27E6", - "LeftDownTeeVector": "\u2961", - "LeftDownVector": "\u21C3", - "LeftDownVectorBar": "\u2959", - "LeftFloor": "\u230A", - "LeftRightArrow": "\u2194", - "LeftRightVector": "\u294E", - "LeftTee": "\u22A3", - "LeftTeeArrow": "\u21A4", - "LeftTeeVector": "\u295A", - "LeftTriangle": "\u22B2", - "LeftTriangleBar": "\u29CF", - "LeftTriangleEqual": "\u22B4", - "LeftUpDownVector": "\u2951", - "LeftUpTeeVector": "\u2960", - "LeftUpVector": "\u21BF", - "LeftUpVectorBar": "\u2958", - "LeftVector": "\u21BC", - "LeftVectorBar": "\u2952", - "Leftarrow": "\u21D0", - "Leftrightarrow": "\u21D4", - "LessEqualGreater": "\u22DA", - "LessFullEqual": "\u2266", - "LessGreater": "\u2276", - "LessLess": "\u2AA1", - "LessSlantEqual": "\u2A7D", - "LessTilde": "\u2272", - "Lfr": "\U0001D50F", - "Ll": "\u22D8", - "Lleftarrow": "\u21DA", - "Lmidot": "\u013F", - "LongLeftArrow": "\u27F5", - "LongLeftRightArrow": "\u27F7", - "LongRightArrow": "\u27F6", - "Longleftarrow": "\u27F8", - "Longleftrightarrow": "\u27FA", - "Longrightarrow": "\u27F9", - "Lopf": "\U0001D543", - "LowerLeftArrow": "\u2199", - "LowerRightArrow": "\u2198", - "Lscr": "\u2112", - "Lsh": "\u21B0", - "Lstrok": "\u0141", - "Lt": "\u226A", - "Map": "\u2905", - "Mcy": "\u041C", - "MediumSpace": "\u205F", - "Mellintrf": "\u2133", - "Mfr": "\U0001D510", - "MinusPlus": "\u2213", - "Mopf": "\U0001D544", - "Mscr": "\u2133", - "Mu": "\u039C", - "NJcy": "\u040A", - "Nacute": "\u0143", - "Ncaron": "\u0147", - "Ncedil": "\u0145", - "Ncy": "\u041D", - "NegativeMediumSpace": "\u200B", - "NegativeThickSpace": "\u200B", - "NegativeThinSpace": "\u200B", - "NegativeVeryThinSpace": "\u200B", - "NestedGreaterGreater": "\u226B", - "NestedLessLess": "\u226A", - "NewLine": "\u000A", - "Nfr": "\U0001D511", - "NoBreak": "\u2060", - "NonBreakingSpace": "\u00A0", - "Nopf": "\u2115", - "Not": "\u2AEC", - "NotCongruent": "\u2262", - "NotCupCap": "\u226D", - "NotDoubleVerticalBar": "\u2226", - "NotElement": "\u2209", - "NotEqual": "\u2260", - "NotEqualTilde": "\u2242\u0338", - "NotExists": "\u2204", - "NotGreater": "\u226F", - "NotGreaterEqual": "\u2271", - "NotGreaterFullEqual": "\u2267\u0338", - "NotGreaterGreater": "\u226B\u0338", - "NotGreaterLess": "\u2279", - "NotGreaterSlantEqual": "\u2A7E\u0338", - "NotGreaterTilde": "\u2275", - "NotHumpDownHump": "\u224E\u0338", - "NotHumpEqual": "\u224F\u0338", - "NotLeftTriangle": "\u22EA", - "NotLeftTriangleBar": "\u29CF\u0338", - "NotLeftTriangleEqual": "\u22EC", - "NotLess": "\u226E", - "NotLessEqual": "\u2270", - "NotLessGreater": "\u2278", - "NotLessLess": "\u226A\u0338", - "NotLessSlantEqual": "\u2A7D\u0338", - "NotLessTilde": "\u2274", - "NotNestedGreaterGreater": "\u2AA2\u0338", - "NotNestedLessLess": "\u2AA1\u0338", - "NotPrecedes": "\u2280", - "NotPrecedesEqual": "\u2AAF\u0338", - "NotPrecedesSlantEqual": "\u22E0", - "NotReverseElement": "\u220C", - "NotRightTriangle": "\u22EB", - "NotRightTriangleBar": "\u29D0\u0338", - "NotRightTriangleEqual": "\u22ED", - "NotSquareSubset": "\u228F\u0338", - "NotSquareSubsetEqual": "\u22E2", - "NotSquareSuperset": "\u2290\u0338", - "NotSquareSupersetEqual": "\u22E3", - "NotSubset": "\u2282\u20D2", - "NotSubsetEqual": "\u2288", - "NotSucceeds": "\u2281", - "NotSucceedsEqual": "\u2AB0\u0338", - "NotSucceedsSlantEqual": "\u22E1", - "NotSucceedsTilde": "\u227F\u0338", - "NotSuperset": "\u2283\u20D2", - "NotSupersetEqual": "\u2289", - "NotTilde": "\u2241", - "NotTildeEqual": "\u2244", - "NotTildeFullEqual": "\u2247", - "NotTildeTilde": "\u2249", - "NotVerticalBar": "\u2224", - "Nscr": "\U0001D4A9", - "Ntilde": "\u00D1", - "Nu": "\u039D", - "OElig": "\u0152", - "Oacute": "\u00D3", - "Ocirc": "\u00D4", - "Ocy": "\u041E", - "Odblac": "\u0150", - "Ofr": "\U0001D512", - "Ograve": "\u00D2", - "Omacr": "\u014C", - "Omega": "\u03A9", - "Omicron": "\u039F", - "Oopf": "\U0001D546", - "OpenCurlyDoubleQuote": "\u201C", - "OpenCurlyQuote": "\u2018", - "Or": "\u2A54", - "Oscr": "\U0001D4AA", - "Oslash": "\u00D8", - "Otilde": "\u00D5", - "Otimes": "\u2A37", - "Ouml": "\u00D6", - "OverBar": "\u203E", - "OverBrace": "\u23DE", - "OverBracket": "\u23B4", - "OverParenthesis": "\u23DC", - "PartialD": "\u2202", - "Pcy": "\u041F", - "Pfr": "\U0001D513", - "Phi": "\u03A6", - "Pi": "\u03A0", - "PlusMinus": "\u00B1", - "Poincareplane": "\u210C", - "Popf": "\u2119", - "Pr": "\u2ABB", - "Precedes": "\u227A", - "PrecedesEqual": "\u2AAF", - "PrecedesSlantEqual": "\u227C", - "PrecedesTilde": "\u227E", - "Prime": "\u2033", - "Product": "\u220F", - "Proportion": "\u2237", - "Proportional": "\u221D", - "Pscr": "\U0001D4AB", - "Psi": "\u03A8", - "QUOT": "\u0022", - "Qfr": "\U0001D514", - "Qopf": "\u211A", - "Qscr": "\U0001D4AC", - "RBarr": "\u2910", - "REG": "\u00AE", - "Racute": "\u0154", - "Rang": "\u27EB", - "Rarr": "\u21A0", - "Rarrtl": "\u2916", - "Rcaron": "\u0158", - "Rcedil": "\u0156", - "Rcy": "\u0420", - "Re": "\u211C", - "ReverseElement": "\u220B", - "ReverseEquilibrium": "\u21CB", - "ReverseUpEquilibrium": "\u296F", - "Rfr": "\u211C", - "Rho": "\u03A1", - "RightAngleBracket": "\u27E9", - "RightArrow": "\u2192", - "RightArrowBar": "\u21E5", - "RightArrowLeftArrow": "\u21C4", - "RightCeiling": "\u2309", - "RightDoubleBracket": "\u27E7", - "RightDownTeeVector": "\u295D", - "RightDownVector": "\u21C2", - "RightDownVectorBar": "\u2955", - "RightFloor": "\u230B", - "RightTee": "\u22A2", - "RightTeeArrow": "\u21A6", - "RightTeeVector": "\u295B", - "RightTriangle": "\u22B3", - "RightTriangleBar": "\u29D0", - "RightTriangleEqual": "\u22B5", - "RightUpDownVector": "\u294F", - "RightUpTeeVector": "\u295C", - "RightUpVector": "\u21BE", - "RightUpVectorBar": "\u2954", - "RightVector": "\u21C0", - "RightVectorBar": "\u2953", - "Rightarrow": "\u21D2", - "Ropf": "\u211D", - "RoundImplies": "\u2970", - "Rrightarrow": "\u21DB", - "Rscr": "\u211B", - "Rsh": "\u21B1", - "RuleDelayed": "\u29F4", - "SHCHcy": "\u0429", - "SHcy": "\u0428", - "SOFTcy": "\u042C", - "Sacute": "\u015A", - "Sc": "\u2ABC", - "Scaron": "\u0160", - "Scedil": "\u015E", - "Scirc": "\u015C", - "Scy": "\u0421", - "Sfr": "\U0001D516", - "ShortDownArrow": "\u2193", - "ShortLeftArrow": "\u2190", - "ShortRightArrow": "\u2192", - "ShortUpArrow": "\u2191", - "Sigma": "\u03A3", - "SmallCircle": "\u2218", - "Sopf": "\U0001D54A", - "Sqrt": "\u221A", - "Square": "\u25A1", - "SquareIntersection": "\u2293", - "SquareSubset": "\u228F", - "SquareSubsetEqual": "\u2291", - "SquareSuperset": "\u2290", - "SquareSupersetEqual": "\u2292", - "SquareUnion": "\u2294", - "Sscr": "\U0001D4AE", - "Star": "\u22C6", - "Sub": "\u22D0", - "Subset": "\u22D0", - "SubsetEqual": "\u2286", - "Succeeds": "\u227B", - "SucceedsEqual": "\u2AB0", - "SucceedsSlantEqual": "\u227D", - "SucceedsTilde": "\u227F", - "SuchThat": "\u220B", - "Sum": "\u2211", - "Sup": "\u22D1", - "Superset": "\u2283", - "SupersetEqual": "\u2287", - "Supset": "\u22D1", - "THORN": "\u00DE", - "TRADE": "\u2122", - "TSHcy": "\u040B", - "TScy": "\u0426", - "Tab": "\u0009", - "Tau": "\u03A4", - "Tcaron": "\u0164", - "Tcedil": "\u0162", - "Tcy": "\u0422", - "Tfr": "\U0001D517", - "Therefore": "\u2234", - "Theta": "\u0398", - "ThickSpace": "\u205F\u200A", - "ThinSpace": "\u2009", - "Tilde": "\u223C", - "TildeEqual": "\u2243", - "TildeFullEqual": "\u2245", - "TildeTilde": "\u2248", - "Topf": "\U0001D54B", - "TripleDot": "\u20DB", - "Tscr": "\U0001D4AF", - "Tstrok": "\u0166", - "Uacute": "\u00DA", - "Uarr": "\u219F", - "Uarrocir": "\u2949", - "Ubrcy": "\u040E", - "Ubreve": "\u016C", - "Ucirc": "\u00DB", - "Ucy": "\u0423", - "Udblac": "\u0170", - "Ufr": "\U0001D518", - "Ugrave": "\u00D9", - "Umacr": "\u016A", - "UnderBar": "\u005F", - "UnderBrace": "\u23DF", - "UnderBracket": "\u23B5", - "UnderParenthesis": "\u23DD", - "Union": "\u22C3", - "UnionPlus": "\u228E", - "Uogon": "\u0172", - "Uopf": "\U0001D54C", - "UpArrow": "\u2191", - "UpArrowBar": "\u2912", - "UpArrowDownArrow": "\u21C5", - "UpDownArrow": "\u2195", - "UpEquilibrium": "\u296E", - "UpTee": "\u22A5", - "UpTeeArrow": "\u21A5", - "Uparrow": "\u21D1", - "Updownarrow": "\u21D5", - "UpperLeftArrow": "\u2196", - "UpperRightArrow": "\u2197", - "Upsi": "\u03D2", - "Upsilon": "\u03A5", - "Uring": "\u016E", - "Uscr": "\U0001D4B0", - "Utilde": "\u0168", - "Uuml": "\u00DC", - "VDash": "\u22AB", - "Vbar": "\u2AEB", - "Vcy": "\u0412", - "Vdash": "\u22A9", - "Vdashl": "\u2AE6", - "Vee": "\u22C1", - "Verbar": "\u2016", - "Vert": "\u2016", - "VerticalBar": "\u2223", - "VerticalLine": "\u007C", - "VerticalSeparator": "\u2758", - "VerticalTilde": "\u2240", - "VeryThinSpace": "\u200A", - "Vfr": "\U0001D519", - "Vopf": "\U0001D54D", - "Vscr": "\U0001D4B1", - "Vvdash": "\u22AA", - "Wcirc": "\u0174", - "Wedge": "\u22C0", - "Wfr": "\U0001D51A", - "Wopf": "\U0001D54E", - "Wscr": "\U0001D4B2", - "Xfr": "\U0001D51B", - "Xi": "\u039E", - "Xopf": "\U0001D54F", - "Xscr": "\U0001D4B3", - "YAcy": "\u042F", - "YIcy": "\u0407", - "YUcy": "\u042E", - "Yacute": "\u00DD", - "Ycirc": "\u0176", - "Ycy": "\u042B", - "Yfr": "\U0001D51C", - "Yopf": "\U0001D550", - "Yscr": "\U0001D4B4", - "Yuml": "\u0178", - "ZHcy": "\u0416", - "Zacute": "\u0179", - "Zcaron": "\u017D", - "Zcy": "\u0417", - "Zdot": "\u017B", - "ZeroWidthSpace": "\u200B", - "Zeta": "\u0396", - "Zfr": "\u2128", - "Zopf": "\u2124", - "Zscr": "\U0001D4B5", - "aacute": "\u00E1", - "abreve": "\u0103", - "ac": "\u223E", - "acE": "\u223E\u0333", - "acd": "\u223F", - "acirc": "\u00E2", - "acute": "\u00B4", - "acy": "\u0430", - "aelig": "\u00E6", - "af": "\u2061", - "afr": "\U0001D51E", - "agrave": "\u00E0", - "alefsym": "\u2135", - "aleph": "\u2135", - "alpha": "\u03B1", - "amacr": "\u0101", - "amalg": "\u2A3F", - "amp": "\u0026", - "and": "\u2227", - "andand": "\u2A55", - "andd": "\u2A5C", - "andslope": "\u2A58", - "andv": "\u2A5A", - "ang": "\u2220", - "ange": "\u29A4", - "angle": "\u2220", - "angmsd": "\u2221", - "angmsdaa": "\u29A8", - "angmsdab": "\u29A9", - "angmsdac": "\u29AA", - "angmsdad": "\u29AB", - "angmsdae": "\u29AC", - "angmsdaf": "\u29AD", - "angmsdag": "\u29AE", - "angmsdah": "\u29AF", - "angrt": "\u221F", - "angrtvb": "\u22BE", - "angrtvbd": "\u299D", - "angsph": "\u2222", - "angst": "\u00C5", - "angzarr": "\u237C", - "aogon": "\u0105", - "aopf": "\U0001D552", - "ap": "\u2248", - "apE": "\u2A70", - "apacir": "\u2A6F", - "ape": "\u224A", - "apid": "\u224B", - "apos": "\u0027", - "approx": "\u2248", - "approxeq": "\u224A", - "aring": "\u00E5", - "ascr": "\U0001D4B6", - "ast": "\u002A", - "asymp": "\u2248", - "asympeq": "\u224D", - "atilde": "\u00E3", - "auml": "\u00E4", - "awconint": "\u2233", - "awint": "\u2A11", - "bNot": "\u2AED", - "backcong": "\u224C", - "backepsilon": "\u03F6", - "backprime": "\u2035", - "backsim": "\u223D", - "backsimeq": "\u22CD", - "barvee": "\u22BD", - "barwed": "\u2305", - "barwedge": "\u2305", - "bbrk": "\u23B5", - "bbrktbrk": "\u23B6", - "bcong": "\u224C", - "bcy": "\u0431", - "bdquo": "\u201E", - "becaus": "\u2235", - "because": "\u2235", - "bemptyv": "\u29B0", - "bepsi": "\u03F6", - "bernou": "\u212C", - "beta": "\u03B2", - "beth": "\u2136", - "between": "\u226C", - "bfr": "\U0001D51F", - "bigcap": "\u22C2", - "bigcirc": "\u25EF", - "bigcup": "\u22C3", - "bigodot": "\u2A00", - "bigoplus": "\u2A01", - "bigotimes": "\u2A02", - "bigsqcup": "\u2A06", - "bigstar": "\u2605", - "bigtriangledown": "\u25BD", - "bigtriangleup": "\u25B3", - "biguplus": "\u2A04", - "bigvee": "\u22C1", - "bigwedge": "\u22C0", - "bkarow": "\u290D", - "blacklozenge": "\u29EB", - "blacksquare": "\u25AA", - "blacktriangle": "\u25B4", - "blacktriangledown": "\u25BE", - "blacktriangleleft": "\u25C2", - "blacktriangleright": "\u25B8", - "blank": "\u2423", - "blk12": "\u2592", - "blk14": "\u2591", - "blk34": "\u2593", - "block": "\u2588", - "bne": "\u003D\u20E5", - "bnequiv": "\u2261\u20E5", - "bnot": "\u2310", - "bopf": "\U0001D553", - "bot": "\u22A5", - "bottom": "\u22A5", - "bowtie": "\u22C8", - "boxDL": "\u2557", - "boxDR": "\u2554", - "boxDl": "\u2556", - "boxDr": "\u2553", - "boxH": "\u2550", - "boxHD": "\u2566", - "boxHU": "\u2569", - "boxHd": "\u2564", - "boxHu": "\u2567", - "boxUL": "\u255D", - "boxUR": "\u255A", - "boxUl": "\u255C", - "boxUr": "\u2559", - "boxV": "\u2551", - "boxVH": "\u256C", - "boxVL": "\u2563", - "boxVR": "\u2560", - "boxVh": "\u256B", - "boxVl": "\u2562", - "boxVr": "\u255F", - "boxbox": "\u29C9", - "boxdL": "\u2555", - "boxdR": "\u2552", - "boxdl": "\u2510", - "boxdr": "\u250C", - "boxh": "\u2500", - "boxhD": "\u2565", - "boxhU": "\u2568", - "boxhd": "\u252C", - "boxhu": "\u2534", - "boxminus": "\u229F", - "boxplus": "\u229E", - "boxtimes": "\u22A0", - "boxuL": "\u255B", - "boxuR": "\u2558", - "boxul": "\u2518", - "boxur": "\u2514", - "boxv": "\u2502", - "boxvH": "\u256A", - "boxvL": "\u2561", - "boxvR": "\u255E", - "boxvh": "\u253C", - "boxvl": "\u2524", - "boxvr": "\u251C", - "bprime": "\u2035", - "breve": "\u02D8", - "brvbar": "\u00A6", - "bscr": "\U0001D4B7", - "bsemi": "\u204F", - "bsim": "\u223D", - "bsime": "\u22CD", - "bsol": "\u005C", - "bsolb": "\u29C5", - "bsolhsub": "\u27C8", - "bull": "\u2022", - "bullet": "\u2022", - "bump": "\u224E", - "bumpE": "\u2AAE", - "bumpe": "\u224F", - "bumpeq": "\u224F", - "cacute": "\u0107", - "cap": "\u2229", - "capand": "\u2A44", - "capbrcup": "\u2A49", - "capcap": "\u2A4B", - "capcup": "\u2A47", - "capdot": "\u2A40", - "caps": "\u2229\uFE00", - "caret": "\u2041", - "caron": "\u02C7", - "ccaps": "\u2A4D", - "ccaron": "\u010D", - "ccedil": "\u00E7", - "ccirc": "\u0109", - "ccups": "\u2A4C", - "ccupssm": "\u2A50", - "cdot": "\u010B", - "cedil": "\u00B8", - "cemptyv": "\u29B2", - "cent": "\u00A2", - "centerdot": "\u00B7", - "cfr": "\U0001D520", - "chcy": "\u0447", - "check": "\u2713", - "checkmark": "\u2713", - "chi": "\u03C7", - "cir": "\u25CB", - "cirE": "\u29C3", - "circ": "\u02C6", - "circeq": "\u2257", - "circlearrowleft": "\u21BA", - "circlearrowright": "\u21BB", - "circledR": "\u00AE", - "circledS": "\u24C8", - "circledast": "\u229B", - "circledcirc": "\u229A", - "circleddash": "\u229D", - "cire": "\u2257", - "cirfnint": "\u2A10", - "cirmid": "\u2AEF", - "cirscir": "\u29C2", - "clubs": "\u2663", - "clubsuit": "\u2663", - "colon": "\u003A", - "colone": "\u2254", - "coloneq": "\u2254", - "comma": "\u002C", - "commat": "\u0040", - "comp": "\u2201", - "compfn": "\u2218", - "complement": "\u2201", - "complexes": "\u2102", - "cong": "\u2245", - "congdot": "\u2A6D", - "conint": "\u222E", - "copf": "\U0001D554", - "coprod": "\u2210", - "copy": "\u00A9", - "copysr": "\u2117", - "crarr": "\u21B5", - "cross": "\u2717", - "cscr": "\U0001D4B8", - "csub": "\u2ACF", - "csube": "\u2AD1", - "csup": "\u2AD0", - "csupe": "\u2AD2", - "ctdot": "\u22EF", - "cudarrl": "\u2938", - "cudarrr": "\u2935", - "cuepr": "\u22DE", - "cuesc": "\u22DF", - "cularr": "\u21B6", - "cularrp": "\u293D", - "cup": "\u222A", - "cupbrcap": "\u2A48", - "cupcap": "\u2A46", - "cupcup": "\u2A4A", - "cupdot": "\u228D", - "cupor": "\u2A45", - "cups": "\u222A\uFE00", - "curarr": "\u21B7", - "curarrm": "\u293C", - "curlyeqprec": "\u22DE", - "curlyeqsucc": "\u22DF", - "curlyvee": "\u22CE", - "curlywedge": "\u22CF", - "curren": "\u00A4", - "curvearrowleft": "\u21B6", - "curvearrowright": "\u21B7", - "cuvee": "\u22CE", - "cuwed": "\u22CF", - "cwconint": "\u2232", - "cwint": "\u2231", - "cylcty": "\u232D", - "dArr": "\u21D3", - "dHar": "\u2965", - "dagger": "\u2020", - "daleth": "\u2138", - "darr": "\u2193", - "dash": "\u2010", - "dashv": "\u22A3", - "dbkarow": "\u290F", - "dblac": "\u02DD", - "dcaron": "\u010F", - "dcy": "\u0434", - "dd": "\u2146", - "ddagger": "\u2021", - "ddarr": "\u21CA", - "ddotseq": "\u2A77", - "deg": "\u00B0", - "delta": "\u03B4", - "demptyv": "\u29B1", - "dfisht": "\u297F", - "dfr": "\U0001D521", - "dharl": "\u21C3", - "dharr": "\u21C2", - "diam": "\u22C4", - "diamond": "\u22C4", - "diamondsuit": "\u2666", - "diams": "\u2666", - "die": "\u00A8", - "digamma": "\u03DD", - "disin": "\u22F2", - "div": "\u00F7", - "divide": "\u00F7", - "divideontimes": "\u22C7", - "divonx": "\u22C7", - "djcy": "\u0452", - "dlcorn": "\u231E", - "dlcrop": "\u230D", - "dollar": "\u0024", - "dopf": "\U0001D555", - "dot": "\u02D9", - "doteq": "\u2250", - "doteqdot": "\u2251", - "dotminus": "\u2238", - "dotplus": "\u2214", - "dotsquare": "\u22A1", - "doublebarwedge": "\u2306", - "downarrow": "\u2193", - "downdownarrows": "\u21CA", - "downharpoonleft": "\u21C3", - "downharpoonright": "\u21C2", - "drbkarow": "\u2910", - "drcorn": "\u231F", - "drcrop": "\u230C", - "dscr": "\U0001D4B9", - "dscy": "\u0455", - "dsol": "\u29F6", - "dstrok": "\u0111", - "dtdot": "\u22F1", - "dtri": "\u25BF", - "dtrif": "\u25BE", - "duarr": "\u21F5", - "duhar": "\u296F", - "dwangle": "\u29A6", - "dzcy": "\u045F", - "dzigrarr": "\u27FF", - "eDDot": "\u2A77", - "eDot": "\u2251", - "eacute": "\u00E9", - "easter": "\u2A6E", - "ecaron": "\u011B", - "ecir": "\u2256", - "ecirc": "\u00EA", - "ecolon": "\u2255", - "ecy": "\u044D", - "edot": "\u0117", - "ee": "\u2147", - "efDot": "\u2252", - "efr": "\U0001D522", - "eg": "\u2A9A", - "egrave": "\u00E8", - "egs": "\u2A96", - "egsdot": "\u2A98", - "el": "\u2A99", - "elinters": "\u23E7", - "ell": "\u2113", - "els": "\u2A95", - "elsdot": "\u2A97", - "emacr": "\u0113", - "empty": "\u2205", - "emptyset": "\u2205", - "emptyv": "\u2205", - "emsp": "\u2003", - "emsp13": "\u2004", - "emsp14": "\u2005", - "eng": "\u014B", - "ensp": "\u2002", - "eogon": "\u0119", - "eopf": "\U0001D556", - "epar": "\u22D5", - "eparsl": "\u29E3", - "eplus": "\u2A71", - "epsi": "\u03B5", - "epsilon": "\u03B5", - "epsiv": "\u03F5", - "eqcirc": "\u2256", - "eqcolon": "\u2255", - "eqsim": "\u2242", - "eqslantgtr": "\u2A96", - "eqslantless": "\u2A95", - "equals": "\u003D", - "equest": "\u225F", - "equiv": "\u2261", - "equivDD": "\u2A78", - "eqvparsl": "\u29E5", - "erDot": "\u2253", - "erarr": "\u2971", - "escr": "\u212F", - "esdot": "\u2250", - "esim": "\u2242", - "eta": "\u03B7", - "eth": "\u00F0", - "euml": "\u00EB", - "euro": "\u20AC", - "excl": "\u0021", - "exist": "\u2203", - "expectation": "\u2130", - "exponentiale": "\u2147", - "fallingdotseq": "\u2252", - "fcy": "\u0444", - "female": "\u2640", - "ffilig": "\uFB03", - "fflig": "\uFB00", - "ffllig": "\uFB04", - "ffr": "\U0001D523", - "filig": "\uFB01", - "fjlig": "\u0066\u006A fj", - "flat": "\u266D", - "fllig": "\uFB02", - "fltns": "\u25B1", - "fnof": "\u0192", - "fopf": "\U0001D557", - "forall": "\u2200", - "fork": "\u22D4", - "forkv": "\u2AD9", - "fpartint": "\u2A0D", - "frac12": "\u00BD", - "frac13": "\u2153", - "frac14": "\u00BC", - "frac15": "\u2155", - "frac16": "\u2159", - "frac18": "\u215B", - "frac23": "\u2154", - "frac25": "\u2156", - "frac34": "\u00BE", - "frac35": "\u2157", - "frac38": "\u215C", - "frac45": "\u2158", - "frac56": "\u215A", - "frac58": "\u215D", - "frac78": "\u215E", - "frasl": "\u2044", - "frown": "\u2322", - "fscr": "\U0001D4BB", - "gE": "\u2267", - "gEl": "\u2A8C", - "gacute": "\u01F5", - "gamma": "\u03B3", - "gammad": "\u03DD", - "gap": "\u2A86", - "gbreve": "\u011F", - "gcirc": "\u011D", - "gcy": "\u0433", - "gdot": "\u0121", - "ge": "\u2265", - "gel": "\u22DB", - "geq": "\u2265", - "geqq": "\u2267", - "geqslant": "\u2A7E", - "ges": "\u2A7E", - "gescc": "\u2AA9", - "gesdot": "\u2A80", - "gesdoto": "\u2A82", - "gesdotol": "\u2A84", - "gesl": "\u22DB\uFE00", - "gesles": "\u2A94", - "gfr": "\U0001D524", - "gg": "\u226B", - "ggg": "\u22D9", - "gimel": "\u2137", - "gjcy": "\u0453", - "gl": "\u2277", - "glE": "\u2A92", - "gla": "\u2AA5", - "glj": "\u2AA4", - "gnE": "\u2269", - "gnap": "\u2A8A", - "gnapprox": "\u2A8A", - "gne": "\u2A88", - "gneq": "\u2A88", - "gneqq": "\u2269", - "gnsim": "\u22E7", - "gopf": "\U0001D558", - "grave": "\u0060", - "gscr": "\u210A", - "gsim": "\u2273", - "gsime": "\u2A8E", - "gsiml": "\u2A90", - "gt": "\u003E", - "gtcc": "\u2AA7", - "gtcir": "\u2A7A", - "gtdot": "\u22D7", - "gtlPar": "\u2995", - "gtquest": "\u2A7C", - "gtrapprox": "\u2A86", - "gtrarr": "\u2978", - "gtrdot": "\u22D7", - "gtreqless": "\u22DB", - "gtreqqless": "\u2A8C", - "gtrless": "\u2277", - "gtrsim": "\u2273", - "gvertneqq": "\u2269\uFE00", - "gvnE": "\u2269\uFE00", - "hArr": "\u21D4", - "hairsp": "\u200A", - "half": "\u00BD", - "hamilt": "\u210B", - "hardcy": "\u044A", - "harr": "\u2194", - "harrcir": "\u2948", - "harrw": "\u21AD", - "hbar": "\u210F", - "hcirc": "\u0125", - "hearts": "\u2665", - "heartsuit": "\u2665", - "hellip": "\u2026", - "hercon": "\u22B9", - "hfr": "\U0001D525", - "hksearow": "\u2925", - "hkswarow": "\u2926", - "hoarr": "\u21FF", - "homtht": "\u223B", - "hookleftarrow": "\u21A9", - "hookrightarrow": "\u21AA", - "hopf": "\U0001D559", - "horbar": "\u2015", - "hscr": "\U0001D4BD", - "hslash": "\u210F", - "hstrok": "\u0127", - "hybull": "\u2043", - "hyphen": "\u2010", - "iacute": "\u00ED", - "ic": "\u2063", - "icirc": "\u00EE", - "icy": "\u0438", - "iecy": "\u0435", - "iexcl": "\u00A1", - "iff": "\u21D4", - "ifr": "\U0001D526", - "igrave": "\u00EC", - "ii": "\u2148", - "iiiint": "\u2A0C", - "iiint": "\u222D", - "iinfin": "\u29DC", - "iiota": "\u2129", - "ijlig": "\u0133", - "imacr": "\u012B", - "image": "\u2111", - "imagline": "\u2110", - "imagpart": "\u2111", - "imath": "\u0131", - "imof": "\u22B7", - "imped": "\u01B5", - "in": "\u2208", - "incare": "\u2105", - "infin": "\u221E", - "infintie": "\u29DD", - "inodot": "\u0131", - "int": "\u222B", - "intcal": "\u22BA", - "integers": "\u2124", - "intercal": "\u22BA", - "intlarhk": "\u2A17", - "intprod": "\u2A3C", - "iocy": "\u0451", - "iogon": "\u012F", - "iopf": "\U0001D55A", - "iota": "\u03B9", - "iprod": "\u2A3C", - "iquest": "\u00BF", - "iscr": "\U0001D4BE", - "isin": "\u2208", - "isinE": "\u22F9", - "isindot": "\u22F5", - "isins": "\u22F4", - "isinsv": "\u22F3", - "isinv": "\u2208", - "it": "\u2062", - "itilde": "\u0129", - "iukcy": "\u0456", - "iuml": "\u00EF", - "jcirc": "\u0135", - "jcy": "\u0439", - "jfr": "\U0001D527", - "jmath": "\u0237", - "jopf": "\U0001D55B", - "jscr": "\U0001D4BF", - "jsercy": "\u0458", - "jukcy": "\u0454", - "kappa": "\u03BA", - "kappav": "\u03F0", - "kcedil": "\u0137", - "kcy": "\u043A", - "kfr": "\U0001D528", - "kgreen": "\u0138", - "khcy": "\u0445", - "kjcy": "\u045C", - "kopf": "\U0001D55C", - "kscr": "\U0001D4C0", - "lAarr": "\u21DA", - "lArr": "\u21D0", - "lAtail": "\u291B", - "lBarr": "\u290E", - "lE": "\u2266", - "lEg": "\u2A8B", - "lHar": "\u2962", - "lacute": "\u013A", - "laemptyv": "\u29B4", - "lagran": "\u2112", - "lambda": "\u03BB", - "lang": "\u27E8", - "langd": "\u2991", - "langle": "\u27E8", - "lap": "\u2A85", - "laquo": "\u00AB", - "larr": "\u2190", - "larrb": "\u21E4", - "larrbfs": "\u291F", - "larrfs": "\u291D", - "larrhk": "\u21A9", - "larrlp": "\u21AB", - "larrpl": "\u2939", - "larrsim": "\u2973", - "larrtl": "\u21A2", - "lat": "\u2AAB", - "latail": "\u2919", - "late": "\u2AAD", - "lates": "\u2AAD\uFE00", - "lbarr": "\u290C", - "lbbrk": "\u2772", - "lbrace": "\u007B", - "lbrack": "\u005B", - "lbrke": "\u298B", - "lbrksld": "\u298F", - "lbrkslu": "\u298D", - "lcaron": "\u013E", - "lcedil": "\u013C", - "lceil": "\u2308", - "lcub": "\u007B", - "lcy": "\u043B", - "ldca": "\u2936", - "ldquo": "\u201C", - "ldquor": "\u201E", - "ldrdhar": "\u2967", - "ldrushar": "\u294B", - "ldsh": "\u21B2", - "le": "\u2264", - "leftarrow": "\u2190", - "leftarrowtail": "\u21A2", - "leftharpoondown": "\u21BD", - "leftharpoonup": "\u21BC", - "leftleftarrows": "\u21C7", - "leftrightarrow": "\u2194", - "leftrightarrows": "\u21C6", - "leftrightharpoons": "\u21CB", - "leftrightsquigarrow": "\u21AD", - "leftthreetimes": "\u22CB", - "leg": "\u22DA", - "leq": "\u2264", - "leqq": "\u2266", - "leqslant": "\u2A7D", - "les": "\u2A7D", - "lescc": "\u2AA8", - "lesdot": "\u2A7F", - "lesdoto": "\u2A81", - "lesdotor": "\u2A83", - "lesg": "\u22DA\uFE00", - "lesges": "\u2A93", - "lessapprox": "\u2A85", - "lessdot": "\u22D6", - "lesseqgtr": "\u22DA", - "lesseqqgtr": "\u2A8B", - "lessgtr": "\u2276", - "lesssim": "\u2272", - "lfisht": "\u297C", - "lfloor": "\u230A", - "lfr": "\U0001D529", - "lg": "\u2276", - "lgE": "\u2A91", - "lhard": "\u21BD", - "lharu": "\u21BC", - "lharul": "\u296A", - "lhblk": "\u2584", - "ljcy": "\u0459", - "ll": "\u226A", - "llarr": "\u21C7", - "llcorner": "\u231E", - "llhard": "\u296B", - "lltri": "\u25FA", - "lmidot": "\u0140", - "lmoust": "\u23B0", - "lmoustache": "\u23B0", - "lnE": "\u2268", - "lnap": "\u2A89", - "lnapprox": "\u2A89", - "lne": "\u2A87", - "lneq": "\u2A87", - "lneqq": "\u2268", - "lnsim": "\u22E6", - "loang": "\u27EC", - "loarr": "\u21FD", - "lobrk": "\u27E6", - "longleftarrow": "\u27F5", - "longleftrightarrow": "\u27F7", - "longmapsto": "\u27FC", - "longrightarrow": "\u27F6", - "looparrowleft": "\u21AB", - "looparrowright": "\u21AC", - "lopar": "\u2985", - "lopf": "\U0001D55D", - "loplus": "\u2A2D", - "lotimes": "\u2A34", - "lowast": "\u2217", - "lowbar": "\u005F", - "loz": "\u25CA", - "lozenge": "\u25CA", - "lozf": "\u29EB", - "lpar": "\u0028", - "lparlt": "\u2993", - "lrarr": "\u21C6", - "lrcorner": "\u231F", - "lrhar": "\u21CB", - "lrhard": "\u296D", - "lrm": "\u200E", - "lrtri": "\u22BF", - "lsaquo": "\u2039", - "lscr": "\U0001D4C1", - "lsh": "\u21B0", - "lsim": "\u2272", - "lsime": "\u2A8D", - "lsimg": "\u2A8F", - "lsqb": "\u005B", - "lsquo": "\u2018", - "lsquor": "\u201A", - "lstrok": "\u0142", - "lt": "\u003C", - "ltcc": "\u2AA6", - "ltcir": "\u2A79", - "ltdot": "\u22D6", - "lthree": "\u22CB", - "ltimes": "\u22C9", - "ltlarr": "\u2976", - "ltquest": "\u2A7B", - "ltrPar": "\u2996", - "ltri": "\u25C3", - "ltrie": "\u22B4", - "ltrif": "\u25C2", - "lurdshar": "\u294A", - "luruhar": "\u2966", - "lvertneqq": "\u2268\uFE00", - "lvnE": "\u2268\uFE00", - "mDDot": "\u223A", - "macr": "\u00AF", - "male": "\u2642", - "malt": "\u2720", - "maltese": "\u2720", - "map": "\u21A6", - "mapsto": "\u21A6", - "mapstodown": "\u21A7", - "mapstoleft": "\u21A4", - "mapstoup": "\u21A5", - "marker": "\u25AE", - "mcomma": "\u2A29", - "mcy": "\u043C", - "mdash": "\u2014", - "measuredangle": "\u2221", - "mfr": "\U0001D52A", - "mho": "\u2127", - "micro": "\u00B5", - "mid": "\u2223", - "midast": "\u002A", - "midcir": "\u2AF0", - "middot": "\u00B7", - "minus": "\u2212", - "minusb": "\u229F", - "minusd": "\u2238", - "minusdu": "\u2A2A", - "mlcp": "\u2ADB", - "mldr": "\u2026", - "mnplus": "\u2213", - "models": "\u22A7", - "mopf": "\U0001D55E", - "mp": "\u2213", - "mscr": "\U0001D4C2", - "mstpos": "\u223E", - "mu": "\u03BC", - "multimap": "\u22B8", - "mumap": "\u22B8", - "nGg": "\u22D9\u0338", - "nGt": "\u226B\u20D2", - "nGtv": "\u226B\u0338", - "nLeftarrow": "\u21CD", - "nLeftrightarrow": "\u21CE", - "nLl": "\u22D8\u0338", - "nLt": "\u226A\u20D2", - "nLtv": "\u226A\u0338", - "nRightarrow": "\u21CF", - "nVDash": "\u22AF", - "nVdash": "\u22AE", - "nabla": "\u2207", - "nacute": "\u0144", - "nang": "\u2220\u20D2", - "nap": "\u2249", - "napE": "\u2A70\u0338", - "napid": "\u224B\u0338", - "napos": "\u0149", - "napprox": "\u2249", - "natur": "\u266E", - "natural": "\u266E", - "naturals": "\u2115", - "nbsp": "\u00A0", - "nbump": "\u224E\u0338", - "nbumpe": "\u224F\u0338", - "ncap": "\u2A43", - "ncaron": "\u0148", - "ncedil": "\u0146", - "ncong": "\u2247", - "ncongdot": "\u2A6D\u0338", - "ncup": "\u2A42", - "ncy": "\u043D", - "ndash": "\u2013", - "ne": "\u2260", - "neArr": "\u21D7", - "nearhk": "\u2924", - "nearr": "\u2197", - "nearrow": "\u2197", - "nedot": "\u2250\u0338", - "nequiv": "\u2262", - "nesear": "\u2928", - "nesim": "\u2242\u0338", - "nexist": "\u2204", - "nexists": "\u2204", - "nfr": "\U0001D52B", - "ngE": "\u2267\u0338", - "nge": "\u2271", - "ngeq": "\u2271", - "ngeqq": "\u2267\u0338", - "ngeqslant": "\u2A7E\u0338", - "nges": "\u2A7E\u0338", - "ngsim": "\u2275", - "ngt": "\u226F", - "ngtr": "\u226F", - "nhArr": "\u21CE", - "nharr": "\u21AE", - "nhpar": "\u2AF2", - "ni": "\u220B", - "nis": "\u22FC", - "nisd": "\u22FA", - "niv": "\u220B", - "njcy": "\u045A", - "nlArr": "\u21CD", - "nlE": "\u2266\u0338", - "nlarr": "\u219A", - "nldr": "\u2025", - "nle": "\u2270", - "nleftarrow": "\u219A", - "nleftrightarrow": "\u21AE", - "nleq": "\u2270", - "nleqq": "\u2266\u0338", - "nleqslant": "\u2A7D\u0338", - "nles": "\u2A7D\u0338", - "nless": "\u226E", - "nlsim": "\u2274", - "nlt": "\u226E", - "nltri": "\u22EA", - "nltrie": "\u22EC", - "nmid": "\u2224", - "nopf": "\U0001D55F", - "not": "\u00AC", - "notin": "\u2209", - "notinE": "\u22F9\u0338", - "notindot": "\u22F5\u0338", - "notinva": "\u2209", - "notinvb": "\u22F7", - "notinvc": "\u22F6", - "notni": "\u220C", - "notniva": "\u220C", - "notnivb": "\u22FE", - "notnivc": "\u22FD", - "npar": "\u2226", - "nparallel": "\u2226", - "nparsl": "\u2AFD\u20E5", - "npart": "\u2202\u0338", - "npolint": "\u2A14", - "npr": "\u2280", - "nprcue": "\u22E0", - "npre": "\u2AAF\u0338", - "nprec": "\u2280", - "npreceq": "\u2AAF\u0338", - "nrArr": "\u21CF", - "nrarr": "\u219B", - "nrarrc": "\u2933\u0338", - "nrarrw": "\u219D\u0338", - "nrightarrow": "\u219B", - "nrtri": "\u22EB", - "nrtrie": "\u22ED", - "nsc": "\u2281", - "nsccue": "\u22E1", - "nsce": "\u2AB0\u0338", - "nscr": "\U0001D4C3", - "nshortmid": "\u2224", - "nshortparallel": "\u2226", - "nsim": "\u2241", - "nsime": "\u2244", - "nsimeq": "\u2244", - "nsmid": "\u2224", - "nspar": "\u2226", - "nsqsube": "\u22E2", - "nsqsupe": "\u22E3", - "nsub": "\u2284", - "nsubE": "\u2AC5\u0338", - "nsube": "\u2288", - "nsubset": "\u2282\u20D2", - "nsubseteq": "\u2288", - "nsubseteqq": "\u2AC5\u0338", - "nsucc": "\u2281", - "nsucceq": "\u2AB0\u0338", - "nsup": "\u2285", - "nsupE": "\u2AC6\u0338", - "nsupe": "\u2289", - "nsupset": "\u2283\u20D2", - "nsupseteq": "\u2289", - "nsupseteqq": "\u2AC6\u0338", - "ntgl": "\u2279", - "ntilde": "\u00F1", - "ntlg": "\u2278", - "ntriangleleft": "\u22EA", - "ntrianglelefteq": "\u22EC", - "ntriangleright": "\u22EB", - "ntrianglerighteq": "\u22ED", - "nu": "\u03BD", - "num": "\u0023", - "numero": "\u2116", - "numsp": "\u2007", - "nvDash": "\u22AD", - "nvHarr": "\u2904", - "nvap": "\u224D\u20D2", - "nvdash": "\u22AC", - "nvge": "\u2265\u20D2", - "nvgt": "\u003E\u20D2", - "nvinfin": "\u29DE", - "nvlArr": "\u2902", - "nvle": "\u2264\u20D2", - "nvlt": "\u003C\u20D2", - "nvltrie": "\u22B4\u20D2", - "nvrArr": "\u2903", - "nvrtrie": "\u22B5\u20D2", - "nvsim": "\u223C\u20D2", - "nwArr": "\u21D6", - "nwarhk": "\u2923", - "nwarr": "\u2196", - "nwarrow": "\u2196", - "nwnear": "\u2927", - "oS": "\u24C8", - "oacute": "\u00F3", - "oast": "\u229B", - "ocir": "\u229A", - "ocirc": "\u00F4", - "ocy": "\u043E", - "odash": "\u229D", - "odblac": "\u0151", - "odiv": "\u2A38", - "odot": "\u2299", - "odsold": "\u29BC", - "oelig": "\u0153", - "ofcir": "\u29BF", - "ofr": "\U0001D52C", - "ogon": "\u02DB", - "ograve": "\u00F2", - "ogt": "\u29C1", - "ohbar": "\u29B5", - "ohm": "\u03A9", - "oint": "\u222E", - "olarr": "\u21BA", - "olcir": "\u29BE", - "olcross": "\u29BB", - "oline": "\u203E", - "olt": "\u29C0", - "omacr": "\u014D", - "omega": "\u03C9", - "omicron": "\u03BF", - "omid": "\u29B6", - "ominus": "\u2296", - "oopf": "\U0001D560", - "opar": "\u29B7", - "operp": "\u29B9", - "oplus": "\u2295", - "or": "\u2228", - "orarr": "\u21BB", - "ord": "\u2A5D", - "order": "\u2134", - "orderof": "\u2134", - "ordf": "\u00AA", - "ordm": "\u00BA", - "origof": "\u22B6", - "oror": "\u2A56", - "orslope": "\u2A57", - "orv": "\u2A5B", - "oscr": "\u2134", - "oslash": "\u00F8", - "osol": "\u2298", - "otilde": "\u00F5", - "otimes": "\u2297", - "otimesas": "\u2A36", - "ouml": "\u00F6", - "ovbar": "\u233D", - "par": "\u2225", - "para": "\u00B6", - "parallel": "\u2225", - "parsim": "\u2AF3", - "parsl": "\u2AFD", - "part": "\u2202", - "pcy": "\u043F", - "percnt": "\u0025", - "period": "\u002E", - "permil": "\u2030", - "perp": "\u22A5", - "pertenk": "\u2031", - "pfr": "\U0001D52D", - "phi": "\u03C6", - "phiv": "\u03D5", - "phmmat": "\u2133", - "phone": "\u260E", - "pi": "\u03C0", - "pitchfork": "\u22D4", - "piv": "\u03D6", - "planck": "\u210F", - "planckh": "\u210E", - "plankv": "\u210F", - "plus": "\u002B", - "plusacir": "\u2A23", - "plusb": "\u229E", - "pluscir": "\u2A22", - "plusdo": "\u2214", - "plusdu": "\u2A25", - "pluse": "\u2A72", - "plusmn": "\u00B1", - "plussim": "\u2A26", - "plustwo": "\u2A27", - "pm": "\u00B1", - "pointint": "\u2A15", - "popf": "\U0001D561", - "pound": "\u00A3", - "pr": "\u227A", - "prE": "\u2AB3", - "prap": "\u2AB7", - "prcue": "\u227C", - "pre": "\u2AAF", - "prec": "\u227A", - "precapprox": "\u2AB7", - "preccurlyeq": "\u227C", - "preceq": "\u2AAF", - "precnapprox": "\u2AB9", - "precneqq": "\u2AB5", - "precnsim": "\u22E8", - "precsim": "\u227E", - "prime": "\u2032", - "primes": "\u2119", - "prnE": "\u2AB5", - "prnap": "\u2AB9", - "prnsim": "\u22E8", - "prod": "\u220F", - "profalar": "\u232E", - "profline": "\u2312", - "profsurf": "\u2313", - "prop": "\u221D", - "propto": "\u221D", - "prsim": "\u227E", - "prurel": "\u22B0", - "pscr": "\U0001D4C5", - "psi": "\u03C8", - "puncsp": "\u2008", - "qfr": "\U0001D52E", - "qint": "\u2A0C", - "qopf": "\U0001D562", - "qprime": "\u2057", - "qscr": "\U0001D4C6", - "quaternions": "\u210D", - "quatint": "\u2A16", - "quest": "\u003F", - "questeq": "\u225F", - "quot": "\u0022", - "rAarr": "\u21DB", - "rArr": "\u21D2", - "rAtail": "\u291C", - "rBarr": "\u290F", - "rHar": "\u2964", - "race": "\u223D\u0331", - "racute": "\u0155", - "radic": "\u221A", - "raemptyv": "\u29B3", - "rang": "\u27E9", - "rangd": "\u2992", - "range": "\u29A5", - "rangle": "\u27E9", - "raquo": "\u00BB", - "rarr": "\u2192", - "rarrap": "\u2975", - "rarrb": "\u21E5", - "rarrbfs": "\u2920", - "rarrc": "\u2933", - "rarrfs": "\u291E", - "rarrhk": "\u21AA", - "rarrlp": "\u21AC", - "rarrpl": "\u2945", - "rarrsim": "\u2974", - "rarrtl": "\u21A3", - "rarrw": "\u219D", - "ratail": "\u291A", - "ratio": "\u2236", - "rationals": "\u211A", - "rbarr": "\u290D", - "rbbrk": "\u2773", - "rbrace": "\u007D", - "rbrack": "\u005D", - "rbrke": "\u298C", - "rbrksld": "\u298E", - "rbrkslu": "\u2990", - "rcaron": "\u0159", - "rcedil": "\u0157", - "rceil": "\u2309", - "rcub": "\u007D", - "rcy": "\u0440", - "rdca": "\u2937", - "rdldhar": "\u2969", - "rdquo": "\u201D", - "rdquor": "\u201D", - "rdsh": "\u21B3", - "real": "\u211C", - "realine": "\u211B", - "realpart": "\u211C", - "reals": "\u211D", - "rect": "\u25AD", - "reg": "\u00AE", - "rfisht": "\u297D", - "rfloor": "\u230B", - "rfr": "\U0001D52F", - "rhard": "\u21C1", - "rharu": "\u21C0", - "rharul": "\u296C", - "rho": "\u03C1", - "rhov": "\u03F1", - "rightarrow": "\u2192", - "rightarrowtail": "\u21A3", - "rightharpoondown": "\u21C1", - "rightharpoonup": "\u21C0", - "rightleftarrows": "\u21C4", - "rightleftharpoons": "\u21CC", - "rightrightarrows": "\u21C9", - "rightsquigarrow": "\u219D", - "rightthreetimes": "\u22CC", - "ring": "\u02DA", - "risingdotseq": "\u2253", - "rlarr": "\u21C4", - "rlhar": "\u21CC", - "rlm": "\u200F", - "rmoust": "\u23B1", - "rmoustache": "\u23B1", - "rnmid": "\u2AEE", - "roang": "\u27ED", - "roarr": "\u21FE", - "robrk": "\u27E7", - "ropar": "\u2986", - "ropf": "\U0001D563", - "roplus": "\u2A2E", - "rotimes": "\u2A35", - "rpar": "\u0029", - "rpargt": "\u2994", - "rppolint": "\u2A12", - "rrarr": "\u21C9", - "rsaquo": "\u203A", - "rscr": "\U0001D4C7", - "rsh": "\u21B1", - "rsqb": "\u005D", - "rsquo": "\u2019", - "rsquor": "\u2019", - "rthree": "\u22CC", - "rtimes": "\u22CA", - "rtri": "\u25B9", - "rtrie": "\u22B5", - "rtrif": "\u25B8", - "rtriltri": "\u29CE", - "ruluhar": "\u2968", - "rx": "\u211E", - "sacute": "\u015B", - "sbquo": "\u201A", - "sc": "\u227B", - "scE": "\u2AB4", - "scap": "\u2AB8", - "scaron": "\u0161", - "sccue": "\u227D", - "sce": "\u2AB0", - "scedil": "\u015F", - "scirc": "\u015D", - "scnE": "\u2AB6", - "scnap": "\u2ABA", - "scnsim": "\u22E9", - "scpolint": "\u2A13", - "scsim": "\u227F", - "scy": "\u0441", - "sdot": "\u22C5", - "sdotb": "\u22A1", - "sdote": "\u2A66", - "seArr": "\u21D8", - "searhk": "\u2925", - "searr": "\u2198", - "searrow": "\u2198", - "sect": "\u00A7", - "semi": "\u003B", - "seswar": "\u2929", - "setminus": "\u2216", - "setmn": "\u2216", - "sext": "\u2736", - "sfr": "\U0001D530", - "sfrown": "\u2322", - "sharp": "\u266F", - "shchcy": "\u0449", - "shcy": "\u0448", - "shortmid": "\u2223", - "shortparallel": "\u2225", - "shy": "\u00AD", - "sigma": "\u03C3", - "sigmaf": "\u03C2", - "sigmav": "\u03C2", - "sim": "\u223C", - "simdot": "\u2A6A", - "sime": "\u2243", - "simeq": "\u2243", - "simg": "\u2A9E", - "simgE": "\u2AA0", - "siml": "\u2A9D", - "simlE": "\u2A9F", - "simne": "\u2246", - "simplus": "\u2A24", - "simrarr": "\u2972", - "slarr": "\u2190", - "smallsetminus": "\u2216", - "smashp": "\u2A33", - "smeparsl": "\u29E4", - "smid": "\u2223", - "smile": "\u2323", - "smt": "\u2AAA", - "smte": "\u2AAC", - "smtes": "\u2AAC\uFE00", - "softcy": "\u044C", - "sol": "\u002F", - "solb": "\u29C4", - "solbar": "\u233F", - "sopf": "\U0001D564", - "spades": "\u2660", - "spadesuit": "\u2660", - "spar": "\u2225", - "sqcap": "\u2293", - "sqcaps": "\u2293\uFE00", - "sqcup": "\u2294", - "sqcups": "\u2294\uFE00", - "sqsub": "\u228F", - "sqsube": "\u2291", - "sqsubset": "\u228F", - "sqsubseteq": "\u2291", - "sqsup": "\u2290", - "sqsupe": "\u2292", - "sqsupset": "\u2290", - "sqsupseteq": "\u2292", - "squ": "\u25A1", - "square": "\u25A1", - "squarf": "\u25AA", - "squf": "\u25AA", - "srarr": "\u2192", - "sscr": "\U0001D4C8", - "ssetmn": "\u2216", - "ssmile": "\u2323", - "sstarf": "\u22C6", - "star": "\u2606", - "starf": "\u2605", - "straightepsilon": "\u03F5", - "straightphi": "\u03D5", - "strns": "\u00AF", - "sub": "\u2282", - "subE": "\u2AC5", - "subdot": "\u2ABD", - "sube": "\u2286", - "subedot": "\u2AC3", - "submult": "\u2AC1", - "subnE": "\u2ACB", - "subne": "\u228A", - "subplus": "\u2ABF", - "subrarr": "\u2979", - "subset": "\u2282", - "subseteq": "\u2286", - "subseteqq": "\u2AC5", - "subsetneq": "\u228A", - "subsetneqq": "\u2ACB", - "subsim": "\u2AC7", - "subsub": "\u2AD5", - "subsup": "\u2AD3", - "succ": "\u227B", - "succapprox": "\u2AB8", - "succcurlyeq": "\u227D", - "succeq": "\u2AB0", - "succnapprox": "\u2ABA", - "succneqq": "\u2AB6", - "succnsim": "\u22E9", - "succsim": "\u227F", - "sum": "\u2211", - "sung": "\u266A", - "sup": "\u2283", - "sup1": "\u00B9", - "sup2": "\u00B2", - "sup3": "\u00B3", - "supE": "\u2AC6", - "supdot": "\u2ABE", - "supdsub": "\u2AD8", - "supe": "\u2287", - "supedot": "\u2AC4", - "suphsol": "\u27C9", - "suphsub": "\u2AD7", - "suplarr": "\u297B", - "supmult": "\u2AC2", - "supnE": "\u2ACC", - "supne": "\u228B", - "supplus": "\u2AC0", - "supset": "\u2283", - "supseteq": "\u2287", - "supseteqq": "\u2AC6", - "supsetneq": "\u228B", - "supsetneqq": "\u2ACC", - "supsim": "\u2AC8", - "supsub": "\u2AD4", - "supsup": "\u2AD6", - "swArr": "\u21D9", - "swarhk": "\u2926", - "swarr": "\u2199", - "swarrow": "\u2199", - "swnwar": "\u292A", - "szlig": "\u00DF", - "target": "\u2316", - "tau": "\u03C4", - "tbrk": "\u23B4", - "tcaron": "\u0165", - "tcedil": "\u0163", - "tcy": "\u0442", - "tdot": "\u20DB", - "telrec": "\u2315", - "tfr": "\U0001D531", - "there4": "\u2234", - "therefore": "\u2234", - "theta": "\u03B8", - "thetasym": "\u03D1", - "thetav": "\u03D1", - "thickapprox": "\u2248", - "thicksim": "\u223C", - "thinsp": "\u2009", - "thkap": "\u2248", - "thksim": "\u223C", - "thorn": "\u00FE", - "tilde": "\u02DC", - "times": "\u00D7", - "timesb": "\u22A0", - "timesbar": "\u2A31", - "timesd": "\u2A30", - "tint": "\u222D", - "toea": "\u2928", - "top": "\u22A4", - "topbot": "\u2336", - "topcir": "\u2AF1", - "topf": "\U0001D565", - "topfork": "\u2ADA", - "tosa": "\u2929", - "tprime": "\u2034", - "trade": "\u2122", - "triangle": "\u25B5", - "triangledown": "\u25BF", - "triangleleft": "\u25C3", - "trianglelefteq": "\u22B4", - "triangleq": "\u225C", - "triangleright": "\u25B9", - "trianglerighteq": "\u22B5", - "tridot": "\u25EC", - "trie": "\u225C", - "triminus": "\u2A3A", - "triplus": "\u2A39", - "trisb": "\u29CD", - "tritime": "\u2A3B", - "trpezium": "\u23E2", - "tscr": "\U0001D4C9", - "tscy": "\u0446", - "tshcy": "\u045B", - "tstrok": "\u0167", - "twixt": "\u226C", - "twoheadleftarrow": "\u219E", - "twoheadrightarrow": "\u21A0", - "uArr": "\u21D1", - "uHar": "\u2963", - "uacute": "\u00FA", - "uarr": "\u2191", - "ubrcy": "\u045E", - "ubreve": "\u016D", - "ucirc": "\u00FB", - "ucy": "\u0443", - "udarr": "\u21C5", - "udblac": "\u0171", - "udhar": "\u296E", - "ufisht": "\u297E", - "ufr": "\U0001D532", - "ugrave": "\u00F9", - "uharl": "\u21BF", - "uharr": "\u21BE", - "uhblk": "\u2580", - "ulcorn": "\u231C", - "ulcorner": "\u231C", - "ulcrop": "\u230F", - "ultri": "\u25F8", - "umacr": "\u016B", - "uml": "\u00A8", - "uogon": "\u0173", - "uopf": "\U0001D566", - "uparrow": "\u2191", - "updownarrow": "\u2195", - "upharpoonleft": "\u21BF", - "upharpoonright": "\u21BE", - "uplus": "\u228E", - "upsi": "\u03C5", - "upsih": "\u03D2", - "upsilon": "\u03C5", - "upuparrows": "\u21C8", - "urcorn": "\u231D", - "urcorner": "\u231D", - "urcrop": "\u230E", - "uring": "\u016F", - "urtri": "\u25F9", - "uscr": "\U0001D4CA", - "utdot": "\u22F0", - "utilde": "\u0169", - "utri": "\u25B5", - "utrif": "\u25B4", - "uuarr": "\u21C8", - "uuml": "\u00FC", - "uwangle": "\u29A7", - "vArr": "\u21D5", - "vBar": "\u2AE8", - "vBarv": "\u2AE9", - "vDash": "\u22A8", - "vangrt": "\u299C", - "varepsilon": "\u03F5", - "varkappa": "\u03F0", - "varnothing": "\u2205", - "varphi": "\u03D5", - "varpi": "\u03D6", - "varpropto": "\u221D", - "varr": "\u2195", - "varrho": "\u03F1", - "varsigma": "\u03C2", - "varsubsetneq": "\u228A\uFE00", - "varsubsetneqq": "\u2ACB\uFE00", - "varsupsetneq": "\u228B\uFE00", - "varsupsetneqq": "\u2ACC\uFE00", - "vartheta": "\u03D1", - "vartriangleleft": "\u22B2", - "vartriangleright": "\u22B3", - "vcy": "\u0432", - "vdash": "\u22A2", - "vee": "\u2228", - "veebar": "\u22BB", - "veeeq": "\u225A", - "vellip": "\u22EE", - "verbar": "\u007C", - "vert": "\u007C", - "vfr": "\U0001D533", - "vltri": "\u22B2", - "vnsub": "\u2282\u20D2", - "vnsup": "\u2283\u20D2", - "vopf": "\U0001D567", - "vprop": "\u221D", - "vrtri": "\u22B3", - "vscr": "\U0001D4CB", - "vsubnE": "\u2ACB\uFE00", - "vsubne": "\u228A\uFE00", - "vsupnE": "\u2ACC\uFE00", - "vsupne": "\u228B\uFE00", - "vzigzag": "\u299A", - "wcirc": "\u0175", - "wedbar": "\u2A5F", - "wedge": "\u2227", - "wedgeq": "\u2259", - "weierp": "\u2118", - "wfr": "\U0001D534", - "wopf": "\U0001D568", - "wp": "\u2118", - "wr": "\u2240", - "wreath": "\u2240", - "wscr": "\U0001D4CC", - "xcap": "\u22C2", - "xcirc": "\u25EF", - "xcup": "\u22C3", - "xdtri": "\u25BD", - "xfr": "\U0001D535", - "xhArr": "\u27FA", - "xharr": "\u27F7", - "xi": "\u03BE", - "xlArr": "\u27F8", - "xlarr": "\u27F5", - "xmap": "\u27FC", - "xnis": "\u22FB", - "xodot": "\u2A00", - "xopf": "\U0001D569", - "xoplus": "\u2A01", - "xotime": "\u2A02", - "xrArr": "\u27F9", - "xrarr": "\u27F6", - "xscr": "\U0001D4CD", - "xsqcup": "\u2A06", - "xuplus": "\u2A04", - "xutri": "\u25B3", - "xvee": "\u22C1", - "xwedge": "\u22C0", - "yacute": "\u00FD", - "yacy": "\u044F", - "ycirc": "\u0177", - "ycy": "\u044B", - "yen": "\u00A5", - "yfr": "\U0001D536", - "yicy": "\u0457", - "yopf": "\U0001D56A", - "yscr": "\U0001D4CE", - "yucy": "\u044E", - "yuml": "\u00FF", - "zacute": "\u017A", - "zcaron": "\u017E", - "zcy": "\u0437", - "zdot": "\u017C", - "zeetrf": "\u2128", - "zeta": "\u03B6", - "zfr": "\U0001D537", - "zhcy": "\u0436", - "zigrarr": "\u21DD", - "zopf": "\U0001D56B", - "zscr": "\U0001D4CF", - "zwj": "\u200D", - "zwnj": "\u200C", -} diff --git a/vendor/gitlab.com/golang-commonmark/linkify/.gitlab-ci.yml b/vendor/gitlab.com/golang-commonmark/linkify/.gitlab-ci.yml deleted file mode 100644 index 5e4d0bf2..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/.gitlab-ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -image: golang:1.13 - -stages: - - build - - test - -before_script: - - go get golang.org/x/text/unicode/rangetable - -build: - stage: build - script: - - go build ./... - -test: - stage: test - script: - - test -z "$(gofmt -l . | tee /dev/stderr)" - - go test ./... diff --git a/vendor/gitlab.com/golang-commonmark/linkify/LICENSE b/vendor/gitlab.com/golang-commonmark/linkify/LICENSE deleted file mode 100644 index 9cdcd201..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2015, The Authors -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/gitlab.com/golang-commonmark/linkify/README.md b/vendor/gitlab.com/golang-commonmark/linkify/README.md deleted file mode 100644 index 8b791113..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/README.md +++ /dev/null @@ -1,12 +0,0 @@ -linkify [![License](https://img.shields.io/badge/licence-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause) [![GoDoc](http://godoc.org/gitlab.com/golang-commonmark/linkify?status.svg)](http://godoc.org/gitlab.com/golang-commonmark/linkify) [![Pipeline status](https://gitlab.com/golang-commonmark/linkify/badges/master/pipeline.svg)](https://gitlab.com/golang-commonmark/linkify/commits/master) -======= - -Package linkify provides a way to find what looks like links in plain text. - -## Install - - go get -u gitlab.com/golang-commonmark/linkify - -## Use - -See an [example](https://gitlab.com/golang-commonmark/linkify/blob/master/linkify_example_test.go). diff --git a/vendor/gitlab.com/golang-commonmark/linkify/charset.go b/vendor/gitlab.com/golang-commonmark/linkify/charset.go deleted file mode 100644 index 7ea3b625..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/charset.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package linkify - -import ( - "unicode" - - "golang.org/x/text/unicode/rangetable" -) - -var ( - unreserved = [256]bool{'-': true, '.': true, '_': true, '~': true} - basicPunct = [256]bool{'.': true, ',': true, '?': true, '!': true, ';': true, ':': true} - subdelims = [256]bool{'!': true, '$': true, '&': true, '\'': true, '(': true, ')': true, - '*': true, '+': true, ',': true, ';': true, '=': true} - emailcs = [256]bool{'a': true, 'b': true, 'c': true, 'd': true, 'e': true, 'f': true, 'g': true, - 'h': true, 'i': true, 'j': true, 'k': true, 'l': true, 'm': true, 'n': true, 'o': true, - 'p': true, 'q': true, 'r': true, 's': true, 't': true, 'u': true, 'v': true, 'w': true, - 'x': true, 'y': true, 'z': true, 'A': true, 'B': true, 'C': true, 'D': true, 'E': true, - 'F': true, 'G': true, 'H': true, 'I': true, 'J': true, 'K': true, 'L': true, 'M': true, - 'N': true, 'O': true, 'P': true, 'Q': true, 'R': true, 'S': true, 'T': true, 'U': true, - 'V': true, 'W': true, 'X': true, 'Y': true, 'Z': true, '0': true, '1': true, '2': true, - '3': true, '4': true, '5': true, '6': true, '7': true, '8': true, '9': true, '!': true, - '#': true, '$': true, '%': true, '&': true, '\'': true, '*': true, '+': true, '/': true, - '=': true, '?': true, '^': true, '_': true, '`': true, '{': true, '|': true, '}': true, - '~': true, '-': true} - letterOrDigit = rangetable.Merge(unicode.Letter, unicode.Digit) - punctSpaceCc = rangetable.Merge(unicode.Punct, unicode.Space, unicode.Cc) -) - -func isAllowedInEmail(r rune) bool { - return r < 0x7f && emailcs[r] -} - -func isLetterOrDigit(r rune) bool { - return unicode.Is(letterOrDigit, r) -} - -func isPunctOrSpaceOrControl(r rune) bool { - return r == '<' || r == '>' || r == '\uff5c' || unicode.Is(punctSpaceCc, r) -} - -func isUnreserved(r rune) bool { - return (r < 0x7f && unreserved[r]) || unicode.Is(letterOrDigit, r) -} - -func isSubDelimiter(r rune) bool { - return r < 0x7f && subdelims[r] -} diff --git a/vendor/gitlab.com/golang-commonmark/linkify/email.go b/vendor/gitlab.com/golang-commonmark/linkify/email.go deleted file mode 100644 index 35bfb679..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/email.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package linkify - -import ( - "unicode" - "unicode/utf8" -) - -func findEmailStart(s string, start int) (_ int, _ bool) { - end := start - allowDot := false - for end >= 0 { - b := s[end] - switch { - case emailcs[b]: - allowDot = true - case b == '.': - if !allowDot { - return - } - allowDot = false - default: - if end == start { - return - } - if s[end+1] == '.' { - return - } - r, _ := utf8.DecodeLastRuneInString(s[:end+1]) - if r == utf8.RuneError { - return - } - if !unicode.IsSpace(r) { - return - } - return end + 1, true - } - end-- - } - if end < start && s[end+1] == '.' { - return - } - return end + 1, true -} - -func findEmailEnd(s string, start int) (_ int, _ bool) { - end := start - allowDot := false -loop: - for end < len(s) { - b := s[end] - switch { - case emailcs[b]: - allowDot = true - case b == '.': - if !allowDot { - return - } - allowDot = false - case b == '@': - break loop - default: - return - } - end++ - } - if end >= len(s)-5 { - return - } - if end > start && s[end-1] == '.' { - return - } - - var dot int - var ok bool - end, dot, ok = findHostnameEnd(s, end+1) - if !ok || dot == -1 { - return - } - - if dot+5 <= len(s) && s[dot+1:dot+5] == "xn--" { - return end, true - } - - if length := match(s[dot+1:]); dot+length+1 != end { - return - } - - return end, true -} diff --git a/vendor/gitlab.com/golang-commonmark/linkify/generated.go b/vendor/gitlab.com/golang-commonmark/linkify/generated.go deleted file mode 100644 index 0fbd3cba..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/generated.go +++ /dev/null @@ -1,18175 +0,0 @@ -// Code generated by genfsm.go. DO NOT EDIT - -package linkify - -func match(s string) int { - st := 0 - length := -1 - - for i := 0; i < len(s); i++ { - b := s[i] - - switch st { - case 0: - switch byteToLower(b) { - case 'a': - st = 1 - case 'b': - st = 148 - case 'c': - st = 303 - case 'd': - st = 571 - case 'e': - st = 686 - case 'f': - st = 797 - case 'g': - st = 916 - case 'h': - st = 1014 - case 'i': - st = 1099 - case 'j': - st = 1180 - case 'k': - st = 1210 - case 'l': - st = 1253 - case 'm': - st = 1349 - case 'n': - st = 1478 - case 'o': - st = 1536 - case 'p': - st = 1577 - case 'q': - st = 1699 - case 'r': - st = 1709 - case 's': - st = 1797 - case 't': - st = 2010 - case 'u': - st = 2128 - case 'v': - st = 2147 - case 'w': - st = 2220 - case 'x': - st = 2283 - case 'y': - st = 2297 - case 'z': - st = 2330 - case '0': - st = 2348 - case '1': - st = 2350 - case '2': - st = 2352 - case '3': - st = 2354 - case '4': - st = 2356 - case '5': - st = 2358 - case '6': - st = 2360 - case '7': - st = 2362 - case '8': - st = 2364 - case '9': - st = 2366 - default: - return length - } - - case 1: - switch byteToLower(b) { - case 'b': - st = 2 - case 'c': - length = i + 1 - st = 12 - case 'd': - length = i + 1 - st = 39 - case 'e': - length = i + 1 - st = 44 - case 'f': - length = i + 1 - st = 47 - case 'g': - length = i + 1 - st = 49 - case 'i': - length = i + 1 - st = 54 - case 'l': - length = i + 1 - st = 62 - case 'm': - length = i + 1 - st = 74 - case 'n': - length = i + 1 - st = 82 - case 'o': - length = i + 1 - st = 88 - case 'p': - st = 89 - case 'q': - length = i + 1 - st = 98 - case 'r': - length = i + 1 - st = 106 - case 's': - length = i + 1 - st = 114 - case 't': - length = i + 1 - st = 125 - case 'u': - length = i + 1 - st = 132 - case 'w': - length = i + 1 - st = 144 - case 'x': - length = i + 1 - st = 145 - case 'z': - length = i + 1 - st = 147 - default: - return length - } - - case 2: - switch byteToLower(b) { - case 'b': - length = i + 1 - st = 3 - case 'o': - st = 7 - default: - return length - } - - case 3: - switch byteToLower(b) { - case 'o': - st = 4 - default: - return length - } - - case 4: - switch byteToLower(b) { - case 't': - st = 5 - default: - return length - } - - case 5: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 6 - default: - return length - } - - case 7: - switch byteToLower(b) { - case 'g': - st = 8 - default: - return length - } - - case 8: - switch byteToLower(b) { - case 'a': - st = 9 - default: - return length - } - - case 9: - switch byteToLower(b) { - case 'd': - st = 10 - default: - return length - } - - case 10: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 11 - default: - return length - } - - case 12: - switch byteToLower(b) { - case 'a': - st = 13 - case 'c': - st = 18 - case 't': - st = 33 - default: - return length - } - - case 13: - switch byteToLower(b) { - case 'd': - st = 14 - default: - return length - } - - case 14: - switch byteToLower(b) { - case 'e': - st = 15 - default: - return length - } - - case 15: - switch byteToLower(b) { - case 'm': - st = 16 - default: - return length - } - - case 16: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 17 - default: - return length - } - - case 18: - switch byteToLower(b) { - case 'e': - st = 19 - case 'o': - st = 25 - default: - return length - } - - case 19: - switch byteToLower(b) { - case 'n': - st = 20 - default: - return length - } - - case 20: - switch byteToLower(b) { - case 't': - st = 21 - default: - return length - } - - case 21: - switch byteToLower(b) { - case 'u': - st = 22 - default: - return length - } - - case 22: - switch byteToLower(b) { - case 'r': - st = 23 - default: - return length - } - - case 23: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 24 - default: - return length - } - - case 25: - switch byteToLower(b) { - case 'u': - st = 26 - default: - return length - } - - case 26: - switch byteToLower(b) { - case 'n': - st = 27 - default: - return length - } - - case 27: - switch byteToLower(b) { - case 't': - st = 28 - default: - return length - } - - case 28: - switch byteToLower(b) { - case 'a': - st = 29 - default: - return length - } - - case 29: - switch byteToLower(b) { - case 'n': - st = 30 - default: - return length - } - - case 30: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 31 - default: - return length - } - - case 31: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 32 - default: - return length - } - - case 33: - switch byteToLower(b) { - case 'i': - st = 34 - case 'o': - st = 37 - default: - return length - } - - case 34: - switch byteToLower(b) { - case 'v': - st = 35 - default: - return length - } - - case 35: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 36 - default: - return length - } - - case 37: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 38 - default: - return length - } - - case 39: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 40 - case 'u': - st = 41 - default: - return length - } - - case 41: - switch byteToLower(b) { - case 'l': - st = 42 - default: - return length - } - - case 42: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 43 - default: - return length - } - - case 44: - switch byteToLower(b) { - case 'r': - st = 45 - default: - return length - } - - case 45: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 46 - default: - return length - } - - case 47: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 48 - default: - return length - } - - case 49: - switch byteToLower(b) { - case 'e': - st = 50 - default: - return length - } - - case 50: - switch byteToLower(b) { - case 'n': - st = 51 - default: - return length - } - - case 51: - switch byteToLower(b) { - case 'c': - st = 52 - default: - return length - } - - case 52: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 53 - default: - return length - } - - case 54: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 55 - case 'r': - st = 56 - default: - return length - } - - case 56: - switch byteToLower(b) { - case 'f': - st = 57 - default: - return length - } - - case 57: - switch byteToLower(b) { - case 'o': - st = 58 - default: - return length - } - - case 58: - switch byteToLower(b) { - case 'r': - st = 59 - default: - return length - } - - case 59: - switch byteToLower(b) { - case 'c': - st = 60 - default: - return length - } - - case 60: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 61 - default: - return length - } - - case 62: - switch byteToLower(b) { - case 'l': - st = 63 - case 's': - st = 70 - default: - return length - } - - case 63: - switch byteToLower(b) { - case 'f': - st = 64 - default: - return length - } - - case 64: - switch byteToLower(b) { - case 'i': - st = 65 - default: - return length - } - - case 65: - switch byteToLower(b) { - case 'n': - st = 66 - default: - return length - } - - case 66: - switch byteToLower(b) { - case 'a': - st = 67 - default: - return length - } - - case 67: - switch byteToLower(b) { - case 'n': - st = 68 - default: - return length - } - - case 68: - switch byteToLower(b) { - case 'z': - length = i + 1 - st = 69 - default: - return length - } - - case 70: - switch byteToLower(b) { - case 'a': - st = 71 - default: - return length - } - - case 71: - switch byteToLower(b) { - case 'c': - st = 72 - default: - return length - } - - case 72: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 73 - default: - return length - } - - case 74: - switch byteToLower(b) { - case 's': - st = 75 - default: - return length - } - - case 75: - switch byteToLower(b) { - case 't': - st = 76 - default: - return length - } - - case 76: - switch byteToLower(b) { - case 'e': - st = 77 - default: - return length - } - - case 77: - switch byteToLower(b) { - case 'r': - st = 78 - default: - return length - } - - case 78: - switch byteToLower(b) { - case 'd': - st = 79 - default: - return length - } - - case 79: - switch byteToLower(b) { - case 'a': - st = 80 - default: - return length - } - - case 80: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 81 - default: - return length - } - - case 82: - switch byteToLower(b) { - case 'd': - st = 83 - default: - return length - } - - case 83: - switch byteToLower(b) { - case 'r': - st = 84 - default: - return length - } - - case 84: - switch byteToLower(b) { - case 'o': - st = 85 - default: - return length - } - - case 85: - switch byteToLower(b) { - case 'i': - st = 86 - default: - return length - } - - case 86: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 87 - default: - return length - } - - case 89: - switch byteToLower(b) { - case 'a': - st = 90 - default: - return length - } - - case 90: - switch byteToLower(b) { - case 'r': - st = 91 - default: - return length - } - - case 91: - switch byteToLower(b) { - case 't': - st = 92 - default: - return length - } - - case 92: - switch byteToLower(b) { - case 'm': - st = 93 - default: - return length - } - - case 93: - switch byteToLower(b) { - case 'e': - st = 94 - default: - return length - } - - case 94: - switch byteToLower(b) { - case 'n': - st = 95 - default: - return length - } - - case 95: - switch byteToLower(b) { - case 't': - st = 96 - default: - return length - } - - case 96: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 97 - default: - return length - } - - case 98: - switch byteToLower(b) { - case 'u': - st = 99 - default: - return length - } - - case 99: - switch byteToLower(b) { - case 'a': - st = 100 - default: - return length - } - - case 100: - switch byteToLower(b) { - case 'r': - st = 101 - default: - return length - } - - case 101: - switch byteToLower(b) { - case 'e': - st = 102 - default: - return length - } - - case 102: - switch byteToLower(b) { - case 'l': - st = 103 - default: - return length - } - - case 103: - switch byteToLower(b) { - case 'l': - st = 104 - default: - return length - } - - case 104: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 105 - default: - return length - } - - case 106: - switch byteToLower(b) { - case 'c': - st = 107 - case 'm': - st = 110 - case 'p': - st = 112 - default: - return length - } - - case 107: - switch byteToLower(b) { - case 'h': - st = 108 - default: - return length - } - - case 108: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 109 - default: - return length - } - - case 110: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 111 - default: - return length - } - - case 112: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 113 - default: - return length - } - - case 114: - switch byteToLower(b) { - case 'i': - st = 115 - case 's': - st = 117 - default: - return length - } - - case 115: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 116 - default: - return length - } - - case 117: - switch byteToLower(b) { - case 'o': - st = 118 - default: - return length - } - - case 118: - switch byteToLower(b) { - case 'c': - st = 119 - default: - return length - } - - case 119: - switch byteToLower(b) { - case 'i': - st = 120 - default: - return length - } - - case 120: - switch byteToLower(b) { - case 'a': - st = 121 - default: - return length - } - - case 121: - switch byteToLower(b) { - case 't': - st = 122 - default: - return length - } - - case 122: - switch byteToLower(b) { - case 'e': - st = 123 - default: - return length - } - - case 123: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 124 - default: - return length - } - - case 125: - switch byteToLower(b) { - case 't': - st = 126 - default: - return length - } - - case 126: - switch byteToLower(b) { - case 'o': - st = 127 - default: - return length - } - - case 127: - switch byteToLower(b) { - case 'r': - st = 128 - default: - return length - } - - case 128: - switch byteToLower(b) { - case 'n': - st = 129 - default: - return length - } - - case 129: - switch byteToLower(b) { - case 'e': - st = 130 - default: - return length - } - - case 130: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 131 - default: - return length - } - - case 132: - switch byteToLower(b) { - case 'c': - st = 133 - case 'd': - st = 138 - case 't': - st = 141 - default: - return length - } - - case 133: - switch byteToLower(b) { - case 't': - st = 134 - default: - return length - } - - case 134: - switch byteToLower(b) { - case 'i': - st = 135 - default: - return length - } - - case 135: - switch byteToLower(b) { - case 'o': - st = 136 - default: - return length - } - - case 136: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 137 - default: - return length - } - - case 138: - switch byteToLower(b) { - case 'i': - st = 139 - default: - return length - } - - case 139: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 140 - default: - return length - } - - case 141: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 142 - default: - return length - } - - case 142: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 143 - default: - return length - } - - case 145: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 146 - default: - return length - } - - case 148: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 149 - case 'b': - length = i + 1 - st = 177 - case 'd': - length = i + 1 - st = 181 - case 'e': - length = i + 1 - st = 182 - case 'f': - length = i + 1 - st = 191 - case 'g': - length = i + 1 - st = 192 - case 'h': - length = i + 1 - st = 193 - case 'i': - length = i + 1 - st = 194 - case 'j': - length = i + 1 - st = 207 - case 'l': - st = 208 - case 'm': - length = i + 1 - st = 227 - case 'n': - length = i + 1 - st = 229 - case 'o': - length = i + 1 - st = 238 - case 'r': - length = i + 1 - st = 251 - case 's': - length = i + 1 - st = 275 - case 't': - length = i + 1 - st = 276 - case 'u': - st = 277 - case 'v': - length = i + 1 - st = 298 - case 'w': - length = i + 1 - st = 299 - case 'y': - length = i + 1 - st = 300 - case 'z': - length = i + 1 - st = 301 - default: - return length - } - - case 149: - switch byteToLower(b) { - case 'n': - st = 150 - case 'r': - length = i + 1 - st = 153 - case 'u': - st = 168 - case 'y': - st = 173 - default: - return length - } - - case 150: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 151 - case 'k': - length = i + 1 - st = 152 - default: - return length - } - - case 153: - switch byteToLower(b) { - case 'c': - st = 154 - case 'g': - st = 163 - default: - return length - } - - case 154: - switch byteToLower(b) { - case 'l': - st = 155 - default: - return length - } - - case 155: - switch byteToLower(b) { - case 'a': - st = 156 - default: - return length - } - - case 156: - switch byteToLower(b) { - case 'y': - st = 157 - default: - return length - } - - case 157: - switch byteToLower(b) { - case 'c': - st = 158 - case 's': - length = i + 1 - st = 162 - default: - return length - } - - case 158: - switch byteToLower(b) { - case 'a': - st = 159 - default: - return length - } - - case 159: - switch byteToLower(b) { - case 'r': - st = 160 - default: - return length - } - - case 160: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 161 - default: - return length - } - - case 163: - switch byteToLower(b) { - case 'a': - st = 164 - default: - return length - } - - case 164: - switch byteToLower(b) { - case 'i': - st = 165 - default: - return length - } - - case 165: - switch byteToLower(b) { - case 'n': - st = 166 - default: - return length - } - - case 166: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 167 - default: - return length - } - - case 168: - switch byteToLower(b) { - case 'h': - st = 169 - default: - return length - } - - case 169: - switch byteToLower(b) { - case 'a': - st = 170 - default: - return length - } - - case 170: - switch byteToLower(b) { - case 'u': - st = 171 - default: - return length - } - - case 171: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 172 - default: - return length - } - - case 173: - switch byteToLower(b) { - case 'e': - st = 174 - default: - return length - } - - case 174: - switch byteToLower(b) { - case 'r': - st = 175 - default: - return length - } - - case 175: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 176 - default: - return length - } - - case 177: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 178 - case 'v': - st = 179 - default: - return length - } - - case 179: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 180 - default: - return length - } - - case 182: - switch byteToLower(b) { - case 'e': - st = 183 - case 'r': - st = 185 - case 's': - st = 189 - default: - return length - } - - case 183: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 184 - default: - return length - } - - case 185: - switch byteToLower(b) { - case 'l': - st = 186 - default: - return length - } - - case 186: - switch byteToLower(b) { - case 'i': - st = 187 - default: - return length - } - - case 187: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 188 - default: - return length - } - - case 189: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 190 - default: - return length - } - - case 194: - switch byteToLower(b) { - case 'b': - st = 195 - case 'd': - length = i + 1 - st = 198 - case 'k': - st = 199 - case 'n': - st = 201 - case 'o': - length = i + 1 - st = 204 - case 't': - length = i + 1 - st = 205 - case 'z': - length = i + 1 - st = 206 - default: - return length - } - - case 195: - switch byteToLower(b) { - case 'l': - st = 196 - default: - return length - } - - case 196: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 197 - default: - return length - } - - case 199: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 200 - default: - return length - } - - case 201: - switch byteToLower(b) { - case 'g': - st = 202 - default: - return length - } - - case 202: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 203 - default: - return length - } - - case 208: - switch byteToLower(b) { - case 'a': - st = 209 - case 'o': - st = 218 - case 'u': - st = 225 - default: - return length - } - - case 209: - switch byteToLower(b) { - case 'c': - st = 210 - default: - return length - } - - case 210: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 211 - default: - return length - } - - case 211: - switch byteToLower(b) { - case 'f': - st = 212 - default: - return length - } - - case 212: - switch byteToLower(b) { - case 'r': - st = 213 - default: - return length - } - - case 213: - switch byteToLower(b) { - case 'i': - st = 214 - default: - return length - } - - case 214: - switch byteToLower(b) { - case 'd': - st = 215 - default: - return length - } - - case 215: - switch byteToLower(b) { - case 'a': - st = 216 - default: - return length - } - - case 216: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 217 - default: - return length - } - - case 218: - switch byteToLower(b) { - case 'o': - st = 219 - default: - return length - } - - case 219: - switch byteToLower(b) { - case 'm': - st = 220 - default: - return length - } - - case 220: - switch byteToLower(b) { - case 'b': - st = 221 - default: - return length - } - - case 221: - switch byteToLower(b) { - case 'e': - st = 222 - default: - return length - } - - case 222: - switch byteToLower(b) { - case 'r': - st = 223 - default: - return length - } - - case 223: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 224 - default: - return length - } - - case 225: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 226 - default: - return length - } - - case 227: - switch byteToLower(b) { - case 'w': - length = i + 1 - st = 228 - default: - return length - } - - case 229: - switch byteToLower(b) { - case 'p': - st = 230 - default: - return length - } - - case 230: - switch byteToLower(b) { - case 'p': - st = 231 - default: - return length - } - - case 231: - switch byteToLower(b) { - case 'a': - st = 232 - default: - return length - } - - case 232: - switch byteToLower(b) { - case 'r': - st = 233 - default: - return length - } - - case 233: - switch byteToLower(b) { - case 'i': - st = 234 - default: - return length - } - - case 234: - switch byteToLower(b) { - case 'b': - st = 235 - default: - return length - } - - case 235: - switch byteToLower(b) { - case 'a': - st = 236 - default: - return length - } - - case 236: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 237 - default: - return length - } - - case 238: - switch byteToLower(b) { - case 'a': - st = 239 - case 'n': - st = 242 - case 'o': - length = i + 1 - st = 244 - case 'u': - st = 245 - default: - return length - } - - case 239: - switch byteToLower(b) { - case 't': - st = 240 - default: - return length - } - - case 240: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 241 - default: - return length - } - - case 242: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 243 - default: - return length - } - - case 245: - switch byteToLower(b) { - case 't': - st = 246 - default: - return length - } - - case 246: - switch byteToLower(b) { - case 'i': - st = 247 - default: - return length - } - - case 247: - switch byteToLower(b) { - case 'q': - st = 248 - default: - return length - } - - case 248: - switch byteToLower(b) { - case 'u': - st = 249 - default: - return length - } - - case 249: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 250 - default: - return length - } - - case 251: - switch byteToLower(b) { - case 'i': - st = 252 - case 'o': - st = 261 - case 'u': - st = 269 - default: - return length - } - - case 252: - switch byteToLower(b) { - case 'd': - st = 253 - default: - return length - } - - case 253: - switch byteToLower(b) { - case 'g': - st = 254 - default: - return length - } - - case 254: - switch byteToLower(b) { - case 'e': - st = 255 - default: - return length - } - - case 255: - switch byteToLower(b) { - case 's': - st = 256 - default: - return length - } - - case 256: - switch byteToLower(b) { - case 't': - st = 257 - default: - return length - } - - case 257: - switch byteToLower(b) { - case 'o': - st = 258 - default: - return length - } - - case 258: - switch byteToLower(b) { - case 'n': - st = 259 - default: - return length - } - - case 259: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 260 - default: - return length - } - - case 261: - switch byteToLower(b) { - case 'k': - st = 262 - case 't': - st = 265 - default: - return length - } - - case 262: - switch byteToLower(b) { - case 'e': - st = 263 - default: - return length - } - - case 263: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 264 - default: - return length - } - - case 265: - switch byteToLower(b) { - case 'h': - st = 266 - default: - return length - } - - case 266: - switch byteToLower(b) { - case 'e': - st = 267 - default: - return length - } - - case 267: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 268 - default: - return length - } - - case 269: - switch byteToLower(b) { - case 's': - st = 270 - default: - return length - } - - case 270: - switch byteToLower(b) { - case 's': - st = 271 - default: - return length - } - - case 271: - switch byteToLower(b) { - case 'e': - st = 272 - default: - return length - } - - case 272: - switch byteToLower(b) { - case 'l': - st = 273 - default: - return length - } - - case 273: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 274 - default: - return length - } - - case 277: - switch byteToLower(b) { - case 'd': - st = 278 - case 'i': - st = 284 - case 's': - st = 290 - case 'z': - st = 296 - default: - return length - } - - case 278: - switch byteToLower(b) { - case 'a': - st = 279 - default: - return length - } - - case 279: - switch byteToLower(b) { - case 'p': - st = 280 - default: - return length - } - - case 280: - switch byteToLower(b) { - case 'e': - st = 281 - default: - return length - } - - case 281: - switch byteToLower(b) { - case 's': - st = 282 - default: - return length - } - - case 282: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 283 - default: - return length - } - - case 284: - switch byteToLower(b) { - case 'l': - st = 285 - default: - return length - } - - case 285: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 286 - default: - return length - } - - case 286: - switch byteToLower(b) { - case 'e': - st = 287 - default: - return length - } - - case 287: - switch byteToLower(b) { - case 'r': - st = 288 - default: - return length - } - - case 288: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 289 - default: - return length - } - - case 290: - switch byteToLower(b) { - case 'i': - st = 291 - default: - return length - } - - case 291: - switch byteToLower(b) { - case 'n': - st = 292 - default: - return length - } - - case 292: - switch byteToLower(b) { - case 'e': - st = 293 - default: - return length - } - - case 293: - switch byteToLower(b) { - case 's': - st = 294 - default: - return length - } - - case 294: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 295 - default: - return length - } - - case 296: - switch byteToLower(b) { - case 'z': - length = i + 1 - st = 297 - default: - return length - } - - case 301: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 302 - default: - return length - } - - case 303: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 304 - case 'b': - st = 366 - case 'c': - length = i + 1 - st = 368 - case 'd': - length = i + 1 - st = 369 - case 'e': - st = 370 - case 'f': - length = i + 1 - st = 378 - case 'g': - length = i + 1 - st = 381 - case 'h': - length = i + 1 - st = 382 - case 'i': - length = i + 1 - st = 409 - case 'k': - length = i + 1 - st = 417 - case 'l': - length = i + 1 - st = 418 - case 'm': - length = i + 1 - st = 443 - case 'n': - length = i + 1 - st = 444 - case 'o': - length = i + 1 - st = 445 - case 'r': - length = i + 1 - st = 532 - case 'u': - length = i + 1 - st = 552 - case 'v': - length = i + 1 - st = 561 - case 'w': - length = i + 1 - st = 562 - case 'x': - length = i + 1 - st = 563 - case 'y': - length = i + 1 - st = 564 - case 'z': - length = i + 1 - st = 570 - default: - return length - } - - case 304: - switch byteToLower(b) { - case 'b': - length = i + 1 - st = 305 - case 'f': - st = 306 - case 'l': - length = i + 1 - st = 308 - case 'm': - st = 309 - case 'n': - st = 314 - case 'p': - st = 328 - case 'r': - st = 338 - case 's': - st = 354 - case 't': - length = i + 1 - st = 360 - default: - return length - } - - case 306: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 307 - default: - return length - } - - case 309: - switch byteToLower(b) { - case 'e': - st = 310 - case 'p': - length = i + 1 - st = 313 - default: - return length - } - - case 310: - switch byteToLower(b) { - case 'r': - st = 311 - default: - return length - } - - case 311: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 312 - default: - return length - } - - case 314: - switch byteToLower(b) { - case 'c': - st = 315 - case 'o': - st = 326 - default: - return length - } - - case 315: - switch byteToLower(b) { - case 'e': - st = 316 - default: - return length - } - - case 316: - switch byteToLower(b) { - case 'r': - st = 317 - default: - return length - } - - case 317: - switch byteToLower(b) { - case 'r': - st = 318 - default: - return length - } - - case 318: - switch byteToLower(b) { - case 'e': - st = 319 - default: - return length - } - - case 319: - switch byteToLower(b) { - case 's': - st = 320 - default: - return length - } - - case 320: - switch byteToLower(b) { - case 'e': - st = 321 - default: - return length - } - - case 321: - switch byteToLower(b) { - case 'a': - st = 322 - default: - return length - } - - case 322: - switch byteToLower(b) { - case 'r': - st = 323 - default: - return length - } - - case 323: - switch byteToLower(b) { - case 'c': - st = 324 - default: - return length - } - - case 324: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 325 - default: - return length - } - - case 326: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 327 - default: - return length - } - - case 328: - switch byteToLower(b) { - case 'e': - st = 329 - case 'i': - st = 334 - default: - return length - } - - case 329: - switch byteToLower(b) { - case 't': - st = 330 - default: - return length - } - - case 330: - switch byteToLower(b) { - case 'o': - st = 331 - default: - return length - } - - case 331: - switch byteToLower(b) { - case 'w': - st = 332 - default: - return length - } - - case 332: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 333 - default: - return length - } - - case 334: - switch byteToLower(b) { - case 't': - st = 335 - default: - return length - } - - case 335: - switch byteToLower(b) { - case 'a': - st = 336 - default: - return length - } - - case 336: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 337 - default: - return length - } - - case 338: - switch byteToLower(b) { - case 'a': - st = 339 - case 'd': - st = 343 - case 'e': - length = i + 1 - st = 345 - case 's': - length = i + 1 - st = 349 - case 't': - st = 350 - default: - return length - } - - case 339: - switch byteToLower(b) { - case 'v': - st = 340 - default: - return length - } - - case 340: - switch byteToLower(b) { - case 'a': - st = 341 - default: - return length - } - - case 341: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 342 - default: - return length - } - - case 343: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 344 - default: - return length - } - - case 345: - switch byteToLower(b) { - case 'e': - st = 346 - default: - return length - } - - case 346: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 347 - default: - return length - } - - case 347: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 348 - default: - return length - } - - case 350: - switch byteToLower(b) { - case 'i': - st = 351 - default: - return length - } - - case 351: - switch byteToLower(b) { - case 'e': - st = 352 - default: - return length - } - - case 352: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 353 - default: - return length - } - - case 354: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 355 - case 'h': - length = i + 1 - st = 356 - case 'i': - st = 357 - default: - return length - } - - case 357: - switch byteToLower(b) { - case 'n': - st = 358 - default: - return length - } - - case 358: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 359 - default: - return length - } - - case 360: - switch byteToLower(b) { - case 'e': - st = 361 - default: - return length - } - - case 361: - switch byteToLower(b) { - case 'r': - st = 362 - default: - return length - } - - case 362: - switch byteToLower(b) { - case 'i': - st = 363 - default: - return length - } - - case 363: - switch byteToLower(b) { - case 'n': - st = 364 - default: - return length - } - - case 364: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 365 - default: - return length - } - - case 366: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 367 - default: - return length - } - - case 370: - switch byteToLower(b) { - case 'n': - st = 371 - case 'o': - length = i + 1 - st = 375 - case 'r': - st = 376 - default: - return length - } - - case 371: - switch byteToLower(b) { - case 't': - st = 372 - default: - return length - } - - case 372: - switch byteToLower(b) { - case 'e': - st = 373 - default: - return length - } - - case 373: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 374 - default: - return length - } - - case 376: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 377 - default: - return length - } - - case 378: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 379 - case 'd': - length = i + 1 - st = 380 - default: - return length - } - - case 382: - switch byteToLower(b) { - case 'a': - st = 383 - case 'e': - st = 389 - case 'l': - st = 392 - case 'r': - st = 395 - case 'u': - st = 405 - default: - return length - } - - case 383: - switch byteToLower(b) { - case 'n': - st = 384 - case 't': - length = i + 1 - st = 388 - default: - return length - } - - case 384: - switch byteToLower(b) { - case 'n': - st = 385 - default: - return length - } - - case 385: - switch byteToLower(b) { - case 'e': - st = 386 - default: - return length - } - - case 386: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 387 - default: - return length - } - - case 389: - switch byteToLower(b) { - case 'a': - st = 390 - default: - return length - } - - case 390: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 391 - default: - return length - } - - case 392: - switch byteToLower(b) { - case 'o': - st = 393 - default: - return length - } - - case 393: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 394 - default: - return length - } - - case 395: - switch byteToLower(b) { - case 'i': - st = 396 - case 'o': - st = 402 - default: - return length - } - - case 396: - switch byteToLower(b) { - case 's': - st = 397 - default: - return length - } - - case 397: - switch byteToLower(b) { - case 't': - st = 398 - default: - return length - } - - case 398: - switch byteToLower(b) { - case 'm': - st = 399 - default: - return length - } - - case 399: - switch byteToLower(b) { - case 'a': - st = 400 - default: - return length - } - - case 400: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 401 - default: - return length - } - - case 402: - switch byteToLower(b) { - case 'm': - st = 403 - default: - return length - } - - case 403: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 404 - default: - return length - } - - case 405: - switch byteToLower(b) { - case 'r': - st = 406 - default: - return length - } - - case 406: - switch byteToLower(b) { - case 'c': - st = 407 - default: - return length - } - - case 407: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 408 - default: - return length - } - - case 409: - switch byteToLower(b) { - case 's': - st = 410 - case 't': - st = 413 - default: - return length - } - - case 410: - switch byteToLower(b) { - case 'c': - st = 411 - default: - return length - } - - case 411: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 412 - default: - return length - } - - case 413: - switch byteToLower(b) { - case 'i': - st = 414 - case 'y': - length = i + 1 - st = 416 - default: - return length - } - - case 414: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 415 - default: - return length - } - - case 418: - switch byteToLower(b) { - case 'a': - st = 419 - case 'e': - st = 423 - case 'i': - st = 429 - case 'o': - st = 435 - case 'u': - st = 441 - default: - return length - } - - case 419: - switch byteToLower(b) { - case 'i': - st = 420 - default: - return length - } - - case 420: - switch byteToLower(b) { - case 'm': - st = 421 - default: - return length - } - - case 421: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 422 - default: - return length - } - - case 423: - switch byteToLower(b) { - case 'a': - st = 424 - default: - return length - } - - case 424: - switch byteToLower(b) { - case 'n': - st = 425 - default: - return length - } - - case 425: - switch byteToLower(b) { - case 'i': - st = 426 - default: - return length - } - - case 426: - switch byteToLower(b) { - case 'n': - st = 427 - default: - return length - } - - case 427: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 428 - default: - return length - } - - case 429: - switch byteToLower(b) { - case 'c': - st = 430 - case 'n': - st = 432 - default: - return length - } - - case 430: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 431 - default: - return length - } - - case 432: - switch byteToLower(b) { - case 'i': - st = 433 - default: - return length - } - - case 433: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 434 - default: - return length - } - - case 435: - switch byteToLower(b) { - case 't': - st = 436 - default: - return length - } - - case 436: - switch byteToLower(b) { - case 'h': - st = 437 - default: - return length - } - - case 437: - switch byteToLower(b) { - case 'i': - st = 438 - default: - return length - } - - case 438: - switch byteToLower(b) { - case 'n': - st = 439 - default: - return length - } - - case 439: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 440 - default: - return length - } - - case 441: - switch byteToLower(b) { - case 'b': - length = i + 1 - st = 442 - default: - return length - } - - case 445: - switch byteToLower(b) { - case 'a': - st = 446 - case 'd': - st = 449 - case 'f': - st = 452 - case 'l': - st = 456 - case 'm': - length = i + 1 - st = 465 - case 'n': - st = 480 - case 'o': - st = 507 - case 'r': - st = 514 - case 'u': - st = 519 - default: - return length - } - - case 446: - switch byteToLower(b) { - case 'c': - st = 447 - default: - return length - } - - case 447: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 448 - default: - return length - } - - case 449: - switch byteToLower(b) { - case 'e': - st = 450 - default: - return length - } - - case 450: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 451 - default: - return length - } - - case 452: - switch byteToLower(b) { - case 'f': - st = 453 - default: - return length - } - - case 453: - switch byteToLower(b) { - case 'e': - st = 454 - default: - return length - } - - case 454: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 455 - default: - return length - } - - case 456: - switch byteToLower(b) { - case 'l': - st = 457 - case 'o': - st = 461 - default: - return length - } - - case 457: - switch byteToLower(b) { - case 'e': - st = 458 - default: - return length - } - - case 458: - switch byteToLower(b) { - case 'g': - st = 459 - default: - return length - } - - case 459: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 460 - default: - return length - } - - case 461: - switch byteToLower(b) { - case 'g': - st = 462 - default: - return length - } - - case 462: - switch byteToLower(b) { - case 'n': - st = 463 - default: - return length - } - - case 463: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 464 - default: - return length - } - - case 465: - switch byteToLower(b) { - case 'm': - st = 466 - case 'p': - st = 472 - default: - return length - } - - case 466: - switch byteToLower(b) { - case 'u': - st = 467 - default: - return length - } - - case 467: - switch byteToLower(b) { - case 'n': - st = 468 - default: - return length - } - - case 468: - switch byteToLower(b) { - case 'i': - st = 469 - default: - return length - } - - case 469: - switch byteToLower(b) { - case 't': - st = 470 - default: - return length - } - - case 470: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 471 - default: - return length - } - - case 472: - switch byteToLower(b) { - case 'a': - st = 473 - case 'u': - st = 476 - default: - return length - } - - case 473: - switch byteToLower(b) { - case 'n': - st = 474 - default: - return length - } - - case 474: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 475 - default: - return length - } - - case 476: - switch byteToLower(b) { - case 't': - st = 477 - default: - return length - } - - case 477: - switch byteToLower(b) { - case 'e': - st = 478 - default: - return length - } - - case 478: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 479 - default: - return length - } - - case 480: - switch byteToLower(b) { - case 'd': - st = 481 - case 's': - st = 484 - case 't': - st = 499 - default: - return length - } - - case 481: - switch byteToLower(b) { - case 'o': - st = 482 - default: - return length - } - - case 482: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 483 - default: - return length - } - - case 484: - switch byteToLower(b) { - case 't': - st = 485 - case 'u': - st = 493 - default: - return length - } - - case 485: - switch byteToLower(b) { - case 'r': - st = 486 - default: - return length - } - - case 486: - switch byteToLower(b) { - case 'u': - st = 487 - default: - return length - } - - case 487: - switch byteToLower(b) { - case 'c': - st = 488 - default: - return length - } - - case 488: - switch byteToLower(b) { - case 't': - st = 489 - default: - return length - } - - case 489: - switch byteToLower(b) { - case 'i': - st = 490 - default: - return length - } - - case 490: - switch byteToLower(b) { - case 'o': - st = 491 - default: - return length - } - - case 491: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 492 - default: - return length - } - - case 493: - switch byteToLower(b) { - case 'l': - st = 494 - default: - return length - } - - case 494: - switch byteToLower(b) { - case 't': - st = 495 - default: - return length - } - - case 495: - switch byteToLower(b) { - case 'i': - st = 496 - default: - return length - } - - case 496: - switch byteToLower(b) { - case 'n': - st = 497 - default: - return length - } - - case 497: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 498 - default: - return length - } - - case 499: - switch byteToLower(b) { - case 'r': - st = 500 - default: - return length - } - - case 500: - switch byteToLower(b) { - case 'a': - st = 501 - default: - return length - } - - case 501: - switch byteToLower(b) { - case 'c': - st = 502 - default: - return length - } - - case 502: - switch byteToLower(b) { - case 't': - st = 503 - default: - return length - } - - case 503: - switch byteToLower(b) { - case 'o': - st = 504 - default: - return length - } - - case 504: - switch byteToLower(b) { - case 'r': - st = 505 - default: - return length - } - - case 505: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 506 - default: - return length - } - - case 507: - switch byteToLower(b) { - case 'k': - st = 508 - case 'l': - length = i + 1 - st = 512 - case 'p': - length = i + 1 - st = 513 - default: - return length - } - - case 508: - switch byteToLower(b) { - case 'i': - st = 509 - default: - return length - } - - case 509: - switch byteToLower(b) { - case 'n': - st = 510 - default: - return length - } - - case 510: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 511 - default: - return length - } - - case 514: - switch byteToLower(b) { - case 's': - st = 515 - default: - return length - } - - case 515: - switch byteToLower(b) { - case 'i': - st = 516 - default: - return length - } - - case 516: - switch byteToLower(b) { - case 'c': - st = 517 - default: - return length - } - - case 517: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 518 - default: - return length - } - - case 519: - switch byteToLower(b) { - case 'n': - st = 520 - case 'p': - st = 524 - case 'r': - st = 528 - default: - return length - } - - case 520: - switch byteToLower(b) { - case 't': - st = 521 - default: - return length - } - - case 521: - switch byteToLower(b) { - case 'r': - st = 522 - default: - return length - } - - case 522: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 523 - default: - return length - } - - case 524: - switch byteToLower(b) { - case 'o': - st = 525 - default: - return length - } - - case 525: - switch byteToLower(b) { - case 'n': - st = 526 - default: - return length - } - - case 526: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 527 - default: - return length - } - - case 528: - switch byteToLower(b) { - case 's': - st = 529 - default: - return length - } - - case 529: - switch byteToLower(b) { - case 'e': - st = 530 - default: - return length - } - - case 530: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 531 - default: - return length - } - - case 532: - switch byteToLower(b) { - case 'e': - st = 533 - case 'i': - st = 541 - case 's': - length = i + 1 - st = 546 - case 'u': - st = 547 - default: - return length - } - - case 533: - switch byteToLower(b) { - case 'd': - st = 534 - default: - return length - } - - case 534: - switch byteToLower(b) { - case 'i': - st = 535 - default: - return length - } - - case 535: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 536 - default: - return length - } - - case 536: - switch byteToLower(b) { - case 'c': - st = 537 - default: - return length - } - - case 537: - switch byteToLower(b) { - case 'a': - st = 538 - default: - return length - } - - case 538: - switch byteToLower(b) { - case 'r': - st = 539 - default: - return length - } - - case 539: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 540 - default: - return length - } - - case 541: - switch byteToLower(b) { - case 'c': - st = 542 - default: - return length - } - - case 542: - switch byteToLower(b) { - case 'k': - st = 543 - default: - return length - } - - case 543: - switch byteToLower(b) { - case 'e': - st = 544 - default: - return length - } - - case 544: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 545 - default: - return length - } - - case 547: - switch byteToLower(b) { - case 'i': - st = 548 - default: - return length - } - - case 548: - switch byteToLower(b) { - case 's': - st = 549 - default: - return length - } - - case 549: - switch byteToLower(b) { - case 'e': - st = 550 - default: - return length - } - - case 550: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 551 - default: - return length - } - - case 552: - switch byteToLower(b) { - case 'i': - st = 553 - default: - return length - } - - case 553: - switch byteToLower(b) { - case 's': - st = 554 - default: - return length - } - - case 554: - switch byteToLower(b) { - case 'i': - st = 555 - default: - return length - } - - case 555: - switch byteToLower(b) { - case 'n': - st = 556 - default: - return length - } - - case 556: - switch byteToLower(b) { - case 'e': - st = 557 - default: - return length - } - - case 557: - switch byteToLower(b) { - case 'l': - st = 558 - default: - return length - } - - case 558: - switch byteToLower(b) { - case 'l': - st = 559 - default: - return length - } - - case 559: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 560 - default: - return length - } - - case 564: - switch byteToLower(b) { - case 'm': - st = 565 - case 'o': - st = 568 - default: - return length - } - - case 565: - switch byteToLower(b) { - case 'r': - st = 566 - default: - return length - } - - case 566: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 567 - default: - return length - } - - case 568: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 569 - default: - return length - } - - case 571: - switch byteToLower(b) { - case 'a': - st = 572 - case 'c': - st = 589 - case 'e': - length = i + 1 - st = 592 - case 'i': - st = 624 - case 'j': - length = i + 1 - st = 651 - case 'k': - length = i + 1 - st = 652 - case 'm': - length = i + 1 - st = 653 - case 'n': - st = 654 - case 'o': - length = i + 1 - st = 656 - case 'u': - st = 677 - case 'v': - st = 682 - case 'z': - length = i + 1 - st = 685 - default: - return length - } - - case 572: - switch byteToLower(b) { - case 'b': - st = 573 - case 'd': - length = i + 1 - st = 576 - case 'n': - st = 577 - case 't': - st = 580 - case 'y': - length = i + 1 - st = 588 - default: - return length - } - - case 573: - switch byteToLower(b) { - case 'u': - st = 574 - default: - return length - } - - case 574: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 575 - default: - return length - } - - case 577: - switch byteToLower(b) { - case 'c': - st = 578 - default: - return length - } - - case 578: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 579 - default: - return length - } - - case 580: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 581 - case 'i': - st = 582 - case 's': - st = 585 - default: - return length - } - - case 582: - switch byteToLower(b) { - case 'n': - st = 583 - default: - return length - } - - case 583: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 584 - default: - return length - } - - case 585: - switch byteToLower(b) { - case 'u': - st = 586 - default: - return length - } - - case 586: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 587 - default: - return length - } - - case 589: - switch byteToLower(b) { - case 'l': - st = 590 - default: - return length - } - - case 590: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 591 - default: - return length - } - - case 592: - switch byteToLower(b) { - case 'a': - st = 593 - case 'g': - st = 596 - case 'l': - st = 600 - case 'm': - st = 606 - case 'n': - st = 612 - case 's': - st = 619 - case 'v': - length = i + 1 - st = 623 - default: - return length - } - - case 593: - switch byteToLower(b) { - case 'l': - st = 594 - default: - return length - } - - case 594: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 595 - default: - return length - } - - case 596: - switch byteToLower(b) { - case 'r': - st = 597 - default: - return length - } - - case 597: - switch byteToLower(b) { - case 'e': - st = 598 - default: - return length - } - - case 598: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 599 - default: - return length - } - - case 600: - switch byteToLower(b) { - case 'i': - st = 601 - default: - return length - } - - case 601: - switch byteToLower(b) { - case 'v': - st = 602 - default: - return length - } - - case 602: - switch byteToLower(b) { - case 'e': - st = 603 - default: - return length - } - - case 603: - switch byteToLower(b) { - case 'r': - st = 604 - default: - return length - } - - case 604: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 605 - default: - return length - } - - case 606: - switch byteToLower(b) { - case 'o': - st = 607 - default: - return length - } - - case 607: - switch byteToLower(b) { - case 'c': - st = 608 - default: - return length - } - - case 608: - switch byteToLower(b) { - case 'r': - st = 609 - default: - return length - } - - case 609: - switch byteToLower(b) { - case 'a': - st = 610 - default: - return length - } - - case 610: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 611 - default: - return length - } - - case 612: - switch byteToLower(b) { - case 't': - st = 613 - default: - return length - } - - case 613: - switch byteToLower(b) { - case 'a': - st = 614 - case 'i': - st = 616 - default: - return length - } - - case 614: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 615 - default: - return length - } - - case 616: - switch byteToLower(b) { - case 's': - st = 617 - default: - return length - } - - case 617: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 618 - default: - return length - } - - case 619: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 620 - default: - return length - } - - case 620: - switch byteToLower(b) { - case 'g': - st = 621 - default: - return length - } - - case 621: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 622 - default: - return length - } - - case 624: - switch byteToLower(b) { - case 'a': - st = 625 - case 'e': - st = 631 - case 'g': - st = 633 - case 'r': - st = 638 - case 's': - st = 645 - default: - return length - } - - case 625: - switch byteToLower(b) { - case 'm': - st = 626 - default: - return length - } - - case 626: - switch byteToLower(b) { - case 'o': - st = 627 - default: - return length - } - - case 627: - switch byteToLower(b) { - case 'n': - st = 628 - default: - return length - } - - case 628: - switch byteToLower(b) { - case 'd': - st = 629 - default: - return length - } - - case 629: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 630 - default: - return length - } - - case 631: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 632 - default: - return length - } - - case 633: - switch byteToLower(b) { - case 'i': - st = 634 - default: - return length - } - - case 634: - switch byteToLower(b) { - case 't': - st = 635 - default: - return length - } - - case 635: - switch byteToLower(b) { - case 'a': - st = 636 - default: - return length - } - - case 636: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 637 - default: - return length - } - - case 638: - switch byteToLower(b) { - case 'e': - st = 639 - default: - return length - } - - case 639: - switch byteToLower(b) { - case 'c': - st = 640 - default: - return length - } - - case 640: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 641 - default: - return length - } - - case 641: - switch byteToLower(b) { - case 'o': - st = 642 - default: - return length - } - - case 642: - switch byteToLower(b) { - case 'r': - st = 643 - default: - return length - } - - case 643: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 644 - default: - return length - } - - case 645: - switch byteToLower(b) { - case 'c': - st = 646 - default: - return length - } - - case 646: - switch byteToLower(b) { - case 'o': - st = 647 - default: - return length - } - - case 647: - switch byteToLower(b) { - case 'u': - st = 648 - default: - return length - } - - case 648: - switch byteToLower(b) { - case 'n': - st = 649 - default: - return length - } - - case 649: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 650 - default: - return length - } - - case 654: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 655 - default: - return length - } - - case 656: - switch byteToLower(b) { - case 'c': - st = 657 - case 'g': - length = i + 1 - st = 659 - case 'h': - st = 660 - case 'm': - st = 662 - case 'o': - st = 667 - case 'w': - st = 671 - default: - return length - } - - case 657: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 658 - default: - return length - } - - case 660: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 661 - default: - return length - } - - case 662: - switch byteToLower(b) { - case 'a': - st = 663 - default: - return length - } - - case 663: - switch byteToLower(b) { - case 'i': - st = 664 - default: - return length - } - - case 664: - switch byteToLower(b) { - case 'n': - st = 665 - default: - return length - } - - case 665: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 666 - default: - return length - } - - case 667: - switch byteToLower(b) { - case 's': - st = 668 - default: - return length - } - - case 668: - switch byteToLower(b) { - case 'a': - st = 669 - default: - return length - } - - case 669: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 670 - default: - return length - } - - case 671: - switch byteToLower(b) { - case 'n': - st = 672 - default: - return length - } - - case 672: - switch byteToLower(b) { - case 'l': - st = 673 - default: - return length - } - - case 673: - switch byteToLower(b) { - case 'o': - st = 674 - default: - return length - } - - case 674: - switch byteToLower(b) { - case 'a': - st = 675 - default: - return length - } - - case 675: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 676 - default: - return length - } - - case 677: - switch byteToLower(b) { - case 'r': - st = 678 - default: - return length - } - - case 678: - switch byteToLower(b) { - case 'b': - st = 679 - default: - return length - } - - case 679: - switch byteToLower(b) { - case 'a': - st = 680 - default: - return length - } - - case 680: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 681 - default: - return length - } - - case 682: - switch byteToLower(b) { - case 'a': - st = 683 - default: - return length - } - - case 683: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 684 - default: - return length - } - - case 686: - switch byteToLower(b) { - case 'a': - st = 687 - case 'c': - length = i + 1 - st = 692 - case 'd': - st = 693 - case 'e': - length = i + 1 - st = 701 - case 'g': - length = i + 1 - st = 702 - case 'm': - st = 703 - case 'n': - st = 711 - case 'p': - st = 734 - case 'q': - st = 738 - case 'r': - length = i + 1 - st = 746 - case 's': - length = i + 1 - st = 749 - case 't': - length = i + 1 - st = 755 - case 'u': - length = i + 1 - st = 756 - case 'v': - st = 766 - case 'x': - st = 776 - default: - return length - } - - case 687: - switch byteToLower(b) { - case 'r': - st = 688 - case 't': - length = i + 1 - st = 691 - default: - return length - } - - case 688: - switch byteToLower(b) { - case 't': - st = 689 - default: - return length - } - - case 689: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 690 - default: - return length - } - - case 693: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 694 - default: - return length - } - - case 694: - switch byteToLower(b) { - case 'c': - st = 695 - default: - return length - } - - case 695: - switch byteToLower(b) { - case 'a': - st = 696 - default: - return length - } - - case 696: - switch byteToLower(b) { - case 't': - st = 697 - default: - return length - } - - case 697: - switch byteToLower(b) { - case 'i': - st = 698 - default: - return length - } - - case 698: - switch byteToLower(b) { - case 'o': - st = 699 - default: - return length - } - - case 699: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 700 - default: - return length - } - - case 703: - switch byteToLower(b) { - case 'a': - st = 704 - case 'e': - st = 707 - default: - return length - } - - case 704: - switch byteToLower(b) { - case 'i': - st = 705 - default: - return length - } - - case 705: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 706 - default: - return length - } - - case 707: - switch byteToLower(b) { - case 'r': - st = 708 - default: - return length - } - - case 708: - switch byteToLower(b) { - case 'c': - st = 709 - default: - return length - } - - case 709: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 710 - default: - return length - } - - case 711: - switch byteToLower(b) { - case 'e': - st = 712 - case 'g': - st = 716 - case 't': - st = 725 - default: - return length - } - - case 712: - switch byteToLower(b) { - case 'r': - st = 713 - default: - return length - } - - case 713: - switch byteToLower(b) { - case 'g': - st = 714 - default: - return length - } - - case 714: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 715 - default: - return length - } - - case 716: - switch byteToLower(b) { - case 'i': - st = 717 - default: - return length - } - - case 717: - switch byteToLower(b) { - case 'n': - st = 718 - default: - return length - } - - case 718: - switch byteToLower(b) { - case 'e': - st = 719 - default: - return length - } - - case 719: - switch byteToLower(b) { - case 'e': - st = 720 - default: - return length - } - - case 720: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 721 - default: - return length - } - - case 721: - switch byteToLower(b) { - case 'i': - st = 722 - default: - return length - } - - case 722: - switch byteToLower(b) { - case 'n': - st = 723 - default: - return length - } - - case 723: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 724 - default: - return length - } - - case 725: - switch byteToLower(b) { - case 'e': - st = 726 - default: - return length - } - - case 726: - switch byteToLower(b) { - case 'r': - st = 727 - default: - return length - } - - case 727: - switch byteToLower(b) { - case 'p': - st = 728 - default: - return length - } - - case 728: - switch byteToLower(b) { - case 'r': - st = 729 - default: - return length - } - - case 729: - switch byteToLower(b) { - case 'i': - st = 730 - default: - return length - } - - case 730: - switch byteToLower(b) { - case 's': - st = 731 - default: - return length - } - - case 731: - switch byteToLower(b) { - case 'e': - st = 732 - default: - return length - } - - case 732: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 733 - default: - return length - } - - case 734: - switch byteToLower(b) { - case 's': - st = 735 - default: - return length - } - - case 735: - switch byteToLower(b) { - case 'o': - st = 736 - default: - return length - } - - case 736: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 737 - default: - return length - } - - case 738: - switch byteToLower(b) { - case 'u': - st = 739 - default: - return length - } - - case 739: - switch byteToLower(b) { - case 'i': - st = 740 - default: - return length - } - - case 740: - switch byteToLower(b) { - case 'p': - st = 741 - default: - return length - } - - case 741: - switch byteToLower(b) { - case 'm': - st = 742 - default: - return length - } - - case 742: - switch byteToLower(b) { - case 'e': - st = 743 - default: - return length - } - - case 743: - switch byteToLower(b) { - case 'n': - st = 744 - default: - return length - } - - case 744: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 745 - default: - return length - } - - case 746: - switch byteToLower(b) { - case 'n': - st = 747 - default: - return length - } - - case 747: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 748 - default: - return length - } - - case 749: - switch byteToLower(b) { - case 'q': - length = i + 1 - st = 750 - case 't': - st = 751 - default: - return length - } - - case 751: - switch byteToLower(b) { - case 'a': - st = 752 - default: - return length - } - - case 752: - switch byteToLower(b) { - case 't': - st = 753 - default: - return length - } - - case 753: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 754 - default: - return length - } - - case 756: - switch byteToLower(b) { - case 'r': - st = 757 - case 's': - length = i + 1 - st = 765 - default: - return length - } - - case 757: - switch byteToLower(b) { - case 'o': - st = 758 - default: - return length - } - - case 758: - switch byteToLower(b) { - case 'v': - st = 759 - default: - return length - } - - case 759: - switch byteToLower(b) { - case 'i': - st = 760 - default: - return length - } - - case 760: - switch byteToLower(b) { - case 's': - st = 761 - default: - return length - } - - case 761: - switch byteToLower(b) { - case 'i': - st = 762 - default: - return length - } - - case 762: - switch byteToLower(b) { - case 'o': - st = 763 - default: - return length - } - - case 763: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 764 - default: - return length - } - - case 766: - switch byteToLower(b) { - case 'e': - st = 767 - default: - return length - } - - case 767: - switch byteToLower(b) { - case 'n': - st = 768 - case 'r': - st = 771 - default: - return length - } - - case 768: - switch byteToLower(b) { - case 't': - st = 769 - default: - return length - } - - case 769: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 770 - default: - return length - } - - case 771: - switch byteToLower(b) { - case 'b': - st = 772 - default: - return length - } - - case 772: - switch byteToLower(b) { - case 'a': - st = 773 - default: - return length - } - - case 773: - switch byteToLower(b) { - case 'n': - st = 774 - default: - return length - } - - case 774: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 775 - default: - return length - } - - case 776: - switch byteToLower(b) { - case 'c': - st = 777 - case 'i': - st = 783 - case 'p': - st = 785 - default: - return length - } - - case 777: - switch byteToLower(b) { - case 'h': - st = 778 - default: - return length - } - - case 778: - switch byteToLower(b) { - case 'a': - st = 779 - default: - return length - } - - case 779: - switch byteToLower(b) { - case 'n': - st = 780 - default: - return length - } - - case 780: - switch byteToLower(b) { - case 'g': - st = 781 - default: - return length - } - - case 781: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 782 - default: - return length - } - - case 783: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 784 - default: - return length - } - - case 785: - switch byteToLower(b) { - case 'e': - st = 786 - case 'o': - st = 789 - case 'r': - st = 793 - default: - return length - } - - case 786: - switch byteToLower(b) { - case 'r': - st = 787 - default: - return length - } - - case 787: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 788 - default: - return length - } - - case 789: - switch byteToLower(b) { - case 's': - st = 790 - default: - return length - } - - case 790: - switch byteToLower(b) { - case 'e': - st = 791 - default: - return length - } - - case 791: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 792 - default: - return length - } - - case 793: - switch byteToLower(b) { - case 'e': - st = 794 - default: - return length - } - - case 794: - switch byteToLower(b) { - case 's': - st = 795 - default: - return length - } - - case 795: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 796 - default: - return length - } - - case 797: - switch byteToLower(b) { - case 'a': - st = 798 - case 'e': - st = 812 - case 'i': - length = i + 1 - st = 819 - case 'j': - length = i + 1 - st = 846 - case 'k': - length = i + 1 - st = 847 - case 'l': - st = 848 - case 'm': - length = i + 1 - st = 870 - case 'o': - length = i + 1 - st = 871 - case 'r': - length = i + 1 - st = 893 - case 'u': - st = 900 - case 'y': - st = 914 - default: - return length - } - - case 798: - switch byteToLower(b) { - case 'i': - st = 799 - case 'n': - length = i + 1 - st = 803 - case 'r': - st = 805 - case 's': - st = 807 - default: - return length - } - - case 799: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 800 - case 't': - st = 801 - default: - return length - } - - case 801: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 802 - default: - return length - } - - case 803: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 804 - default: - return length - } - - case 805: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 806 - default: - return length - } - - case 807: - switch byteToLower(b) { - case 'h': - st = 808 - default: - return length - } - - case 808: - switch byteToLower(b) { - case 'i': - st = 809 - default: - return length - } - - case 809: - switch byteToLower(b) { - case 'o': - st = 810 - default: - return length - } - - case 810: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 811 - default: - return length - } - - case 812: - switch byteToLower(b) { - case 'e': - st = 813 - default: - return length - } - - case 813: - switch byteToLower(b) { - case 'd': - st = 814 - default: - return length - } - - case 814: - switch byteToLower(b) { - case 'b': - st = 815 - default: - return length - } - - case 815: - switch byteToLower(b) { - case 'a': - st = 816 - default: - return length - } - - case 816: - switch byteToLower(b) { - case 'c': - st = 817 - default: - return length - } - - case 817: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 818 - default: - return length - } - - case 819: - switch byteToLower(b) { - case 'l': - st = 820 - case 'n': - st = 822 - case 'r': - st = 830 - case 's': - st = 836 - case 't': - length = i + 1 - st = 841 - default: - return length - } - - case 820: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 821 - default: - return length - } - - case 822: - switch byteToLower(b) { - case 'a': - st = 823 - default: - return length - } - - case 823: - switch byteToLower(b) { - case 'n': - st = 824 - default: - return length - } - - case 824: - switch byteToLower(b) { - case 'c': - st = 825 - default: - return length - } - - case 825: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 826 - case 'i': - st = 827 - default: - return length - } - - case 827: - switch byteToLower(b) { - case 'a': - st = 828 - default: - return length - } - - case 828: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 829 - default: - return length - } - - case 830: - switch byteToLower(b) { - case 'm': - st = 831 - default: - return length - } - - case 831: - switch byteToLower(b) { - case 'd': - st = 832 - default: - return length - } - - case 832: - switch byteToLower(b) { - case 'a': - st = 833 - default: - return length - } - - case 833: - switch byteToLower(b) { - case 'l': - st = 834 - default: - return length - } - - case 834: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 835 - default: - return length - } - - case 836: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 837 - default: - return length - } - - case 837: - switch byteToLower(b) { - case 'i': - st = 838 - default: - return length - } - - case 838: - switch byteToLower(b) { - case 'n': - st = 839 - default: - return length - } - - case 839: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 840 - default: - return length - } - - case 841: - switch byteToLower(b) { - case 'n': - st = 842 - default: - return length - } - - case 842: - switch byteToLower(b) { - case 'e': - st = 843 - default: - return length - } - - case 843: - switch byteToLower(b) { - case 's': - st = 844 - default: - return length - } - - case 844: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 845 - default: - return length - } - - case 848: - switch byteToLower(b) { - case 'i': - st = 849 - case 'o': - st = 854 - case 's': - st = 863 - case 'y': - length = i + 1 - st = 869 - default: - return length - } - - case 849: - switch byteToLower(b) { - case 'g': - st = 850 - default: - return length - } - - case 850: - switch byteToLower(b) { - case 'h': - st = 851 - default: - return length - } - - case 851: - switch byteToLower(b) { - case 't': - st = 852 - default: - return length - } - - case 852: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 853 - default: - return length - } - - case 854: - switch byteToLower(b) { - case 'r': - st = 855 - case 'w': - st = 859 - default: - return length - } - - case 855: - switch byteToLower(b) { - case 'i': - st = 856 - default: - return length - } - - case 856: - switch byteToLower(b) { - case 's': - st = 857 - default: - return length - } - - case 857: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 858 - default: - return length - } - - case 859: - switch byteToLower(b) { - case 'e': - st = 860 - default: - return length - } - - case 860: - switch byteToLower(b) { - case 'r': - st = 861 - default: - return length - } - - case 861: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 862 - default: - return length - } - - case 863: - switch byteToLower(b) { - case 'm': - st = 864 - default: - return length - } - - case 864: - switch byteToLower(b) { - case 'i': - st = 865 - default: - return length - } - - case 865: - switch byteToLower(b) { - case 'd': - st = 866 - default: - return length - } - - case 866: - switch byteToLower(b) { - case 't': - st = 867 - default: - return length - } - - case 867: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 868 - default: - return length - } - - case 871: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 872 - case 'r': - st = 878 - case 'u': - st = 885 - default: - return length - } - - case 872: - switch byteToLower(b) { - case 't': - st = 873 - default: - return length - } - - case 873: - switch byteToLower(b) { - case 'b': - st = 874 - default: - return length - } - - case 874: - switch byteToLower(b) { - case 'a': - st = 875 - default: - return length - } - - case 875: - switch byteToLower(b) { - case 'l': - st = 876 - default: - return length - } - - case 876: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 877 - default: - return length - } - - case 878: - switch byteToLower(b) { - case 'e': - st = 879 - case 's': - st = 881 - default: - return length - } - - case 879: - switch byteToLower(b) { - case 'x': - length = i + 1 - st = 880 - default: - return length - } - - case 881: - switch byteToLower(b) { - case 'a': - st = 882 - default: - return length - } - - case 882: - switch byteToLower(b) { - case 'l': - st = 883 - default: - return length - } - - case 883: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 884 - default: - return length - } - - case 885: - switch byteToLower(b) { - case 'n': - st = 886 - default: - return length - } - - case 886: - switch byteToLower(b) { - case 'd': - st = 887 - default: - return length - } - - case 887: - switch byteToLower(b) { - case 'a': - st = 888 - default: - return length - } - - case 888: - switch byteToLower(b) { - case 't': - st = 889 - default: - return length - } - - case 889: - switch byteToLower(b) { - case 'i': - st = 890 - default: - return length - } - - case 890: - switch byteToLower(b) { - case 'o': - st = 891 - default: - return length - } - - case 891: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 892 - default: - return length - } - - case 893: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 894 - case 'o': - st = 895 - default: - return length - } - - case 895: - switch byteToLower(b) { - case 'g': - st = 896 - default: - return length - } - - case 896: - switch byteToLower(b) { - case 'a': - st = 897 - default: - return length - } - - case 897: - switch byteToLower(b) { - case 'n': - st = 898 - default: - return length - } - - case 898: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 899 - default: - return length - } - - case 900: - switch byteToLower(b) { - case 'n': - st = 901 - case 'r': - st = 903 - case 't': - st = 910 - default: - return length - } - - case 901: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 902 - default: - return length - } - - case 903: - switch byteToLower(b) { - case 'n': - st = 904 - default: - return length - } - - case 904: - switch byteToLower(b) { - case 'i': - st = 905 - default: - return length - } - - case 905: - switch byteToLower(b) { - case 't': - st = 906 - default: - return length - } - - case 906: - switch byteToLower(b) { - case 'u': - st = 907 - default: - return length - } - - case 907: - switch byteToLower(b) { - case 'r': - st = 908 - default: - return length - } - - case 908: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 909 - default: - return length - } - - case 910: - switch byteToLower(b) { - case 'b': - st = 911 - default: - return length - } - - case 911: - switch byteToLower(b) { - case 'o': - st = 912 - default: - return length - } - - case 912: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 913 - default: - return length - } - - case 914: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 915 - default: - return length - } - - case 916: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 917 - case 'b': - length = i + 1 - st = 927 - case 'd': - length = i + 1 - st = 930 - case 'e': - length = i + 1 - st = 932 - case 'f': - length = i + 1 - st = 935 - case 'g': - length = i + 1 - st = 936 - case 'h': - length = i + 1 - st = 939 - case 'i': - length = i + 1 - st = 940 - case 'l': - length = i + 1 - st = 947 - case 'm': - length = i + 1 - st = 957 - case 'n': - length = i + 1 - st = 963 - case 'o': - st = 965 - case 'p': - length = i + 1 - st = 980 - case 'q': - length = i + 1 - st = 981 - case 'r': - length = i + 1 - st = 982 - case 's': - length = i + 1 - st = 998 - case 't': - length = i + 1 - st = 999 - case 'u': - length = i + 1 - st = 1000 - case 'w': - length = i + 1 - st = 1012 - case 'y': - length = i + 1 - st = 1013 - default: - return length - } - - case 917: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 918 - case 'r': - st = 923 - default: - return length - } - - case 918: - switch byteToLower(b) { - case 'l': - st = 919 - default: - return length - } - - case 919: - switch byteToLower(b) { - case 'e': - st = 920 - default: - return length - } - - case 920: - switch byteToLower(b) { - case 'r': - st = 921 - default: - return length - } - - case 921: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 922 - default: - return length - } - - case 923: - switch byteToLower(b) { - case 'd': - st = 924 - default: - return length - } - - case 924: - switch byteToLower(b) { - case 'e': - st = 925 - default: - return length - } - - case 925: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 926 - default: - return length - } - - case 927: - switch byteToLower(b) { - case 'i': - st = 928 - default: - return length - } - - case 928: - switch byteToLower(b) { - case 'z': - length = i + 1 - st = 929 - default: - return length - } - - case 930: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 931 - default: - return length - } - - case 932: - switch byteToLower(b) { - case 'n': - st = 933 - default: - return length - } - - case 933: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 934 - default: - return length - } - - case 936: - switch byteToLower(b) { - case 'e': - st = 937 - default: - return length - } - - case 937: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 938 - default: - return length - } - - case 940: - switch byteToLower(b) { - case 'f': - st = 941 - case 'v': - st = 944 - default: - return length - } - - case 941: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 942 - default: - return length - } - - case 942: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 943 - default: - return length - } - - case 944: - switch byteToLower(b) { - case 'e': - st = 945 - default: - return length - } - - case 945: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 946 - default: - return length - } - - case 947: - switch byteToLower(b) { - case 'a': - st = 948 - case 'e': - length = i + 1 - st = 951 - case 'o': - st = 952 - default: - return length - } - - case 948: - switch byteToLower(b) { - case 's': - st = 949 - default: - return length - } - - case 949: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 950 - default: - return length - } - - case 952: - switch byteToLower(b) { - case 'b': - st = 953 - default: - return length - } - - case 953: - switch byteToLower(b) { - case 'a': - st = 954 - case 'o': - length = i + 1 - st = 956 - default: - return length - } - - case 954: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 955 - default: - return length - } - - case 957: - switch byteToLower(b) { - case 'a': - st = 958 - case 'o': - length = i + 1 - st = 961 - case 'x': - length = i + 1 - st = 962 - default: - return length - } - - case 958: - switch byteToLower(b) { - case 'i': - st = 959 - default: - return length - } - - case 959: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 960 - default: - return length - } - - case 963: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 964 - default: - return length - } - - case 965: - switch byteToLower(b) { - case 'l': - st = 966 - case 'o': - length = i + 1 - st = 974 - case 'p': - length = i + 1 - st = 978 - case 'v': - length = i + 1 - st = 979 - default: - return length - } - - case 966: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 967 - case 'f': - length = i + 1 - st = 973 - default: - return length - } - - case 967: - switch byteToLower(b) { - case 'p': - st = 968 - default: - return length - } - - case 968: - switch byteToLower(b) { - case 'o': - st = 969 - default: - return length - } - - case 969: - switch byteToLower(b) { - case 'i': - st = 970 - default: - return length - } - - case 970: - switch byteToLower(b) { - case 'n': - st = 971 - default: - return length - } - - case 971: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 972 - default: - return length - } - - case 974: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 975 - default: - return length - } - - case 975: - switch byteToLower(b) { - case 'l': - st = 976 - default: - return length - } - - case 976: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 977 - default: - return length - } - - case 982: - switch byteToLower(b) { - case 'a': - st = 983 - case 'e': - st = 992 - case 'i': - st = 995 - default: - return length - } - - case 983: - switch byteToLower(b) { - case 'p': - st = 984 - case 't': - st = 989 - default: - return length - } - - case 984: - switch byteToLower(b) { - case 'h': - st = 985 - default: - return length - } - - case 985: - switch byteToLower(b) { - case 'i': - st = 986 - default: - return length - } - - case 986: - switch byteToLower(b) { - case 'c': - st = 987 - default: - return length - } - - case 987: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 988 - default: - return length - } - - case 989: - switch byteToLower(b) { - case 'i': - st = 990 - default: - return length - } - - case 990: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 991 - default: - return length - } - - case 992: - switch byteToLower(b) { - case 'e': - st = 993 - default: - return length - } - - case 993: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 994 - default: - return length - } - - case 995: - switch byteToLower(b) { - case 'p': - st = 996 - default: - return length - } - - case 996: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 997 - default: - return length - } - - case 1000: - switch byteToLower(b) { - case 'g': - st = 1001 - case 'i': - st = 1003 - case 'r': - st = 1010 - default: - return length - } - - case 1001: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1002 - default: - return length - } - - case 1003: - switch byteToLower(b) { - case 'd': - st = 1004 - case 't': - st = 1006 - default: - return length - } - - case 1004: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1005 - default: - return length - } - - case 1006: - switch byteToLower(b) { - case 'a': - st = 1007 - default: - return length - } - - case 1007: - switch byteToLower(b) { - case 'r': - st = 1008 - default: - return length - } - - case 1008: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1009 - default: - return length - } - - case 1010: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 1011 - default: - return length - } - - case 1014: - switch byteToLower(b) { - case 'a': - st = 1015 - case 'e': - st = 1028 - case 'i': - st = 1044 - case 'k': - length = i + 1 - st = 1055 - case 'm': - length = i + 1 - st = 1056 - case 'n': - length = i + 1 - st = 1057 - case 'o': - st = 1058 - case 'r': - length = i + 1 - st = 1096 - case 't': - length = i + 1 - st = 1097 - case 'u': - length = i + 1 - st = 1098 - default: - return length - } - - case 1015: - switch byteToLower(b) { - case 'm': - st = 1016 - case 'n': - st = 1021 - case 'u': - st = 1026 - default: - return length - } - - case 1016: - switch byteToLower(b) { - case 'b': - st = 1017 - default: - return length - } - - case 1017: - switch byteToLower(b) { - case 'u': - st = 1018 - default: - return length - } - - case 1018: - switch byteToLower(b) { - case 'r': - st = 1019 - default: - return length - } - - case 1019: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1020 - default: - return length - } - - case 1021: - switch byteToLower(b) { - case 'g': - st = 1022 - default: - return length - } - - case 1022: - switch byteToLower(b) { - case 'o': - st = 1023 - default: - return length - } - - case 1023: - switch byteToLower(b) { - case 'u': - st = 1024 - default: - return length - } - - case 1024: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1025 - default: - return length - } - - case 1026: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1027 - default: - return length - } - - case 1028: - switch byteToLower(b) { - case 'a': - st = 1029 - case 'l': - st = 1037 - case 'r': - st = 1039 - default: - return length - } - - case 1029: - switch byteToLower(b) { - case 'l': - st = 1030 - default: - return length - } - - case 1030: - switch byteToLower(b) { - case 't': - st = 1031 - default: - return length - } - - case 1031: - switch byteToLower(b) { - case 'h': - st = 1032 - default: - return length - } - - case 1032: - switch byteToLower(b) { - case 'c': - st = 1033 - default: - return length - } - - case 1033: - switch byteToLower(b) { - case 'a': - st = 1034 - default: - return length - } - - case 1034: - switch byteToLower(b) { - case 'r': - st = 1035 - default: - return length - } - - case 1035: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1036 - default: - return length - } - - case 1037: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 1038 - default: - return length - } - - case 1039: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1040 - case 'm': - st = 1041 - default: - return length - } - - case 1041: - switch byteToLower(b) { - case 'e': - st = 1042 - default: - return length - } - - case 1042: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1043 - default: - return length - } - - case 1044: - switch byteToLower(b) { - case 'p': - st = 1045 - case 't': - st = 1049 - case 'v': - length = i + 1 - st = 1054 - default: - return length - } - - case 1045: - switch byteToLower(b) { - case 'h': - st = 1046 - default: - return length - } - - case 1046: - switch byteToLower(b) { - case 'o': - st = 1047 - default: - return length - } - - case 1047: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 1048 - default: - return length - } - - case 1049: - switch byteToLower(b) { - case 'a': - st = 1050 - default: - return length - } - - case 1050: - switch byteToLower(b) { - case 'c': - st = 1051 - default: - return length - } - - case 1051: - switch byteToLower(b) { - case 'h': - st = 1052 - default: - return length - } - - case 1052: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1053 - default: - return length - } - - case 1058: - switch byteToLower(b) { - case 'c': - st = 1059 - case 'l': - st = 1063 - case 'm': - st = 1073 - case 'n': - st = 1081 - case 'r': - st = 1084 - case 's': - st = 1087 - case 'u': - st = 1092 - case 'w': - length = i + 1 - st = 1095 - default: - return length - } - - case 1059: - switch byteToLower(b) { - case 'k': - st = 1060 - default: - return length - } - - case 1060: - switch byteToLower(b) { - case 'e': - st = 1061 - default: - return length - } - - case 1061: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1062 - default: - return length - } - - case 1063: - switch byteToLower(b) { - case 'd': - st = 1064 - case 'i': - st = 1069 - default: - return length - } - - case 1064: - switch byteToLower(b) { - case 'i': - st = 1065 - default: - return length - } - - case 1065: - switch byteToLower(b) { - case 'n': - st = 1066 - default: - return length - } - - case 1066: - switch byteToLower(b) { - case 'g': - st = 1067 - default: - return length - } - - case 1067: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1068 - default: - return length - } - - case 1069: - switch byteToLower(b) { - case 'd': - st = 1070 - default: - return length - } - - case 1070: - switch byteToLower(b) { - case 'a': - st = 1071 - default: - return length - } - - case 1071: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1072 - default: - return length - } - - case 1073: - switch byteToLower(b) { - case 'e': - st = 1074 - default: - return length - } - - case 1074: - switch byteToLower(b) { - case 'd': - st = 1075 - case 's': - length = i + 1 - st = 1080 - default: - return length - } - - case 1075: - switch byteToLower(b) { - case 'e': - st = 1076 - default: - return length - } - - case 1076: - switch byteToLower(b) { - case 'p': - st = 1077 - default: - return length - } - - case 1077: - switch byteToLower(b) { - case 'o': - st = 1078 - default: - return length - } - - case 1078: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1079 - default: - return length - } - - case 1081: - switch byteToLower(b) { - case 'd': - st = 1082 - default: - return length - } - - case 1082: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1083 - default: - return length - } - - case 1084: - switch byteToLower(b) { - case 's': - st = 1085 - default: - return length - } - - case 1085: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1086 - default: - return length - } - - case 1087: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1088 - default: - return length - } - - case 1088: - switch byteToLower(b) { - case 'i': - st = 1089 - default: - return length - } - - case 1089: - switch byteToLower(b) { - case 'n': - st = 1090 - default: - return length - } - - case 1090: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1091 - default: - return length - } - - case 1092: - switch byteToLower(b) { - case 's': - st = 1093 - default: - return length - } - - case 1093: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1094 - default: - return length - } - - case 1099: - switch byteToLower(b) { - case '2': - st = 1100 - case 'b': - st = 1102 - case 'c': - st = 1104 - case 'd': - length = i + 1 - st = 1108 - case 'e': - length = i + 1 - st = 1109 - case 'f': - st = 1110 - case 'l': - length = i + 1 - st = 1112 - case 'm': - length = i + 1 - st = 1113 - case 'n': - length = i + 1 - st = 1122 - case 'o': - length = i + 1 - st = 1170 - case 'q': - length = i + 1 - st = 1171 - case 'r': - length = i + 1 - st = 1172 - case 's': - length = i + 1 - st = 1176 - case 't': - length = i + 1 - st = 1177 - case 'w': - st = 1178 - default: - return length - } - - case 1100: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 1101 - default: - return length - } - - case 1102: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 1103 - default: - return length - } - - case 1104: - switch byteToLower(b) { - case 'b': - st = 1105 - case 'u': - length = i + 1 - st = 1107 - default: - return length - } - - case 1105: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1106 - default: - return length - } - - case 1110: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 1111 - default: - return length - } - - case 1113: - switch byteToLower(b) { - case 'm': - st = 1114 - default: - return length - } - - case 1114: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1115 - default: - return length - } - - case 1115: - switch byteToLower(b) { - case 'b': - st = 1116 - default: - return length - } - - case 1116: - switch byteToLower(b) { - case 'i': - st = 1117 - default: - return length - } - - case 1117: - switch byteToLower(b) { - case 'l': - st = 1118 - default: - return length - } - - case 1118: - switch byteToLower(b) { - case 'i': - st = 1119 - default: - return length - } - - case 1119: - switch byteToLower(b) { - case 'e': - st = 1120 - default: - return length - } - - case 1120: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1121 - default: - return length - } - - case 1122: - switch byteToLower(b) { - case 'd': - st = 1123 - case 'f': - st = 1131 - case 'g': - length = i + 1 - st = 1138 - case 'k': - length = i + 1 - st = 1139 - case 's': - st = 1140 - case 't': - length = i + 1 - st = 1150 - case 'v': - st = 1161 - default: - return length - } - - case 1123: - switch byteToLower(b) { - case 'u': - st = 1124 - default: - return length - } - - case 1124: - switch byteToLower(b) { - case 's': - st = 1125 - default: - return length - } - - case 1125: - switch byteToLower(b) { - case 't': - st = 1126 - default: - return length - } - - case 1126: - switch byteToLower(b) { - case 'r': - st = 1127 - default: - return length - } - - case 1127: - switch byteToLower(b) { - case 'i': - st = 1128 - default: - return length - } - - case 1128: - switch byteToLower(b) { - case 'e': - st = 1129 - default: - return length - } - - case 1129: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1130 - default: - return length - } - - case 1131: - switch byteToLower(b) { - case 'i': - st = 1132 - case 'o': - length = i + 1 - st = 1137 - default: - return length - } - - case 1132: - switch byteToLower(b) { - case 'n': - st = 1133 - default: - return length - } - - case 1133: - switch byteToLower(b) { - case 'i': - st = 1134 - default: - return length - } - - case 1134: - switch byteToLower(b) { - case 't': - st = 1135 - default: - return length - } - - case 1135: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1136 - default: - return length - } - - case 1140: - switch byteToLower(b) { - case 't': - st = 1141 - case 'u': - st = 1147 - default: - return length - } - - case 1141: - switch byteToLower(b) { - case 'i': - st = 1142 - default: - return length - } - - case 1142: - switch byteToLower(b) { - case 't': - st = 1143 - default: - return length - } - - case 1143: - switch byteToLower(b) { - case 'u': - st = 1144 - default: - return length - } - - case 1144: - switch byteToLower(b) { - case 't': - st = 1145 - default: - return length - } - - case 1145: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1146 - default: - return length - } - - case 1147: - switch byteToLower(b) { - case 'r': - st = 1148 - default: - return length - } - - case 1148: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1149 - default: - return length - } - - case 1150: - switch byteToLower(b) { - case 'e': - st = 1151 - default: - return length - } - - case 1151: - switch byteToLower(b) { - case 'r': - st = 1152 - default: - return length - } - - case 1152: - switch byteToLower(b) { - case 'n': - st = 1153 - default: - return length - } - - case 1153: - switch byteToLower(b) { - case 'a': - st = 1154 - default: - return length - } - - case 1154: - switch byteToLower(b) { - case 't': - st = 1155 - default: - return length - } - - case 1155: - switch byteToLower(b) { - case 'i': - st = 1156 - default: - return length - } - - case 1156: - switch byteToLower(b) { - case 'o': - st = 1157 - default: - return length - } - - case 1157: - switch byteToLower(b) { - case 'n': - st = 1158 - default: - return length - } - - case 1158: - switch byteToLower(b) { - case 'a': - st = 1159 - default: - return length - } - - case 1159: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1160 - default: - return length - } - - case 1161: - switch byteToLower(b) { - case 'e': - st = 1162 - default: - return length - } - - case 1162: - switch byteToLower(b) { - case 's': - st = 1163 - default: - return length - } - - case 1163: - switch byteToLower(b) { - case 't': - st = 1164 - default: - return length - } - - case 1164: - switch byteToLower(b) { - case 'm': - st = 1165 - default: - return length - } - - case 1165: - switch byteToLower(b) { - case 'e': - st = 1166 - default: - return length - } - - case 1166: - switch byteToLower(b) { - case 'n': - st = 1167 - default: - return length - } - - case 1167: - switch byteToLower(b) { - case 't': - st = 1168 - default: - return length - } - - case 1168: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1169 - default: - return length - } - - case 1172: - switch byteToLower(b) { - case 'i': - st = 1173 - default: - return length - } - - case 1173: - switch byteToLower(b) { - case 's': - st = 1174 - default: - return length - } - - case 1174: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 1175 - default: - return length - } - - case 1178: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1179 - default: - return length - } - - case 1180: - switch byteToLower(b) { - case 'a': - st = 1181 - case 'c': - st = 1184 - case 'e': - length = i + 1 - st = 1186 - case 'l': - st = 1195 - case 'm': - length = i + 1 - st = 1197 - case 'o': - length = i + 1 - st = 1198 - case 'p': - length = i + 1 - st = 1204 - case 'u': - st = 1205 - default: - return length - } - - case 1181: - switch byteToLower(b) { - case 'v': - st = 1182 - default: - return length - } - - case 1182: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1183 - default: - return length - } - - case 1184: - switch byteToLower(b) { - case 'b': - length = i + 1 - st = 1185 - default: - return length - } - - case 1186: - switch byteToLower(b) { - case 't': - st = 1187 - case 'w': - st = 1190 - default: - return length - } - - case 1187: - switch byteToLower(b) { - case 'z': - st = 1188 - default: - return length - } - - case 1188: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1189 - default: - return length - } - - case 1190: - switch byteToLower(b) { - case 'e': - st = 1191 - default: - return length - } - - case 1191: - switch byteToLower(b) { - case 'l': - st = 1192 - default: - return length - } - - case 1192: - switch byteToLower(b) { - case 'r': - st = 1193 - default: - return length - } - - case 1193: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1194 - default: - return length - } - - case 1195: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1196 - default: - return length - } - - case 1198: - switch byteToLower(b) { - case 'b': - st = 1199 - default: - return length - } - - case 1199: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1200 - case 'u': - st = 1201 - default: - return length - } - - case 1201: - switch byteToLower(b) { - case 'r': - st = 1202 - default: - return length - } - - case 1202: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1203 - default: - return length - } - - case 1205: - switch byteToLower(b) { - case 'e': - st = 1206 - default: - return length - } - - case 1206: - switch byteToLower(b) { - case 'g': - st = 1207 - default: - return length - } - - case 1207: - switch byteToLower(b) { - case 'o': - st = 1208 - default: - return length - } - - case 1208: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1209 - default: - return length - } - - case 1210: - switch byteToLower(b) { - case 'a': - st = 1211 - case 'd': - st = 1216 - case 'e': - length = i + 1 - st = 1219 - case 'g': - length = i + 1 - st = 1220 - case 'h': - length = i + 1 - st = 1221 - case 'i': - length = i + 1 - st = 1222 - case 'm': - length = i + 1 - st = 1231 - case 'n': - length = i + 1 - st = 1232 - case 'o': - st = 1233 - case 'p': - length = i + 1 - st = 1242 - case 'r': - length = i + 1 - st = 1243 - case 'w': - length = i + 1 - st = 1247 - case 'y': - length = i + 1 - st = 1248 - case 'z': - length = i + 1 - st = 1252 - default: - return length - } - - case 1211: - switch byteToLower(b) { - case 'u': - st = 1212 - default: - return length - } - - case 1212: - switch byteToLower(b) { - case 'f': - st = 1213 - default: - return length - } - - case 1213: - switch byteToLower(b) { - case 'e': - st = 1214 - default: - return length - } - - case 1214: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1215 - default: - return length - } - - case 1216: - switch byteToLower(b) { - case 'd': - st = 1217 - default: - return length - } - - case 1217: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1218 - default: - return length - } - - case 1222: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 1223 - case 't': - st = 1224 - case 'w': - st = 1229 - default: - return length - } - - case 1224: - switch byteToLower(b) { - case 'c': - st = 1225 - default: - return length - } - - case 1225: - switch byteToLower(b) { - case 'h': - st = 1226 - default: - return length - } - - case 1226: - switch byteToLower(b) { - case 'e': - st = 1227 - default: - return length - } - - case 1227: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1228 - default: - return length - } - - case 1229: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1230 - default: - return length - } - - case 1233: - switch byteToLower(b) { - case 'e': - st = 1234 - case 'm': - st = 1237 - default: - return length - } - - case 1234: - switch byteToLower(b) { - case 'l': - st = 1235 - default: - return length - } - - case 1235: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1236 - default: - return length - } - - case 1237: - switch byteToLower(b) { - case 'a': - st = 1238 - default: - return length - } - - case 1238: - switch byteToLower(b) { - case 't': - st = 1239 - default: - return length - } - - case 1239: - switch byteToLower(b) { - case 's': - st = 1240 - default: - return length - } - - case 1240: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 1241 - default: - return length - } - - case 1243: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1244 - case 'e': - st = 1245 - default: - return length - } - - case 1245: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1246 - default: - return length - } - - case 1248: - switch byteToLower(b) { - case 'o': - st = 1249 - default: - return length - } - - case 1249: - switch byteToLower(b) { - case 't': - st = 1250 - default: - return length - } - - case 1250: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1251 - default: - return length - } - - case 1253: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1254 - case 'b': - length = i + 1 - st = 1271 - case 'c': - length = i + 1 - st = 1272 - case 'd': - st = 1273 - case 'e': - st = 1275 - case 'g': - st = 1287 - case 'i': - length = i + 1 - st = 1290 - case 'k': - length = i + 1 - st = 1314 - case 'o': - st = 1315 - case 'r': - length = i + 1 - st = 1333 - case 's': - length = i + 1 - st = 1334 - case 't': - length = i + 1 - st = 1335 - case 'u': - length = i + 1 - st = 1338 - case 'v': - length = i + 1 - st = 1347 - case 'y': - length = i + 1 - st = 1348 - default: - return length - } - - case 1254: - switch byteToLower(b) { - case 'c': - st = 1255 - case 'n': - st = 1260 - case 't': - length = i + 1 - st = 1262 - case 'w': - st = 1267 - default: - return length - } - - case 1255: - switch byteToLower(b) { - case 'a': - st = 1256 - default: - return length - } - - case 1256: - switch byteToLower(b) { - case 'i': - st = 1257 - default: - return length - } - - case 1257: - switch byteToLower(b) { - case 'x': - st = 1258 - default: - return length - } - - case 1258: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1259 - default: - return length - } - - case 1260: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1261 - default: - return length - } - - case 1262: - switch byteToLower(b) { - case 'r': - st = 1263 - default: - return length - } - - case 1263: - switch byteToLower(b) { - case 'o': - st = 1264 - default: - return length - } - - case 1264: - switch byteToLower(b) { - case 'b': - st = 1265 - default: - return length - } - - case 1265: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1266 - default: - return length - } - - case 1267: - switch byteToLower(b) { - case 'y': - st = 1268 - default: - return length - } - - case 1268: - switch byteToLower(b) { - case 'e': - st = 1269 - default: - return length - } - - case 1269: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1270 - default: - return length - } - - case 1273: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1274 - default: - return length - } - - case 1275: - switch byteToLower(b) { - case 'a': - st = 1276 - case 'c': - st = 1279 - case 'g': - st = 1284 - default: - return length - } - - case 1276: - switch byteToLower(b) { - case 's': - st = 1277 - default: - return length - } - - case 1277: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1278 - default: - return length - } - - case 1279: - switch byteToLower(b) { - case 'l': - st = 1280 - default: - return length - } - - case 1280: - switch byteToLower(b) { - case 'e': - st = 1281 - default: - return length - } - - case 1281: - switch byteToLower(b) { - case 'r': - st = 1282 - default: - return length - } - - case 1282: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1283 - default: - return length - } - - case 1284: - switch byteToLower(b) { - case 'a': - st = 1285 - default: - return length - } - - case 1285: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1286 - default: - return length - } - - case 1287: - switch byteToLower(b) { - case 'b': - st = 1288 - default: - return length - } - - case 1288: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1289 - default: - return length - } - - case 1290: - switch byteToLower(b) { - case 'a': - st = 1291 - case 'd': - st = 1296 - case 'f': - st = 1298 - case 'g': - st = 1300 - case 'm': - st = 1306 - case 'n': - st = 1312 - default: - return length - } - - case 1291: - switch byteToLower(b) { - case 'i': - st = 1292 - default: - return length - } - - case 1292: - switch byteToLower(b) { - case 's': - st = 1293 - default: - return length - } - - case 1293: - switch byteToLower(b) { - case 'o': - st = 1294 - default: - return length - } - - case 1294: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1295 - default: - return length - } - - case 1296: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1297 - default: - return length - } - - case 1298: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1299 - default: - return length - } - - case 1300: - switch byteToLower(b) { - case 'h': - st = 1301 - default: - return length - } - - case 1301: - switch byteToLower(b) { - case 't': - st = 1302 - default: - return length - } - - case 1302: - switch byteToLower(b) { - case 'i': - st = 1303 - default: - return length - } - - case 1303: - switch byteToLower(b) { - case 'n': - st = 1304 - default: - return length - } - - case 1304: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1305 - default: - return length - } - - case 1306: - switch byteToLower(b) { - case 'i': - st = 1307 - case 'o': - length = i + 1 - st = 1311 - default: - return length - } - - case 1307: - switch byteToLower(b) { - case 't': - st = 1308 - default: - return length - } - - case 1308: - switch byteToLower(b) { - case 'e': - st = 1309 - default: - return length - } - - case 1309: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1310 - default: - return length - } - - case 1312: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 1313 - default: - return length - } - - case 1315: - switch byteToLower(b) { - case 'a': - st = 1316 - case 'c': - st = 1319 - case 'l': - length = i + 1 - st = 1322 - case 'n': - st = 1323 - case 't': - st = 1327 - case 'v': - st = 1331 - default: - return length - } - - case 1316: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1317 - default: - return length - } - - case 1317: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1318 - default: - return length - } - - case 1319: - switch byteToLower(b) { - case 'a': - st = 1320 - default: - return length - } - - case 1320: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1321 - default: - return length - } - - case 1323: - switch byteToLower(b) { - case 'd': - st = 1324 - default: - return length - } - - case 1324: - switch byteToLower(b) { - case 'o': - st = 1325 - default: - return length - } - - case 1325: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1326 - default: - return length - } - - case 1327: - switch byteToLower(b) { - case 't': - st = 1328 - default: - return length - } - - case 1328: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1329 - case 'o': - length = i + 1 - st = 1330 - default: - return length - } - - case 1331: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1332 - default: - return length - } - - case 1335: - switch byteToLower(b) { - case 'd': - st = 1336 - default: - return length - } - - case 1336: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1337 - default: - return length - } - - case 1338: - switch byteToLower(b) { - case 'p': - st = 1339 - case 'x': - st = 1342 - default: - return length - } - - case 1339: - switch byteToLower(b) { - case 'i': - st = 1340 - default: - return length - } - - case 1340: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1341 - default: - return length - } - - case 1342: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1343 - case 'u': - st = 1344 - default: - return length - } - - case 1344: - switch byteToLower(b) { - case 'r': - st = 1345 - default: - return length - } - - case 1345: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1346 - default: - return length - } - - case 1349: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1350 - case 'b': - st = 1383 - case 'c': - length = i + 1 - st = 1385 - case 'd': - length = i + 1 - st = 1386 - case 'e': - length = i + 1 - st = 1387 - case 'g': - length = i + 1 - st = 1409 - case 'h': - length = i + 1 - st = 1410 - case 'i': - st = 1411 - case 'k': - length = i + 1 - st = 1418 - case 'l': - length = i + 1 - st = 1419 - case 'm': - length = i + 1 - st = 1420 - case 'n': - length = i + 1 - st = 1422 - case 'o': - length = i + 1 - st = 1423 - case 'p': - length = i + 1 - st = 1460 - case 'q': - length = i + 1 - st = 1461 - case 'r': - length = i + 1 - st = 1462 - case 's': - length = i + 1 - st = 1463 - case 't': - length = i + 1 - st = 1464 - case 'u': - length = i + 1 - st = 1468 - case 'v': - length = i + 1 - st = 1473 - case 'w': - length = i + 1 - st = 1474 - case 'x': - length = i + 1 - st = 1475 - case 'y': - length = i + 1 - st = 1476 - case 'z': - length = i + 1 - st = 1477 - default: - return length - } - - case 1350: - switch byteToLower(b) { - case 'd': - st = 1351 - case 'i': - st = 1355 - case 'n': - st = 1360 - case 'r': - st = 1370 - default: - return length - } - - case 1351: - switch byteToLower(b) { - case 'r': - st = 1352 - default: - return length - } - - case 1352: - switch byteToLower(b) { - case 'i': - st = 1353 - default: - return length - } - - case 1353: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1354 - default: - return length - } - - case 1355: - switch byteToLower(b) { - case 'f': - length = i + 1 - st = 1356 - case 's': - st = 1357 - default: - return length - } - - case 1357: - switch byteToLower(b) { - case 'o': - st = 1358 - default: - return length - } - - case 1358: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1359 - default: - return length - } - - case 1360: - switch byteToLower(b) { - case 'a': - st = 1361 - case 'g': - st = 1368 - default: - return length - } - - case 1361: - switch byteToLower(b) { - case 'g': - st = 1362 - default: - return length - } - - case 1362: - switch byteToLower(b) { - case 'e': - st = 1363 - default: - return length - } - - case 1363: - switch byteToLower(b) { - case 'm': - st = 1364 - default: - return length - } - - case 1364: - switch byteToLower(b) { - case 'e': - st = 1365 - default: - return length - } - - case 1365: - switch byteToLower(b) { - case 'n': - st = 1366 - default: - return length - } - - case 1366: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1367 - default: - return length - } - - case 1368: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1369 - default: - return length - } - - case 1370: - switch byteToLower(b) { - case 'k': - st = 1371 - case 'r': - st = 1378 - default: - return length - } - - case 1371: - switch byteToLower(b) { - case 'e': - st = 1372 - default: - return length - } - - case 1372: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1373 - default: - return length - } - - case 1373: - switch byteToLower(b) { - case 'i': - st = 1374 - case 's': - length = i + 1 - st = 1377 - default: - return length - } - - case 1374: - switch byteToLower(b) { - case 'n': - st = 1375 - default: - return length - } - - case 1375: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1376 - default: - return length - } - - case 1378: - switch byteToLower(b) { - case 'i': - st = 1379 - default: - return length - } - - case 1379: - switch byteToLower(b) { - case 'o': - st = 1380 - default: - return length - } - - case 1380: - switch byteToLower(b) { - case 't': - st = 1381 - default: - return length - } - - case 1381: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1382 - default: - return length - } - - case 1383: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1384 - default: - return length - } - - case 1387: - switch byteToLower(b) { - case 'd': - st = 1388 - case 'e': - st = 1391 - case 'l': - st = 1393 - case 'm': - st = 1400 - case 'n': - length = i + 1 - st = 1407 - default: - return length - } - - case 1388: - switch byteToLower(b) { - case 'i': - st = 1389 - default: - return length - } - - case 1389: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1390 - default: - return length - } - - case 1391: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1392 - default: - return length - } - - case 1393: - switch byteToLower(b) { - case 'b': - st = 1394 - default: - return length - } - - case 1394: - switch byteToLower(b) { - case 'o': - st = 1395 - default: - return length - } - - case 1395: - switch byteToLower(b) { - case 'u': - st = 1396 - default: - return length - } - - case 1396: - switch byteToLower(b) { - case 'r': - st = 1397 - default: - return length - } - - case 1397: - switch byteToLower(b) { - case 'n': - st = 1398 - default: - return length - } - - case 1398: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1399 - default: - return length - } - - case 1400: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1401 - case 'o': - st = 1402 - default: - return length - } - - case 1402: - switch byteToLower(b) { - case 'r': - st = 1403 - default: - return length - } - - case 1403: - switch byteToLower(b) { - case 'i': - st = 1404 - default: - return length - } - - case 1404: - switch byteToLower(b) { - case 'a': - st = 1405 - default: - return length - } - - case 1405: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1406 - default: - return length - } - - case 1407: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 1408 - default: - return length - } - - case 1411: - switch byteToLower(b) { - case 'a': - st = 1412 - case 'l': - length = i + 1 - st = 1415 - case 'n': - st = 1416 - default: - return length - } - - case 1412: - switch byteToLower(b) { - case 'm': - st = 1413 - default: - return length - } - - case 1413: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1414 - default: - return length - } - - case 1416: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1417 - default: - return length - } - - case 1420: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1421 - default: - return length - } - - case 1423: - switch byteToLower(b) { - case 'b': - st = 1424 - case 'd': - st = 1426 - case 'e': - length = i + 1 - st = 1428 - case 'n': - st = 1429 - case 'r': - st = 1435 - case 's': - st = 1444 - case 't': - st = 1448 - case 'v': - length = i + 1 - st = 1457 - default: - return length - } - - case 1424: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1425 - default: - return length - } - - case 1426: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1427 - default: - return length - } - - case 1429: - switch byteToLower(b) { - case 'a': - st = 1430 - case 'e': - st = 1433 - default: - return length - } - - case 1430: - switch byteToLower(b) { - case 's': - st = 1431 - default: - return length - } - - case 1431: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 1432 - default: - return length - } - - case 1433: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1434 - default: - return length - } - - case 1435: - switch byteToLower(b) { - case 'm': - st = 1436 - case 't': - st = 1439 - default: - return length - } - - case 1436: - switch byteToLower(b) { - case 'o': - st = 1437 - default: - return length - } - - case 1437: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1438 - default: - return length - } - - case 1439: - switch byteToLower(b) { - case 'g': - st = 1440 - default: - return length - } - - case 1440: - switch byteToLower(b) { - case 'a': - st = 1441 - default: - return length - } - - case 1441: - switch byteToLower(b) { - case 'g': - st = 1442 - default: - return length - } - - case 1442: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1443 - default: - return length - } - - case 1444: - switch byteToLower(b) { - case 'c': - st = 1445 - default: - return length - } - - case 1445: - switch byteToLower(b) { - case 'o': - st = 1446 - default: - return length - } - - case 1446: - switch byteToLower(b) { - case 'w': - length = i + 1 - st = 1447 - default: - return length - } - - case 1448: - switch byteToLower(b) { - case 'o': - st = 1449 - default: - return length - } - - case 1449: - switch byteToLower(b) { - case 'r': - st = 1450 - default: - return length - } - - case 1450: - switch byteToLower(b) { - case 'c': - st = 1451 - default: - return length - } - - case 1451: - switch byteToLower(b) { - case 'y': - st = 1452 - default: - return length - } - - case 1452: - switch byteToLower(b) { - case 'c': - st = 1453 - default: - return length - } - - case 1453: - switch byteToLower(b) { - case 'l': - st = 1454 - default: - return length - } - - case 1454: - switch byteToLower(b) { - case 'e': - st = 1455 - default: - return length - } - - case 1455: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1456 - default: - return length - } - - case 1457: - switch byteToLower(b) { - case 'i': - st = 1458 - default: - return length - } - - case 1458: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1459 - default: - return length - } - - case 1464: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1465 - case 'p': - st = 1466 - default: - return length - } - - case 1466: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1467 - default: - return length - } - - case 1468: - switch byteToLower(b) { - case 's': - st = 1469 - default: - return length - } - - case 1469: - switch byteToLower(b) { - case 'e': - st = 1470 - default: - return length - } - - case 1470: - switch byteToLower(b) { - case 'u': - st = 1471 - default: - return length - } - - case 1471: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 1472 - default: - return length - } - - case 1478: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1479 - case 'c': - length = i + 1 - st = 1491 - case 'e': - length = i + 1 - st = 1492 - case 'f': - length = i + 1 - st = 1509 - case 'g': - length = i + 1 - st = 1510 - case 'h': - st = 1512 - case 'i': - length = i + 1 - st = 1514 - case 'l': - length = i + 1 - st = 1524 - case 'o': - length = i + 1 - st = 1525 - case 'p': - length = i + 1 - st = 1526 - case 'r': - length = i + 1 - st = 1527 - case 't': - st = 1530 - case 'u': - length = i + 1 - st = 1532 - case 'y': - st = 1533 - case 'z': - length = i + 1 - st = 1535 - default: - return length - } - - case 1479: - switch byteToLower(b) { - case 'd': - st = 1480 - case 'g': - st = 1483 - case 'm': - st = 1487 - case 'v': - st = 1489 - default: - return length - } - - case 1480: - switch byteToLower(b) { - case 'e': - st = 1481 - default: - return length - } - - case 1481: - switch byteToLower(b) { - case 'x': - length = i + 1 - st = 1482 - default: - return length - } - - case 1483: - switch byteToLower(b) { - case 'o': - st = 1484 - default: - return length - } - - case 1484: - switch byteToLower(b) { - case 'y': - st = 1485 - default: - return length - } - - case 1485: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1486 - default: - return length - } - - case 1487: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1488 - default: - return length - } - - case 1489: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1490 - default: - return length - } - - case 1492: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1493 - case 't': - length = i + 1 - st = 1494 - case 'u': - st = 1499 - case 'w': - length = i + 1 - st = 1504 - case 'x': - st = 1506 - default: - return length - } - - case 1494: - switch byteToLower(b) { - case 'w': - st = 1495 - default: - return length - } - - case 1495: - switch byteToLower(b) { - case 'o': - st = 1496 - default: - return length - } - - case 1496: - switch byteToLower(b) { - case 'r': - st = 1497 - default: - return length - } - - case 1497: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 1498 - default: - return length - } - - case 1499: - switch byteToLower(b) { - case 's': - st = 1500 - default: - return length - } - - case 1500: - switch byteToLower(b) { - case 't': - st = 1501 - default: - return length - } - - case 1501: - switch byteToLower(b) { - case 'a': - st = 1502 - default: - return length - } - - case 1502: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1503 - default: - return length - } - - case 1504: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1505 - default: - return length - } - - case 1506: - switch byteToLower(b) { - case 'u': - st = 1507 - default: - return length - } - - case 1507: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1508 - default: - return length - } - - case 1510: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1511 - default: - return length - } - - case 1512: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 1513 - default: - return length - } - - case 1514: - switch byteToLower(b) { - case 'c': - st = 1515 - case 'n': - st = 1517 - case 's': - st = 1520 - default: - return length - } - - case 1515: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1516 - default: - return length - } - - case 1517: - switch byteToLower(b) { - case 'j': - st = 1518 - default: - return length - } - - case 1518: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1519 - default: - return length - } - - case 1520: - switch byteToLower(b) { - case 's': - st = 1521 - default: - return length - } - - case 1521: - switch byteToLower(b) { - case 'a': - st = 1522 - default: - return length - } - - case 1522: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1523 - default: - return length - } - - case 1527: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1528 - case 'w': - length = i + 1 - st = 1529 - default: - return length - } - - case 1530: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1531 - default: - return length - } - - case 1533: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1534 - default: - return length - } - - case 1536: - switch byteToLower(b) { - case 'k': - st = 1537 - case 'm': - length = i + 1 - st = 1543 - case 'n': - st = 1544 - case 'o': - st = 1554 - case 'r': - st = 1556 - case 's': - st = 1566 - case 't': - st = 1570 - case 'v': - st = 1575 - default: - return length - } - - case 1537: - switch byteToLower(b) { - case 'i': - st = 1538 - default: - return length - } - - case 1538: - switch byteToLower(b) { - case 'n': - st = 1539 - default: - return length - } - - case 1539: - switch byteToLower(b) { - case 'a': - st = 1540 - default: - return length - } - - case 1540: - switch byteToLower(b) { - case 'w': - st = 1541 - default: - return length - } - - case 1541: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1542 - default: - return length - } - - case 1544: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1545 - case 'g': - length = i + 1 - st = 1546 - case 'i': - st = 1547 - case 'l': - length = i + 1 - st = 1550 - default: - return length - } - - case 1547: - switch byteToLower(b) { - case 'o': - st = 1548 - default: - return length - } - - case 1548: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1549 - default: - return length - } - - case 1550: - switch byteToLower(b) { - case 'i': - st = 1551 - default: - return length - } - - case 1551: - switch byteToLower(b) { - case 'n': - st = 1552 - default: - return length - } - - case 1552: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1553 - default: - return length - } - - case 1554: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1555 - default: - return length - } - - case 1556: - switch byteToLower(b) { - case 'a': - st = 1557 - case 'g': - length = i + 1 - st = 1561 - default: - return length - } - - case 1557: - switch byteToLower(b) { - case 'c': - st = 1558 - default: - return length - } - - case 1558: - switch byteToLower(b) { - case 'l': - st = 1559 - default: - return length - } - - case 1559: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1560 - default: - return length - } - - case 1561: - switch byteToLower(b) { - case 'a': - st = 1562 - default: - return length - } - - case 1562: - switch byteToLower(b) { - case 'n': - st = 1563 - default: - return length - } - - case 1563: - switch byteToLower(b) { - case 'i': - st = 1564 - default: - return length - } - - case 1564: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1565 - default: - return length - } - - case 1566: - switch byteToLower(b) { - case 'a': - st = 1567 - default: - return length - } - - case 1567: - switch byteToLower(b) { - case 'k': - st = 1568 - default: - return length - } - - case 1568: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1569 - default: - return length - } - - case 1570: - switch byteToLower(b) { - case 's': - st = 1571 - default: - return length - } - - case 1571: - switch byteToLower(b) { - case 'u': - st = 1572 - default: - return length - } - - case 1572: - switch byteToLower(b) { - case 'k': - st = 1573 - default: - return length - } - - case 1573: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1574 - default: - return length - } - - case 1575: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 1576 - default: - return length - } - - case 1577: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1578 - case 'e': - length = i + 1 - st = 1596 - case 'f': - length = i + 1 - st = 1597 - case 'g': - length = i + 1 - st = 1598 - case 'h': - length = i + 1 - st = 1599 - case 'i': - st = 1625 - case 'k': - length = i + 1 - st = 1644 - case 'l': - length = i + 1 - st = 1645 - case 'm': - length = i + 1 - st = 1656 - case 'n': - length = i + 1 - st = 1657 - case 'o': - st = 1658 - case 'r': - length = i + 1 - st = 1668 - case 's': - length = i + 1 - st = 1693 - case 't': - length = i + 1 - st = 1694 - case 'u': - st = 1695 - case 'w': - length = i + 1 - st = 1697 - case 'y': - length = i + 1 - st = 1698 - default: - return length - } - - case 1578: - switch byteToLower(b) { - case 'g': - st = 1579 - case 'n': - st = 1581 - case 'r': - st = 1586 - default: - return length - } - - case 1579: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1580 - default: - return length - } - - case 1581: - switch byteToLower(b) { - case 'e': - st = 1582 - default: - return length - } - - case 1582: - switch byteToLower(b) { - case 'r': - st = 1583 - default: - return length - } - - case 1583: - switch byteToLower(b) { - case 'a': - st = 1584 - default: - return length - } - - case 1584: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1585 - default: - return length - } - - case 1586: - switch byteToLower(b) { - case 'i': - st = 1587 - case 't': - st = 1589 - default: - return length - } - - case 1587: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1588 - default: - return length - } - - case 1589: - switch byteToLower(b) { - case 'n': - st = 1590 - case 's': - length = i + 1 - st = 1594 - case 'y': - length = i + 1 - st = 1595 - default: - return length - } - - case 1590: - switch byteToLower(b) { - case 'e': - st = 1591 - default: - return length - } - - case 1591: - switch byteToLower(b) { - case 'r': - st = 1592 - default: - return length - } - - case 1592: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1593 - default: - return length - } - - case 1599: - switch byteToLower(b) { - case 'a': - st = 1600 - case 'i': - st = 1606 - case 'o': - st = 1611 - case 'y': - st = 1621 - default: - return length - } - - case 1600: - switch byteToLower(b) { - case 'r': - st = 1601 - default: - return length - } - - case 1601: - switch byteToLower(b) { - case 'm': - st = 1602 - default: - return length - } - - case 1602: - switch byteToLower(b) { - case 'a': - st = 1603 - default: - return length - } - - case 1603: - switch byteToLower(b) { - case 'c': - st = 1604 - default: - return length - } - - case 1604: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1605 - default: - return length - } - - case 1606: - switch byteToLower(b) { - case 'l': - st = 1607 - default: - return length - } - - case 1607: - switch byteToLower(b) { - case 'i': - st = 1608 - default: - return length - } - - case 1608: - switch byteToLower(b) { - case 'p': - st = 1609 - default: - return length - } - - case 1609: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1610 - default: - return length - } - - case 1611: - switch byteToLower(b) { - case 't': - st = 1612 - default: - return length - } - - case 1612: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1613 - default: - return length - } - - case 1613: - switch byteToLower(b) { - case 'g': - st = 1614 - case 's': - length = i + 1 - st = 1620 - default: - return length - } - - case 1614: - switch byteToLower(b) { - case 'r': - st = 1615 - default: - return length - } - - case 1615: - switch byteToLower(b) { - case 'a': - st = 1616 - default: - return length - } - - case 1616: - switch byteToLower(b) { - case 'p': - st = 1617 - default: - return length - } - - case 1617: - switch byteToLower(b) { - case 'h': - st = 1618 - default: - return length - } - - case 1618: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1619 - default: - return length - } - - case 1621: - switch byteToLower(b) { - case 's': - st = 1622 - default: - return length - } - - case 1622: - switch byteToLower(b) { - case 'i': - st = 1623 - default: - return length - } - - case 1623: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1624 - default: - return length - } - - case 1625: - switch byteToLower(b) { - case 'a': - st = 1626 - case 'c': - st = 1630 - case 'n': - st = 1639 - case 'z': - st = 1641 - default: - return length - } - - case 1626: - switch byteToLower(b) { - case 'g': - st = 1627 - default: - return length - } - - case 1627: - switch byteToLower(b) { - case 'e': - st = 1628 - default: - return length - } - - case 1628: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1629 - default: - return length - } - - case 1630: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1631 - case 't': - st = 1632 - default: - return length - } - - case 1632: - switch byteToLower(b) { - case 'e': - st = 1633 - case 'u': - st = 1635 - default: - return length - } - - case 1633: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1634 - default: - return length - } - - case 1635: - switch byteToLower(b) { - case 'r': - st = 1636 - default: - return length - } - - case 1636: - switch byteToLower(b) { - case 'e': - st = 1637 - default: - return length - } - - case 1637: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1638 - default: - return length - } - - case 1639: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 1640 - default: - return length - } - - case 1641: - switch byteToLower(b) { - case 'z': - st = 1642 - default: - return length - } - - case 1642: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1643 - default: - return length - } - - case 1645: - switch byteToLower(b) { - case 'a': - st = 1646 - case 'u': - st = 1649 - default: - return length - } - - case 1646: - switch byteToLower(b) { - case 'c': - st = 1647 - default: - return length - } - - case 1647: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1648 - default: - return length - } - - case 1649: - switch byteToLower(b) { - case 'm': - st = 1650 - case 's': - length = i + 1 - st = 1655 - default: - return length - } - - case 1650: - switch byteToLower(b) { - case 'b': - st = 1651 - default: - return length - } - - case 1651: - switch byteToLower(b) { - case 'i': - st = 1652 - default: - return length - } - - case 1652: - switch byteToLower(b) { - case 'n': - st = 1653 - default: - return length - } - - case 1653: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1654 - default: - return length - } - - case 1658: - switch byteToLower(b) { - case 'h': - st = 1659 - case 'k': - st = 1661 - case 'r': - st = 1664 - case 's': - st = 1666 - default: - return length - } - - case 1659: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1660 - default: - return length - } - - case 1661: - switch byteToLower(b) { - case 'e': - st = 1662 - default: - return length - } - - case 1662: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1663 - default: - return length - } - - case 1664: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1665 - default: - return length - } - - case 1666: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1667 - default: - return length - } - - case 1668: - switch byteToLower(b) { - case 'a': - st = 1669 - case 'e': - st = 1672 - case 'o': - length = i + 1 - st = 1675 - default: - return length - } - - case 1669: - switch byteToLower(b) { - case 'x': - st = 1670 - default: - return length - } - - case 1670: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1671 - default: - return length - } - - case 1672: - switch byteToLower(b) { - case 's': - st = 1673 - default: - return length - } - - case 1673: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1674 - default: - return length - } - - case 1675: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1676 - case 'f': - length = i + 1 - st = 1684 - case 'p': - st = 1685 - default: - return length - } - - case 1676: - switch byteToLower(b) { - case 'u': - st = 1677 - default: - return length - } - - case 1677: - switch byteToLower(b) { - case 'c': - st = 1678 - default: - return length - } - - case 1678: - switch byteToLower(b) { - case 't': - st = 1679 - default: - return length - } - - case 1679: - switch byteToLower(b) { - case 'i': - st = 1680 - default: - return length - } - - case 1680: - switch byteToLower(b) { - case 'o': - st = 1681 - default: - return length - } - - case 1681: - switch byteToLower(b) { - case 'n': - st = 1682 - default: - return length - } - - case 1682: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1683 - default: - return length - } - - case 1685: - switch byteToLower(b) { - case 'e': - st = 1686 - default: - return length - } - - case 1686: - switch byteToLower(b) { - case 'r': - st = 1687 - default: - return length - } - - case 1687: - switch byteToLower(b) { - case 't': - st = 1688 - default: - return length - } - - case 1688: - switch byteToLower(b) { - case 'i': - st = 1689 - case 'y': - length = i + 1 - st = 1692 - default: - return length - } - - case 1689: - switch byteToLower(b) { - case 'e': - st = 1690 - default: - return length - } - - case 1690: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1691 - default: - return length - } - - case 1695: - switch byteToLower(b) { - case 'b': - length = i + 1 - st = 1696 - default: - return length - } - - case 1699: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1700 - case 'p': - st = 1701 - case 'u': - st = 1704 - default: - return length - } - - case 1701: - switch byteToLower(b) { - case 'o': - st = 1702 - default: - return length - } - - case 1702: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1703 - default: - return length - } - - case 1704: - switch byteToLower(b) { - case 'e': - st = 1705 - default: - return length - } - - case 1705: - switch byteToLower(b) { - case 'b': - st = 1706 - default: - return length - } - - case 1706: - switch byteToLower(b) { - case 'e': - st = 1707 - default: - return length - } - - case 1707: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 1708 - default: - return length - } - - case 1709: - switch byteToLower(b) { - case 'a': - st = 1710 - case 'e': - length = i + 1 - st = 1715 - case 'i': - st = 1772 - case 'o': - length = i + 1 - st = 1777 - case 's': - length = i + 1 - st = 1784 - case 'u': - length = i + 1 - st = 1787 - case 'w': - length = i + 1 - st = 1791 - case 'y': - st = 1792 - default: - return length - } - - case 1710: - switch byteToLower(b) { - case 'c': - st = 1711 - default: - return length - } - - case 1711: - switch byteToLower(b) { - case 'i': - st = 1712 - default: - return length - } - - case 1712: - switch byteToLower(b) { - case 'n': - st = 1713 - default: - return length - } - - case 1713: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1714 - default: - return length - } - - case 1715: - switch byteToLower(b) { - case 'a': - st = 1716 - case 'c': - st = 1721 - case 'd': - length = i + 1 - st = 1726 - case 'h': - st = 1732 - case 'i': - st = 1735 - case 'n': - length = i + 1 - st = 1740 - case 'p': - st = 1745 - case 's': - st = 1759 - case 'v': - st = 1767 - default: - return length - } - - case 1716: - switch byteToLower(b) { - case 'l': - st = 1717 - default: - return length - } - - case 1717: - switch byteToLower(b) { - case 't': - st = 1718 - default: - return length - } - - case 1718: - switch byteToLower(b) { - case 'o': - st = 1719 - default: - return length - } - - case 1719: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1720 - default: - return length - } - - case 1721: - switch byteToLower(b) { - case 'i': - st = 1722 - default: - return length - } - - case 1722: - switch byteToLower(b) { - case 'p': - st = 1723 - default: - return length - } - - case 1723: - switch byteToLower(b) { - case 'e': - st = 1724 - default: - return length - } - - case 1724: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1725 - default: - return length - } - - case 1726: - switch byteToLower(b) { - case 's': - st = 1727 - default: - return length - } - - case 1727: - switch byteToLower(b) { - case 't': - st = 1728 - default: - return length - } - - case 1728: - switch byteToLower(b) { - case 'o': - st = 1729 - default: - return length - } - - case 1729: - switch byteToLower(b) { - case 'n': - st = 1730 - default: - return length - } - - case 1730: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1731 - default: - return length - } - - case 1732: - switch byteToLower(b) { - case 'a': - st = 1733 - default: - return length - } - - case 1733: - switch byteToLower(b) { - case 'b': - length = i + 1 - st = 1734 - default: - return length - } - - case 1735: - switch byteToLower(b) { - case 's': - st = 1736 - case 't': - length = i + 1 - st = 1739 - default: - return length - } - - case 1736: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1737 - default: - return length - } - - case 1737: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1738 - default: - return length - } - - case 1740: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1741 - default: - return length - } - - case 1741: - switch byteToLower(b) { - case 'a': - st = 1742 - default: - return length - } - - case 1742: - switch byteToLower(b) { - case 'l': - st = 1743 - default: - return length - } - - case 1743: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1744 - default: - return length - } - - case 1745: - switch byteToLower(b) { - case 'a': - st = 1746 - case 'o': - st = 1749 - case 'u': - st = 1752 - default: - return length - } - - case 1746: - switch byteToLower(b) { - case 'i': - st = 1747 - default: - return length - } - - case 1747: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1748 - default: - return length - } - - case 1749: - switch byteToLower(b) { - case 'r': - st = 1750 - default: - return length - } - - case 1750: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1751 - default: - return length - } - - case 1752: - switch byteToLower(b) { - case 'b': - st = 1753 - default: - return length - } - - case 1753: - switch byteToLower(b) { - case 'l': - st = 1754 - default: - return length - } - - case 1754: - switch byteToLower(b) { - case 'i': - st = 1755 - default: - return length - } - - case 1755: - switch byteToLower(b) { - case 'c': - st = 1756 - default: - return length - } - - case 1756: - switch byteToLower(b) { - case 'a': - st = 1757 - default: - return length - } - - case 1757: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 1758 - default: - return length - } - - case 1759: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1760 - default: - return length - } - - case 1760: - switch byteToLower(b) { - case 'a': - st = 1761 - default: - return length - } - - case 1761: - switch byteToLower(b) { - case 'u': - st = 1762 - default: - return length - } - - case 1762: - switch byteToLower(b) { - case 'r': - st = 1763 - default: - return length - } - - case 1763: - switch byteToLower(b) { - case 'a': - st = 1764 - default: - return length - } - - case 1764: - switch byteToLower(b) { - case 'n': - st = 1765 - default: - return length - } - - case 1765: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1766 - default: - return length - } - - case 1767: - switch byteToLower(b) { - case 'i': - st = 1768 - default: - return length - } - - case 1768: - switch byteToLower(b) { - case 'e': - st = 1769 - default: - return length - } - - case 1769: - switch byteToLower(b) { - case 'w': - length = i + 1 - st = 1770 - default: - return length - } - - case 1770: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1771 - default: - return length - } - - case 1772: - switch byteToLower(b) { - case 'c': - st = 1773 - case 'o': - length = i + 1 - st = 1775 - case 'p': - length = i + 1 - st = 1776 - default: - return length - } - - case 1773: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 1774 - default: - return length - } - - case 1777: - switch byteToLower(b) { - case 'c': - st = 1778 - case 'd': - st = 1781 - default: - return length - } - - case 1778: - switch byteToLower(b) { - case 'k': - st = 1779 - default: - return length - } - - case 1779: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1780 - default: - return length - } - - case 1781: - switch byteToLower(b) { - case 'e': - st = 1782 - default: - return length - } - - case 1782: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1783 - default: - return length - } - - case 1784: - switch byteToLower(b) { - case 'v': - st = 1785 - default: - return length - } - - case 1785: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 1786 - default: - return length - } - - case 1787: - switch byteToLower(b) { - case 'h': - st = 1788 - case 'n': - length = i + 1 - st = 1790 - default: - return length - } - - case 1788: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1789 - default: - return length - } - - case 1792: - switch byteToLower(b) { - case 'u': - st = 1793 - default: - return length - } - - case 1793: - switch byteToLower(b) { - case 'k': - st = 1794 - default: - return length - } - - case 1794: - switch byteToLower(b) { - case 'y': - st = 1795 - default: - return length - } - - case 1795: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 1796 - default: - return length - } - - case 1797: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1798 - case 'b': - length = i + 1 - st = 1830 - case 'c': - length = i + 1 - st = 1831 - case 'd': - length = i + 1 - st = 1864 - case 'e': - length = i + 1 - st = 1865 - case 'g': - length = i + 1 - st = 1880 - case 'h': - length = i + 1 - st = 1881 - case 'i': - length = i + 1 - st = 1896 - case 'j': - length = i + 1 - st = 1904 - case 'k': - length = i + 1 - st = 1905 - case 'l': - length = i + 1 - st = 1908 - case 'm': - length = i + 1 - st = 1909 - case 'n': - length = i + 1 - st = 1910 - case 'o': - length = i + 1 - st = 1913 - case 'p': - st = 1941 - case 'r': - length = i + 1 - st = 1961 - case 't': - length = i + 1 - st = 1962 - case 'u': - length = i + 1 - st = 1969 - case 'v': - length = i + 1 - st = 1993 - case 'w': - st = 1994 - case 'x': - length = i + 1 - st = 1998 - case 'y': - length = i + 1 - st = 1999 - case 'z': - length = i + 1 - st = 2009 - default: - return length - } - - case 1798: - switch byteToLower(b) { - case 'a': - st = 1799 - case 'l': - st = 1805 - case 'm': - st = 1807 - case 'n': - st = 1812 - case 'p': - length = i + 1 - st = 1825 - case 'r': - st = 1826 - case 'x': - st = 1828 - default: - return length - } - - case 1799: - switch byteToLower(b) { - case 'r': - st = 1800 - default: - return length - } - - case 1800: - switch byteToLower(b) { - case 'l': - st = 1801 - default: - return length - } - - case 1801: - switch byteToLower(b) { - case 'a': - st = 1802 - default: - return length - } - - case 1802: - switch byteToLower(b) { - case 'n': - st = 1803 - default: - return length - } - - case 1803: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 1804 - default: - return length - } - - case 1805: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1806 - default: - return length - } - - case 1807: - switch byteToLower(b) { - case 's': - st = 1808 - default: - return length - } - - case 1808: - switch byteToLower(b) { - case 'u': - st = 1809 - default: - return length - } - - case 1809: - switch byteToLower(b) { - case 'n': - st = 1810 - default: - return length - } - - case 1810: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1811 - default: - return length - } - - case 1812: - switch byteToLower(b) { - case 'd': - st = 1813 - default: - return length - } - - case 1813: - switch byteToLower(b) { - case 'v': - st = 1814 - default: - return length - } - - case 1814: - switch byteToLower(b) { - case 'i': - st = 1815 - default: - return length - } - - case 1815: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 1816 - default: - return length - } - - case 1816: - switch byteToLower(b) { - case 'c': - st = 1817 - default: - return length - } - - case 1817: - switch byteToLower(b) { - case 'o': - st = 1818 - default: - return length - } - - case 1818: - switch byteToLower(b) { - case 'r': - st = 1819 - default: - return length - } - - case 1819: - switch byteToLower(b) { - case 'o': - st = 1820 - default: - return length - } - - case 1820: - switch byteToLower(b) { - case 'm': - st = 1821 - default: - return length - } - - case 1821: - switch byteToLower(b) { - case 'a': - st = 1822 - default: - return length - } - - case 1822: - switch byteToLower(b) { - case 'n': - st = 1823 - default: - return length - } - - case 1823: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1824 - default: - return length - } - - case 1826: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1827 - default: - return length - } - - case 1828: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 1829 - default: - return length - } - - case 1831: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1832 - case 'b': - length = i + 1 - st = 1833 - case 'h': - st = 1834 - case 'i': - st = 1857 - case 'o': - st = 1862 - default: - return length - } - - case 1834: - switch byteToLower(b) { - case 'm': - st = 1835 - case 'o': - st = 1839 - case 'u': - st = 1850 - case 'w': - st = 1853 - default: - return length - } - - case 1835: - switch byteToLower(b) { - case 'i': - st = 1836 - default: - return length - } - - case 1836: - switch byteToLower(b) { - case 'd': - st = 1837 - default: - return length - } - - case 1837: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1838 - default: - return length - } - - case 1839: - switch byteToLower(b) { - case 'l': - st = 1840 - case 'o': - st = 1848 - default: - return length - } - - case 1840: - switch byteToLower(b) { - case 'a': - st = 1841 - default: - return length - } - - case 1841: - switch byteToLower(b) { - case 'r': - st = 1842 - default: - return length - } - - case 1842: - switch byteToLower(b) { - case 's': - st = 1843 - default: - return length - } - - case 1843: - switch byteToLower(b) { - case 'h': - st = 1844 - default: - return length - } - - case 1844: - switch byteToLower(b) { - case 'i': - st = 1845 - default: - return length - } - - case 1845: - switch byteToLower(b) { - case 'p': - st = 1846 - default: - return length - } - - case 1846: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1847 - default: - return length - } - - case 1848: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1849 - default: - return length - } - - case 1850: - switch byteToLower(b) { - case 'l': - st = 1851 - default: - return length - } - - case 1851: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1852 - default: - return length - } - - case 1853: - switch byteToLower(b) { - case 'a': - st = 1854 - default: - return length - } - - case 1854: - switch byteToLower(b) { - case 'r': - st = 1855 - default: - return length - } - - case 1855: - switch byteToLower(b) { - case 'z': - length = i + 1 - st = 1856 - default: - return length - } - - case 1857: - switch byteToLower(b) { - case 'e': - st = 1858 - default: - return length - } - - case 1858: - switch byteToLower(b) { - case 'n': - st = 1859 - default: - return length - } - - case 1859: - switch byteToLower(b) { - case 'c': - st = 1860 - default: - return length - } - - case 1860: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1861 - default: - return length - } - - case 1862: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1863 - default: - return length - } - - case 1865: - switch byteToLower(b) { - case 'a': - st = 1866 - case 'n': - st = 1868 - case 'r': - st = 1871 - case 'w': - length = i + 1 - st = 1877 - case 'x': - length = i + 1 - st = 1878 - default: - return length - } - - case 1866: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1867 - default: - return length - } - - case 1868: - switch byteToLower(b) { - case 'e': - st = 1869 - default: - return length - } - - case 1869: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1870 - default: - return length - } - - case 1871: - switch byteToLower(b) { - case 'v': - st = 1872 - default: - return length - } - - case 1872: - switch byteToLower(b) { - case 'i': - st = 1873 - default: - return length - } - - case 1873: - switch byteToLower(b) { - case 'c': - st = 1874 - default: - return length - } - - case 1874: - switch byteToLower(b) { - case 'e': - st = 1875 - default: - return length - } - - case 1875: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1876 - default: - return length - } - - case 1878: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1879 - default: - return length - } - - case 1881: - switch byteToLower(b) { - case 'i': - st = 1882 - case 'o': - st = 1887 - case 'r': - st = 1891 - default: - return length - } - - case 1882: - switch byteToLower(b) { - case 'k': - st = 1883 - default: - return length - } - - case 1883: - switch byteToLower(b) { - case 's': - st = 1884 - default: - return length - } - - case 1884: - switch byteToLower(b) { - case 'h': - st = 1885 - default: - return length - } - - case 1885: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 1886 - default: - return length - } - - case 1887: - switch byteToLower(b) { - case 'e': - st = 1888 - case 'w': - length = i + 1 - st = 1890 - default: - return length - } - - case 1888: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1889 - default: - return length - } - - case 1891: - switch byteToLower(b) { - case 'i': - st = 1892 - default: - return length - } - - case 1892: - switch byteToLower(b) { - case 'r': - st = 1893 - default: - return length - } - - case 1893: - switch byteToLower(b) { - case 'a': - st = 1894 - default: - return length - } - - case 1894: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 1895 - default: - return length - } - - case 1896: - switch byteToLower(b) { - case 'n': - st = 1897 - case 't': - st = 1902 - default: - return length - } - - case 1897: - switch byteToLower(b) { - case 'g': - st = 1898 - default: - return length - } - - case 1898: - switch byteToLower(b) { - case 'l': - st = 1899 - default: - return length - } - - case 1899: - switch byteToLower(b) { - case 'e': - st = 1900 - default: - return length - } - - case 1900: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1901 - default: - return length - } - - case 1902: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1903 - default: - return length - } - - case 1905: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1906 - case 'y': - length = i + 1 - st = 1907 - default: - return length - } - - case 1910: - switch byteToLower(b) { - case 'c': - st = 1911 - default: - return length - } - - case 1911: - switch byteToLower(b) { - case 'f': - length = i + 1 - st = 1912 - default: - return length - } - - case 1913: - switch byteToLower(b) { - case 'c': - st = 1914 - case 'f': - st = 1921 - case 'h': - st = 1927 - case 'l': - st = 1929 - case 'n': - st = 1938 - case 'y': - length = i + 1 - st = 1940 - default: - return length - } - - case 1914: - switch byteToLower(b) { - case 'c': - st = 1915 - case 'i': - st = 1918 - default: - return length - } - - case 1915: - switch byteToLower(b) { - case 'e': - st = 1916 - default: - return length - } - - case 1916: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1917 - default: - return length - } - - case 1918: - switch byteToLower(b) { - case 'a': - st = 1919 - default: - return length - } - - case 1919: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1920 - default: - return length - } - - case 1921: - switch byteToLower(b) { - case 't': - st = 1922 - default: - return length - } - - case 1922: - switch byteToLower(b) { - case 'w': - st = 1923 - default: - return length - } - - case 1923: - switch byteToLower(b) { - case 'a': - st = 1924 - default: - return length - } - - case 1924: - switch byteToLower(b) { - case 'r': - st = 1925 - default: - return length - } - - case 1925: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1926 - default: - return length - } - - case 1927: - switch byteToLower(b) { - case 'u': - length = i + 1 - st = 1928 - default: - return length - } - - case 1929: - switch byteToLower(b) { - case 'a': - st = 1930 - case 'u': - st = 1932 - default: - return length - } - - case 1930: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 1931 - default: - return length - } - - case 1932: - switch byteToLower(b) { - case 't': - st = 1933 - default: - return length - } - - case 1933: - switch byteToLower(b) { - case 'i': - st = 1934 - default: - return length - } - - case 1934: - switch byteToLower(b) { - case 'o': - st = 1935 - default: - return length - } - - case 1935: - switch byteToLower(b) { - case 'n': - st = 1936 - default: - return length - } - - case 1936: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1937 - default: - return length - } - - case 1938: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1939 - default: - return length - } - - case 1941: - switch byteToLower(b) { - case 'a': - st = 1942 - case 'i': - st = 1945 - case 'r': - st = 1950 - default: - return length - } - - case 1942: - switch byteToLower(b) { - case 'c': - st = 1943 - default: - return length - } - - case 1943: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1944 - default: - return length - } - - case 1945: - switch byteToLower(b) { - case 'e': - st = 1946 - default: - return length - } - - case 1946: - switch byteToLower(b) { - case 'g': - st = 1947 - default: - return length - } - - case 1947: - switch byteToLower(b) { - case 'e': - st = 1948 - default: - return length - } - - case 1948: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 1949 - default: - return length - } - - case 1950: - switch byteToLower(b) { - case 'e': - st = 1951 - default: - return length - } - - case 1951: - switch byteToLower(b) { - case 'a': - st = 1952 - default: - return length - } - - case 1952: - switch byteToLower(b) { - case 'd': - st = 1953 - default: - return length - } - - case 1953: - switch byteToLower(b) { - case 'b': - st = 1954 - default: - return length - } - - case 1954: - switch byteToLower(b) { - case 'e': - st = 1955 - default: - return length - } - - case 1955: - switch byteToLower(b) { - case 't': - st = 1956 - default: - return length - } - - case 1956: - switch byteToLower(b) { - case 't': - st = 1957 - default: - return length - } - - case 1957: - switch byteToLower(b) { - case 'i': - st = 1958 - default: - return length - } - - case 1958: - switch byteToLower(b) { - case 'n': - st = 1959 - default: - return length - } - - case 1959: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 1960 - default: - return length - } - - case 1962: - switch byteToLower(b) { - case 'u': - st = 1963 - case 'y': - st = 1966 - default: - return length - } - - case 1963: - switch byteToLower(b) { - case 'd': - st = 1964 - default: - return length - } - - case 1964: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1965 - default: - return length - } - - case 1966: - switch byteToLower(b) { - case 'l': - st = 1967 - default: - return length - } - - case 1967: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 1968 - default: - return length - } - - case 1969: - switch byteToLower(b) { - case 'c': - st = 1970 - case 'p': - st = 1973 - case 'r': - st = 1983 - case 'z': - st = 1989 - default: - return length - } - - case 1970: - switch byteToLower(b) { - case 'k': - st = 1971 - default: - return length - } - - case 1971: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1972 - default: - return length - } - - case 1973: - switch byteToLower(b) { - case 'p': - st = 1974 - default: - return length - } - - case 1974: - switch byteToLower(b) { - case 'l': - st = 1975 - case 'o': - st = 1980 - default: - return length - } - - case 1975: - switch byteToLower(b) { - case 'i': - st = 1976 - case 'y': - length = i + 1 - st = 1979 - default: - return length - } - - case 1976: - switch byteToLower(b) { - case 'e': - st = 1977 - default: - return length - } - - case 1977: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1978 - default: - return length - } - - case 1980: - switch byteToLower(b) { - case 'r': - st = 1981 - default: - return length - } - - case 1981: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 1982 - default: - return length - } - - case 1983: - switch byteToLower(b) { - case 'f': - length = i + 1 - st = 1984 - case 'g': - st = 1985 - default: - return length - } - - case 1985: - switch byteToLower(b) { - case 'e': - st = 1986 - default: - return length - } - - case 1986: - switch byteToLower(b) { - case 'r': - st = 1987 - default: - return length - } - - case 1987: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 1988 - default: - return length - } - - case 1989: - switch byteToLower(b) { - case 'u': - st = 1990 - default: - return length - } - - case 1990: - switch byteToLower(b) { - case 'k': - st = 1991 - default: - return length - } - - case 1991: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 1992 - default: - return length - } - - case 1994: - switch byteToLower(b) { - case 'i': - st = 1995 - default: - return length - } - - case 1995: - switch byteToLower(b) { - case 's': - st = 1996 - default: - return length - } - - case 1996: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 1997 - default: - return length - } - - case 1999: - switch byteToLower(b) { - case 'd': - st = 2000 - case 's': - st = 2004 - default: - return length - } - - case 2000: - switch byteToLower(b) { - case 'n': - st = 2001 - default: - return length - } - - case 2001: - switch byteToLower(b) { - case 'e': - st = 2002 - default: - return length - } - - case 2002: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 2003 - default: - return length - } - - case 2004: - switch byteToLower(b) { - case 't': - st = 2005 - default: - return length - } - - case 2005: - switch byteToLower(b) { - case 'e': - st = 2006 - default: - return length - } - - case 2006: - switch byteToLower(b) { - case 'm': - st = 2007 - default: - return length - } - - case 2007: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2008 - default: - return length - } - - case 2010: - switch byteToLower(b) { - case 'a': - st = 2011 - case 'c': - length = i + 1 - st = 2024 - case 'd': - length = i + 1 - st = 2025 - case 'e': - st = 2026 - case 'f': - length = i + 1 - st = 2047 - case 'g': - length = i + 1 - st = 2048 - case 'h': - length = i + 1 - st = 2049 - case 'i': - st = 2056 - case 'j': - length = i + 1 - st = 2073 - case 'k': - length = i + 1 - st = 2074 - case 'l': - length = i + 1 - st = 2075 - case 'm': - length = i + 1 - st = 2076 - case 'n': - length = i + 1 - st = 2077 - case 'o': - length = i + 1 - st = 2078 - case 'r': - length = i + 1 - st = 2104 - case 't': - length = i + 1 - st = 2122 - case 'u': - st = 2123 - case 'v': - length = i + 1 - st = 2125 - case 'w': - length = i + 1 - st = 2126 - case 'z': - length = i + 1 - st = 2127 - default: - return length - } - - case 2011: - switch byteToLower(b) { - case 'i': - st = 2012 - case 't': - st = 2016 - case 'x': - length = i + 1 - st = 2022 - default: - return length - } - - case 2012: - switch byteToLower(b) { - case 'p': - st = 2013 - default: - return length - } - - case 2013: - switch byteToLower(b) { - case 'e': - st = 2014 - default: - return length - } - - case 2014: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 2015 - default: - return length - } - - case 2016: - switch byteToLower(b) { - case 'a': - st = 2017 - case 't': - st = 2019 - default: - return length - } - - case 2017: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 2018 - default: - return length - } - - case 2019: - switch byteToLower(b) { - case 'o': - st = 2020 - default: - return length - } - - case 2020: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 2021 - default: - return length - } - - case 2022: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 2023 - default: - return length - } - - case 2026: - switch byteToLower(b) { - case 'a': - st = 2027 - case 'c': - st = 2029 - case 'l': - length = i + 1 - st = 2037 - case 'm': - st = 2038 - case 'n': - st = 2043 - default: - return length - } - - case 2027: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 2028 - default: - return length - } - - case 2029: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 2030 - default: - return length - } - - case 2030: - switch byteToLower(b) { - case 'n': - st = 2031 - default: - return length - } - - case 2031: - switch byteToLower(b) { - case 'o': - st = 2032 - default: - return length - } - - case 2032: - switch byteToLower(b) { - case 'l': - st = 2033 - default: - return length - } - - case 2033: - switch byteToLower(b) { - case 'o': - st = 2034 - default: - return length - } - - case 2034: - switch byteToLower(b) { - case 'g': - st = 2035 - default: - return length - } - - case 2035: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 2036 - default: - return length - } - - case 2038: - switch byteToLower(b) { - case 'a': - st = 2039 - default: - return length - } - - case 2039: - switch byteToLower(b) { - case 's': - st = 2040 - default: - return length - } - - case 2040: - switch byteToLower(b) { - case 'e': - st = 2041 - default: - return length - } - - case 2041: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 2042 - default: - return length - } - - case 2043: - switch byteToLower(b) { - case 'n': - st = 2044 - default: - return length - } - - case 2044: - switch byteToLower(b) { - case 'i': - st = 2045 - default: - return length - } - - case 2045: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2046 - default: - return length - } - - case 2049: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 2050 - case 'e': - st = 2051 - default: - return length - } - - case 2051: - switch byteToLower(b) { - case 'a': - st = 2052 - default: - return length - } - - case 2052: - switch byteToLower(b) { - case 't': - st = 2053 - default: - return length - } - - case 2053: - switch byteToLower(b) { - case 'e': - st = 2054 - default: - return length - } - - case 2054: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 2055 - default: - return length - } - - case 2056: - switch byteToLower(b) { - case 'c': - st = 2057 - case 'e': - st = 2062 - case 'p': - st = 2066 - case 'r': - st = 2068 - default: - return length - } - - case 2057: - switch byteToLower(b) { - case 'k': - st = 2058 - default: - return length - } - - case 2058: - switch byteToLower(b) { - case 'e': - st = 2059 - default: - return length - } - - case 2059: - switch byteToLower(b) { - case 't': - st = 2060 - default: - return length - } - - case 2060: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2061 - default: - return length - } - - case 2062: - switch byteToLower(b) { - case 'n': - st = 2063 - default: - return length - } - - case 2063: - switch byteToLower(b) { - case 'd': - st = 2064 - default: - return length - } - - case 2064: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2065 - default: - return length - } - - case 2066: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2067 - default: - return length - } - - case 2068: - switch byteToLower(b) { - case 'e': - st = 2069 - case 'o': - st = 2071 - default: - return length - } - - case 2069: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2070 - default: - return length - } - - case 2071: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 2072 - default: - return length - } - - case 2078: - switch byteToLower(b) { - case 'd': - st = 2079 - case 'k': - st = 2082 - case 'o': - st = 2085 - case 'p': - length = i + 1 - st = 2088 - case 'r': - st = 2089 - case 's': - st = 2092 - case 'u': - st = 2097 - case 'w': - st = 2100 - case 'y': - st = 2102 - default: - return length - } - - case 2079: - switch byteToLower(b) { - case 'a': - st = 2080 - default: - return length - } - - case 2080: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 2081 - default: - return length - } - - case 2082: - switch byteToLower(b) { - case 'y': - st = 2083 - default: - return length - } - - case 2083: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 2084 - default: - return length - } - - case 2085: - switch byteToLower(b) { - case 'l': - st = 2086 - default: - return length - } - - case 2086: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2087 - default: - return length - } - - case 2089: - switch byteToLower(b) { - case 'a': - st = 2090 - default: - return length - } - - case 2090: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 2091 - default: - return length - } - - case 2092: - switch byteToLower(b) { - case 'h': - st = 2093 - default: - return length - } - - case 2093: - switch byteToLower(b) { - case 'i': - st = 2094 - default: - return length - } - - case 2094: - switch byteToLower(b) { - case 'b': - st = 2095 - default: - return length - } - - case 2095: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2096 - default: - return length - } - - case 2097: - switch byteToLower(b) { - case 'r': - st = 2098 - default: - return length - } - - case 2098: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2099 - default: - return length - } - - case 2100: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 2101 - default: - return length - } - - case 2102: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2103 - default: - return length - } - - case 2104: - switch byteToLower(b) { - case 'a': - st = 2105 - case 'u': - st = 2119 - default: - return length - } - - case 2105: - switch byteToLower(b) { - case 'd': - st = 2106 - case 'i': - st = 2111 - case 'v': - st = 2116 - default: - return length - } - - case 2106: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2107 - case 'i': - st = 2108 - default: - return length - } - - case 2108: - switch byteToLower(b) { - case 'n': - st = 2109 - default: - return length - } - - case 2109: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 2110 - default: - return length - } - - case 2111: - switch byteToLower(b) { - case 'n': - st = 2112 - default: - return length - } - - case 2112: - switch byteToLower(b) { - case 'i': - st = 2113 - default: - return length - } - - case 2113: - switch byteToLower(b) { - case 'n': - st = 2114 - default: - return length - } - - case 2114: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 2115 - default: - return length - } - - case 2116: - switch byteToLower(b) { - case 'e': - st = 2117 - default: - return length - } - - case 2117: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 2118 - default: - return length - } - - case 2119: - switch byteToLower(b) { - case 's': - st = 2120 - default: - return length - } - - case 2120: - switch byteToLower(b) { - case 't': - length = i + 1 - st = 2121 - default: - return length - } - - case 2123: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 2124 - default: - return length - } - - case 2128: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2129 - case 'g': - length = i + 1 - st = 2130 - case 'k': - length = i + 1 - st = 2131 - case 'n': - st = 2132 - case 'o': - st = 2142 - case 's': - length = i + 1 - st = 2144 - case 'y': - length = i + 1 - st = 2145 - case 'z': - length = i + 1 - st = 2146 - default: - return length - } - - case 2132: - switch byteToLower(b) { - case 'i': - st = 2133 - case 'o': - length = i + 1 - st = 2141 - default: - return length - } - - case 2133: - switch byteToLower(b) { - case 'v': - st = 2134 - default: - return length - } - - case 2134: - switch byteToLower(b) { - case 'e': - st = 2135 - default: - return length - } - - case 2135: - switch byteToLower(b) { - case 'r': - st = 2136 - default: - return length - } - - case 2136: - switch byteToLower(b) { - case 's': - st = 2137 - default: - return length - } - - case 2137: - switch byteToLower(b) { - case 'i': - st = 2138 - default: - return length - } - - case 2138: - switch byteToLower(b) { - case 't': - st = 2139 - default: - return length - } - - case 2139: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 2140 - default: - return length - } - - case 2142: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 2143 - default: - return length - } - - case 2147: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2148 - case 'c': - length = i + 1 - st = 2156 - case 'e': - length = i + 1 - st = 2157 - case 'g': - length = i + 1 - st = 2178 - case 'i': - length = i + 1 - st = 2179 - case 'l': - st = 2195 - case 'n': - length = i + 1 - st = 2204 - case 'o': - st = 2205 - case 'u': - length = i + 1 - st = 2219 - default: - return length - } - - case 2148: - switch byteToLower(b) { - case 'c': - st = 2149 - default: - return length - } - - case 2149: - switch byteToLower(b) { - case 'a': - st = 2150 - default: - return length - } - - case 2150: - switch byteToLower(b) { - case 't': - st = 2151 - default: - return length - } - - case 2151: - switch byteToLower(b) { - case 'i': - st = 2152 - default: - return length - } - - case 2152: - switch byteToLower(b) { - case 'o': - st = 2153 - default: - return length - } - - case 2153: - switch byteToLower(b) { - case 'n': - st = 2154 - default: - return length - } - - case 2154: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2155 - default: - return length - } - - case 2157: - switch byteToLower(b) { - case 'g': - st = 2158 - case 'n': - st = 2161 - case 'r': - st = 2167 - case 't': - length = i + 1 - st = 2177 - default: - return length - } - - case 2158: - switch byteToLower(b) { - case 'a': - st = 2159 - default: - return length - } - - case 2159: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2160 - default: - return length - } - - case 2161: - switch byteToLower(b) { - case 't': - st = 2162 - default: - return length - } - - case 2162: - switch byteToLower(b) { - case 'u': - st = 2163 - default: - return length - } - - case 2163: - switch byteToLower(b) { - case 'r': - st = 2164 - default: - return length - } - - case 2164: - switch byteToLower(b) { - case 'e': - st = 2165 - default: - return length - } - - case 2165: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2166 - default: - return length - } - - case 2167: - switch byteToLower(b) { - case 's': - st = 2168 - default: - return length - } - - case 2168: - switch byteToLower(b) { - case 'i': - st = 2169 - default: - return length - } - - case 2169: - switch byteToLower(b) { - case 'c': - st = 2170 - default: - return length - } - - case 2170: - switch byteToLower(b) { - case 'h': - st = 2171 - default: - return length - } - - case 2171: - switch byteToLower(b) { - case 'e': - st = 2172 - default: - return length - } - - case 2172: - switch byteToLower(b) { - case 'r': - st = 2173 - default: - return length - } - - case 2173: - switch byteToLower(b) { - case 'u': - st = 2174 - default: - return length - } - - case 2174: - switch byteToLower(b) { - case 'n': - st = 2175 - default: - return length - } - - case 2175: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 2176 - default: - return length - } - - case 2179: - switch byteToLower(b) { - case 'a': - st = 2180 - case 'd': - st = 2184 - case 'l': - st = 2187 - case 's': - st = 2191 - default: - return length - } - - case 2180: - switch byteToLower(b) { - case 'j': - st = 2181 - default: - return length - } - - case 2181: - switch byteToLower(b) { - case 'e': - st = 2182 - default: - return length - } - - case 2182: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2183 - default: - return length - } - - case 2184: - switch byteToLower(b) { - case 'e': - st = 2185 - default: - return length - } - - case 2185: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 2186 - default: - return length - } - - case 2187: - switch byteToLower(b) { - case 'l': - st = 2188 - default: - return length - } - - case 2188: - switch byteToLower(b) { - case 'a': - st = 2189 - default: - return length - } - - case 2189: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2190 - default: - return length - } - - case 2191: - switch byteToLower(b) { - case 'i': - st = 2192 - default: - return length - } - - case 2192: - switch byteToLower(b) { - case 'o': - st = 2193 - default: - return length - } - - case 2193: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 2194 - default: - return length - } - - case 2195: - switch byteToLower(b) { - case 'a': - st = 2196 - default: - return length - } - - case 2196: - switch byteToLower(b) { - case 'a': - st = 2197 - default: - return length - } - - case 2197: - switch byteToLower(b) { - case 'n': - st = 2198 - default: - return length - } - - case 2198: - switch byteToLower(b) { - case 'd': - st = 2199 - default: - return length - } - - case 2199: - switch byteToLower(b) { - case 'e': - st = 2200 - default: - return length - } - - case 2200: - switch byteToLower(b) { - case 'r': - st = 2201 - default: - return length - } - - case 2201: - switch byteToLower(b) { - case 'e': - st = 2202 - default: - return length - } - - case 2202: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 2203 - default: - return length - } - - case 2205: - switch byteToLower(b) { - case 'd': - st = 2206 - case 't': - st = 2209 - case 'y': - st = 2215 - default: - return length - } - - case 2206: - switch byteToLower(b) { - case 'k': - st = 2207 - default: - return length - } - - case 2207: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2208 - default: - return length - } - - case 2209: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2210 - case 'i': - st = 2211 - case 'o': - length = i + 1 - st = 2214 - default: - return length - } - - case 2211: - switch byteToLower(b) { - case 'n': - st = 2212 - default: - return length - } - - case 2212: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 2213 - default: - return length - } - - case 2215: - switch byteToLower(b) { - case 'a': - st = 2216 - default: - return length - } - - case 2216: - switch byteToLower(b) { - case 'g': - st = 2217 - default: - return length - } - - case 2217: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2218 - default: - return length - } - - case 2220: - switch byteToLower(b) { - case 'a': - st = 2221 - case 'e': - st = 2233 - case 'f': - length = i + 1 - st = 2249 - case 'h': - st = 2250 - case 'i': - st = 2256 - case 'm': - st = 2271 - case 'o': - st = 2273 - case 's': - length = i + 1 - st = 2279 - case 't': - st = 2280 - default: - return length - } - - case 2221: - switch byteToLower(b) { - case 'l': - st = 2222 - case 'n': - st = 2228 - case 't': - st = 2230 - default: - return length - } - - case 2222: - switch byteToLower(b) { - case 'e': - st = 2223 - case 't': - st = 2225 - default: - return length - } - - case 2223: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2224 - default: - return length - } - - case 2225: - switch byteToLower(b) { - case 'e': - st = 2226 - default: - return length - } - - case 2226: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 2227 - default: - return length - } - - case 2228: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 2229 - default: - return length - } - - case 2230: - switch byteToLower(b) { - case 'c': - st = 2231 - default: - return length - } - - case 2231: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 2232 - default: - return length - } - - case 2233: - switch byteToLower(b) { - case 'b': - st = 2234 - case 'd': - length = i + 1 - st = 2242 - case 'i': - st = 2247 - default: - return length - } - - case 2234: - switch byteToLower(b) { - case 'c': - st = 2235 - case 's': - st = 2238 - default: - return length - } - - case 2235: - switch byteToLower(b) { - case 'a': - st = 2236 - default: - return length - } - - case 2236: - switch byteToLower(b) { - case 'm': - length = i + 1 - st = 2237 - default: - return length - } - - case 2238: - switch byteToLower(b) { - case 'i': - st = 2239 - default: - return length - } - - case 2239: - switch byteToLower(b) { - case 't': - st = 2240 - default: - return length - } - - case 2240: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2241 - default: - return length - } - - case 2242: - switch byteToLower(b) { - case 'd': - st = 2243 - default: - return length - } - - case 2243: - switch byteToLower(b) { - case 'i': - st = 2244 - default: - return length - } - - case 2244: - switch byteToLower(b) { - case 'n': - st = 2245 - default: - return length - } - - case 2245: - switch byteToLower(b) { - case 'g': - length = i + 1 - st = 2246 - default: - return length - } - - case 2247: - switch byteToLower(b) { - case 'r': - length = i + 1 - st = 2248 - default: - return length - } - - case 2250: - switch byteToLower(b) { - case 'o': - st = 2251 - default: - return length - } - - case 2251: - switch byteToLower(b) { - case 's': - st = 2252 - default: - return length - } - - case 2252: - switch byteToLower(b) { - case 'w': - st = 2253 - default: - return length - } - - case 2253: - switch byteToLower(b) { - case 'h': - st = 2254 - default: - return length - } - - case 2254: - switch byteToLower(b) { - case 'o': - length = i + 1 - st = 2255 - default: - return length - } - - case 2256: - switch byteToLower(b) { - case 'e': - st = 2257 - case 'k': - st = 2259 - case 'l': - st = 2261 - case 'n': - length = i + 1 - st = 2270 - default: - return length - } - - case 2257: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 2258 - default: - return length - } - - case 2259: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 2260 - default: - return length - } - - case 2261: - switch byteToLower(b) { - case 'l': - st = 2262 - default: - return length - } - - case 2262: - switch byteToLower(b) { - case 'i': - st = 2263 - default: - return length - } - - case 2263: - switch byteToLower(b) { - case 'a': - st = 2264 - default: - return length - } - - case 2264: - switch byteToLower(b) { - case 'm': - st = 2265 - default: - return length - } - - case 2265: - switch byteToLower(b) { - case 'h': - st = 2266 - default: - return length - } - - case 2266: - switch byteToLower(b) { - case 'i': - st = 2267 - default: - return length - } - - case 2267: - switch byteToLower(b) { - case 'l': - st = 2268 - default: - return length - } - - case 2268: - switch byteToLower(b) { - case 'l': - length = i + 1 - st = 2269 - default: - return length - } - - case 2271: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2272 - default: - return length - } - - case 2273: - switch byteToLower(b) { - case 'r': - st = 2274 - default: - return length - } - - case 2274: - switch byteToLower(b) { - case 'k': - length = i + 1 - st = 2275 - case 'l': - st = 2277 - default: - return length - } - - case 2275: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2276 - default: - return length - } - - case 2277: - switch byteToLower(b) { - case 'd': - length = i + 1 - st = 2278 - default: - return length - } - - case 2280: - switch byteToLower(b) { - case 'c': - length = i + 1 - st = 2281 - case 'f': - length = i + 1 - st = 2282 - default: - return length - } - - case 2283: - switch byteToLower(b) { - case 'b': - st = 2284 - case 'e': - st = 2287 - case 'i': - st = 2291 - case 'x': - st = 2293 - case 'y': - st = 2295 - case 'n': - st = 2860 - default: - return length - } - - case 2284: - switch byteToLower(b) { - case 'o': - st = 2285 - default: - return length - } - - case 2285: - switch byteToLower(b) { - case 'x': - length = i + 1 - st = 2286 - default: - return length - } - - case 2287: - switch byteToLower(b) { - case 'r': - st = 2288 - default: - return length - } - - case 2288: - switch byteToLower(b) { - case 'o': - st = 2289 - default: - return length - } - - case 2289: - switch byteToLower(b) { - case 'x': - length = i + 1 - st = 2290 - default: - return length - } - - case 2291: - switch byteToLower(b) { - case 'n': - length = i + 1 - st = 2292 - default: - return length - } - - case 2293: - switch byteToLower(b) { - case 'x': - length = i + 1 - st = 2294 - default: - return length - } - - case 2295: - switch byteToLower(b) { - case 'z': - length = i + 1 - st = 2296 - default: - return length - } - - case 2297: - switch byteToLower(b) { - case 'a': - st = 2298 - case 'e': - length = i + 1 - st = 2307 - case 'o': - st = 2308 - case 't': - length = i + 1 - st = 2329 - default: - return length - } - - case 2298: - switch byteToLower(b) { - case 'c': - st = 2299 - case 'n': - st = 2303 - default: - return length - } - - case 2299: - switch byteToLower(b) { - case 'h': - st = 2300 - default: - return length - } - - case 2300: - switch byteToLower(b) { - case 't': - st = 2301 - default: - return length - } - - case 2301: - switch byteToLower(b) { - case 's': - length = i + 1 - st = 2302 - default: - return length - } - - case 2303: - switch byteToLower(b) { - case 'd': - st = 2304 - default: - return length - } - - case 2304: - switch byteToLower(b) { - case 'e': - st = 2305 - default: - return length - } - - case 2305: - switch byteToLower(b) { - case 'x': - length = i + 1 - st = 2306 - default: - return length - } - - case 2308: - switch byteToLower(b) { - case 'd': - st = 2309 - case 'g': - st = 2316 - case 'k': - st = 2318 - case 'u': - st = 2324 - default: - return length - } - - case 2309: - switch byteToLower(b) { - case 'o': - st = 2310 - default: - return length - } - - case 2310: - switch byteToLower(b) { - case 'b': - st = 2311 - default: - return length - } - - case 2311: - switch byteToLower(b) { - case 'a': - st = 2312 - default: - return length - } - - case 2312: - switch byteToLower(b) { - case 's': - st = 2313 - default: - return length - } - - case 2313: - switch byteToLower(b) { - case 'h': - st = 2314 - default: - return length - } - - case 2314: - switch byteToLower(b) { - case 'i': - length = i + 1 - st = 2315 - default: - return length - } - - case 2316: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2317 - default: - return length - } - - case 2318: - switch byteToLower(b) { - case 'o': - st = 2319 - default: - return length - } - - case 2319: - switch byteToLower(b) { - case 'h': - st = 2320 - default: - return length - } - - case 2320: - switch byteToLower(b) { - case 'a': - st = 2321 - default: - return length - } - - case 2321: - switch byteToLower(b) { - case 'm': - st = 2322 - default: - return length - } - - case 2322: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2323 - default: - return length - } - - case 2324: - switch byteToLower(b) { - case 't': - st = 2325 - default: - return length - } - - case 2325: - switch byteToLower(b) { - case 'u': - st = 2326 - default: - return length - } - - case 2326: - switch byteToLower(b) { - case 'b': - st = 2327 - default: - return length - } - - case 2327: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2328 - default: - return length - } - - case 2330: - switch byteToLower(b) { - case 'a': - length = i + 1 - st = 2331 - case 'i': - st = 2332 - case 'k': - st = 2334 - case 'm': - length = i + 1 - st = 2337 - case 'o': - st = 2338 - case 'u': - st = 2341 - case 'w': - length = i + 1 - st = 2347 - default: - return length - } - - case 2332: - switch byteToLower(b) { - case 'p': - length = i + 1 - st = 2333 - default: - return length - } - - case 2334: - switch byteToLower(b) { - case 'e': - st = 2335 - default: - return length - } - - case 2335: - switch byteToLower(b) { - case 'y': - length = i + 1 - st = 2336 - default: - return length - } - - case 2338: - switch byteToLower(b) { - case 'n': - st = 2339 - default: - return length - } - - case 2339: - switch byteToLower(b) { - case 'e': - length = i + 1 - st = 2340 - default: - return length - } - - case 2341: - switch byteToLower(b) { - case 'e': - st = 2342 - default: - return length - } - - case 2342: - switch byteToLower(b) { - case 'r': - st = 2343 - default: - return length - } - - case 2343: - switch byteToLower(b) { - case 'i': - st = 2344 - default: - return length - } - - case 2344: - switch byteToLower(b) { - case 'c': - st = 2345 - default: - return length - } - - case 2345: - switch byteToLower(b) { - case 'h': - length = i + 1 - st = 2346 - default: - return length - } - - case 2348: - switch b { - case '.': - length = i + 1 - st = 2349 - default: - return length - } - - case 2350: - switch b { - case '.': - length = i + 1 - st = 2351 - case '0': - st = 2368 - case '1': - st = 2370 - case '2': - st = 2372 - case '3': - st = 2374 - case '4': - st = 2376 - case '5': - st = 2378 - case '6': - st = 2380 - case '7': - st = 2382 - case '8': - st = 2384 - case '9': - st = 2386 - default: - return length - } - - case 2352: - switch b { - case '.': - length = i + 1 - st = 2353 - case '0': - st = 2388 - case '1': - st = 2390 - case '2': - st = 2392 - case '3': - st = 2394 - case '4': - st = 2396 - case '5': - st = 2398 - case '6': - st = 2400 - case '7': - st = 2402 - case '8': - st = 2404 - case '9': - st = 2406 - default: - return length - } - - case 2354: - switch b { - case '.': - length = i + 1 - st = 2355 - case '0': - st = 2408 - case '1': - st = 2410 - case '2': - st = 2412 - case '3': - st = 2414 - case '4': - st = 2416 - case '5': - st = 2418 - case '6': - st = 2420 - case '7': - st = 2422 - case '8': - st = 2424 - case '9': - st = 2426 - default: - return length - } - - case 2356: - switch b { - case '.': - length = i + 1 - st = 2357 - case '0': - st = 2428 - case '1': - st = 2430 - case '2': - st = 2432 - case '3': - st = 2434 - case '4': - st = 2436 - case '5': - st = 2438 - case '6': - st = 2440 - case '7': - st = 2442 - case '8': - st = 2444 - case '9': - st = 2446 - default: - return length - } - - case 2358: - switch b { - case '.': - length = i + 1 - st = 2359 - case '0': - st = 2448 - case '1': - st = 2450 - case '2': - st = 2452 - case '3': - st = 2454 - case '4': - st = 2456 - case '5': - st = 2458 - case '6': - st = 2460 - case '7': - st = 2462 - case '8': - st = 2464 - case '9': - st = 2466 - default: - return length - } - - case 2360: - switch b { - case '.': - length = i + 1 - st = 2361 - case '0': - st = 2468 - case '1': - st = 2470 - case '2': - st = 2472 - case '3': - st = 2474 - case '4': - st = 2476 - case '5': - st = 2478 - case '6': - st = 2480 - case '7': - st = 2482 - case '8': - st = 2484 - case '9': - st = 2486 - default: - return length - } - - case 2362: - switch b { - case '.': - length = i + 1 - st = 2363 - case '0': - st = 2488 - case '1': - st = 2490 - case '2': - st = 2492 - case '3': - st = 2494 - case '4': - st = 2496 - case '5': - st = 2498 - case '6': - st = 2500 - case '7': - st = 2502 - case '8': - st = 2504 - case '9': - st = 2506 - default: - return length - } - - case 2364: - switch b { - case '.': - length = i + 1 - st = 2365 - case '0': - st = 2508 - case '1': - st = 2510 - case '2': - st = 2512 - case '3': - st = 2514 - case '4': - st = 2516 - case '5': - st = 2518 - case '6': - st = 2520 - case '7': - st = 2522 - case '8': - st = 2524 - case '9': - st = 2526 - default: - return length - } - - case 2366: - switch b { - case '.': - length = i + 1 - st = 2367 - case '0': - st = 2528 - case '1': - st = 2530 - case '2': - st = 2532 - case '3': - st = 2534 - case '4': - st = 2536 - case '5': - st = 2538 - case '6': - st = 2540 - case '7': - st = 2542 - case '8': - st = 2544 - case '9': - st = 2546 - default: - return length - } - - case 2368: - switch b { - case '.': - length = i + 1 - st = 2369 - case '0': - st = 2548 - case '1': - st = 2550 - case '2': - st = 2552 - case '3': - st = 2554 - case '4': - st = 2556 - case '5': - st = 2558 - case '6': - st = 2560 - case '7': - st = 2562 - case '8': - st = 2564 - case '9': - st = 2566 - default: - return length - } - - case 2370: - switch b { - case '.': - length = i + 1 - st = 2371 - case '0': - st = 2568 - case '1': - st = 2570 - case '2': - st = 2572 - case '3': - st = 2574 - case '4': - st = 2576 - case '5': - st = 2578 - case '6': - st = 2580 - case '7': - st = 2582 - case '8': - st = 2584 - case '9': - st = 2586 - default: - return length - } - - case 2372: - switch b { - case '.': - length = i + 1 - st = 2373 - case '0': - st = 2588 - case '1': - st = 2590 - case '2': - st = 2592 - case '3': - st = 2594 - case '4': - st = 2596 - case '5': - st = 2598 - case '6': - st = 2600 - case '7': - st = 2602 - case '8': - st = 2604 - case '9': - st = 2606 - default: - return length - } - - case 2374: - switch b { - case '.': - length = i + 1 - st = 2375 - case '0': - st = 2608 - case '1': - st = 2610 - case '2': - st = 2612 - case '3': - st = 2614 - case '4': - st = 2616 - case '5': - st = 2618 - case '6': - st = 2620 - case '7': - st = 2622 - case '8': - st = 2624 - case '9': - st = 2626 - default: - return length - } - - case 2376: - switch b { - case '.': - length = i + 1 - st = 2377 - case '0': - st = 2628 - case '1': - st = 2630 - case '2': - st = 2632 - case '3': - st = 2634 - case '4': - st = 2636 - case '5': - st = 2638 - case '6': - st = 2640 - case '7': - st = 2642 - case '8': - st = 2644 - case '9': - st = 2646 - default: - return length - } - - case 2378: - switch b { - case '.': - length = i + 1 - st = 2379 - case '0': - st = 2648 - case '1': - st = 2650 - case '2': - st = 2652 - case '3': - st = 2654 - case '4': - st = 2656 - case '5': - st = 2658 - case '6': - st = 2660 - case '7': - st = 2662 - case '8': - st = 2664 - case '9': - st = 2666 - default: - return length - } - - case 2380: - switch b { - case '.': - length = i + 1 - st = 2381 - case '0': - st = 2668 - case '1': - st = 2670 - case '2': - st = 2672 - case '3': - st = 2674 - case '4': - st = 2676 - case '5': - st = 2678 - case '6': - st = 2680 - case '7': - st = 2682 - case '8': - st = 2684 - case '9': - st = 2686 - default: - return length - } - - case 2382: - switch b { - case '.': - length = i + 1 - st = 2383 - case '0': - st = 2688 - case '1': - st = 2690 - case '2': - st = 2692 - case '3': - st = 2694 - case '4': - st = 2696 - case '5': - st = 2698 - case '6': - st = 2700 - case '7': - st = 2702 - case '8': - st = 2704 - case '9': - st = 2706 - default: - return length - } - - case 2384: - switch b { - case '.': - length = i + 1 - st = 2385 - case '0': - st = 2708 - case '1': - st = 2710 - case '2': - st = 2712 - case '3': - st = 2714 - case '4': - st = 2716 - case '5': - st = 2718 - case '6': - st = 2720 - case '7': - st = 2722 - case '8': - st = 2724 - case '9': - st = 2726 - default: - return length - } - - case 2386: - switch b { - case '.': - length = i + 1 - st = 2387 - case '0': - st = 2728 - case '1': - st = 2730 - case '2': - st = 2732 - case '3': - st = 2734 - case '4': - st = 2736 - case '5': - st = 2738 - case '6': - st = 2740 - case '7': - st = 2742 - case '8': - st = 2744 - case '9': - st = 2746 - default: - return length - } - - case 2388: - switch b { - case '.': - length = i + 1 - st = 2389 - case '0': - st = 2748 - case '1': - st = 2750 - case '2': - st = 2752 - case '3': - st = 2754 - case '4': - st = 2756 - case '5': - st = 2758 - case '6': - st = 2760 - case '7': - st = 2762 - case '8': - st = 2764 - case '9': - st = 2766 - default: - return length - } - - case 2390: - switch b { - case '.': - length = i + 1 - st = 2391 - case '0': - st = 2768 - case '1': - st = 2770 - case '2': - st = 2772 - case '3': - st = 2774 - case '4': - st = 2776 - case '5': - st = 2778 - case '6': - st = 2780 - case '7': - st = 2782 - case '8': - st = 2784 - case '9': - st = 2786 - default: - return length - } - - case 2392: - switch b { - case '.': - length = i + 1 - st = 2393 - case '0': - st = 2788 - case '1': - st = 2790 - case '2': - st = 2792 - case '3': - st = 2794 - case '4': - st = 2796 - case '5': - st = 2798 - case '6': - st = 2800 - case '7': - st = 2802 - case '8': - st = 2804 - case '9': - st = 2806 - default: - return length - } - - case 2394: - switch b { - case '.': - length = i + 1 - st = 2395 - case '0': - st = 2808 - case '1': - st = 2810 - case '2': - st = 2812 - case '3': - st = 2814 - case '4': - st = 2816 - case '5': - st = 2818 - case '6': - st = 2820 - case '7': - st = 2822 - case '8': - st = 2824 - case '9': - st = 2826 - default: - return length - } - - case 2396: - switch b { - case '.': - length = i + 1 - st = 2397 - case '0': - st = 2828 - case '1': - st = 2830 - case '2': - st = 2832 - case '3': - st = 2834 - case '4': - st = 2836 - case '5': - st = 2838 - case '6': - st = 2840 - case '7': - st = 2842 - case '8': - st = 2844 - case '9': - st = 2846 - default: - return length - } - - case 2398: - switch b { - case '.': - length = i + 1 - st = 2399 - case '0': - st = 2848 - case '1': - st = 2850 - case '2': - st = 2852 - case '3': - st = 2854 - case '4': - st = 2856 - case '5': - st = 2858 - default: - return length - } - - case 2400: - switch b { - case '.': - length = i + 1 - st = 2401 - default: - return length - } - - case 2402: - switch b { - case '.': - length = i + 1 - st = 2403 - default: - return length - } - - case 2404: - switch b { - case '.': - length = i + 1 - st = 2405 - default: - return length - } - - case 2406: - switch b { - case '.': - length = i + 1 - st = 2407 - default: - return length - } - - case 2408: - switch b { - case '.': - length = i + 1 - st = 2409 - default: - return length - } - - case 2410: - switch b { - case '.': - length = i + 1 - st = 2411 - default: - return length - } - - case 2412: - switch b { - case '.': - length = i + 1 - st = 2413 - default: - return length - } - - case 2414: - switch b { - case '.': - length = i + 1 - st = 2415 - default: - return length - } - - case 2416: - switch b { - case '.': - length = i + 1 - st = 2417 - default: - return length - } - - case 2418: - switch b { - case '.': - length = i + 1 - st = 2419 - default: - return length - } - - case 2420: - switch b { - case '.': - length = i + 1 - st = 2421 - default: - return length - } - - case 2422: - switch b { - case '.': - length = i + 1 - st = 2423 - default: - return length - } - - case 2424: - switch b { - case '.': - length = i + 1 - st = 2425 - default: - return length - } - - case 2426: - switch b { - case '.': - length = i + 1 - st = 2427 - default: - return length - } - - case 2428: - switch b { - case '.': - length = i + 1 - st = 2429 - default: - return length - } - - case 2430: - switch b { - case '.': - length = i + 1 - st = 2431 - default: - return length - } - - case 2432: - switch b { - case '.': - length = i + 1 - st = 2433 - default: - return length - } - - case 2434: - switch b { - case '.': - length = i + 1 - st = 2435 - default: - return length - } - - case 2436: - switch b { - case '.': - length = i + 1 - st = 2437 - default: - return length - } - - case 2438: - switch b { - case '.': - length = i + 1 - st = 2439 - default: - return length - } - - case 2440: - switch b { - case '.': - length = i + 1 - st = 2441 - default: - return length - } - - case 2442: - switch b { - case '.': - length = i + 1 - st = 2443 - default: - return length - } - - case 2444: - switch b { - case '.': - length = i + 1 - st = 2445 - default: - return length - } - - case 2446: - switch b { - case '.': - length = i + 1 - st = 2447 - default: - return length - } - - case 2448: - switch b { - case '.': - length = i + 1 - st = 2449 - default: - return length - } - - case 2450: - switch b { - case '.': - length = i + 1 - st = 2451 - default: - return length - } - - case 2452: - switch b { - case '.': - length = i + 1 - st = 2453 - default: - return length - } - - case 2454: - switch b { - case '.': - length = i + 1 - st = 2455 - default: - return length - } - - case 2456: - switch b { - case '.': - length = i + 1 - st = 2457 - default: - return length - } - - case 2458: - switch b { - case '.': - length = i + 1 - st = 2459 - default: - return length - } - - case 2460: - switch b { - case '.': - length = i + 1 - st = 2461 - default: - return length - } - - case 2462: - switch b { - case '.': - length = i + 1 - st = 2463 - default: - return length - } - - case 2464: - switch b { - case '.': - length = i + 1 - st = 2465 - default: - return length - } - - case 2466: - switch b { - case '.': - length = i + 1 - st = 2467 - default: - return length - } - - case 2468: - switch b { - case '.': - length = i + 1 - st = 2469 - default: - return length - } - - case 2470: - switch b { - case '.': - length = i + 1 - st = 2471 - default: - return length - } - - case 2472: - switch b { - case '.': - length = i + 1 - st = 2473 - default: - return length - } - - case 2474: - switch b { - case '.': - length = i + 1 - st = 2475 - default: - return length - } - - case 2476: - switch b { - case '.': - length = i + 1 - st = 2477 - default: - return length - } - - case 2478: - switch b { - case '.': - length = i + 1 - st = 2479 - default: - return length - } - - case 2480: - switch b { - case '.': - length = i + 1 - st = 2481 - default: - return length - } - - case 2482: - switch b { - case '.': - length = i + 1 - st = 2483 - default: - return length - } - - case 2484: - switch b { - case '.': - length = i + 1 - st = 2485 - default: - return length - } - - case 2486: - switch b { - case '.': - length = i + 1 - st = 2487 - default: - return length - } - - case 2488: - switch b { - case '.': - length = i + 1 - st = 2489 - default: - return length - } - - case 2490: - switch b { - case '.': - length = i + 1 - st = 2491 - default: - return length - } - - case 2492: - switch b { - case '.': - length = i + 1 - st = 2493 - default: - return length - } - - case 2494: - switch b { - case '.': - length = i + 1 - st = 2495 - default: - return length - } - - case 2496: - switch b { - case '.': - length = i + 1 - st = 2497 - default: - return length - } - - case 2498: - switch b { - case '.': - length = i + 1 - st = 2499 - default: - return length - } - - case 2500: - switch b { - case '.': - length = i + 1 - st = 2501 - default: - return length - } - - case 2502: - switch b { - case '.': - length = i + 1 - st = 2503 - default: - return length - } - - case 2504: - switch b { - case '.': - length = i + 1 - st = 2505 - default: - return length - } - - case 2506: - switch b { - case '.': - length = i + 1 - st = 2507 - default: - return length - } - - case 2508: - switch b { - case '.': - length = i + 1 - st = 2509 - default: - return length - } - - case 2510: - switch b { - case '.': - length = i + 1 - st = 2511 - default: - return length - } - - case 2512: - switch b { - case '.': - length = i + 1 - st = 2513 - default: - return length - } - - case 2514: - switch b { - case '.': - length = i + 1 - st = 2515 - default: - return length - } - - case 2516: - switch b { - case '.': - length = i + 1 - st = 2517 - default: - return length - } - - case 2518: - switch b { - case '.': - length = i + 1 - st = 2519 - default: - return length - } - - case 2520: - switch b { - case '.': - length = i + 1 - st = 2521 - default: - return length - } - - case 2522: - switch b { - case '.': - length = i + 1 - st = 2523 - default: - return length - } - - case 2524: - switch b { - case '.': - length = i + 1 - st = 2525 - default: - return length - } - - case 2526: - switch b { - case '.': - length = i + 1 - st = 2527 - default: - return length - } - - case 2528: - switch b { - case '.': - length = i + 1 - st = 2529 - default: - return length - } - - case 2530: - switch b { - case '.': - length = i + 1 - st = 2531 - default: - return length - } - - case 2532: - switch b { - case '.': - length = i + 1 - st = 2533 - default: - return length - } - - case 2534: - switch b { - case '.': - length = i + 1 - st = 2535 - default: - return length - } - - case 2536: - switch b { - case '.': - length = i + 1 - st = 2537 - default: - return length - } - - case 2538: - switch b { - case '.': - length = i + 1 - st = 2539 - default: - return length - } - - case 2540: - switch b { - case '.': - length = i + 1 - st = 2541 - default: - return length - } - - case 2542: - switch b { - case '.': - length = i + 1 - st = 2543 - default: - return length - } - - case 2544: - switch b { - case '.': - length = i + 1 - st = 2545 - default: - return length - } - - case 2546: - switch b { - case '.': - length = i + 1 - st = 2547 - default: - return length - } - - case 2548: - switch b { - case '.': - length = i + 1 - st = 2549 - default: - return length - } - - case 2550: - switch b { - case '.': - length = i + 1 - st = 2551 - default: - return length - } - - case 2552: - switch b { - case '.': - length = i + 1 - st = 2553 - default: - return length - } - - case 2554: - switch b { - case '.': - length = i + 1 - st = 2555 - default: - return length - } - - case 2556: - switch b { - case '.': - length = i + 1 - st = 2557 - default: - return length - } - - case 2558: - switch b { - case '.': - length = i + 1 - st = 2559 - default: - return length - } - - case 2560: - switch b { - case '.': - length = i + 1 - st = 2561 - default: - return length - } - - case 2562: - switch b { - case '.': - length = i + 1 - st = 2563 - default: - return length - } - - case 2564: - switch b { - case '.': - length = i + 1 - st = 2565 - default: - return length - } - - case 2566: - switch b { - case '.': - length = i + 1 - st = 2567 - default: - return length - } - - case 2568: - switch b { - case '.': - length = i + 1 - st = 2569 - default: - return length - } - - case 2570: - switch b { - case '.': - length = i + 1 - st = 2571 - default: - return length - } - - case 2572: - switch b { - case '.': - length = i + 1 - st = 2573 - default: - return length - } - - case 2574: - switch b { - case '.': - length = i + 1 - st = 2575 - default: - return length - } - - case 2576: - switch b { - case '.': - length = i + 1 - st = 2577 - default: - return length - } - - case 2578: - switch b { - case '.': - length = i + 1 - st = 2579 - default: - return length - } - - case 2580: - switch b { - case '.': - length = i + 1 - st = 2581 - default: - return length - } - - case 2582: - switch b { - case '.': - length = i + 1 - st = 2583 - default: - return length - } - - case 2584: - switch b { - case '.': - length = i + 1 - st = 2585 - default: - return length - } - - case 2586: - switch b { - case '.': - length = i + 1 - st = 2587 - default: - return length - } - - case 2588: - switch b { - case '.': - length = i + 1 - st = 2589 - default: - return length - } - - case 2590: - switch b { - case '.': - length = i + 1 - st = 2591 - default: - return length - } - - case 2592: - switch b { - case '.': - length = i + 1 - st = 2593 - default: - return length - } - - case 2594: - switch b { - case '.': - length = i + 1 - st = 2595 - default: - return length - } - - case 2596: - switch b { - case '.': - length = i + 1 - st = 2597 - default: - return length - } - - case 2598: - switch b { - case '.': - length = i + 1 - st = 2599 - default: - return length - } - - case 2600: - switch b { - case '.': - length = i + 1 - st = 2601 - default: - return length - } - - case 2602: - switch b { - case '.': - length = i + 1 - st = 2603 - default: - return length - } - - case 2604: - switch b { - case '.': - length = i + 1 - st = 2605 - default: - return length - } - - case 2606: - switch b { - case '.': - length = i + 1 - st = 2607 - default: - return length - } - - case 2608: - switch b { - case '.': - length = i + 1 - st = 2609 - default: - return length - } - - case 2610: - switch b { - case '.': - length = i + 1 - st = 2611 - default: - return length - } - - case 2612: - switch b { - case '.': - length = i + 1 - st = 2613 - default: - return length - } - - case 2614: - switch b { - case '.': - length = i + 1 - st = 2615 - default: - return length - } - - case 2616: - switch b { - case '.': - length = i + 1 - st = 2617 - default: - return length - } - - case 2618: - switch b { - case '.': - length = i + 1 - st = 2619 - default: - return length - } - - case 2620: - switch b { - case '.': - length = i + 1 - st = 2621 - default: - return length - } - - case 2622: - switch b { - case '.': - length = i + 1 - st = 2623 - default: - return length - } - - case 2624: - switch b { - case '.': - length = i + 1 - st = 2625 - default: - return length - } - - case 2626: - switch b { - case '.': - length = i + 1 - st = 2627 - default: - return length - } - - case 2628: - switch b { - case '.': - length = i + 1 - st = 2629 - default: - return length - } - - case 2630: - switch b { - case '.': - length = i + 1 - st = 2631 - default: - return length - } - - case 2632: - switch b { - case '.': - length = i + 1 - st = 2633 - default: - return length - } - - case 2634: - switch b { - case '.': - length = i + 1 - st = 2635 - default: - return length - } - - case 2636: - switch b { - case '.': - length = i + 1 - st = 2637 - default: - return length - } - - case 2638: - switch b { - case '.': - length = i + 1 - st = 2639 - default: - return length - } - - case 2640: - switch b { - case '.': - length = i + 1 - st = 2641 - default: - return length - } - - case 2642: - switch b { - case '.': - length = i + 1 - st = 2643 - default: - return length - } - - case 2644: - switch b { - case '.': - length = i + 1 - st = 2645 - default: - return length - } - - case 2646: - switch b { - case '.': - length = i + 1 - st = 2647 - default: - return length - } - - case 2648: - switch b { - case '.': - length = i + 1 - st = 2649 - default: - return length - } - - case 2650: - switch b { - case '.': - length = i + 1 - st = 2651 - default: - return length - } - - case 2652: - switch b { - case '.': - length = i + 1 - st = 2653 - default: - return length - } - - case 2654: - switch b { - case '.': - length = i + 1 - st = 2655 - default: - return length - } - - case 2656: - switch b { - case '.': - length = i + 1 - st = 2657 - default: - return length - } - - case 2658: - switch b { - case '.': - length = i + 1 - st = 2659 - default: - return length - } - - case 2660: - switch b { - case '.': - length = i + 1 - st = 2661 - default: - return length - } - - case 2662: - switch b { - case '.': - length = i + 1 - st = 2663 - default: - return length - } - - case 2664: - switch b { - case '.': - length = i + 1 - st = 2665 - default: - return length - } - - case 2666: - switch b { - case '.': - length = i + 1 - st = 2667 - default: - return length - } - - case 2668: - switch b { - case '.': - length = i + 1 - st = 2669 - default: - return length - } - - case 2670: - switch b { - case '.': - length = i + 1 - st = 2671 - default: - return length - } - - case 2672: - switch b { - case '.': - length = i + 1 - st = 2673 - default: - return length - } - - case 2674: - switch b { - case '.': - length = i + 1 - st = 2675 - default: - return length - } - - case 2676: - switch b { - case '.': - length = i + 1 - st = 2677 - default: - return length - } - - case 2678: - switch b { - case '.': - length = i + 1 - st = 2679 - default: - return length - } - - case 2680: - switch b { - case '.': - length = i + 1 - st = 2681 - default: - return length - } - - case 2682: - switch b { - case '.': - length = i + 1 - st = 2683 - default: - return length - } - - case 2684: - switch b { - case '.': - length = i + 1 - st = 2685 - default: - return length - } - - case 2686: - switch b { - case '.': - length = i + 1 - st = 2687 - default: - return length - } - - case 2688: - switch b { - case '.': - length = i + 1 - st = 2689 - default: - return length - } - - case 2690: - switch b { - case '.': - length = i + 1 - st = 2691 - default: - return length - } - - case 2692: - switch b { - case '.': - length = i + 1 - st = 2693 - default: - return length - } - - case 2694: - switch b { - case '.': - length = i + 1 - st = 2695 - default: - return length - } - - case 2696: - switch b { - case '.': - length = i + 1 - st = 2697 - default: - return length - } - - case 2698: - switch b { - case '.': - length = i + 1 - st = 2699 - default: - return length - } - - case 2700: - switch b { - case '.': - length = i + 1 - st = 2701 - default: - return length - } - - case 2702: - switch b { - case '.': - length = i + 1 - st = 2703 - default: - return length - } - - case 2704: - switch b { - case '.': - length = i + 1 - st = 2705 - default: - return length - } - - case 2706: - switch b { - case '.': - length = i + 1 - st = 2707 - default: - return length - } - - case 2708: - switch b { - case '.': - length = i + 1 - st = 2709 - default: - return length - } - - case 2710: - switch b { - case '.': - length = i + 1 - st = 2711 - default: - return length - } - - case 2712: - switch b { - case '.': - length = i + 1 - st = 2713 - default: - return length - } - - case 2714: - switch b { - case '.': - length = i + 1 - st = 2715 - default: - return length - } - - case 2716: - switch b { - case '.': - length = i + 1 - st = 2717 - default: - return length - } - - case 2718: - switch b { - case '.': - length = i + 1 - st = 2719 - default: - return length - } - - case 2720: - switch b { - case '.': - length = i + 1 - st = 2721 - default: - return length - } - - case 2722: - switch b { - case '.': - length = i + 1 - st = 2723 - default: - return length - } - - case 2724: - switch b { - case '.': - length = i + 1 - st = 2725 - default: - return length - } - - case 2726: - switch b { - case '.': - length = i + 1 - st = 2727 - default: - return length - } - - case 2728: - switch b { - case '.': - length = i + 1 - st = 2729 - default: - return length - } - - case 2730: - switch b { - case '.': - length = i + 1 - st = 2731 - default: - return length - } - - case 2732: - switch b { - case '.': - length = i + 1 - st = 2733 - default: - return length - } - - case 2734: - switch b { - case '.': - length = i + 1 - st = 2735 - default: - return length - } - - case 2736: - switch b { - case '.': - length = i + 1 - st = 2737 - default: - return length - } - - case 2738: - switch b { - case '.': - length = i + 1 - st = 2739 - default: - return length - } - - case 2740: - switch b { - case '.': - length = i + 1 - st = 2741 - default: - return length - } - - case 2742: - switch b { - case '.': - length = i + 1 - st = 2743 - default: - return length - } - - case 2744: - switch b { - case '.': - length = i + 1 - st = 2745 - default: - return length - } - - case 2746: - switch b { - case '.': - length = i + 1 - st = 2747 - default: - return length - } - - case 2748: - switch b { - case '.': - length = i + 1 - st = 2749 - default: - return length - } - - case 2750: - switch b { - case '.': - length = i + 1 - st = 2751 - default: - return length - } - - case 2752: - switch b { - case '.': - length = i + 1 - st = 2753 - default: - return length - } - - case 2754: - switch b { - case '.': - length = i + 1 - st = 2755 - default: - return length - } - - case 2756: - switch b { - case '.': - length = i + 1 - st = 2757 - default: - return length - } - - case 2758: - switch b { - case '.': - length = i + 1 - st = 2759 - default: - return length - } - - case 2760: - switch b { - case '.': - length = i + 1 - st = 2761 - default: - return length - } - - case 2762: - switch b { - case '.': - length = i + 1 - st = 2763 - default: - return length - } - - case 2764: - switch b { - case '.': - length = i + 1 - st = 2765 - default: - return length - } - - case 2766: - switch b { - case '.': - length = i + 1 - st = 2767 - default: - return length - } - - case 2768: - switch b { - case '.': - length = i + 1 - st = 2769 - default: - return length - } - - case 2770: - switch b { - case '.': - length = i + 1 - st = 2771 - default: - return length - } - - case 2772: - switch b { - case '.': - length = i + 1 - st = 2773 - default: - return length - } - - case 2774: - switch b { - case '.': - length = i + 1 - st = 2775 - default: - return length - } - - case 2776: - switch b { - case '.': - length = i + 1 - st = 2777 - default: - return length - } - - case 2778: - switch b { - case '.': - length = i + 1 - st = 2779 - default: - return length - } - - case 2780: - switch b { - case '.': - length = i + 1 - st = 2781 - default: - return length - } - - case 2782: - switch b { - case '.': - length = i + 1 - st = 2783 - default: - return length - } - - case 2784: - switch b { - case '.': - length = i + 1 - st = 2785 - default: - return length - } - - case 2786: - switch b { - case '.': - length = i + 1 - st = 2787 - default: - return length - } - - case 2788: - switch b { - case '.': - length = i + 1 - st = 2789 - default: - return length - } - - case 2790: - switch b { - case '.': - length = i + 1 - st = 2791 - default: - return length - } - - case 2792: - switch b { - case '.': - length = i + 1 - st = 2793 - default: - return length - } - - case 2794: - switch b { - case '.': - length = i + 1 - st = 2795 - default: - return length - } - - case 2796: - switch b { - case '.': - length = i + 1 - st = 2797 - default: - return length - } - - case 2798: - switch b { - case '.': - length = i + 1 - st = 2799 - default: - return length - } - - case 2800: - switch b { - case '.': - length = i + 1 - st = 2801 - default: - return length - } - - case 2802: - switch b { - case '.': - length = i + 1 - st = 2803 - default: - return length - } - - case 2804: - switch b { - case '.': - length = i + 1 - st = 2805 - default: - return length - } - - case 2806: - switch b { - case '.': - length = i + 1 - st = 2807 - default: - return length - } - - case 2808: - switch b { - case '.': - length = i + 1 - st = 2809 - default: - return length - } - - case 2810: - switch b { - case '.': - length = i + 1 - st = 2811 - default: - return length - } - - case 2812: - switch b { - case '.': - length = i + 1 - st = 2813 - default: - return length - } - - case 2814: - switch b { - case '.': - length = i + 1 - st = 2815 - default: - return length - } - - case 2816: - switch b { - case '.': - length = i + 1 - st = 2817 - default: - return length - } - - case 2818: - switch b { - case '.': - length = i + 1 - st = 2819 - default: - return length - } - - case 2820: - switch b { - case '.': - length = i + 1 - st = 2821 - default: - return length - } - - case 2822: - switch b { - case '.': - length = i + 1 - st = 2823 - default: - return length - } - - case 2824: - switch b { - case '.': - length = i + 1 - st = 2825 - default: - return length - } - - case 2826: - switch b { - case '.': - length = i + 1 - st = 2827 - default: - return length - } - - case 2828: - switch b { - case '.': - length = i + 1 - st = 2829 - default: - return length - } - - case 2830: - switch b { - case '.': - length = i + 1 - st = 2831 - default: - return length - } - - case 2832: - switch b { - case '.': - length = i + 1 - st = 2833 - default: - return length - } - - case 2834: - switch b { - case '.': - length = i + 1 - st = 2835 - default: - return length - } - - case 2836: - switch b { - case '.': - length = i + 1 - st = 2837 - default: - return length - } - - case 2838: - switch b { - case '.': - length = i + 1 - st = 2839 - default: - return length - } - - case 2840: - switch b { - case '.': - length = i + 1 - st = 2841 - default: - return length - } - - case 2842: - switch b { - case '.': - length = i + 1 - st = 2843 - default: - return length - } - - case 2844: - switch b { - case '.': - length = i + 1 - st = 2845 - default: - return length - } - - case 2846: - switch b { - case '.': - length = i + 1 - st = 2847 - default: - return length - } - - case 2848: - switch b { - case '.': - length = i + 1 - st = 2849 - default: - return length - } - - case 2850: - switch b { - case '.': - length = i + 1 - st = 2851 - default: - return length - } - - case 2852: - switch b { - case '.': - length = i + 1 - st = 2853 - default: - return length - } - - case 2854: - switch b { - case '.': - length = i + 1 - st = 2855 - default: - return length - } - - case 2856: - switch b { - case '.': - length = i + 1 - st = 2857 - default: - return length - } - - case 2858: - switch b { - case '.': - length = i + 1 - st = 2859 - default: - return length - } - - case 2860: - switch b { - case '-': - st = 2861 - default: - return length - } - - case 2861: - switch b { - case '-': - length = i + 1 - st = 2862 - default: - return length - } - - } - } - - return length -} diff --git a/vendor/gitlab.com/golang-commonmark/linkify/linkify.go b/vendor/gitlab.com/golang-commonmark/linkify/linkify.go deleted file mode 100644 index 116d5615..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/linkify.go +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package linkify provides a way to find links in plain text. -package linkify - -import ( - "strings" - "unicode/utf8" -) - -// Link represents a link found in a string with a schema and a position in the string. -type Link struct { - Scheme string - Start, End int -} - -func max(a, b int) int { - if a >= b { - return a - } - return b -} - -// Links returns links found in s. -func Links(s string) (links []Link) { - for i := 0; i < len(s)-2; i++ { - switch s[i] { - case '.': // IP address or domain name - if i == 0 { - continue // . at the start of a line - } - if length := match(s[i+1:]); length > 0 { - pos := i + 1 + length - switch s[pos-1] { - case '.': // IP address - if pos >= len(s) { - continue // . at the end of line - } - if !digit(s[i-1]) { - i = pos - continue // . should be preceded by a digit - } - if !digit(s[pos]) { - i = pos - continue // . should be followed by a digit - } - - // find the start of the IP address - j := i - 2 - m := max(0, j-3) - for j >= m && digit(s[j]) { - j-- - } - if i-2-j > 2 { - i = pos + 1 - continue // at most 3 digits - } - start := 0 - if j >= 0 { - r, rlen := utf8.DecodeLastRuneInString(s[:j+1]) - if !isPunctOrSpaceOrControl(r) { - i = pos + 1 - continue - } - switch r { - case '.', ':', '/', '\\', '-', '_': - i = pos + 1 - continue - } - start = j + 2 - rlen - } - - length, ok := skipIPv4(s[start:]) - if !ok { - i = pos + 1 - continue - } - end := start + length - if end == len(s) { - links = append(links, Link{ - Scheme: "", - Start: start, - End: end, - }) - return - } - - r, _ := utf8.DecodeRuneInString(s[end:]) - if !isPunctOrSpaceOrControl(r) { - continue - } - - end = skipPort(s, end) - end = skipPath(s, end) - end = skipQuery(s, end) - end = skipFragment(s, end) - end = unskipPunct(s, end) - - if end < len(s) { - r, _ = utf8.DecodeRuneInString(s[end:]) - if !isPunctOrSpaceOrControl(r) || r == '%' { - continue - } - } - - links = append(links, Link{ - Scheme: "", - Start: start, - End: end, - }) - i = end - - default: // domain name - r, _ := utf8.DecodeLastRuneInString(s[:i]) - if isPunctOrSpaceOrControl(r) { - continue - } - - if pos == len(s) { - start, ok := findHostnameStart(s, i) - if !ok { - continue - } - links = append(links, Link{ - Scheme: "", - Start: start, - End: pos, - }) - return - } - - if s[i+1:pos] != "xn--" { - r, _ = utf8.DecodeRuneInString(s[pos:]) - if isLetterOrDigit(r) { - continue // should not be followed by a letter or a digit - } - } - - end, dot, ok := findHostnameEnd(s, pos) - if !ok { - continue - } - dot = max(dot, i) - - if !(dot+5 <= len(s) && s[dot+1:dot+5] == "xn--") { - if length := match(s[dot+1:]); dot+length+1 != end { - continue - } - } - - start, ok := findHostnameStart(s, i) - if !ok { - continue - } - - end = skipPort(s, end) - end = skipPath(s, end) - end = skipQuery(s, end) - end = skipFragment(s, end) - end = unskipPunct(s, end) - - if end < len(s) { - r, _ = utf8.DecodeRuneInString(s[end:]) - if !isPunctOrSpaceOrControl(r) || r == '%' { - continue // should be followed by punctuation or space - } - } - - links = append(links, Link{ - Scheme: "", - Start: start, - End: end, - }) - i = end - } - } - - case '/': // schema-less link - if s[i+1] != '/' { - continue - } - - if i > 0 { - if s[i-1] == ':' { - i++ - continue // should not be preceded by a colon - } - r, _ := utf8.DecodeLastRuneInString(s[:i]) - if !isPunctOrSpaceOrControl(r) { - i++ - continue // should be preceded by punctuation or space - } - } - - r, _ := utf8.DecodeRuneInString(s[i+2:]) - if !isLetterOrDigit(r) { - i++ - continue // should be followed by a letter or a digit - } - - start := i - end, dot, ok := findHostnameEnd(s, i+2) - if !ok { - continue - } - if s[i+2:end] != "localhost" { - if dot == -1 { - continue // no dot - } - if length, ok := skipIPv4(s[i+2:]); !ok || i+2+length != end { - if length := match(s[dot+1:]); dot+length+1 != end { - continue - } - } - } - - end = skipPort(s, end) - end = skipPath(s, end) - end = skipQuery(s, end) - end = skipFragment(s, end) - end = unskipPunct(s, end) - - if end < len(s) { - r, _ = utf8.DecodeRuneInString(s[end:]) - if !isPunctOrSpaceOrControl(r) || r == '%' { - continue // should be followed by punctuation or space - } - } - - links = append(links, Link{ - Scheme: "//", - Start: start, - End: end, - }) - i = end - - case ':': // http, https, ftp, mailto or localhost - if i < 3 { // at least ftp: - continue - } - - if i >= 9 && s[i-1] == 't' && s[i-9:i] == "localhost" { - j := i - 9 - if !digit(s[j+10]) { - continue - } - if j > 0 { - r, _ := utf8.DecodeLastRuneInString(s[:j]) - if !isPunctOrSpaceOrControl(r) { - i++ - continue // should be preceded by punctuation or space - } - } - - start := j - pos := j + 9 - end := skipPort(s, pos) - if end == pos { - continue // invalid port - } - end = skipPath(s, end) - end = skipQuery(s, end) - end = skipFragment(s, end) - end = unskipPunct(s, end) - - if end < len(s) { - r, _ := utf8.DecodeRuneInString(s[end:]) - if !isPunctOrSpaceOrControl(r) || r == '%' { - i++ - continue // should be followed by punctuation or space - } - } - - links = append(links, Link{ - Scheme: "", - Start: start, - End: end, - }) - i = end - - break - } - - j := i - 1 - var start int - var schema string - - switch byteToLower(s[j]) { - case 'o': // mailto - if j < 5 { - continue // too short for mailto - } - if len(s)-j < 8 { - continue // insufficient length after - } - if strings.ToLower(s[j-5:j+2]) != "mailto:" { - continue - } - r, _ := utf8.DecodeLastRuneInString(s[:j-5]) - if isLetterOrDigit(r) { - continue // should not be preceded by a letter or a digit - } - r, _ = utf8.DecodeRuneInString(s[j+2:]) - if !isAllowedInEmail(r) { - continue // should be followed by a valid e-mail character - } - - start = j - 5 - end, ok := findEmailEnd(s, j+2) - if !ok { - continue - } - - links = append(links, Link{ - Scheme: "mailto:", - Start: start, - End: end, - }) - i = end - continue // continue processing - - case 'p': // http or ftp - if len(s)-j < 8 { - continue // insufficient length after - } - switch byteToLower(s[j-2]) { - case 'f': - if strings.ToLower(s[j-2:j+4]) != "ftp://" { - continue - } - start = j - 2 - schema = "ftp:" - case 't': - if j < 3 { - continue - } - if strings.ToLower(s[j-3:j+4]) != "http://" { - continue - } - start = j - 3 - schema = "http:" - default: - continue - } - - case 's': // https - if j < 4 { - continue // too short for https - } - if len(s)-j < 8 { - continue // insufficient length after - } - start = j - 4 - if strings.ToLower(s[start:j+4]) != "https://" { - continue - } - schema = "https:" - - default: - continue - } - - // http, https or ftp - - if start > 0 { - r, _ := utf8.DecodeLastRuneInString(s[:start]) - if !isPunctOrSpaceOrControl(r) { - continue // should be preceded by punctuation or space - } - } - - r, _ := utf8.DecodeRuneInString(s[j+4:]) - if isPunctOrSpaceOrControl(r) { - continue - } - - end, dot, ok := findHostnameEnd(s, j+4) - if !ok { - continue - } - if s[j+4:end] != "localhost" { - if dot == -1 { - continue // no dot - } - if length, ok := skipIPv4(s[j+4:]); !ok || j+4+length != end { - if !(dot+5 <= len(s) && s[dot+1:dot+5] == "xn--") { - if length := match(s[dot+1:]); dot+length+1 != end { - continue - } - } - } - } - - end = skipPort(s, end) - end = skipPath(s, end) - end = skipQuery(s, end) - end = skipFragment(s, end) - end = unskipPunct(s, end) - - if end < len(s) { - r, _ = utf8.DecodeRuneInString(s[end:]) - if !isPunctOrSpaceOrControl(r) || r == '%' { - continue // should be followed by punctuation or space - } - } - - links = append(links, Link{ - Scheme: schema, - Start: start, - End: end, - }) - i = end - - case '@': // schema-less e-mail - if i == 0 { - continue // @ at the start of a line - } - - if len(s)-i < 5 { - continue // insufficient length after - } - - r, _ := utf8.DecodeLastRuneInString(s[:i]) - if !isAllowedInEmail(r) { - continue // should be preceded by a valid e-mail character - } - - r, _ = utf8.DecodeRuneInString(s[i+1:]) - if !isLetterOrDigit(r) { - continue // should be followed by a letter or a digit - } - - start, ok := findEmailStart(s, i-1) - if !ok { - continue - } - - end, dot, ok := findHostnameEnd(s, i+1) - if !ok { - continue - } - if dot == -1 { - continue // no dot - } - if !(dot+5 <= len(s) && s[dot+1:dot+5] == "xn--") { - if length := match(s[dot+1:]); dot+length+1 != end { - continue - } - } - - links = append(links, Link{ - Scheme: "mailto:", - Start: start, - End: end, - }) - i = end - } - } - return -} diff --git a/vendor/gitlab.com/golang-commonmark/linkify/url.go b/vendor/gitlab.com/golang-commonmark/linkify/url.go deleted file mode 100644 index b2a21bbd..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/url.go +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package linkify - -import "unicode/utf8" - -func atoi3(s string, start int) (int, bool) { - n := 0 - var i int - for i = start; i < len(s) && digit(s[i]); i++ { - n = n*10 + int(s[i]-'0') - if n > 255 { - return 0, false - } - } - if i == start { - return 0, false - } - return i, true -} - -func skipIPv4(s string) (_ int, _ bool) { - j := 0 - for i := 0; i < 4; i++ { - if j >= len(s) { - return - } - if i > 0 { - if s[j] != '.' { - return - } - j++ - } - n, ok := atoi3(s, j) - if !ok { - return - } - j = n - } - return j, true -} - -func atoi5(s string, start int) (int, bool) { - n := 0 - var i int - for i = start; i < len(s) && digit(s[i]); i++ { - n = n*10 + int(s[i]-'0') - if n > 65535 { - return 0, false - } - } - if i == start || n == 0 { - return 0, false - } - return i, true -} - -func skipPort(s string, start int) int { - if start >= len(s) || s[start] != ':' { - return start - } - end, ok := atoi5(s, start+1) - if !ok { - return start - } - return end -} - -func skipPath(s string, start int) int { - if start >= len(s) || s[start] != '/' { - return start // skip empty path - } - var stack []rune - var notClosedIndex int - var nHyphen int - end := start + 1 -loop: - for end < len(s) { - r, rlen := utf8.DecodeRuneInString(s[end:]) - if r == utf8.RuneError { - nHyphen = 0 - break - } - - switch { - case isUnreserved(r): - if r == '-' { - nHyphen++ - if nHyphen > 2 { - break loop - } - } else { - nHyphen = 0 - } - case isSubDelimiter(r) || r == '[' || r == ']': - nHyphen = 0 - switch r { - case '[', '(': - if len(stack) == 0 { - notClosedIndex = end - } - stack = append(stack, r) - case ']', ')': - opening := '[' - if r == ')' { - opening = '(' - } - if len(stack) == 0 || stack[len(stack)-1] != opening { - break loop - } - stack = stack[:len(stack)-1] - } - case r == '/' || r == ':' || r == '@': - nHyphen = 0 - case r == '%': - nHyphen = 0 - if end+2 >= len(s) { - break loop - } - if !(hexDigit(s[end+1]) && - hexDigit(s[end+2])) { - break loop - } - end += 2 - default: - nHyphen = 0 - if r != ' ' || len(stack) == 0 { - break loop - } - } - end += rlen - } - if len(stack) > 0 { - return notClosedIndex - } - if nHyphen > 0 { - return end - nHyphen + 1 - } - return end -} - -func skipQuery(s string, start int) int { - if start >= len(s) || s[start] != '?' { - return start - } - var stack []rune - var notClosedIndex int - var nHyphen int - end := start + 1 -loop: - for end < len(s) { - r, rlen := utf8.DecodeRuneInString(s[end:]) - if r == utf8.RuneError { - nHyphen = 0 - break - } - - switch { - case isUnreserved(r): - if r == '-' { - nHyphen++ - if nHyphen > 1 { - break loop - } - } else { - nHyphen = 0 - } - case isSubDelimiter(r) || r == '[' || r == ']': - nHyphen = 0 - switch r { - case '[', '(': - if len(stack) == 0 { - notClosedIndex = end - } - stack = append(stack, r) - case ']', ')': - opening := '[' - if r == ')' { - opening = '(' - } - if len(stack) == 0 || stack[len(stack)-1] != opening { - break loop - } - stack = stack[:len(stack)-1] - } - case r == '?' || r == '/' || r == ':' || r == '@': - nHyphen = 0 - case r == '%': - nHyphen = 0 - if end+2 >= len(s) { - break loop - } - if !(hexDigit(s[end+1]) && - hexDigit(s[end+2])) { - break loop - } - end += 2 - default: - nHyphen = 0 - if r != ' ' || len(stack) == 0 { - break loop - } - } - end += rlen - } - if len(stack) > 0 { - return notClosedIndex - } - if nHyphen > 0 { - return end - nHyphen + 1 - } - return end -} - -func skipFragment(s string, start int) int { - if start >= len(s) || s[start] != '#' { - return start - } - var stack []rune - var notClosedIndex int - var nHyphen int - end := start + 1 -loop: - for end < len(s) { - r, rlen := utf8.DecodeRuneInString(s[end:]) - if r == utf8.RuneError { - nHyphen = 0 - break - } - - switch { - case isUnreserved(r): - if r == '-' { - nHyphen++ - if nHyphen > 1 { - break loop - } - } else { - nHyphen = 0 - } - case isSubDelimiter(r) || r == '[' || r == ']': - nHyphen = 0 - switch r { - case '[', '(': - if len(stack) == 0 { - notClosedIndex = end - } - stack = append(stack, r) - case ']', ')': - opening := '[' - if r == ')' { - opening = '(' - } - if len(stack) == 0 || stack[len(stack)-1] != opening { - break loop - } - stack = stack[:len(stack)-1] - } - case r == '?' || r == '/' || r == ':' || r == '@': - nHyphen = 0 - case r == '%': - nHyphen = 0 - if end+2 >= len(s) { - break loop - } - if !(hexDigit(s[end+1]) && - hexDigit(s[end+2])) { - break loop - } - end += 2 - default: - nHyphen = 0 - if r != ' ' || len(stack) == 0 { - break loop - } - } - end += rlen - } - if len(stack) > 0 { - return notClosedIndex - } - if nHyphen > 0 { - return end - nHyphen + 1 - } - return end -} - -func unskipPunct(s string, start int) int { - end := start - 1 - if end < 0 || end >= len(s) || !basicPunct[s[end]] { - return start - } - return end -} - -func findHostnameStart(s string, start int) (_ int, _ bool) { - end := start - lastDot := true - nHyphen := 0 -loop: - for end > 0 { - r, rlen := utf8.DecodeLastRuneInString(s[:end]) - if r == utf8.RuneError { - return - } - - switch { - case r == '.': - if nHyphen > 0 { - return - } - lastDot = true - case r == '-': - if end == start { - return - } - if lastDot { - return - } - nHyphen++ - if nHyphen == 3 { - return - } - case r == ':' || r == '/' || r == '\\' || r == '_': - return - case isPunctOrSpaceOrControl(r): - break loop - default: - lastDot = false - nHyphen = 0 - } - end -= rlen - } - if lastDot || nHyphen > 0 { - return - } - return end, true -} - -func findHostnameEnd(s string, start int) (_ int, _ int, _ bool) { - end := start - lastDot := false - lastDotPos := -1 - nHyphen := 0 -loop: - for end < len(s) { - r, rlen := utf8.DecodeRuneInString(s[end:]) - if r == utf8.RuneError { - return - } - - switch { - case r == '.': - if nHyphen > 0 { - return - } - if lastDot { - break loop - } - lastDot = true - lastDotPos = end - nHyphen = 0 - case r == '-': - lastDot = false - if end == start { - return - } - if lastDot { - return - } - nHyphen++ - if nHyphen == 3 { - break loop - } - case r == '\\' || r == '_': - return - case isPunctOrSpaceOrControl(r): - break loop - default: - lastDot = false - nHyphen = 0 - } - end += rlen - } - - if nHyphen > 0 { - end -= nHyphen - } else if lastDot { - if s[end-1] == '.' { - end-- - } - lastDotPos = end - 1 - for lastDotPos >= start && s[lastDotPos] != '.' { - lastDotPos-- - } - if lastDotPos < start { - lastDotPos = -1 - } - } - - return end, lastDotPos, true -} diff --git a/vendor/gitlab.com/golang-commonmark/linkify/util.go b/vendor/gitlab.com/golang-commonmark/linkify/util.go deleted file mode 100644 index 9f70a57f..00000000 --- a/vendor/gitlab.com/golang-commonmark/linkify/util.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package linkify - -func digit(b byte) bool { - return b >= '0' && b <= '9' -} - -func hexDigit(b byte) bool { - return digit(b) || b >= 'a' && b <= 'f' || b >= 'A' && b <= 'F' -} - -func byteToLower(b byte) byte { - if b >= 'A' && b <= 'Z' { - return b - 'A' + 'a' - } - return b -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/.gitlab-ci.yml b/vendor/gitlab.com/golang-commonmark/markdown/.gitlab-ci.yml deleted file mode 100644 index 58bdd5c4..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/.gitlab-ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -image: golang:1.11 - -stages: - - build - - test - -before_script: - - go get github.com/russross/blackfriday - - go get gitlab.com/golang-commonmark/html - - go get gitlab.com/golang-commonmark/linkify - - go get gitlab.com/golang-commonmark/mdurl - - go get gitlab.com/golang-commonmark/puny - - go get gitlab.com/opennota/wd - - go get gopkg.in/russross/blackfriday.v2 - -build: - stage: build - script: - - go build ./... - -test: - stage: test - script: - - test -z "$(gofmt -l . | tee /dev/stderr)" - - go test -cover ./... diff --git a/vendor/gitlab.com/golang-commonmark/markdown/AUTHORS b/vendor/gitlab.com/golang-commonmark/markdown/AUTHORS deleted file mode 100644 index 041a96ce..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -opennota@gmail.com diff --git a/vendor/gitlab.com/golang-commonmark/markdown/LICENSE b/vendor/gitlab.com/golang-commonmark/markdown/LICENSE deleted file mode 100644 index 9cdcd201..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2015, The Authors -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/gitlab.com/golang-commonmark/markdown/README.md b/vendor/gitlab.com/golang-commonmark/markdown/README.md deleted file mode 100644 index ac2a1de8..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/README.md +++ /dev/null @@ -1,64 +0,0 @@ -markdown [![GoDoc](http://godoc.org/gitlab.com/golang-commonmark/markdown?status.svg)](http://godoc.org/gitlab.com/golang-commonmark/markdown) [![License](https://img.shields.io/badge/licence-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause) [![Pipeline status](https://gitlab.com/golang-commonmark/markdown/badges/master/pipeline.svg)](https://gitlab.com/golang-commonmark/markdown/commits/master) [![Coverage report](https://gitlab.com/golang-commonmark/markdown/badges/master/coverage.svg)](https://gitlab.com/golang-commonmark/markdown/commits/master) -======== - -Package golang-commonmark/markdown provides a CommonMark-compliant markdown parser and renderer, written in Go. - -## Installation - - go get -u gitlab.com/golang-commonmark/markdown - -You can also go get [mdtool](https://gitlab.com/golang-commonmark/mdtool), an example command-line tool: - - go get -u gitlab.com/golang-commonmark/mdtool - -## Standards support - -Currently supported CommonMark spec: [v0.28](http://spec.commonmark.org/0.28/). - -## Extensions - -Besides the features required by CommonMark, golang-commonmark/markdown supports: - - * Tables (GFM) - * Strikethrough (GFM) - * Autoconverting plain-text URLs to links - * Typographic replacements (smart quotes and other) - -## Usage - -``` go -md := markdown.New(markdown.XHTMLOutput(true)) -fmt.Println(md.RenderToString([]byte("Header\n===\nText"))) -``` - -Check out [the source of mdtool](https://gitlab.com/golang-commonmark/mdtool/blob/master/main.go) for a more complete example. - -The following options are currently supported: - - Name | Type | Description | Default - --------------- | --------- | ----------------------------------------------------------- | --------- - HTML | bool | whether to enable raw HTML | false - Tables | bool | whether to enable GFM tables | true - Linkify | bool | whether to autoconvert plain-text URLs to links | true - Typographer | bool | whether to enable typographic replacements | true - Quotes | string / []string | double + single quote replacement pairs for the typographer | “”‘’ - MaxNesting | int | maximum nesting level | 20 - LangPrefix | string | CSS language prefix for fenced blocks | language- - Breaks | bool | whether to convert newlines inside paragraphs into `
    ` | false - XHTMLOutput | bool | whether to output XHTML instead of HTML | false - -## Benchmarks - -Rendering spec/spec-0.28.txt on a Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz - - BenchmarkRenderSpecNoHTML 100 10254720 ns/op 2998037 B/op 18225 allocs/op - BenchmarkRenderSpec 100 10180241 ns/op 2997307 B/op 18214 allocs/op - BenchmarkRenderSpecBlackFriday 200 7241749 ns/op 2834340 B/op 17101 allocs/op - BenchmarkRenderSpecBlackFriday2 200 7448256 ns/op 2991202 B/op 16705 allocs/op - -## See also - -https://github.com/jgm/CommonMark — the reference CommonMark implementations in C and JavaScript, - also contains the latest spec and an online demo. - -http://talk.commonmark.org — the CommonMark forum, a good place to join together the efforts of the developers. diff --git a/vendor/gitlab.com/golang-commonmark/markdown/align.go b/vendor/gitlab.com/golang-commonmark/markdown/align.go deleted file mode 100644 index bcb63600..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/align.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -type Align byte - -const ( - AlignNone = iota - AlignLeft - AlignCenter - AlignRight -) - -func (a Align) String() string { - switch a { - case AlignLeft: - return "left" - case AlignCenter: - return "center" - case AlignRight: - return "right" - } - return "" -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/autolink.go b/vendor/gitlab.com/golang-commonmark/markdown/autolink.go deleted file mode 100644 index ab51c71b..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/autolink.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import ( - "regexp" - "strings" -) - -var ( - rAutolink = regexp.MustCompile(`^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>`) - rEmail = regexp.MustCompile(`^<([a-zA-Z0-9.!#$%&'*+/=?^_{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>`) -) - -func ruleAutolink(s *StateInline, silent bool) bool { - pos := s.Pos - src := s.Src - - if src[pos] != '<' { - return false - } - - tail := src[pos:] - - if strings.IndexByte(tail, '>') < 0 { - return false - } - - link := rAutolink.FindString(tail) - if link != "" { - link = link[1 : len(link)-1] - href := normalizeLink(link) - if !validateLink(href) { - return false - } - - if !silent { - s.PushOpeningToken(&LinkOpen{Href: href}) - s.PushToken(&Text{Content: normalizeLinkText(link)}) - s.PushClosingToken(&LinkClose{}) - } - - s.Pos += len(link) + 2 - - return true - } - - email := rEmail.FindString(tail) - if email != "" { - email = email[1 : len(email)-1] - href := normalizeLink("mailto:" + email) - if !validateLink(href) { - return false - } - - if !silent { - s.PushOpeningToken(&LinkOpen{Href: href}) - s.PushToken(&Text{Content: normalizeLinkText(email)}) - s.PushClosingToken(&LinkClose{}) - } - - s.Pos += len(email) + 2 - - return true - } - - return false -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/backticks.go b/vendor/gitlab.com/golang-commonmark/markdown/backticks.go deleted file mode 100644 index 07f268dc..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/backticks.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -func ruleBackticks(s *StateInline, silent bool) bool { - pos := s.Pos - src := s.Src - - if src[pos] != '`' { - return false - } - - start := pos - pos++ - max := s.PosMax - - for pos < max && src[pos] == '`' { - pos++ - } - - marker := src[start:pos] - - matchStart := pos - matchEnd := pos - for { - matchStart = strings.IndexByte(src[matchEnd:], '`') - if matchStart == -1 { - break - } - matchStart += matchEnd - - matchEnd = matchStart + 1 - - for matchEnd < max && src[matchEnd] == '`' { - matchEnd++ - } - - if matchEnd-matchStart == len(marker) { - if !silent { - s.PushToken(&CodeInline{ - Content: normalizeInlineCode(src[pos:matchStart]), - }) - } - s.Pos = matchEnd - return true - } - } - - if !silent { - s.Pending.WriteString(marker) - } - - s.Pos += len(marker) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/balance_pairs.go b/vendor/gitlab.com/golang-commonmark/markdown/balance_pairs.go deleted file mode 100644 index d5830634..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/balance_pairs.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleBalancePairs(s *StateInline) { - delimiters := s.Delimiters - max := len(delimiters) - - for i := 0; i < max; i++ { - lastDelim := delimiters[i] - - if !lastDelim.Close { - continue - } - - j := i - lastDelim.Jump - 1 - - for j >= 0 { - currDelim := delimiters[j] - - if currDelim.Open && - currDelim.Marker == lastDelim.Marker && - currDelim.End < 0 && - currDelim.Level == lastDelim.Level { - oddMatch := (currDelim.Close || lastDelim.Open) && - currDelim.Length != -1 && - lastDelim.Length != -1 && - (currDelim.Length+lastDelim.Length)%3 == 0 - if !oddMatch { - delimiters[i].Jump = i - j - delimiters[i].Open = false - delimiters[j].End = i - delimiters[j].Jump = 0 - break - } - } - - j -= currDelim.Jump + 1 - } - } -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/blockquote.go b/vendor/gitlab.com/golang-commonmark/markdown/blockquote.go deleted file mode 100644 index f8ad3626..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/blockquote.go +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "unicode/utf8" - -var blockquoteTerminatedBy []BlockRule - -func ruleBlockQuote(s *StateBlock, startLine, endLine int, silent bool) bool { - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - src := s.Src - - if pos >= max { - return false - } - if src[pos] != '>' { - return false - } - pos++ - - if silent { - return true - } - - initial := s.SCount[startLine] + pos - (s.BMarks[startLine] + s.TShift[startLine]) - offset := initial - - spaceAfterMarker := false - adjustTab := false - if pos < max { - if src[pos] == ' ' { - pos++ - initial++ - offset++ - spaceAfterMarker = true - } else if src[pos] == '\t' { - spaceAfterMarker = true - if (s.BSCount[startLine]+offset)%4 == 3 { - pos++ - initial++ - offset++ - } else { - adjustTab = true - } - } - } - - oldBMarks := []int{s.BMarks[startLine]} - s.BMarks[startLine] = pos - - for pos < max { - r, size := utf8.DecodeRuneInString(src[pos:]) - if runeIsSpace(r) { - if r == '\t' { - d := 0 - if adjustTab { - d = 1 - } - offset += 4 - (offset+s.BSCount[startLine]+d)%4 - } else { - offset++ - } - } else { - break - } - pos += size - } - - oldBSCount := []int{s.BSCount[startLine]} - d := 0 - if spaceAfterMarker { - d = 1 - } - s.BSCount[startLine] = s.SCount[startLine] + 1 + d - - lastLineEmpty := pos >= max - - oldSCount := []int{s.SCount[startLine]} - s.SCount[startLine] = offset - initial - - oldTShift := []int{s.TShift[startLine]} - s.TShift[startLine] = pos - s.BMarks[startLine] - - oldParentType := s.ParentType - s.ParentType = ptBlockQuote - wasOutdented := false - - oldLineMax := s.LineMax - - nextLine := startLine + 1 - for ; nextLine < endLine; nextLine++ { - if s.SCount[nextLine] < s.BlkIndent { - wasOutdented = true - } - pos = s.BMarks[nextLine] + s.TShift[nextLine] - max = s.EMarks[nextLine] - - if pos >= max { - break - } - - pos++ - if src[pos-1] == '>' && !wasOutdented { - initial = s.SCount[nextLine] + pos + (s.BMarks[nextLine] + s.TShift[nextLine]) - offset = initial - - if pos >= len(src) || src[pos] != ' ' && src[pos] != '\t' { - spaceAfterMarker = true - } else if src[pos] == ' ' { - pos++ - initial++ - offset++ - adjustTab = false - spaceAfterMarker = true - } else if src[pos] == '\t' { - spaceAfterMarker = true - - if (s.BSCount[nextLine]+offset)%4 == 3 { - pos++ - initial++ - offset++ - adjustTab = false - } else { - adjustTab = true - } - } - - oldBMarks = append(oldBMarks, s.BMarks[nextLine]) - s.BMarks[nextLine] = pos - - for pos < max { - r, size := utf8.DecodeRuneInString(src[pos:]) - if runeIsSpace(r) { - if r == '\t' { - d := 0 - if adjustTab { - d = 1 - } - offset += 4 - (offset+s.BSCount[startLine]+d)%4 - } else { - offset++ - } - } else { - break - } - pos += size - } - - lastLineEmpty = pos >= max - - oldBSCount = append(oldBSCount, s.BSCount[nextLine]) - d := 0 - if spaceAfterMarker { - d = 1 - } - s.BSCount[nextLine] = s.SCount[nextLine] + 1 + d - - oldSCount = append(oldSCount, s.SCount[nextLine]) - s.SCount[nextLine] = offset - initial - - oldTShift = append(oldTShift, s.TShift[nextLine]) - s.TShift[nextLine] = pos - s.BMarks[nextLine] - - continue - } - - if lastLineEmpty { - break - } - - terminate := false - for _, r := range blockquoteTerminatedBy { - if r(s, nextLine, endLine, true) { - terminate = true - break - } - } - - if terminate { - s.LineMax = nextLine - - if s.BlkIndent != 0 { - oldBMarks = append(oldBMarks, s.BMarks[nextLine]) - oldBSCount = append(oldBSCount, s.BSCount[nextLine]) - oldTShift = append(oldTShift, s.TShift[nextLine]) - oldSCount = append(oldSCount, s.SCount[nextLine]) - s.SCount[nextLine] -= s.BlkIndent - } - - break - } - - oldBMarks = append(oldBMarks, s.BMarks[nextLine]) - oldBSCount = append(oldBSCount, s.BSCount[nextLine]) - oldTShift = append(oldTShift, s.TShift[nextLine]) - oldSCount = append(oldSCount, s.SCount[nextLine]) - - s.SCount[nextLine] = -1 - } - - oldIndent := s.BlkIndent - s.BlkIndent = 0 - - tok := &BlockquoteOpen{ - Map: [2]int{startLine, 0}, - } - s.PushOpeningToken(tok) - - s.Md.Block.Tokenize(s, startLine, nextLine) - - s.PushClosingToken(&BlockquoteClose{}) - - s.LineMax = oldLineMax - s.ParentType = oldParentType - tok.Map[1] = s.Line - - for i := 0; i < len(oldTShift); i++ { - s.BMarks[startLine+i] = oldBMarks[i] - s.TShift[startLine+i] = oldTShift[i] - s.SCount[startLine+i] = oldSCount[i] - s.BSCount[startLine+i] = oldBSCount[i] - } - s.BlkIndent = oldIndent - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/code.go b/vendor/gitlab.com/golang-commonmark/markdown/code.go deleted file mode 100644 index c6dc574e..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/code.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleCode(s *StateBlock, startLine, endLine int, _ bool) bool { - if s.SCount[startLine]-s.BlkIndent < 4 { - return false - } - - nextLine := startLine + 1 - last := nextLine - - for nextLine < endLine { - if s.IsLineEmpty(nextLine) { - nextLine++ - continue - } - - if s.SCount[nextLine]-s.BlkIndent >= 4 { - nextLine++ - last = nextLine - continue - } - - break - } - - s.Line = last - s.PushToken(&CodeBlock{ - Content: s.Lines(startLine, last, 4+s.BlkIndent, true), - Map: [2]int{startLine, s.Line}, - }) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/emphasis.go b/vendor/gitlab.com/golang-commonmark/markdown/emphasis.go deleted file mode 100644 index ea9cda21..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/emphasis.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -type Delimiter struct { - Length int - Jump int - Token int - Level int - End int - Open bool - Close bool - Marker byte -} - -func ruleEmphasis(s *StateInline, silent bool) bool { - src := s.Src - start := s.Pos - marker := src[start] - - if silent { - return false - } - - if marker != '_' && marker != '*' { - return false - } - - canOpen, canClose, length := s.scanDelims(s.Pos, marker == '*') - for i := 0; i < length; i++ { - s.PushToken(&Text{Content: string(marker)}) - - s.Delimiters = append(s.Delimiters, Delimiter{ - Marker: marker, - Length: length, - Jump: i, - Token: len(s.Tokens) - 1, - Level: s.Level, - End: -1, - Open: canOpen, - Close: canClose, - }) - } - - s.Pos += length - - return true -} - -func ruleEmphasisPostprocess(s *StateInline) { - delimiters := s.Delimiters - max := len(delimiters) - for i := max - 1; i >= 0; i-- { - startDelim := delimiters[i] - if startDelim.Marker != '_' && startDelim.Marker != '*' { - continue - } - - if startDelim.End == -1 { - continue - } - - endDelim := delimiters[startDelim.End] - - isStrong := i > 0 && - delimiters[i-1].End == startDelim.End+1 && - delimiters[i-1].Token == startDelim.Token-1 && - delimiters[startDelim.End+1].Token == endDelim.Token+1 && - delimiters[i-1].Marker == startDelim.Marker - - if isStrong { - s.Tokens[startDelim.Token] = &StrongOpen{} - s.Tokens[endDelim.Token] = &StrongClose{} - - if text, ok := s.Tokens[delimiters[i-1].Token].(*Text); ok { - text.Content = "" - } - if text, ok := s.Tokens[delimiters[startDelim.End+1].Token].(*Text); ok { - text.Content = "" - } - i-- - } else { - s.Tokens[startDelim.Token] = &EmphasisOpen{} - s.Tokens[endDelim.Token] = &EmphasisClose{} - } - } -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/entity.go b/vendor/gitlab.com/golang-commonmark/markdown/entity.go deleted file mode 100644 index fd5fba9c..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/entity.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "gitlab.com/golang-commonmark/html" - -func ruleEntity(s *StateInline, silent bool) bool { - pos := s.Pos - src := s.Src - - if src[pos] != '&' { - return false - } - - max := s.PosMax - - if pos+1 < max { - if e, n := html.ParseEntity(src[pos:]); n > 0 { - if !silent { - s.Pending.WriteString(e) - } - s.Pos += n - return true - } - } - - if !silent { - s.Pending.WriteByte('&') - } - s.Pos++ - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/escape.go b/vendor/gitlab.com/golang-commonmark/markdown/escape.go deleted file mode 100644 index 634b9735..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/escape.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -func escaped(b byte) bool { - return strings.IndexByte("\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-", b) != -1 -} - -func ruleEscape(s *StateInline, silent bool) bool { - pos := s.Pos - src := s.Src - - if src[pos] != '\\' { - return false - } - - pos++ - max := s.PosMax - - if pos < max { - b := src[pos] - - if b < 0x7f && escaped(b) { - if !silent { - s.Pending.WriteByte(b) - } - s.Pos += 2 - return true - } - - if b == '\n' { - if !silent { - s.PushToken(&Hardbreak{}) - } - - pos++ - - for pos < max { - b := src[pos] - if !byteIsSpace(b) { - break - } - pos++ - } - - s.Pos = pos - return true - } - } - - if !silent { - s.Pending.WriteByte('\\') - } - s.Pos++ - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/fence.go b/vendor/gitlab.com/golang-commonmark/markdown/fence.go deleted file mode 100644 index 04924dc4..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/fence.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -func ruleFence(s *StateBlock, startLine, endLine int, silent bool) bool { - haveEndMarker := false - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - if pos+3 > max { - return false - } - - src := s.Src - - marker := src[pos] - if marker != '~' && marker != '`' { - return false - } - - mem := pos - pos = s.SkipBytes(pos, marker) - - len := pos - mem - - if len < 3 { - return false - } - - params := strings.TrimSpace(src[pos:max]) - - if strings.IndexByte(params, marker) >= 0 { - return false - } - - if silent { - return true - } - - nextLine := startLine - - for { - nextLine++ - if nextLine >= endLine { - break - } - - mem = s.BMarks[nextLine] + s.TShift[nextLine] - pos = mem - max = s.EMarks[nextLine] - - if pos < max && s.SCount[nextLine] < s.BlkIndent { - break - } - - if pos >= max || src[pos] != marker { - continue - } - - if s.SCount[nextLine]-s.BlkIndent >= 4 { - continue - } - - pos = s.SkipBytes(pos, marker) - - if pos-mem < len { - continue - } - - pos = s.SkipSpaces(pos) - - if pos < max { - continue - } - - haveEndMarker = true - - break - } - - len = s.SCount[startLine] - - s.Line = nextLine - if haveEndMarker { - s.Line++ - } - - s.PushToken(&Fence{ - Params: params, - Content: s.Lines(startLine+1, nextLine, len, true), - Map: [2]int{startLine, s.Line}, - }) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/fuzz.go b/vendor/gitlab.com/golang-commonmark/markdown/fuzz.go deleted file mode 100644 index 66ac7697..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/fuzz.go +++ /dev/null @@ -1,9 +0,0 @@ -//+build gofuzz - -package markdown - -func Fuzz(data []byte) int { - md := New(HTML(true)) - md.Parse(data) - return 1 -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/heading.go b/vendor/gitlab.com/golang-commonmark/markdown/heading.go deleted file mode 100644 index a09c4f72..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/heading.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -func ruleHeading(s *StateBlock, startLine, _ int, silent bool) bool { - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - src := s.Src - - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - - if pos >= max || src[pos] != '#' { - return false - } - - level := 1 - pos++ - for pos < max && src[pos] == '#' && level <= 6 { - level++ - pos++ - } - - if level > 6 || (pos < max && !byteIsSpace(src[pos])) { - return false - } - - if silent { - return true - } - - max = s.SkipSpacesBack(max, pos) - tmp := s.SkipBytesBack(max, '#', pos) - if tmp > pos && byteIsSpace(src[tmp-1]) { - max = tmp - } - - s.Line = startLine + 1 - - s.PushOpeningToken(&HeadingOpen{ - HLevel: level, - Map: [2]int{startLine, s.Line}, - }) - - if pos < max { - s.PushToken(&Inline{ - Content: strings.TrimSpace(src[pos:max]), - Map: [2]int{startLine, s.Line}, - }) - } - s.PushClosingToken(&HeadingClose{HLevel: level}) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/helpers.go b/vendor/gitlab.com/golang-commonmark/markdown/helpers.go deleted file mode 100644 index d158dfcf..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/helpers.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func parseLinkLabel(s *StateInline, start int, disableNested bool) int { - src := s.Src - labelEnd := -1 - max := s.PosMax - oldPos := s.Pos - - s.Pos = start + 1 - level := 1 - found := false - - for s.Pos < max { - marker := src[s.Pos] - - if marker == ']' { - level-- - if level == 0 { - found = true - break - } - } - - prevPos := s.Pos - - s.Md.Inline.SkipToken(s) - - if marker == '[' { - if prevPos == s.Pos-1 { - level++ - } else if disableNested { - s.Pos = oldPos - return -1 - } - } - } - - if found { - labelEnd = s.Pos - } - - s.Pos = oldPos - - return labelEnd -} - -func parseLinkDestination(s string, pos, max int) (url string, lines, endpos int, ok bool) { - start := pos - if pos < max && s[pos] == '<' { - pos++ - for pos < max { - b := s[pos] - if b == '\n' || byteIsSpace(b) { - return - } - if b == '>' { - endpos = pos + 1 - url = unescapeAll(s[start+1 : pos]) - ok = true - return - } - if b == '\\' && pos+1 < max { - pos += 2 - continue - } - - pos++ - } - - return - } - - level := 0 - for pos < max { - b := s[pos] - - if b == ' ' { - break - } - - if b < 0x20 || b == 0x7f { - break - } - - if b == '\\' && pos+1 < max { - pos += 2 - continue - } - - if b == '(' { - level++ - } - - if b == ')' { - if level == 0 { - break - } - level-- - } - - pos++ - } - - if start == pos { - return - } - if level != 0 { - return - } - - url = unescapeAll(s[start:pos]) - endpos = pos - ok = true - - return -} - -func parseLinkTitle(s string, pos, max int) (title string, nlines, endpos int, ok bool) { - lines := 0 - start := pos - - if pos >= max { - return - } - - marker := s[pos] - - if marker != '"' && marker != '\'' && marker != '(' { - return - } - - pos++ - - if marker == '(' { - marker = ')' - } - - for pos < max { - switch s[pos] { - case marker: - endpos = pos + 1 - nlines = lines - title = unescapeAll(s[start+1 : pos]) - ok = true - return - case '\n': - lines++ - case '\\': - if pos+1 < max { - pos++ - if s[pos] == '\n' { - lines++ - } - } - } - pos++ - } - - return -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/hr.go b/vendor/gitlab.com/golang-commonmark/markdown/hr.go deleted file mode 100644 index fe25681d..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/hr.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleHR(s *StateBlock, startLine, endLine int, silent bool) bool { - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - - if pos >= max { - return false - } - - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - - src := s.Src - marker := src[pos] - pos++ - - if marker != '*' && marker != '-' && marker != '_' { - return false - } - - cnt := 1 - for pos < max { - ch := src[pos] - pos++ - if ch != marker && !byteIsSpace(ch) { - return false - } - if ch == marker { - cnt++ - } - } - - if cnt < 3 { - return false - } - - if silent { - return true - } - - s.Line = startLine + 1 - - s.PushToken(&Hr{ - Map: [2]int{startLine, s.Line}, - }) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/html_block.go b/vendor/gitlab.com/golang-commonmark/markdown/html_block.go deleted file mode 100644 index 98a89499..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/html_block.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import ( - "regexp" - "strings" -) - -var ( - htmlBlocks = []string{ - "address", - "article", - "aside", - "base", - "basefont", - "blockquote", - "body", - "caption", - "center", - "col", - "colgroup", - "dd", - "details", - "dialog", - "dir", - "div", - "dl", - "dt", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "frame", - "frameset", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hr", - "html", - "iframe", - "legend", - "li", - "link", - "main", - "menu", - "menuitem", - "meta", - "nav", - "noframes", - "ol", - "optgroup", - "option", - "p", - "param", - "section", - "source", - "summary", - "table", - "tbody", - "td", - "tfoot", - "th", - "thead", - "title", - "tr", - "track", - "ul", - } - - htmlBlocksSet = make(map[string]bool) - - rStartCond1 = regexp.MustCompile(`(?i)^(pre|script|style)([\n\t >]|$)`) - rEndCond1 = regexp.MustCompile(`(?i)`) - rStartCond6 = regexp.MustCompile(`(?i)^/?(` + strings.Join(htmlBlocks, "|") + `)(\s|$|>|/>)`) - rStartCond7 = regexp.MustCompile(`(?i)^(/[a-z][a-z0-9-]*|[a-z][a-z0-9-]*(\s+[a-z_:][a-z0-9_.:-]*\s*=\s*("[^"]*"|'[^']*'|[ "'=<>\x60]))*\s*/?)>\s*$`) -) - -func init() { - for _, tag := range htmlBlocks { - htmlBlocksSet[tag] = true - } -} - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func matchTagName(s string) string { - if len(s) < 2 { - return "" - } - - i := 0 - if s[0] == '/' { - i++ - } - start := i - max := min(15+i, len(s)) - for i < max && isLetter(s[i]) { - i++ - } - if i >= len(s) { - return "" - } - - switch s[i] { - case ' ', '\n', '/', '>': - return strings.ToLower(s[start:i]) - default: - return "" - } -} - -func ruleHTMLBlock(s *StateBlock, startLine, endLine int, silent bool) bool { - if !s.Md.HTML { - return false - } - - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - - if pos+1 >= max { - return false - } - - src := s.Src - - if src[pos] != '<' { - return false - } - - pos++ - b := src[pos] - if !htmlSecond(b) { - return false - } - - nextLine := startLine + 1 - - var endCond func(string) bool - - if pos+2 < max && isLetter(b) && rStartCond1.MatchString(src[pos:]) { - endCond = func(s string) bool { - return rEndCond1.MatchString(s) - } - } else if strings.HasPrefix(src[pos:], "!--") { - endCond = func(s string) bool { - return strings.Contains(s, "-->") - } - } else if b == '?' { - endCond = func(s string) bool { - return strings.Contains(s, "?>") - } - } else if b == '!' && pos+1 < max && isUppercaseLetter(src[pos+1]) { - endCond = func(s string) bool { - return strings.Contains(s, ">") - } - } else if strings.HasPrefix(src[pos:], "![CDATA[") { - endCond = func(s string) bool { - return strings.Contains(s, "]]>") - } - } else if pos+2 < max && (isLetter(b) || b == '/' && isLetter(src[pos+1])) { - terminator := true - if rStartCond6.MatchString(src[pos:max]) { - } else if rStartCond7.MatchString(src[pos:max]) { - terminator = false - } else { - return false - } - if silent { - return terminator - } - endCond = func(s string) bool { - return s == "" - } - } else { - return false - } - - if silent { - return true - } - - if !endCond(src[pos:max]) { - for nextLine < endLine { - if s.SCount[nextLine] < s.BlkIndent { - break - } - - pos := s.BMarks[nextLine] + s.TShift[nextLine] - max := s.EMarks[nextLine] - lineText := src[pos:max] - if endCond(lineText) { - if pos != max { - nextLine++ - } - break - } - nextLine++ - } - } - - s.Line = nextLine - s.PushToken(&HTMLBlock{ - Content: s.Lines(startLine, nextLine, s.BlkIndent, true), - Map: [2]int{startLine, nextLine}, - }) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/html_inline.go b/vendor/gitlab.com/golang-commonmark/markdown/html_inline.go deleted file mode 100644 index 0de54b20..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/html_inline.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "regexp" - -var ( - attrName = `[a-zA-Z_:][a-zA-Z0-9:._-]*` - unquoted = "[^\"'=<>`\\x00-\\x20]+" - singleQuoted = `'[^']*'` - doubleQuoted = `"[^"]*"` - attrValue = `(?:` + unquoted + `|` + singleQuoted + `|` + doubleQuoted + `)` - attribute = `(?:\s+` + attrName + `(?:\s*=\s*` + attrValue + `)?)` - openTag = `<[A-Za-z][A-Za-z0-9-]*` + attribute + `*\s*/?>` - closeTag = `` - comment = `|` - processing = `<[?].*?[?]>` - declaration = `]*>` - cdata = `` - rHTMLTag = regexp.MustCompile(`^(?:` + openTag + `|` + closeTag + `|` + comment + - `|` + processing + `|` + declaration + `|` + cdata + `)`) -) - -func htmlSecond(b byte) bool { - return b == '!' || b == '/' || b == '?' || isLetter(b) -} - -func ruleHTMLInline(s *StateInline, silent bool) bool { - if !s.Md.HTML { - return false - } - - pos := s.Pos - src := s.Src - if pos+2 >= s.PosMax || src[pos] != '<' { - return false - } - - if !htmlSecond(src[pos+1]) { - return false - } - - match := rHTMLTag.FindString(src[pos:]) - if match == "" { - return false - } - - if !silent { - s.PushToken(&HTMLInline{Content: match}) - } - - s.Pos += len(match) - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/image.go b/vendor/gitlab.com/golang-commonmark/markdown/image.go deleted file mode 100644 index 7f2e67d3..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/image.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleImage(s *StateInline, silent bool) bool { - pos := s.Pos - max := s.PosMax - - if pos+2 >= max { - return false - } - - src := s.Src - if src[pos] != '!' || src[pos+1] != '[' { - return false - } - - labelStart := pos + 2 - labelEnd := parseLinkLabel(s, pos+1, false) - if labelEnd < 0 { - return false - } - - var href, title, label string - oldPos := pos - pos = labelEnd + 1 - if pos < max && src[pos] == '(' { - pos++ - for pos < max { - b := src[pos] - if !byteIsSpace(b) && b != '\n' { - break - } - pos++ - } - if pos >= max { - return false - } - - start := pos - url, _, endpos, ok := parseLinkDestination(src, pos, s.PosMax) - if ok { - url = normalizeLink(url) - if validateLink(url) { - href = url - pos = endpos - } - } - - start = pos - for pos < max { - b := src[pos] - if !byteIsSpace(b) && b != '\n' { - break - } - pos++ - } - if pos >= max { - return false - } - - title, _, endpos, ok = parseLinkTitle(src, pos, s.PosMax) - if pos < max && start != pos && ok { - pos = endpos - for pos < max { - b := src[pos] - if !byteIsSpace(b) && b != '\n' { - break - } - pos++ - } - } - - if pos >= max || src[pos] != ')' { - s.Pos = oldPos - return false - } - - pos++ - - } else { - if s.Env.References == nil { - return false - } - - if pos < max && src[pos] == '[' { - start := pos + 1 - pos = parseLinkLabel(s, pos, false) - if pos >= 0 { - label = src[start:pos] - pos++ - } else { - pos = labelEnd + 1 - } - } else { - pos = labelEnd + 1 - } - - if label == "" { - label = src[labelStart:labelEnd] - } - - ref, ok := s.Env.References[normalizeReference(label)] - if !ok { - s.Pos = oldPos - return false - } - - href = ref["href"] - title = ref["title"] - } - - if !silent { - content := src[labelStart:labelEnd] - - tokens := s.Md.Inline.Parse(content, s.Md, s.Env) - - s.PushToken(&Image{ - Src: href, - Title: title, - Tokens: tokens, - }) - } - - s.Pos = pos - s.PosMax = max - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/inline.go b/vendor/gitlab.com/golang-commonmark/markdown/inline.go deleted file mode 100644 index 0bed18ac..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/inline.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleInline(s *StateCore) { - for _, tok := range s.Tokens { - if tok, ok := tok.(*Inline); ok { - tok.Children = s.Md.Inline.Parse(tok.Content, s.Md, s.Env) - } - } -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/lheading.go b/vendor/gitlab.com/golang-commonmark/markdown/lheading.go deleted file mode 100644 index b404066d..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/lheading.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -func ruleLHeading(s *StateBlock, startLine, endLine int, silent bool) bool { - nextLine := startLine + 1 - - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - - oldParentType := s.ParentType - s.ParentType = ptParagraph - src := s.Src - - var pos int - var hLevel int -outer: - for ; nextLine < endLine && !s.IsLineEmpty(nextLine); nextLine++ { - if s.SCount[nextLine]-s.BlkIndent > 3 { - continue - } - - if s.SCount[nextLine] >= s.BlkIndent { - pos = s.BMarks[nextLine] + s.TShift[nextLine] - max := s.EMarks[nextLine] - - if pos < max { - marker := src[pos] - - if marker == '-' || marker == '=' { - pos = s.SkipBytes(pos, marker) - pos = s.SkipSpaces(pos) - - if pos >= max { - hLevel = 1 - if marker == '-' { - hLevel++ - } - break - } - } - } - } - - if s.SCount[nextLine] < 0 { - continue - } - - for _, r := range paragraphTerminatedBy { - if r(s, nextLine, endLine, true) { - break outer - } - } - } - - if hLevel == 0 { - return false - } - - s.Line = nextLine + 1 - - s.PushOpeningToken(&HeadingOpen{ - HLevel: hLevel, - Map: [2]int{startLine, s.Line}, - }) - s.PushToken(&Inline{ - Content: strings.TrimSpace(s.Lines(startLine, nextLine, s.BlkIndent, false)), - Map: [2]int{startLine, s.Line - 1}, - }) - s.PushClosingToken(&HeadingClose{HLevel: hLevel}) - - s.ParentType = oldParentType - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/link.go b/vendor/gitlab.com/golang-commonmark/markdown/link.go deleted file mode 100644 index 8ab2c04b..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/link.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleLink(s *StateInline, silent bool) bool { - pos := s.Pos - oldPos := s.Pos - max := s.PosMax - start := s.Pos - parseReference := true - src := s.Src - - if src[pos] != '[' { - return false - } - - labelStart := pos + 1 - labelEnd := parseLinkLabel(s, pos, true) - - if labelEnd < 0 { - return false - } - - pos = labelEnd + 1 - - var title, href, label string - if pos < max && src[pos] == '(' { - parseReference = false - - pos++ - for pos < max { - code := src[pos] - if !byteIsSpace(code) && code != '\n' { - break - } - pos++ - } - if pos >= max { - return false - } - - start = pos - url, _, endpos, ok := parseLinkDestination(src, pos, s.PosMax) - if ok { - url = normalizeLink(url) - if validateLink(url) { - pos = endpos - href = url - } - } - - start = pos - for pos < max { - code := src[pos] - if !byteIsSpace(code) && code != '\n' { - break - } - pos++ - } - - title, _, endpos, ok = parseLinkTitle(src, pos, s.PosMax) - if pos < max && start != pos && ok { - pos = endpos - for pos < max { - code := src[pos] - if !byteIsSpace(code) && code != '\n' { - break - } - pos++ - } - } - - if pos >= max || src[pos] != ')' { - parseReference = true - } - - pos++ - } - - if parseReference { - if s.Env.References == nil { - return false - } - - if pos < max && src[pos] == '[' { - start := pos + 1 - pos = parseLinkLabel(s, pos, false) - if pos >= 0 { - label = src[start:pos] - pos++ - } else { - pos = labelEnd + 1 - } - } else { - pos = labelEnd + 1 - } - - if label == "" { - label = src[labelStart:labelEnd] - } - - ref, ok := s.Env.References[normalizeReference(label)] - if !ok { - s.Pos = oldPos - return false - } - - href = ref["href"] - title = ref["title"] - } - - if !silent { - s.Pos = labelStart - s.PosMax = labelEnd - - s.PushOpeningToken(&LinkOpen{ - Href: href, - Title: title, - }) - - s.Md.Inline.Tokenize(s) - - s.PushClosingToken(&LinkClose{}) - } - - s.Pos = pos - s.PosMax = max - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/linkify.go b/vendor/gitlab.com/golang-commonmark/markdown/linkify.go deleted file mode 100644 index 5935af1b..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/linkify.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import ( - "strings" - - "gitlab.com/golang-commonmark/linkify" -) - -func isLinkOpen(s string) bool { return isLetter(s[1]) } - -func isLinkClose(s string) bool { return s[1] == '/' } - -func ruleLinkify(s *StateCore) { - blockTokens := s.Tokens - - if !s.Md.Linkify { - return - } - - for _, tok := range blockTokens { - if tok, ok := tok.(*Inline); ok { - tokens := tok.Children - - htmlLinkLevel := 0 - - for i := len(tokens) - 1; i >= 0; i-- { - currentTok := tokens[i] - - if _, ok := currentTok.(*LinkClose); ok { - i-- - for tokens[i].Level() != currentTok.Level() { - if _, ok := tokens[i].(*LinkOpen); ok { - break - } - i-- - } - continue - } - - if currentTok, ok := currentTok.(*HTMLInline); ok { - if isLinkOpen(currentTok.Content) && htmlLinkLevel > 0 { - htmlLinkLevel-- - } - if isLinkClose(currentTok.Content) { - htmlLinkLevel++ - } - } - if htmlLinkLevel > 0 { - continue - } - - if currentTok, ok := currentTok.(*Text); ok { - text := currentTok.Content - links := linkify.Links(text) - if len(links) == 0 { - continue - } - - var nodes []Token - level := currentTok.Lvl - lastPos := 0 - - for _, ln := range links { - urlText := text[ln.Start:ln.End] - url := urlText - if ln.Scheme == "" { - url = "http://" + url - } else if ln.Scheme == "mailto:" && !strings.HasPrefix(url, "mailto:") { - url = "mailto:" + url - } - url = normalizeLink(url) - if !validateLink(url) { - continue - } - - if ln.Scheme == "" { - urlText = strings.TrimPrefix(normalizeLinkText("http://"+urlText), "http://") - } else if ln.Scheme == "mailto:" && !strings.HasPrefix(urlText, "mailto:") { - urlText = strings.TrimPrefix(normalizeLinkText("mailto:"+urlText), "mailto:") - } else { - urlText = normalizeLinkText(urlText) - } - - pos := ln.Start - - if pos > lastPos { - tok := Text{ - Content: text[lastPos:pos], - Lvl: level, - } - nodes = append(nodes, &tok) - } - - nodes = append(nodes, &LinkOpen{ - Href: url, - Lvl: level, - }) - nodes = append(nodes, &Text{ - Content: urlText, - Lvl: level + 1, - }) - nodes = append(nodes, &LinkClose{ - Lvl: level, - }) - - lastPos = ln.End - } - - if lastPos < len(text) { - tok := Text{ - Content: text[lastPos:], - Lvl: level, - } - nodes = append(nodes, &tok) - } - - children := make([]Token, len(tokens)+len(nodes)-1) - copy(children, tokens[:i]) - copy(children[i:], nodes) - copy(children[i+len(nodes):], tokens[i+1:]) - tok.Children = children - tokens = children - } - } - } - } -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/list.go b/vendor/gitlab.com/golang-commonmark/markdown/list.go deleted file mode 100644 index 3b2e0230..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/list.go +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strconv" - -var listTerminatedBy []BlockRule - -func skipBulletListMarker(s *StateBlock, startLine int) int { - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - src := s.Src - - if pos >= max { - return -1 - } - - marker := src[pos] - if marker != '*' && marker != '-' && marker != '+' { - return -1 - } - pos++ - - if pos < max && !byteIsSpace(src[pos]) { - return -1 - } - - return pos -} - -func skipOrderedListMarker(s *StateBlock, startLine int) int { - start := s.BMarks[startLine] + s.TShift[startLine] - pos := start - max := s.EMarks[startLine] - - if pos+1 >= max { - return -1 - } - - src := s.Src - ch := src[pos] - if ch < '0' || ch > '9' { - return -1 - } - pos++ - - for { - if pos >= max { - return -1 - } - - ch = src[pos] - pos++ - - if ch >= '0' && ch <= '9' { - if pos-start >= 10 { - return -1 - } - continue - } - - if ch == ')' || ch == '.' { - break - } - - return -1 - } - - if pos < max && !byteIsSpace(src[pos]) { - return -1 - } - - return pos -} - -func markParagraphsTight(s *StateBlock, idx int) { - level := s.Level + 2 - tokens := s.Tokens - - for i := idx + 2; i < len(tokens)-2; i++ { - if tokens[i].Level() == level { - if tok, ok := tokens[i].(*ParagraphOpen); ok { - tok.Hidden = true - i += 2 - tokens[i].(*ParagraphClose).Hidden = true - } - } - } -} - -func ruleList(s *StateBlock, startLine, endLine int, silent bool) bool { - isTerminatingParagraph := false - tight := true - - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - src := s.Src - - if silent && s.ParentType == ptParagraph { - if s.TShift[startLine] >= s.BlkIndent { - isTerminatingParagraph = true - } - } - - var start int - var markerValue int - - isOrdered := false - posAfterMarker := skipOrderedListMarker(s, startLine) - if posAfterMarker > 0 { - isOrdered = true - start = s.BMarks[startLine] + s.TShift[startLine] - markerValue, _ = strconv.Atoi(src[start : posAfterMarker-1]) - - if isTerminatingParagraph && markerValue != 1 { - return false - } - } else { - posAfterMarker = skipBulletListMarker(s, startLine) - if posAfterMarker < 0 { - return false - } - } - - if isTerminatingParagraph { - if s.SkipSpaces(posAfterMarker) >= s.EMarks[startLine] { - return false - } - } - - markerChar := src[posAfterMarker-1] - - if silent { - return true - } - - tokenIdx := len(s.Tokens) - - var listMap *[2]int - if isOrdered { - tok := &OrderedListOpen{ - Order: markerValue, - Map: [2]int{startLine, 0}, - } - s.PushOpeningToken(tok) - listMap = &tok.Map - } else { - tok := &BulletListOpen{ - Map: [2]int{startLine, 0}, - } - s.PushOpeningToken(tok) - listMap = &tok.Map - } - - nextLine := startLine - prevEmptyEnd := false - - oldParentType := s.ParentType - s.ParentType = ptList - - var pos int - var contentStart int - -outer: - for nextLine < endLine { - pos = posAfterMarker - max := s.EMarks[nextLine] - - initial := s.SCount[nextLine] + posAfterMarker - (s.BMarks[startLine] + s.TShift[startLine]) - offset := initial - - loop: - for pos < max { - switch src[pos] { - case '\t': - offset += 4 - (offset+s.BSCount[nextLine])%4 - case ' ': - offset++ - default: - break loop - } - pos++ - } - - contentStart = pos - - indentAfterMarker := 1 - if contentStart < max { - if iam := offset - initial; iam <= 4 { - indentAfterMarker = iam - } - } - - indent := initial + indentAfterMarker - - tok := &ListItemOpen{ - Map: [2]int{startLine, 0}, - } - s.PushOpeningToken(tok) - itemMap := &tok.Map - - oldIndent := s.BlkIndent - oldTight := s.Tight - oldTShift := s.TShift[startLine] - oldLIndent := s.SCount[startLine] - s.BlkIndent = indent - s.Tight = true - s.TShift[startLine] = contentStart - s.BMarks[startLine] - s.SCount[startLine] = offset - - if contentStart >= max && s.IsLineEmpty(startLine+1) { - s.Line = min(s.Line+2, endLine) - } else { - s.Md.Block.Tokenize(s, startLine, endLine) - } - - if !s.Tight || prevEmptyEnd { - tight = false - } - - prevEmptyEnd = s.Line-startLine > 1 && s.IsLineEmpty(s.Line-1) - - s.BlkIndent = oldIndent - s.TShift[startLine] = oldTShift - s.SCount[startLine] = oldLIndent - s.Tight = oldTight - - s.PushClosingToken(&ListItemClose{}) - - startLine = s.Line - nextLine = startLine - (*itemMap)[1] = nextLine - - if nextLine >= endLine { - break - } - - contentStart = s.BMarks[startLine] - - if s.SCount[nextLine] < s.BlkIndent { - break - } - - for _, r := range listTerminatedBy { - if r(s, nextLine, endLine, true) { - break outer - } - } - - if isOrdered { - posAfterMarker = skipOrderedListMarker(s, nextLine) - if posAfterMarker < 0 { - break - } - } else { - posAfterMarker = skipBulletListMarker(s, nextLine) - if posAfterMarker < 0 { - break - } - } - - if markerChar != src[posAfterMarker-1] { - break - } - } - - if isOrdered { - s.PushClosingToken(&OrderedListClose{}) - } else { - s.PushClosingToken(&BulletListClose{}) - } - - (*listMap)[1] = nextLine - s.Line = nextLine - s.ParentType = oldParentType - - if tight { - markParagraphsTight(s, tokenIdx) - } - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/markdown.go b/vendor/gitlab.com/golang-commonmark/markdown/markdown.go deleted file mode 100644 index 1e37b3ae..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/markdown.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package markdown provides CommonMark-compliant markdown parser and renderer. -package markdown - -import ( - "bytes" - "io" -) - -type Markdown struct { - options - Block ParserBlock - Inline ParserInline - renderOptions RenderOptions -} - -type RenderOptions struct { - LangPrefix string // CSS language class prefix for fenced blocks - XHTML bool // render as XHTML instead of HTML - Breaks bool // convert \n in paragraphs into
    - Nofollow bool // add rel="nofollow" to the links -} - -type options struct { - HTML bool // allow raw HTML in the markup - Tables bool // GFM tables - Linkify bool // autoconvert URL-like text to links - Typographer bool // enable some typographic replacements - Quotes [4]string // double/single quotes replacement pairs - MaxNesting int // maximum nesting level -} - -type Environment struct { - References map[string]map[string]string -} - -type CoreRule func(*StateCore) - -var coreRules []CoreRule - -func New(opts ...option) *Markdown { - m := &Markdown{ - options: options{ - Tables: true, - Linkify: true, - Typographer: true, - Quotes: [4]string{"“", "”", "‘", "’"}, - MaxNesting: 20, - }, - renderOptions: RenderOptions{LangPrefix: "language-"}, - } - for _, opt := range opts { - opt(m) - } - return m -} - -func (m *Markdown) Parse(src []byte) []Token { - if len(src) == 0 { - return nil - } - - s := &StateCore{ - Md: m, - Env: &Environment{}, - } - s.Tokens = m.Block.Parse(src, m, s.Env) - - for _, r := range coreRules { - r(s) - } - return s.Tokens -} - -func (m *Markdown) Render(w io.Writer, src []byte) error { - if len(src) == 0 { - return nil - } - - return NewRenderer(w).Render(m.Parse(src), m.renderOptions) -} - -func (m *Markdown) RenderTokens(w io.Writer, tokens []Token) error { - if len(tokens) == 0 { - return nil - } - - return NewRenderer(w).Render(tokens, m.renderOptions) -} - -func (m *Markdown) RenderToString(src []byte) string { - if len(src) == 0 { - return "" - } - - var buf bytes.Buffer - NewRenderer(&buf).Render(m.Parse(src), m.renderOptions) - return buf.String() -} - -func (m *Markdown) RenderTokensToString(tokens []Token) string { - if len(tokens) == 0 { - return "" - } - - var buf bytes.Buffer - NewRenderer(&buf).Render(tokens, m.renderOptions) - return buf.String() -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/newline.go b/vendor/gitlab.com/golang-commonmark/markdown/newline.go deleted file mode 100644 index c69fa3d9..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/newline.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -func ruleNewline(s *StateInline, silent bool) bool { - pos := s.Pos - src := s.Src - - if src[pos] != '\n' { - return false - } - - pending := s.Pending.Bytes() - pmax := len(pending) - 1 - max := s.PosMax - - if !silent { - if pmax >= 0 && pending[pmax] == ' ' { - if pmax >= 1 && pending[pmax-1] == ' ' { - pmax -= 2 - for pmax >= 0 && pending[pmax] == ' ' { - pmax-- - } - s.Pending.Truncate(pmax + 1) - s.PushToken(&Hardbreak{}) - } else { - s.Pending.Truncate(pmax) - s.PushToken(&Softbreak{}) - } - } else { - s.PushToken(&Softbreak{}) - } - } - - pos++ - - for pos < max && byteIsSpace(src[pos]) { - pos++ - } - - s.Pos = pos - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/options.go b/vendor/gitlab.com/golang-commonmark/markdown/options.go deleted file mode 100644 index 7e5b2cf3..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/options.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -type option func(m *Markdown) - -func HTML(b bool) option { - return func(m *Markdown) { - m.HTML = b - } -} - -func Linkify(b bool) option { - return func(m *Markdown) { - m.Linkify = b - } -} - -func Typographer(b bool) option { - return func(m *Markdown) { - m.Typographer = b - } -} - -func Quotes(stringOrArray interface{}) option { - if s, ok := stringOrArray.(string); ok { - return func(m *Markdown) { - for i, r := range []rune(s) { - m.Quotes[i] = string(r) - } - } - } - a := stringOrArray.([]string) - return func(m *Markdown) { - for i, s := range a { - m.Quotes[i] = s - } - } -} - -func MaxNesting(n int) option { - return func(m *Markdown) { - m.MaxNesting = n - } -} - -func XHTMLOutput(b bool) option { - return func(m *Markdown) { - m.renderOptions.XHTML = b - } -} - -func Breaks(b bool) option { - return func(m *Markdown) { - m.renderOptions.Breaks = b - } -} - -func LangPrefix(p string) option { - return func(m *Markdown) { - m.renderOptions.LangPrefix = p - } -} - -func Nofollow(b bool) option { - return func(m *Markdown) { - m.renderOptions.Nofollow = b - } -} - -func Tables(b bool) option { - return func(m *Markdown) { - m.Tables = b - } -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/paragraph.go b/vendor/gitlab.com/golang-commonmark/markdown/paragraph.go deleted file mode 100644 index a3003ef6..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/paragraph.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -var paragraphTerminatedBy []BlockRule - -func ruleParagraph(s *StateBlock, startLine, _ int, _ bool) bool { - nextLine := startLine + 1 - endLine := s.LineMax - - oldParentType := s.ParentType - s.ParentType = ptParagraph - -outer: - for ; nextLine < endLine && !s.IsLineEmpty(nextLine); nextLine++ { - if s.SCount[nextLine]-s.BlkIndent > 3 { - continue - } - - if s.SCount[nextLine] < 0 { - continue - } - - for _, r := range paragraphTerminatedBy { - if r(s, nextLine, endLine, true) { - break outer - } - } - } - - content := strings.TrimSpace(s.Lines(startLine, nextLine, s.BlkIndent, false)) - - s.Line = nextLine - - s.PushOpeningToken(&ParagraphOpen{ - Map: [2]int{startLine, s.Line}, - }) - s.PushToken(&Inline{ - Content: content, - Map: [2]int{startLine, s.Line}, - }) - s.PushClosingToken(&ParagraphClose{}) - - s.ParentType = oldParentType - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/parser_block.go b/vendor/gitlab.com/golang-commonmark/markdown/parser_block.go deleted file mode 100644 index 8a6ee1ad..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/parser_block.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import ( - "bytes" - "unicode/utf8" -) - -type ParserBlock struct{} - -type BlockRule func(*StateBlock, int, int, bool) bool - -var blockRules []BlockRule - -var nl = []byte{'\n'} - -func normalizeNewlines(src []byte) ([]byte, int) { - if bytes.IndexByte(src, '\r') == -1 { - return src, bytes.Count(src, nl) - } - n := 0 - buf := make([]byte, 0, len(src)) - for i := 0; i < len(src); i++ { - switch ch := src[i]; ch { - case '\n': - n++ - buf = append(buf, '\n') - case '\r': - buf = append(buf, '\n') - n++ - if i < len(src)-1 && src[i+1] == '\n' { - i++ - } - default: - buf = append(buf, ch) - } - } - return buf, n -} - -func (b ParserBlock) Parse(src []byte, md *Markdown, env *Environment) []Token { - src, n := normalizeNewlines(src) - if len(src) == 0 || src[len(src)-1] != '\n' { - n++ - } - n++ - - indentFound := false - start := 0 - indent := 0 - offset := 0 - - mem := make([]int, 0, n*5) - bMarks := mem[0:0:n] - eMarks := mem[n : n : n*2] - tShift := mem[n*2 : n*2 : n*3] - sCount := mem[n*3 : n*3 : n*4] - bsCount := mem[n*4 : n*4 : n*5] - - _, lastRuneLen := utf8.DecodeLastRune(src) - lastRunePos := len(src) - lastRuneLen - for pos, r := range string(src) { - if !indentFound { - if runeIsSpace(r) { - indent++ - if r == '\t' { - offset += 4 - offset%4 - } else { - offset++ - } - continue - } - indentFound = true - } - - if r == '\n' || pos == lastRunePos { - if r != '\n' { - pos = len(src) - } - bMarks = append(bMarks, start) - eMarks = append(eMarks, pos) - tShift = append(tShift, indent) - sCount = append(sCount, offset) - bsCount = append(bsCount, 0) - - indentFound = false - indent = 0 - offset = 0 - start = pos + 1 - } - } - - bMarks = append(bMarks, len(src)) - eMarks = append(eMarks, len(src)) - tShift = append(tShift, 0) - sCount = append(sCount, 0) - bsCount = append(bsCount, 0) - - var s StateBlock - s.BMarks = bMarks - s.EMarks = eMarks - s.TShift = tShift - s.SCount = sCount - s.BSCount = bsCount - s.LineMax = n - 1 - s.Src = string(src) - s.Md = md - s.Env = env - - b.Tokenize(&s, s.Line, s.LineMax) - - return s.Tokens -} - -func (ParserBlock) Tokenize(s *StateBlock, startLine, endLine int) { - line := startLine - hasEmptyLines := false - maxNesting := s.Md.MaxNesting - - for line < endLine { - line = s.SkipEmptyLines(line) - s.Line = line - if line >= endLine { - break - } - - if s.SCount[line] < s.BlkIndent { - break - } - - if s.Level >= maxNesting { - s.Line = endLine - break - } - - for _, r := range blockRules { - if r(s, line, endLine, false) { - break - } - } - - s.Tight = !hasEmptyLines - - if s.IsLineEmpty(s.Line - 1) { - hasEmptyLines = true - } - - line = s.Line - - if line < endLine && s.IsLineEmpty(line) { - hasEmptyLines = true - line++ - s.Line = line - } - } -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/parser_inline.go b/vendor/gitlab.com/golang-commonmark/markdown/parser_inline.go deleted file mode 100644 index 5e976ebd..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/parser_inline.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "unicode/utf8" - -type ParserInline struct { -} - -type ( - InlineRule func(*StateInline, bool) bool - PostprocessRule func(*StateInline) -) - -var ( - inlineRules []InlineRule - postprocessRules []PostprocessRule -) - -func (i ParserInline) Parse(src string, md *Markdown, env *Environment) []Token { - if src == "" { - return nil - } - - var s StateInline - s.Src = src - s.Md = md - s.Env = env - s.PosMax = len(src) - s.Tokens = s.bootstrap[:0] - - i.Tokenize(&s) - - for _, r := range postprocessRules { - r(&s) - } - - return s.Tokens -} - -func (ParserInline) Tokenize(s *StateInline) { - end := s.PosMax - src := s.Src - maxNesting := s.Md.MaxNesting - ok := false - - for s.Pos < end { - if s.Level < maxNesting { - for _, rule := range inlineRules { - ok = rule(s, false) - if ok { - break - } - } - } - - if ok { - if s.Pos >= end { - break - } - continue - } - - r, size := utf8.DecodeRuneInString(src[s.Pos:]) - s.Pending.WriteRune(r) - s.Pos += size - } - - if s.Pending.Len() > 0 { - s.PushPending() - } -} - -func (ParserInline) SkipToken(s *StateInline) { - pos := s.Pos - if s.Cache != nil { - if newPos, ok := s.Cache[pos]; ok { - s.Pos = newPos - return - } - } else { - s.Cache = make(map[int]int) - } - - ok := false - if s.Level < s.Md.MaxNesting { - for _, r := range inlineRules { - s.Level++ - ok = r(s, true) - s.Level-- - if ok { - break - } - } - } else { - s.Pos = s.PosMax - } - - if !ok { - _, size := utf8.DecodeRuneInString(s.Src[s.Pos:]) - s.Pos += size - } - s.Cache[pos] = s.Pos -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/plugins.go b/vendor/gitlab.com/golang-commonmark/markdown/plugins.go deleted file mode 100644 index 5ba818cd..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/plugins.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "sort" - -type registeredCoreRule struct { - id int - rule CoreRule -} - -var registeredCoreRules []registeredCoreRule - -type registeredBlockRule struct { - id int - rule BlockRule - terminates []int -} - -var registeredBlockRules []registeredBlockRule - -type registeredInlineRule struct { - id int - rule InlineRule -} - -var registeredInlineRules []registeredInlineRule - -type registeredPostprocessRule struct { - id int - rule PostprocessRule -} - -var registeredPostprocessRules []registeredPostprocessRule - -func indexInt(a []int, n int) int { - for i, m := range a { - if m == n { - return i - } - } - return -1 -} - -func RegisterCoreRule(id int, rule CoreRule) { - registeredCoreRules = append(registeredCoreRules, registeredCoreRule{ - id: id, - rule: rule, - }) - sort.Slice(registeredCoreRules, func(i, j int) bool { - return registeredCoreRules[i].id < registeredCoreRules[j].id - }) - - coreRules = coreRules[:0] - for _, r := range registeredCoreRules { - coreRules = append(coreRules, r.rule) - } -} - -func RegisterBlockRule(id int, rule BlockRule, terminates []int) { - registeredBlockRules = append(registeredBlockRules, registeredBlockRule{ - id: id, - rule: rule, - terminates: terminates, - }) - sort.Slice(registeredBlockRules, func(i, j int) bool { - return registeredBlockRules[i].id < registeredBlockRules[j].id - }) - - blockRules = blockRules[:0] - blockquoteTerminatedBy = blockquoteTerminatedBy[:0] - listTerminatedBy = listTerminatedBy[:0] - referenceTerminatedBy = referenceTerminatedBy[:0] - paragraphTerminatedBy = paragraphTerminatedBy[:0] - for _, r := range registeredBlockRules { - blockRules = append(blockRules, r.rule) - if indexInt(r.terminates, 400) != -1 { - blockquoteTerminatedBy = append(blockquoteTerminatedBy, r.rule) - } - if indexInt(r.terminates, 600) != -1 { - listTerminatedBy = append(listTerminatedBy, r.rule) - } - if indexInt(r.terminates, 700) != -1 { - referenceTerminatedBy = append(referenceTerminatedBy, r.rule) - } - if indexInt(r.terminates, 1100) != -1 { - paragraphTerminatedBy = append(paragraphTerminatedBy, r.rule) - } - } -} - -func RegisterInlineRule(id int, rule InlineRule) { - registeredInlineRules = append(registeredInlineRules, registeredInlineRule{ - id: id, - rule: rule, - }) - sort.Slice(registeredInlineRules, func(i, j int) bool { - return registeredInlineRules[i].id < registeredInlineRules[j].id - }) - - inlineRules = inlineRules[:0] - for _, r := range registeredInlineRules { - inlineRules = append(inlineRules, r.rule) - } -} - -func RegisterPostprocessRule(id int, rule PostprocessRule) { - registeredPostprocessRules = append(registeredPostprocessRules, registeredPostprocessRule{ - id: id, - rule: rule, - }) - sort.Slice(registeredPostprocessRules, func(i, j int) bool { - return registeredPostprocessRules[i].id < registeredPostprocessRules[j].id - }) - - postprocessRules = postprocessRules[:0] - for _, r := range registeredPostprocessRules { - postprocessRules = append(postprocessRules, r.rule) - } -} - -func init() { - RegisterCoreRule(100, ruleInline) - RegisterCoreRule(200, ruleLinkify) - RegisterCoreRule(300, ruleReplacements) - RegisterCoreRule(400, ruleSmartQuotes) - - RegisterBlockRule(100, ruleTable, []int{1100, 700}) - RegisterBlockRule(200, ruleCode, nil) - RegisterBlockRule(300, ruleFence, []int{1100, 700, 400, 600}) - RegisterBlockRule(400, ruleBlockQuote, []int{1100, 700, 400, 600}) - RegisterBlockRule(500, ruleHR, []int{1100, 700, 400, 600}) - RegisterBlockRule(600, ruleList, []int{1100, 700, 400}) - RegisterBlockRule(700, ruleReference, nil) - RegisterBlockRule(800, ruleHeading, []int{1100, 700, 400}) - RegisterBlockRule(900, ruleLHeading, nil) - RegisterBlockRule(1000, ruleHTMLBlock, []int{1100, 700, 400}) - RegisterBlockRule(1100, ruleParagraph, nil) - - RegisterInlineRule(100, ruleText) - RegisterInlineRule(200, ruleNewline) - RegisterInlineRule(300, ruleEscape) - RegisterInlineRule(400, ruleBackticks) - RegisterInlineRule(500, ruleStrikeThrough) - RegisterInlineRule(600, ruleEmphasis) - RegisterInlineRule(700, ruleLink) - RegisterInlineRule(800, ruleImage) - RegisterInlineRule(900, ruleAutolink) - RegisterInlineRule(1000, ruleHTMLInline) - RegisterInlineRule(1100, ruleEntity) - - RegisterPostprocessRule(100, ruleBalancePairs) - RegisterPostprocessRule(200, ruleStrikethroughPostprocess) - RegisterPostprocessRule(300, ruleEmphasisPostprocess) - RegisterPostprocessRule(400, ruleTextCollapse) -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/reference.go b/vendor/gitlab.com/golang-commonmark/markdown/reference.go deleted file mode 100644 index 6e97809e..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/reference.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import "strings" - -var referenceTerminatedBy []BlockRule - -func ruleReference(s *StateBlock, startLine, _ int, silent bool) bool { - lines := 0 - pos := s.BMarks[startLine] + s.TShift[startLine] - max := s.EMarks[startLine] - nextLine := startLine + 1 - - if s.SCount[startLine]-s.BlkIndent >= 4 { - return false - } - - src := s.Src - - if src[pos] != '[' { - return false - } - - pos++ - for pos < max { - if src[pos] == ']' && src[pos-1] != '\\' { - if pos+1 == max { - return false - } - if src[pos+1] != ':' { - return false - } - break - } - pos++ - } - - endLine := s.LineMax - - oldParentType := s.ParentType - s.ParentType = ptReference -outer: - for ; nextLine < endLine && !s.IsLineEmpty(nextLine); nextLine++ { - if s.SCount[nextLine]-s.BlkIndent > 3 { - continue - } - - if s.SCount[nextLine] < 0 { - continue - } - - for _, r := range referenceTerminatedBy { - if r(s, nextLine, endLine, true) { - break outer - } - } - } - - str := strings.TrimSpace(s.Lines(startLine, nextLine, s.BlkIndent, false)) - max = len(str) - - var labelEnd int - for pos = 1; pos < max; pos++ { - b := str[pos] - if b == '[' { - return false - } else if b == ']' { - labelEnd = pos - break - } else if b == '\n' { - lines++ - } else if b == '\\' { - pos++ - if pos < max && str[pos] == '\n' { - lines++ - } - } - } - - if labelEnd <= 0 || labelEnd+1 >= max || str[labelEnd+1] != ':' { - return false - } - - for pos = labelEnd + 2; pos < max; pos++ { - b := str[pos] - if b == '\n' { - lines++ - } else if !byteIsSpace(b) { - break - } - } - - href, nlines, endpos, ok := parseLinkDestination(str, pos, max) - if !ok { - return false - } - href = normalizeLink(href) - if !validateLink(href) { - return false - } - - pos = endpos - lines += nlines - - destEndPos := pos - destEndLineNo := lines - - start := pos - for ; pos < max; pos++ { - b := str[pos] - if b == '\n' { - lines++ - } else if !byteIsSpace(b) { - break - } - } - - title, nlines, endpos, ok := parseLinkTitle(str, pos, max) - if pos < max && start != pos && ok { - pos = endpos - lines += nlines - } else { - pos = destEndPos - lines = destEndLineNo - } - - for pos < max && byteIsSpace(str[pos]) { - pos++ - } - - if pos < max && str[pos] != '\n' { - if title != "" { - title = "" - pos = destEndPos - lines = destEndLineNo - for pos < max && byteIsSpace(src[pos]) { - pos++ - } - } - } - - if pos < max && str[pos] != '\n' { - return false - } - - label := normalizeReference(str[1:labelEnd]) - if label == "" { - return false - } - - if silent { - return true - } - - if s.Env.References == nil { - s.Env.References = make(map[string]map[string]string) - } - if _, ok := s.Env.References[label]; !ok { - s.Env.References[label] = map[string]string{ - "title": title, - "href": href, - } - } - - s.ParentType = oldParentType - - s.Line = startLine + lines + 1 - - return true -} diff --git a/vendor/gitlab.com/golang-commonmark/markdown/render.go b/vendor/gitlab.com/golang-commonmark/markdown/render.go deleted file mode 100644 index 3955f051..00000000 --- a/vendor/gitlab.com/golang-commonmark/markdown/render.go +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright 2015 The Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package markdown - -import ( - "io" - "regexp" - "strconv" - "strings" - - "gitlab.com/golang-commonmark/html" -) - -type Renderer struct { - w *monadicWriter -} - -func NewRenderer(w io.Writer) *Renderer { - return &Renderer{newMonadicWriter(w)} -} - -func (r *Renderer) Render(tokens []Token, options RenderOptions) error { - for i, tok := range tokens { - if tok, ok := tok.(*Inline); ok { - r.renderInline(tok.Children, options) - } else { - r.renderToken(tokens, i, options) - } - } - - r.w.Flush() - - return r.w.err -} - -func (r *Renderer) renderInline(tokens []Token, o RenderOptions) { - for i := range tokens { - r.renderToken(tokens, i, o) - } -} - -func (r *Renderer) renderInlineAsText(tokens []Token) { - for _, tok := range tokens { - if text, ok := tok.(*Text); ok { - html.WriteEscapedString(r.w, text.Content) - } else if img, ok := tok.(*Image); ok { - r.renderInlineAsText(img.Tokens) - } - } -} - -var rNotSpace = regexp.MustCompile(`^\S+`) - -func (r *Renderer) renderToken(tokens []Token, idx int, options RenderOptions) { - tok := tokens[idx] - - if idx > 0 && tok.Block() && !tok.Closing() { - switch t := tokens[idx-1].(type) { - case *ParagraphOpen: - if t.Hidden { - r.w.WriteByte('\n') - } - case *ParagraphClose: - if t.Hidden { - r.w.WriteByte('\n') - } - } - } - - switch tok := tok.(type) { - case *BlockquoteClose: - r.w.WriteString("") - - case *BlockquoteOpen: - r.w.WriteString("
    ") - - case *BulletListClose: - r.w.WriteString("") - - case *BulletListOpen: - r.w.WriteString("