mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
Database and LDAP upgrades
Bumped underlying dependencies affecting database and LDAP connectivity. Bumped to Go v1.14.3 and released v3.8.0.
This commit is contained in:
parent
aaa8c3282d
commit
4fe022aa0c
310 changed files with 36835 additions and 16448 deletions
1
vendor/golang.org/x/net/html/const.go
generated
vendored
1
vendor/golang.org/x/net/html/const.go
generated
vendored
|
@ -52,7 +52,6 @@ var isSpecialElementMap = map[string]bool{
|
|||
"iframe": true,
|
||||
"img": true,
|
||||
"input": true,
|
||||
"isindex": true, // The 'isindex' element has been removed, but keep it for backwards compatibility.
|
||||
"keygen": true,
|
||||
"li": true,
|
||||
"link": true,
|
||||
|
|
1
vendor/golang.org/x/net/html/foreign.go
generated
vendored
1
vendor/golang.org/x/net/html/foreign.go
generated
vendored
|
@ -172,7 +172,6 @@ var svgAttributeAdjustments = map[string]string{
|
|||
"diffuseconstant": "diffuseConstant",
|
||||
"edgemode": "edgeMode",
|
||||
"externalresourcesrequired": "externalResourcesRequired",
|
||||
"filterres": "filterRes",
|
||||
"filterunits": "filterUnits",
|
||||
"glyphref": "glyphRef",
|
||||
"gradienttransform": "gradientTransform",
|
||||
|
|
5
vendor/golang.org/x/net/html/node.go
generated
vendored
5
vendor/golang.org/x/net/html/node.go
generated
vendored
|
@ -18,6 +18,11 @@ const (
|
|||
ElementNode
|
||||
CommentNode
|
||||
DoctypeNode
|
||||
// RawNode nodes are not returned by the parser, but can be part of the
|
||||
// Node tree passed to func Render to insert raw HTML (without escaping).
|
||||
// If so, this package makes no guarantee that the rendered HTML is secure
|
||||
// (from e.g. Cross Site Scripting attacks) or well-formed.
|
||||
RawNode
|
||||
scopeMarkerNode
|
||||
)
|
||||
|
||||
|
|
389
vendor/golang.org/x/net/html/parse.go
generated
vendored
389
vendor/golang.org/x/net/html/parse.go
generated
vendored
|
@ -184,6 +184,17 @@ func (p *parser) clearStackToContext(s scope) {
|
|||
}
|
||||
}
|
||||
|
||||
// parseGenericRawTextElements implements the generic raw text element parsing
|
||||
// algorithm defined in 12.2.6.2.
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text
|
||||
// TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part
|
||||
// officially, need to make tokenizer consider both states.
|
||||
func (p *parser) parseGenericRawTextElement() {
|
||||
p.addElement()
|
||||
p.originalIM = p.im
|
||||
p.im = textIM
|
||||
}
|
||||
|
||||
// generateImpliedEndTags pops nodes off the stack of open elements as long as
|
||||
// the top node has a tag name of dd, dt, li, optgroup, option, p, rb, rp, rt or rtc.
|
||||
// If exceptions are specified, nodes with that name will not be popped off.
|
||||
|
@ -192,16 +203,17 @@ func (p *parser) generateImpliedEndTags(exceptions ...string) {
|
|||
loop:
|
||||
for i = len(p.oe) - 1; i >= 0; i-- {
|
||||
n := p.oe[i]
|
||||
if n.Type == ElementNode {
|
||||
switch n.DataAtom {
|
||||
case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc:
|
||||
for _, except := range exceptions {
|
||||
if n.Data == except {
|
||||
break loop
|
||||
}
|
||||
if n.Type != ElementNode {
|
||||
break
|
||||
}
|
||||
switch n.DataAtom {
|
||||
case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc:
|
||||
for _, except := range exceptions {
|
||||
if n.Data == except {
|
||||
break loop
|
||||
}
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
@ -369,8 +381,7 @@ findIdenticalElements:
|
|||
// Section 12.2.4.3.
|
||||
func (p *parser) clearActiveFormattingElements() {
|
||||
for {
|
||||
n := p.afe.pop()
|
||||
if len(p.afe) == 0 || n.Type == scopeMarkerNode {
|
||||
if n := p.afe.pop(); len(p.afe) == 0 || n.Type == scopeMarkerNode {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -625,16 +636,29 @@ func inHeadIM(p *parser) bool {
|
|||
switch p.tok.DataAtom {
|
||||
case a.Html:
|
||||
return inBodyIM(p)
|
||||
case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta:
|
||||
case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta:
|
||||
p.addElement()
|
||||
p.oe.pop()
|
||||
p.acknowledgeSelfClosingTag()
|
||||
return true
|
||||
case a.Script, a.Title, a.Noscript, a.Noframes, a.Style:
|
||||
case a.Noscript:
|
||||
if p.scripting {
|
||||
p.parseGenericRawTextElement()
|
||||
return true
|
||||
}
|
||||
p.addElement()
|
||||
p.im = inHeadNoscriptIM
|
||||
// Don't let the tokenizer go into raw text mode when scripting is disabled.
|
||||
p.tokenizer.NextIsNotRawText()
|
||||
return true
|
||||
case a.Script, a.Title:
|
||||
p.addElement()
|
||||
p.setOriginalIM()
|
||||
p.im = textIM
|
||||
return true
|
||||
case a.Noframes, a.Style:
|
||||
p.parseGenericRawTextElement()
|
||||
return true
|
||||
case a.Head:
|
||||
// Ignore the token.
|
||||
return true
|
||||
|
@ -692,6 +716,49 @@ func inHeadIM(p *parser) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// 12.2.6.4.5.
|
||||
func inHeadNoscriptIM(p *parser) bool {
|
||||
switch p.tok.Type {
|
||||
case DoctypeToken:
|
||||
// Ignore the token.
|
||||
return true
|
||||
case StartTagToken:
|
||||
switch p.tok.DataAtom {
|
||||
case a.Html:
|
||||
return inBodyIM(p)
|
||||
case a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Style:
|
||||
return inHeadIM(p)
|
||||
case a.Head, a.Noscript:
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
case EndTagToken:
|
||||
switch p.tok.DataAtom {
|
||||
case a.Noscript, a.Br:
|
||||
default:
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
case TextToken:
|
||||
s := strings.TrimLeft(p.tok.Data, whitespace)
|
||||
if len(s) == 0 {
|
||||
// It was all whitespace.
|
||||
return inHeadIM(p)
|
||||
}
|
||||
case CommentToken:
|
||||
return inHeadIM(p)
|
||||
}
|
||||
p.oe.pop()
|
||||
if p.top().DataAtom != a.Head {
|
||||
panic("html: the new current node will be a head element.")
|
||||
}
|
||||
p.im = inHeadIM
|
||||
if p.tok.DataAtom == a.Noscript {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Section 12.2.6.4.6.
|
||||
func afterHeadIM(p *parser) bool {
|
||||
switch p.tok.Type {
|
||||
|
@ -803,7 +870,7 @@ func inBodyIM(p *parser) bool {
|
|||
return true
|
||||
}
|
||||
copyAttributes(p.oe[0], p.tok)
|
||||
case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title:
|
||||
case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title:
|
||||
return inHeadIM(p)
|
||||
case a.Body:
|
||||
if p.oe.contains(a.Template) {
|
||||
|
@ -829,7 +896,7 @@ func inBodyIM(p *parser) bool {
|
|||
p.addElement()
|
||||
p.im = inFramesetIM
|
||||
return true
|
||||
case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul:
|
||||
case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul:
|
||||
p.popUntil(buttonScope, a.P)
|
||||
p.addElement()
|
||||
case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
|
||||
|
@ -962,53 +1029,6 @@ func inBodyIM(p *parser) bool {
|
|||
p.tok.DataAtom = a.Img
|
||||
p.tok.Data = a.Img.String()
|
||||
return false
|
||||
case a.Isindex:
|
||||
if p.form != nil {
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
action := ""
|
||||
prompt := "This is a searchable index. Enter search keywords: "
|
||||
attr := []Attribute{{Key: "name", Val: "isindex"}}
|
||||
for _, t := range p.tok.Attr {
|
||||
switch t.Key {
|
||||
case "action":
|
||||
action = t.Val
|
||||
case "name":
|
||||
// Ignore the attribute.
|
||||
case "prompt":
|
||||
prompt = t.Val
|
||||
default:
|
||||
attr = append(attr, t)
|
||||
}
|
||||
}
|
||||
p.acknowledgeSelfClosingTag()
|
||||
p.popUntil(buttonScope, a.P)
|
||||
p.parseImpliedToken(StartTagToken, a.Form, a.Form.String())
|
||||
if p.form == nil {
|
||||
// NOTE: The 'isindex' element has been removed,
|
||||
// and the 'template' element has not been designed to be
|
||||
// collaborative with the index element.
|
||||
//
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
if action != "" {
|
||||
p.form.Attr = []Attribute{{Key: "action", Val: action}}
|
||||
}
|
||||
p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
|
||||
p.parseImpliedToken(StartTagToken, a.Label, a.Label.String())
|
||||
p.addText(prompt)
|
||||
p.addChild(&Node{
|
||||
Type: ElementNode,
|
||||
DataAtom: a.Input,
|
||||
Data: a.Input.String(),
|
||||
Attr: attr,
|
||||
})
|
||||
p.oe.pop()
|
||||
p.parseImpliedToken(EndTagToken, a.Label, a.Label.String())
|
||||
p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
|
||||
p.parseImpliedToken(EndTagToken, a.Form, a.Form.String())
|
||||
case a.Textarea:
|
||||
p.addElement()
|
||||
p.setOriginalIM()
|
||||
|
@ -1018,18 +1038,21 @@ func inBodyIM(p *parser) bool {
|
|||
p.popUntil(buttonScope, a.P)
|
||||
p.reconstructActiveFormattingElements()
|
||||
p.framesetOK = false
|
||||
p.addElement()
|
||||
p.setOriginalIM()
|
||||
p.im = textIM
|
||||
p.parseGenericRawTextElement()
|
||||
case a.Iframe:
|
||||
p.framesetOK = false
|
||||
p.parseGenericRawTextElement()
|
||||
case a.Noembed:
|
||||
p.parseGenericRawTextElement()
|
||||
case a.Noscript:
|
||||
if p.scripting {
|
||||
p.parseGenericRawTextElement()
|
||||
return true
|
||||
}
|
||||
p.reconstructActiveFormattingElements()
|
||||
p.addElement()
|
||||
p.setOriginalIM()
|
||||
p.im = textIM
|
||||
case a.Noembed, a.Noscript:
|
||||
p.addElement()
|
||||
p.setOriginalIM()
|
||||
p.im = textIM
|
||||
// Don't let the tokenizer go into raw text mode when scripting is disabled.
|
||||
p.tokenizer.NextIsNotRawText()
|
||||
case a.Select:
|
||||
p.reconstructActiveFormattingElements()
|
||||
p.addElement()
|
||||
|
@ -1085,7 +1108,7 @@ func inBodyIM(p *parser) bool {
|
|||
return false
|
||||
}
|
||||
return true
|
||||
case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul:
|
||||
case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul:
|
||||
p.popUntil(defaultScope, p.tok.DataAtom)
|
||||
case a.Form:
|
||||
if p.oe.contains(a.Template) {
|
||||
|
@ -1146,14 +1169,13 @@ func inBodyIM(p *parser) bool {
|
|||
if len(p.templateStack) > 0 {
|
||||
p.im = inTemplateIM
|
||||
return false
|
||||
} else {
|
||||
for _, e := range p.oe {
|
||||
switch e.DataAtom {
|
||||
case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th,
|
||||
a.Thead, a.Tr, a.Body, a.Html:
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
for _, e := range p.oe {
|
||||
switch e.DataAtom {
|
||||
case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th,
|
||||
a.Thead, a.Tr, a.Body, a.Html:
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1169,9 +1191,15 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
|
|||
// Once the code successfully parses the comprehensive test suite, we should
|
||||
// refactor this code to be more idiomatic.
|
||||
|
||||
// Steps 1-4. The outer loop.
|
||||
// Steps 1-2
|
||||
if current := p.oe.top(); current.Data == tagName && p.afe.index(current) == -1 {
|
||||
p.oe.pop()
|
||||
return
|
||||
}
|
||||
|
||||
// Steps 3-5. The outer loop.
|
||||
for i := 0; i < 8; i++ {
|
||||
// Step 5. Find the formatting element.
|
||||
// Step 6. Find the formatting element.
|
||||
var formattingElement *Node
|
||||
for j := len(p.afe) - 1; j >= 0; j-- {
|
||||
if p.afe[j].Type == scopeMarkerNode {
|
||||
|
@ -1186,17 +1214,22 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
|
|||
p.inBodyEndTagOther(tagAtom, tagName)
|
||||
return
|
||||
}
|
||||
|
||||
// Step 7. Ignore the tag if formatting element is not in the stack of open elements.
|
||||
feIndex := p.oe.index(formattingElement)
|
||||
if feIndex == -1 {
|
||||
p.afe.remove(formattingElement)
|
||||
return
|
||||
}
|
||||
// Step 8. Ignore the tag if formatting element is not in the scope.
|
||||
if !p.elementInScope(defaultScope, tagAtom) {
|
||||
// Ignore the tag.
|
||||
return
|
||||
}
|
||||
|
||||
// Steps 9-10. Find the furthest block.
|
||||
// Step 9. This step is omitted because it's just a parse error but no need to return.
|
||||
|
||||
// Steps 10-11. Find the furthest block.
|
||||
var furthestBlock *Node
|
||||
for _, e := range p.oe[feIndex:] {
|
||||
if isSpecialElement(e) {
|
||||
|
@ -1213,47 +1246,65 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
|
|||
return
|
||||
}
|
||||
|
||||
// Steps 11-12. Find the common ancestor and bookmark node.
|
||||
// Steps 12-13. Find the common ancestor and bookmark node.
|
||||
commonAncestor := p.oe[feIndex-1]
|
||||
bookmark := p.afe.index(formattingElement)
|
||||
|
||||
// Step 13. The inner loop. Find the lastNode to reparent.
|
||||
// Step 14. The inner loop. Find the lastNode to reparent.
|
||||
lastNode := furthestBlock
|
||||
node := furthestBlock
|
||||
x := p.oe.index(node)
|
||||
// Steps 13.1-13.2
|
||||
for j := 0; j < 3; j++ {
|
||||
// Step 13.3.
|
||||
// Step 14.1.
|
||||
j := 0
|
||||
for {
|
||||
// Step 14.2.
|
||||
j++
|
||||
// Step. 14.3.
|
||||
x--
|
||||
node = p.oe[x]
|
||||
// Step 13.4 - 13.5.
|
||||
// Step 14.4. Go to the next step if node is formatting element.
|
||||
if node == formattingElement {
|
||||
break
|
||||
}
|
||||
// Step 14.5. Remove node from the list of active formatting elements if
|
||||
// inner loop counter is greater than three and node is in the list of
|
||||
// active formatting elements.
|
||||
if ni := p.afe.index(node); j > 3 && ni > -1 {
|
||||
p.afe.remove(node)
|
||||
// If any element of the list of active formatting elements is removed,
|
||||
// we need to take care whether bookmark should be decremented or not.
|
||||
// This is because the value of bookmark may exceed the size of the
|
||||
// list by removing elements from the list.
|
||||
if ni <= bookmark {
|
||||
bookmark--
|
||||
}
|
||||
continue
|
||||
}
|
||||
// Step 14.6. Continue the next inner loop if node is not in the list of
|
||||
// active formatting elements.
|
||||
if p.afe.index(node) == -1 {
|
||||
p.oe.remove(node)
|
||||
continue
|
||||
}
|
||||
// Step 13.6.
|
||||
if node == formattingElement {
|
||||
break
|
||||
}
|
||||
// Step 13.7.
|
||||
// Step 14.7.
|
||||
clone := node.clone()
|
||||
p.afe[p.afe.index(node)] = clone
|
||||
p.oe[p.oe.index(node)] = clone
|
||||
node = clone
|
||||
// Step 13.8.
|
||||
// Step 14.8.
|
||||
if lastNode == furthestBlock {
|
||||
bookmark = p.afe.index(node) + 1
|
||||
}
|
||||
// Step 13.9.
|
||||
// Step 14.9.
|
||||
if lastNode.Parent != nil {
|
||||
lastNode.Parent.RemoveChild(lastNode)
|
||||
}
|
||||
node.AppendChild(lastNode)
|
||||
// Step 13.10.
|
||||
// Step 14.10.
|
||||
lastNode = node
|
||||
}
|
||||
|
||||
// Step 14. Reparent lastNode to the common ancestor,
|
||||
// Step 15. Reparent lastNode to the common ancestor,
|
||||
// or for misnested table nodes, to the foster parent.
|
||||
if lastNode.Parent != nil {
|
||||
lastNode.Parent.RemoveChild(lastNode)
|
||||
|
@ -1265,13 +1316,13 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
|
|||
commonAncestor.AppendChild(lastNode)
|
||||
}
|
||||
|
||||
// Steps 15-17. Reparent nodes from the furthest block's children
|
||||
// Steps 16-18. Reparent nodes from the furthest block's children
|
||||
// to a clone of the formatting element.
|
||||
clone := formattingElement.clone()
|
||||
reparentChildren(clone, furthestBlock)
|
||||
furthestBlock.AppendChild(clone)
|
||||
|
||||
// Step 18. Fix up the list of active formatting elements.
|
||||
// Step 19. Fix up the list of active formatting elements.
|
||||
if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark {
|
||||
// Move the bookmark with the rest of the list.
|
||||
bookmark--
|
||||
|
@ -1279,7 +1330,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
|
|||
p.afe.remove(formattingElement)
|
||||
p.afe.insert(bookmark, clone)
|
||||
|
||||
// Step 19. Fix up the stack of open elements.
|
||||
// Step 20. Fix up the stack of open elements.
|
||||
p.oe.remove(formattingElement)
|
||||
p.oe.insert(p.oe.index(furthestBlock)+1, clone)
|
||||
}
|
||||
|
@ -1450,14 +1501,13 @@ func inCaptionIM(p *parser) bool {
|
|||
case StartTagToken:
|
||||
switch p.tok.DataAtom {
|
||||
case a.Caption, a.Col, a.Colgroup, a.Tbody, a.Td, a.Tfoot, a.Thead, a.Tr:
|
||||
if p.popUntil(tableScope, a.Caption) {
|
||||
p.clearActiveFormattingElements()
|
||||
p.im = inTableIM
|
||||
return false
|
||||
} else {
|
||||
if !p.popUntil(tableScope, a.Caption) {
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
p.clearActiveFormattingElements()
|
||||
p.im = inTableIM
|
||||
return false
|
||||
case a.Select:
|
||||
p.reconstructActiveFormattingElements()
|
||||
p.addElement()
|
||||
|
@ -1474,14 +1524,13 @@ func inCaptionIM(p *parser) bool {
|
|||
}
|
||||
return true
|
||||
case a.Table:
|
||||
if p.popUntil(tableScope, a.Caption) {
|
||||
p.clearActiveFormattingElements()
|
||||
p.im = inTableIM
|
||||
return false
|
||||
} else {
|
||||
if !p.popUntil(tableScope, a.Caption) {
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
p.clearActiveFormattingElements()
|
||||
p.im = inTableIM
|
||||
return false
|
||||
case a.Body, a.Col, a.Colgroup, a.Html, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
|
||||
// Ignore the token.
|
||||
return true
|
||||
|
@ -1692,8 +1741,9 @@ func inCellIM(p *parser) bool {
|
|||
return true
|
||||
}
|
||||
// Close the cell and reprocess.
|
||||
p.popUntil(tableScope, a.Td, a.Th)
|
||||
p.clearActiveFormattingElements()
|
||||
if p.popUntil(tableScope, a.Td, a.Th) {
|
||||
p.clearActiveFormattingElements()
|
||||
}
|
||||
p.im = inRowIM
|
||||
return false
|
||||
}
|
||||
|
@ -1724,12 +1774,11 @@ func inSelectIM(p *parser) bool {
|
|||
}
|
||||
p.addElement()
|
||||
case a.Select:
|
||||
if p.popUntil(selectScope, a.Select) {
|
||||
p.resetInsertionMode()
|
||||
} else {
|
||||
if !p.popUntil(selectScope, a.Select) {
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
p.resetInsertionMode()
|
||||
case a.Input, a.Keygen, a.Textarea:
|
||||
if p.elementInScope(selectScope, a.Select) {
|
||||
p.parseImpliedToken(EndTagToken, a.Select, a.Select.String())
|
||||
|
@ -1757,12 +1806,11 @@ func inSelectIM(p *parser) bool {
|
|||
p.oe = p.oe[:i]
|
||||
}
|
||||
case a.Select:
|
||||
if p.popUntil(selectScope, a.Select) {
|
||||
p.resetInsertionMode()
|
||||
} else {
|
||||
if !p.popUntil(selectScope, a.Select) {
|
||||
// Ignore the token.
|
||||
return true
|
||||
}
|
||||
p.resetInsertionMode()
|
||||
case a.Template:
|
||||
return inHeadIM(p)
|
||||
}
|
||||
|
@ -2083,28 +2131,31 @@ func parseForeignContent(p *parser) bool {
|
|||
Data: p.tok.Data,
|
||||
})
|
||||
case StartTagToken:
|
||||
b := breakout[p.tok.Data]
|
||||
if p.tok.DataAtom == a.Font {
|
||||
loop:
|
||||
for _, attr := range p.tok.Attr {
|
||||
switch attr.Key {
|
||||
case "color", "face", "size":
|
||||
b = true
|
||||
break loop
|
||||
if !p.fragment {
|
||||
b := breakout[p.tok.Data]
|
||||
if p.tok.DataAtom == a.Font {
|
||||
loop:
|
||||
for _, attr := range p.tok.Attr {
|
||||
switch attr.Key {
|
||||
case "color", "face", "size":
|
||||
b = true
|
||||
break loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if b {
|
||||
for i := len(p.oe) - 1; i >= 0; i-- {
|
||||
n := p.oe[i]
|
||||
if n.Namespace == "" || htmlIntegrationPoint(n) || mathMLTextIntegrationPoint(n) {
|
||||
p.oe = p.oe[:i+1]
|
||||
break
|
||||
if b {
|
||||
for i := len(p.oe) - 1; i >= 0; i-- {
|
||||
n := p.oe[i]
|
||||
if n.Namespace == "" || htmlIntegrationPoint(n) || mathMLTextIntegrationPoint(n) {
|
||||
p.oe = p.oe[:i+1]
|
||||
break
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
switch p.top().Namespace {
|
||||
current := p.adjustedCurrentNode()
|
||||
switch current.Namespace {
|
||||
case "math":
|
||||
adjustAttributeNames(p.tok.Attr, mathMLAttributeAdjustments)
|
||||
case "svg":
|
||||
|
@ -2119,7 +2170,7 @@ func parseForeignContent(p *parser) bool {
|
|||
panic("html: bad parser state: unexpected namespace")
|
||||
}
|
||||
adjustForeignAttributes(p.tok.Attr)
|
||||
namespace := p.top().Namespace
|
||||
namespace := current.Namespace
|
||||
p.addElement()
|
||||
p.top().Namespace = namespace
|
||||
if namespace != "" {
|
||||
|
@ -2148,12 +2199,20 @@ func parseForeignContent(p *parser) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// Section 12.2.4.2.
|
||||
func (p *parser) adjustedCurrentNode() *Node {
|
||||
if len(p.oe) == 1 && p.fragment && p.context != nil {
|
||||
return p.context
|
||||
}
|
||||
return p.oe.top()
|
||||
}
|
||||
|
||||
// Section 12.2.6.
|
||||
func (p *parser) inForeignContent() bool {
|
||||
if len(p.oe) == 0 {
|
||||
return false
|
||||
}
|
||||
n := p.oe[len(p.oe)-1]
|
||||
n := p.adjustedCurrentNode()
|
||||
if n.Namespace == "" {
|
||||
return false
|
||||
}
|
||||
|
@ -2247,6 +2306,33 @@ func (p *parser) parse() error {
|
|||
//
|
||||
// The input is assumed to be UTF-8 encoded.
|
||||
func Parse(r io.Reader) (*Node, error) {
|
||||
return ParseWithOptions(r)
|
||||
}
|
||||
|
||||
// ParseFragment parses a fragment of HTML and returns the nodes that were
|
||||
// found. If the fragment is the InnerHTML for an existing element, pass that
|
||||
// element in context.
|
||||
//
|
||||
// It has the same intricacies as Parse.
|
||||
func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
|
||||
return ParseFragmentWithOptions(r, context)
|
||||
}
|
||||
|
||||
// ParseOption configures a parser.
|
||||
type ParseOption func(p *parser)
|
||||
|
||||
// ParseOptionEnableScripting configures the scripting flag.
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#enabling-and-disabling-scripting
|
||||
//
|
||||
// By default, scripting is enabled.
|
||||
func ParseOptionEnableScripting(enable bool) ParseOption {
|
||||
return func(p *parser) {
|
||||
p.scripting = enable
|
||||
}
|
||||
}
|
||||
|
||||
// ParseWithOptions is like Parse, with options.
|
||||
func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error) {
|
||||
p := &parser{
|
||||
tokenizer: NewTokenizer(r),
|
||||
doc: &Node{
|
||||
|
@ -2256,19 +2342,19 @@ func Parse(r io.Reader) (*Node, error) {
|
|||
framesetOK: true,
|
||||
im: initialIM,
|
||||
}
|
||||
err := p.parse()
|
||||
if err != nil {
|
||||
|
||||
for _, f := range opts {
|
||||
f(p)
|
||||
}
|
||||
|
||||
if err := p.parse(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return p.doc, nil
|
||||
}
|
||||
|
||||
// ParseFragment parses a fragment of HTML and returns the nodes that were
|
||||
// found. If the fragment is the InnerHTML for an existing element, pass that
|
||||
// element in context.
|
||||
//
|
||||
// It has the same intricacies as Parse.
|
||||
func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
|
||||
// ParseFragmentWithOptions is like ParseFragment, with options.
|
||||
func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ([]*Node, error) {
|
||||
contextTag := ""
|
||||
if context != nil {
|
||||
if context.Type != ElementNode {
|
||||
|
@ -2283,7 +2369,6 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
|
|||
contextTag = context.DataAtom.String()
|
||||
}
|
||||
p := &parser{
|
||||
tokenizer: NewTokenizerFragment(r, contextTag),
|
||||
doc: &Node{
|
||||
Type: DocumentNode,
|
||||
},
|
||||
|
@ -2291,6 +2376,15 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
|
|||
fragment: true,
|
||||
context: context,
|
||||
}
|
||||
if context != nil && context.Namespace != "" {
|
||||
p.tokenizer = NewTokenizer(r)
|
||||
} else {
|
||||
p.tokenizer = NewTokenizerFragment(r, contextTag)
|
||||
}
|
||||
|
||||
for _, f := range opts {
|
||||
f(p)
|
||||
}
|
||||
|
||||
root := &Node{
|
||||
Type: ElementNode,
|
||||
|
@ -2311,8 +2405,7 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
|
|||
}
|
||||
}
|
||||
|
||||
err := p.parse()
|
||||
if err != nil {
|
||||
if err := p.parse(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
34
vendor/golang.org/x/net/html/render.go
generated
vendored
34
vendor/golang.org/x/net/html/render.go
generated
vendored
|
@ -134,6 +134,9 @@ func render1(w writer, n *Node) error {
|
|||
}
|
||||
}
|
||||
return w.WriteByte('>')
|
||||
case RawNode:
|
||||
_, err := w.WriteString(n.Data)
|
||||
return err
|
||||
default:
|
||||
return errors.New("html: unknown node type")
|
||||
}
|
||||
|
@ -252,20 +255,19 @@ func writeQuoted(w writer, s string) error {
|
|||
// Section 12.1.2, "Elements", gives this list of void elements. Void elements
|
||||
// are those that can't have any contents.
|
||||
var voidElements = map[string]bool{
|
||||
"area": true,
|
||||
"base": true,
|
||||
"br": true,
|
||||
"col": true,
|
||||
"command": true,
|
||||
"embed": true,
|
||||
"hr": true,
|
||||
"img": true,
|
||||
"input": true,
|
||||
"keygen": true,
|
||||
"link": true,
|
||||
"meta": true,
|
||||
"param": true,
|
||||
"source": true,
|
||||
"track": true,
|
||||
"wbr": true,
|
||||
"area": true,
|
||||
"base": true,
|
||||
"br": true,
|
||||
"col": true,
|
||||
"embed": true,
|
||||
"hr": true,
|
||||
"img": true,
|
||||
"input": true,
|
||||
"keygen": true,
|
||||
"link": true,
|
||||
"meta": true,
|
||||
"param": true,
|
||||
"source": true,
|
||||
"track": true,
|
||||
"wbr": true,
|
||||
}
|
||||
|
|
9
vendor/golang.org/x/net/html/token.go
generated
vendored
9
vendor/golang.org/x/net/html/token.go
generated
vendored
|
@ -296,8 +296,7 @@ func (z *Tokenizer) Buffered() []byte {
|
|||
// too many times in succession.
|
||||
func readAtLeastOneByte(r io.Reader, b []byte) (int, error) {
|
||||
for i := 0; i < 100; i++ {
|
||||
n, err := r.Read(b)
|
||||
if n != 0 || err != nil {
|
||||
if n, err := r.Read(b); n != 0 || err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
@ -347,6 +346,7 @@ loop:
|
|||
break loop
|
||||
}
|
||||
if c != '/' {
|
||||
z.raw.end--
|
||||
continue loop
|
||||
}
|
||||
if z.readRawEndTag() || z.err != nil {
|
||||
|
@ -1067,6 +1067,11 @@ loop:
|
|||
|
||||
// Raw returns the unmodified text of the current token. Calling Next, Token,
|
||||
// Text, TagName or TagAttr may change the contents of the returned slice.
|
||||
//
|
||||
// The token stream's raw bytes partition the byte stream (up until an
|
||||
// ErrorToken). There are no overlaps or gaps between two consecutive token's
|
||||
// raw bytes. One implication is that the byte offset of the current token is
|
||||
// the sum of the lengths of all previous tokens' raw bytes.
|
||||
func (z *Tokenizer) Raw() []byte {
|
||||
return z.buf[z.raw.start:z.raw.end]
|
||||
}
|
||||
|
|
13
vendor/golang.org/x/oauth2/README.md
generated
vendored
13
vendor/golang.org/x/oauth2/README.md
generated
vendored
|
@ -16,15 +16,16 @@ Or you can manually git clone the repository to
|
|||
|
||||
See godoc for further documentation and examples.
|
||||
|
||||
* [godoc.org/golang.org/x/oauth2](http://godoc.org/golang.org/x/oauth2)
|
||||
* [godoc.org/golang.org/x/oauth2/google](http://godoc.org/golang.org/x/oauth2/google)
|
||||
* [godoc.org/golang.org/x/oauth2](https://godoc.org/golang.org/x/oauth2)
|
||||
* [godoc.org/golang.org/x/oauth2/google](https://godoc.org/golang.org/x/oauth2/google)
|
||||
|
||||
## Policy for new packages
|
||||
|
||||
We no longer accept new provider-specific packages in this repo. For
|
||||
defining provider endpoints and provider-specific OAuth2 behavior, we
|
||||
encourage you to create packages elsewhere. We'll keep the existing
|
||||
packages for compatibility.
|
||||
We no longer accept new provider-specific packages in this repo if all
|
||||
they do is add a single endpoint variable. If you just want to add a
|
||||
single endpoint, add it to the
|
||||
[godoc.org/golang.org/x/oauth2/endpoints](https://godoc.org/golang.org/x/oauth2/endpoints)
|
||||
package.
|
||||
|
||||
## Report Issues / Send Patches
|
||||
|
||||
|
|
10
vendor/golang.org/x/oauth2/internal/token.go
generated
vendored
10
vendor/golang.org/x/oauth2/internal/token.go
generated
vendored
|
@ -63,16 +63,12 @@ type tokenJSON struct {
|
|||
TokenType string `json:"token_type"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
ExpiresIn expirationTime `json:"expires_in"` // at least PayPal returns string, while most return number
|
||||
Expires expirationTime `json:"expires"` // broken Facebook spelling of expires_in
|
||||
}
|
||||
|
||||
func (e *tokenJSON) expiry() (t time.Time) {
|
||||
if v := e.ExpiresIn; v != 0 {
|
||||
return time.Now().Add(time.Duration(v) * time.Second)
|
||||
}
|
||||
if v := e.Expires; v != 0 {
|
||||
return time.Now().Add(time.Duration(v) * time.Second)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -264,12 +260,6 @@ func doTokenRoundTrip(ctx context.Context, req *http.Request) (*Token, error) {
|
|||
Raw: vals,
|
||||
}
|
||||
e := vals.Get("expires_in")
|
||||
if e == "" || e == "null" {
|
||||
// TODO(jbd): Facebook's OAuth2 implementation is broken and
|
||||
// returns expires_in field in expires. Remove the fallback to expires,
|
||||
// when Facebook fixes their implementation.
|
||||
e = vals.Get("expires")
|
||||
}
|
||||
expires, _ := strconv.Atoi(e)
|
||||
if expires != 0 {
|
||||
token.Expiry = time.Now().Add(time.Duration(expires) * time.Second)
|
||||
|
|
2
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
2
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
|
@ -117,7 +117,7 @@ var (
|
|||
// ApprovalForce forces the users to view the consent dialog
|
||||
// and confirm the permissions request at the URL returned
|
||||
// from AuthCodeURL, even if they've already done so.
|
||||
ApprovalForce AuthCodeOption = SetAuthURLParam("approval_prompt", "force")
|
||||
ApprovalForce AuthCodeOption = SetAuthURLParam("prompt", "consent")
|
||||
)
|
||||
|
||||
// An AuthCodeOption is passed to Config.AuthCodeURL.
|
||||
|
|
79
vendor/golang.org/x/oauth2/transport.go
generated
vendored
79
vendor/golang.org/x/oauth2/transport.go
generated
vendored
|
@ -6,7 +6,7 @@ package oauth2
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"sync"
|
||||
)
|
||||
|
@ -25,9 +25,6 @@ type Transport struct {
|
|||
// Base is the base RoundTripper used to make HTTP requests.
|
||||
// If nil, http.DefaultTransport is used.
|
||||
Base http.RoundTripper
|
||||
|
||||
mu sync.Mutex // guards modReq
|
||||
modReq map[*http.Request]*http.Request // original -> modified
|
||||
}
|
||||
|
||||
// RoundTrip authorizes and authenticates the request with an
|
||||
|
@ -52,35 +49,22 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||
|
||||
req2 := cloneRequest(req) // per RoundTripper contract
|
||||
token.SetAuthHeader(req2)
|
||||
t.setModReq(req, req2)
|
||||
res, err := t.base().RoundTrip(req2)
|
||||
|
||||
// req.Body is assumed to have been closed by the base RoundTripper.
|
||||
// req.Body is assumed to be closed by the base RoundTripper.
|
||||
reqBodyClosed = true
|
||||
|
||||
if err != nil {
|
||||
t.setModReq(req, nil)
|
||||
return nil, err
|
||||
}
|
||||
res.Body = &onEOFReader{
|
||||
rc: res.Body,
|
||||
fn: func() { t.setModReq(req, nil) },
|
||||
}
|
||||
return res, nil
|
||||
return t.base().RoundTrip(req2)
|
||||
}
|
||||
|
||||
// CancelRequest cancels an in-flight request by closing its connection.
|
||||
var cancelOnce sync.Once
|
||||
|
||||
// CancelRequest does nothing. It used to be a legacy cancellation mechanism
|
||||
// but now only it only logs on first use to warn that it's deprecated.
|
||||
//
|
||||
// Deprecated: use contexts for cancellation instead.
|
||||
func (t *Transport) CancelRequest(req *http.Request) {
|
||||
type canceler interface {
|
||||
CancelRequest(*http.Request)
|
||||
}
|
||||
if cr, ok := t.base().(canceler); ok {
|
||||
t.mu.Lock()
|
||||
modReq := t.modReq[req]
|
||||
delete(t.modReq, req)
|
||||
t.mu.Unlock()
|
||||
cr.CancelRequest(modReq)
|
||||
}
|
||||
cancelOnce.Do(func() {
|
||||
log.Printf("deprecated: golang.org/x/oauth2: Transport.CancelRequest no longer does anything; use contexts")
|
||||
})
|
||||
}
|
||||
|
||||
func (t *Transport) base() http.RoundTripper {
|
||||
|
@ -90,19 +74,6 @@ func (t *Transport) base() http.RoundTripper {
|
|||
return http.DefaultTransport
|
||||
}
|
||||
|
||||
func (t *Transport) setModReq(orig, mod *http.Request) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
if t.modReq == nil {
|
||||
t.modReq = make(map[*http.Request]*http.Request)
|
||||
}
|
||||
if mod == nil {
|
||||
delete(t.modReq, orig)
|
||||
} else {
|
||||
t.modReq[orig] = mod
|
||||
}
|
||||
}
|
||||
|
||||
// cloneRequest returns a clone of the provided *http.Request.
|
||||
// The clone is a shallow copy of the struct and its Header map.
|
||||
func cloneRequest(r *http.Request) *http.Request {
|
||||
|
@ -116,29 +87,3 @@ func cloneRequest(r *http.Request) *http.Request {
|
|||
}
|
||||
return r2
|
||||
}
|
||||
|
||||
type onEOFReader struct {
|
||||
rc io.ReadCloser
|
||||
fn func()
|
||||
}
|
||||
|
||||
func (r *onEOFReader) Read(p []byte) (n int, err error) {
|
||||
n, err = r.rc.Read(p)
|
||||
if err == io.EOF {
|
||||
r.runFunc()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *onEOFReader) Close() error {
|
||||
err := r.rc.Close()
|
||||
r.runFunc()
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *onEOFReader) runFunc() {
|
||||
if fn := r.fn; fn != nil {
|
||||
fn()
|
||||
r.fn = nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue