repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
henrylee2cn/pholcus | common/goquery/type.go | newSingleSelection | func newSingleSelection(node *html.Node, doc *Document) *Selection {
return &Selection{[]*html.Node{node}, doc, nil}
} | go | func newSingleSelection(node *html.Node, doc *Document) *Selection {
return &Selection{[]*html.Node{node}, doc, nil}
} | [
"func",
"newSingleSelection",
"(",
"node",
"*",
"html",
".",
"Node",
",",
"doc",
"*",
"Document",
")",
"*",
"Selection",
"{",
"return",
"&",
"Selection",
"{",
"[",
"]",
"*",
"html",
".",
"Node",
"{",
"node",
"}",
",",
"doc",
",",
"nil",
"}",
"\n",
... | // Helper constructor to create a selection of only one node | [
"Helper",
"constructor",
"to",
"create",
"a",
"selection",
"of",
"only",
"one",
"node"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/type.go#L106-L108 | train |
henrylee2cn/pholcus | common/goquery/type.go | compileMatcher | func compileMatcher(s string) Matcher {
cs, err := cascadia.Compile(s)
if err != nil {
return invalidMatcher{}
}
return cs
} | go | func compileMatcher(s string) Matcher {
cs, err := cascadia.Compile(s)
if err != nil {
return invalidMatcher{}
}
return cs
} | [
"func",
"compileMatcher",
"(",
"s",
"string",
")",
"Matcher",
"{",
"cs",
",",
"err",
":=",
"cascadia",
".",
"Compile",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"invalidMatcher",
"{",
"}",
"\n",
"}",
"\n",
"return",
"cs",
"\n",
... | // compileMatcher compiles the selector string s and returns
// the corresponding Matcher. If s is an invalid selector string,
// it returns a Matcher that fails all matches. | [
"compileMatcher",
"compiles",
"the",
"selector",
"string",
"s",
"and",
"returns",
"the",
"corresponding",
"Matcher",
".",
"If",
"s",
"is",
"an",
"invalid",
"selector",
"string",
"it",
"returns",
"a",
"Matcher",
"that",
"fails",
"all",
"matches",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/type.go#L122-L128 | train |
henrylee2cn/pholcus | common/util/util.go | IsNum | func IsNum(a string) bool {
reg, _ := regexp.Compile("^\\d+$")
return reg.MatchString(a)
} | go | func IsNum(a string) bool {
reg, _ := regexp.Compile("^\\d+$")
return reg.MatchString(a)
} | [
"func",
"IsNum",
"(",
"a",
"string",
")",
"bool",
"{",
"reg",
",",
"_",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\\\\",
"\"",
")",
"\n",
"return",
"reg",
".",
"MatchString",
"(",
"a",
")",
"\n",
"}"
] | // The IsNum judges string is number or not. | [
"The",
"IsNum",
"judges",
"string",
"is",
"number",
"or",
"not",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/util/util.go#L242-L245 | train |
henrylee2cn/pholcus | common/util/util.go | XML2mapstr | func XML2mapstr(xmldoc string) map[string]string {
var t xml.Token
var err error
inputReader := strings.NewReader(xmldoc)
decoder := xml.NewDecoder(inputReader)
decoder.CharsetReader = func(s string, r io.Reader) (io.Reader, error) {
return charset.NewReader(r, s)
}
m := make(map[string]string, 32)
key := ""
... | go | func XML2mapstr(xmldoc string) map[string]string {
var t xml.Token
var err error
inputReader := strings.NewReader(xmldoc)
decoder := xml.NewDecoder(inputReader)
decoder.CharsetReader = func(s string, r io.Reader) (io.Reader, error) {
return charset.NewReader(r, s)
}
m := make(map[string]string, 32)
key := ""
... | [
"func",
"XML2mapstr",
"(",
"xmldoc",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"var",
"t",
"xml",
".",
"Token",
"\n",
"var",
"err",
"error",
"\n",
"inputReader",
":=",
"strings",
".",
"NewReader",
"(",
"xmldoc",
")",
"\n",
"decoder",
":=... | // simple xml to string support utf8 | [
"simple",
"xml",
"to",
"string",
"support",
"utf8"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/util/util.go#L248-L271 | train |
henrylee2cn/pholcus | common/util/util.go | MakeHash | func MakeHash(s string) string {
const IEEE = 0xedb88320
var IEEETable = crc32.MakeTable(IEEE)
hash := fmt.Sprintf("%x", crc32.Checksum([]byte(s), IEEETable))
return hash
} | go | func MakeHash(s string) string {
const IEEE = 0xedb88320
var IEEETable = crc32.MakeTable(IEEE)
hash := fmt.Sprintf("%x", crc32.Checksum([]byte(s), IEEETable))
return hash
} | [
"func",
"MakeHash",
"(",
"s",
"string",
")",
"string",
"{",
"const",
"IEEE",
"=",
"0xedb88320",
"\n",
"var",
"IEEETable",
"=",
"crc32",
".",
"MakeTable",
"(",
"IEEE",
")",
"\n",
"hash",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"crc32",
".",... | //string to hash | [
"string",
"to",
"hash"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/util/util.go#L274-L279 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | lettersToNumeric | func lettersToNumeric(letters string) int {
sum, mul, n := 0, 1, 0
for i := len(letters) - 1; i >= 0; i, mul, n = i-1, mul*26, 1 {
c := letters[i]
switch {
case 'A' <= c && c <= 'Z':
n += int(c - 'A')
case 'a' <= c && c <= 'z':
n += int(c - 'a')
}
sum += n * mul
}
return sum
} | go | func lettersToNumeric(letters string) int {
sum, mul, n := 0, 1, 0
for i := len(letters) - 1; i >= 0; i, mul, n = i-1, mul*26, 1 {
c := letters[i]
switch {
case 'A' <= c && c <= 'Z':
n += int(c - 'A')
case 'a' <= c && c <= 'z':
n += int(c - 'a')
}
sum += n * mul
}
return sum
} | [
"func",
"lettersToNumeric",
"(",
"letters",
"string",
")",
"int",
"{",
"sum",
",",
"mul",
",",
"n",
":=",
"0",
",",
"1",
",",
"0",
"\n",
"for",
"i",
":=",
"len",
"(",
"letters",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
",",
"mul",
",",
... | // lettersToNumeric is used to convert a character based column
// reference to a zero based numeric column identifier. | [
"lettersToNumeric",
"is",
"used",
"to",
"convert",
"a",
"character",
"based",
"column",
"reference",
"to",
"a",
"zero",
"based",
"numeric",
"column",
"identifier",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L51-L64 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | getLargestDenominator | func getLargestDenominator(numerator, multiple, baseDenominator, power int) (int, int) {
if numerator/multiple == 0 {
return 1, power
}
next, nextPower := getLargestDenominator(
numerator, multiple*baseDenominator, baseDenominator, power+1)
if next > multiple {
return next, nextPower
}
return multiple, powe... | go | func getLargestDenominator(numerator, multiple, baseDenominator, power int) (int, int) {
if numerator/multiple == 0 {
return 1, power
}
next, nextPower := getLargestDenominator(
numerator, multiple*baseDenominator, baseDenominator, power+1)
if next > multiple {
return next, nextPower
}
return multiple, powe... | [
"func",
"getLargestDenominator",
"(",
"numerator",
",",
"multiple",
",",
"baseDenominator",
",",
"power",
"int",
")",
"(",
"int",
",",
"int",
")",
"{",
"if",
"numerator",
"/",
"multiple",
"==",
"0",
"{",
"return",
"1",
",",
"power",
"\n",
"}",
"\n",
"n... | // Get the largestDenominator that is a multiple of a basedDenominator
// and fits at least once into a given numerator. | [
"Get",
"the",
"largestDenominator",
"that",
"is",
"a",
"multiple",
"of",
"a",
"basedDenominator",
"and",
"fits",
"at",
"least",
"once",
"into",
"a",
"given",
"numerator",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L68-L78 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | formatColumnName | func formatColumnName(colId []int) string {
lastPart := len(colId) - 1
result := ""
for n, part := range colId {
if n == lastPart {
// The least significant number is in the
// range 0-25, all other numbers are 1-26,
// hence we use a differente offset for the
// last part.
result += string(part + ... | go | func formatColumnName(colId []int) string {
lastPart := len(colId) - 1
result := ""
for n, part := range colId {
if n == lastPart {
// The least significant number is in the
// range 0-25, all other numbers are 1-26,
// hence we use a differente offset for the
// last part.
result += string(part + ... | [
"func",
"formatColumnName",
"(",
"colId",
"[",
"]",
"int",
")",
"string",
"{",
"lastPart",
":=",
"len",
"(",
"colId",
")",
"-",
"1",
"\n\n",
"result",
":=",
"\"",
"\"",
"\n",
"for",
"n",
",",
"part",
":=",
"range",
"colId",
"{",
"if",
"n",
"==",
... | // Convers a list of numbers representing a column into a alphabetic
// representation, as used in the spreadsheet. | [
"Convers",
"a",
"list",
"of",
"numbers",
"representing",
"a",
"column",
"into",
"a",
"alphabetic",
"representation",
"as",
"used",
"in",
"the",
"spreadsheet",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L82-L102 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | numericToLetters | func numericToLetters(colRef int) string {
parts := intToBase26(colRef)
return formatColumnName(smooshBase26Slice(parts))
} | go | func numericToLetters(colRef int) string {
parts := intToBase26(colRef)
return formatColumnName(smooshBase26Slice(parts))
} | [
"func",
"numericToLetters",
"(",
"colRef",
"int",
")",
"string",
"{",
"parts",
":=",
"intToBase26",
"(",
"colRef",
")",
"\n",
"return",
"formatColumnName",
"(",
"smooshBase26Slice",
"(",
"parts",
")",
")",
"\n",
"}"
] | // numericToLetters is used to convert a zero based, numeric column
// indentifier into a character code. | [
"numericToLetters",
"is",
"used",
"to",
"convert",
"a",
"zero",
"based",
"numeric",
"column",
"indentifier",
"into",
"a",
"character",
"code",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L139-L142 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | letterOnlyMapF | func letterOnlyMapF(rune rune) rune {
switch {
case 'A' <= rune && rune <= 'Z':
return rune
case 'a' <= rune && rune <= 'z':
return rune - 32
}
return -1
} | go | func letterOnlyMapF(rune rune) rune {
switch {
case 'A' <= rune && rune <= 'Z':
return rune
case 'a' <= rune && rune <= 'z':
return rune - 32
}
return -1
} | [
"func",
"letterOnlyMapF",
"(",
"rune",
"rune",
")",
"rune",
"{",
"switch",
"{",
"case",
"'A'",
"<=",
"rune",
"&&",
"rune",
"<=",
"'Z'",
":",
"return",
"rune",
"\n",
"case",
"'a'",
"<=",
"rune",
"&&",
"rune",
"<=",
"'z'",
":",
"return",
"rune",
"-",
... | // letterOnlyMapF is used in conjunction with strings.Map to return
// only the characters A-Z and a-z in a string | [
"letterOnlyMapF",
"is",
"used",
"in",
"conjunction",
"with",
"strings",
".",
"Map",
"to",
"return",
"only",
"the",
"characters",
"A",
"-",
"Z",
"and",
"a",
"-",
"z",
"in",
"a",
"string"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L146-L154 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | getCellIDStringFromCoords | func getCellIDStringFromCoords(x, y int) string {
letterPart := numericToLetters(x)
numericPart := y + 1
return fmt.Sprintf("%s%d", letterPart, numericPart)
} | go | func getCellIDStringFromCoords(x, y int) string {
letterPart := numericToLetters(x)
numericPart := y + 1
return fmt.Sprintf("%s%d", letterPart, numericPart)
} | [
"func",
"getCellIDStringFromCoords",
"(",
"x",
",",
"y",
"int",
")",
"string",
"{",
"letterPart",
":=",
"numericToLetters",
"(",
"x",
")",
"\n",
"numericPart",
":=",
"y",
"+",
"1",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"letterPart"... | // getCellIDStringFromCoords returns the Excel format cell name that
// represents a pair of zero based cartesian coordinates. | [
"getCellIDStringFromCoords",
"returns",
"the",
"Excel",
"format",
"cell",
"name",
"that",
"represents",
"a",
"pair",
"of",
"zero",
"based",
"cartesian",
"coordinates",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L181-L185 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | makeRowFromSpan | func makeRowFromSpan(spans string, sheet *Sheet) *Row {
var error error
var upper int
var row *Row
var cell *Cell
row = new(Row)
row.Sheet = sheet
_, upper, error = getRangeFromString(spans)
if error != nil {
panic(error)
}
error = nil
row.Cells = make([]*Cell, upper)
for i := 0; i < upper; i++ {
cell ... | go | func makeRowFromSpan(spans string, sheet *Sheet) *Row {
var error error
var upper int
var row *Row
var cell *Cell
row = new(Row)
row.Sheet = sheet
_, upper, error = getRangeFromString(spans)
if error != nil {
panic(error)
}
error = nil
row.Cells = make([]*Cell, upper)
for i := 0; i < upper; i++ {
cell ... | [
"func",
"makeRowFromSpan",
"(",
"spans",
"string",
",",
"sheet",
"*",
"Sheet",
")",
"*",
"Row",
"{",
"var",
"error",
"error",
"\n",
"var",
"upper",
"int",
"\n",
"var",
"row",
"*",
"Row",
"\n",
"var",
"cell",
"*",
"Cell",
"\n\n",
"row",
"=",
"new",
... | // makeRowFromSpan will, when given a span expressed as a string,
// return an empty Row large enough to encompass that span and
// populate it with empty cells. All rows start from cell 1 -
// regardless of the lower bound of the span. | [
"makeRowFromSpan",
"will",
"when",
"given",
"a",
"span",
"expressed",
"as",
"a",
"string",
"return",
"an",
"empty",
"Row",
"large",
"enough",
"to",
"encompass",
"that",
"span",
"and",
"populate",
"it",
"with",
"empty",
"cells",
".",
"All",
"rows",
"start",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L254-L274 | train |
henrylee2cn/pholcus | common/xlsx/lib.go | readWorkbookRelationsFromZipFile | func readWorkbookRelationsFromZipFile(workbookRels *zip.File) (WorkBookRels, error) {
var sheetXMLMap WorkBookRels
var wbRelationships *xlsxWorkbookRels
var rc io.ReadCloser
var decoder *xml.Decoder
var err error
rc, err = workbookRels.Open()
if err != nil {
return nil, err
}
decoder = xml.NewDecoder(rc)
w... | go | func readWorkbookRelationsFromZipFile(workbookRels *zip.File) (WorkBookRels, error) {
var sheetXMLMap WorkBookRels
var wbRelationships *xlsxWorkbookRels
var rc io.ReadCloser
var decoder *xml.Decoder
var err error
rc, err = workbookRels.Open()
if err != nil {
return nil, err
}
decoder = xml.NewDecoder(rc)
w... | [
"func",
"readWorkbookRelationsFromZipFile",
"(",
"workbookRels",
"*",
"zip",
".",
"File",
")",
"(",
"WorkBookRels",
",",
"error",
")",
"{",
"var",
"sheetXMLMap",
"WorkBookRels",
"\n",
"var",
"wbRelationships",
"*",
"xlsxWorkbookRels",
"\n",
"var",
"rc",
"io",
".... | // readWorkbookRelationsFromZipFile is an internal helper function to
// extract a map of relationship ID strings to the name of the
// worksheet.xml file they refer to. The resulting map can be used to
// reliably derefence the worksheets in the XLSX file. | [
"readWorkbookRelationsFromZipFile",
"is",
"an",
"internal",
"helper",
"function",
"to",
"extract",
"a",
"map",
"of",
"relationship",
"ID",
"strings",
"to",
"the",
"name",
"of",
"the",
"worksheet",
".",
"xml",
"file",
"they",
"refer",
"to",
".",
"The",
"resulti... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/xlsx/lib.go#L783-L808 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Find | func (s *Selection) Find(selector string) *Selection {
return pushStack(s, findWithMatcher(s.Nodes, compileMatcher(selector)))
} | go | func (s *Selection) Find(selector string) *Selection {
return pushStack(s, findWithMatcher(s.Nodes, compileMatcher(selector)))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Find",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"findWithMatcher",
"(",
"s",
".",
"Nodes",
",",
"compileMatcher",
"(",
"selector",
")",
")",
")",
"\n",
"}"
] | // Find gets the descendants of each element in the current set of matched
// elements, filtered by a selector. It returns a new Selection object
// containing these matched elements. | [
"Find",
"gets",
"the",
"descendants",
"of",
"each",
"element",
"in",
"the",
"current",
"set",
"of",
"matched",
"elements",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"matched",
"elements",... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L23-L25 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | FindMatcher | func (s *Selection) FindMatcher(m Matcher) *Selection {
return pushStack(s, findWithMatcher(s.Nodes, m))
} | go | func (s *Selection) FindMatcher(m Matcher) *Selection {
return pushStack(s, findWithMatcher(s.Nodes, m))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FindMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"findWithMatcher",
"(",
"s",
".",
"Nodes",
",",
"m",
")",
")",
"\n",
"}"
] | // FindMatcher gets the descendants of each element in the current set of matched
// elements, filtered by the matcher. It returns a new Selection object
// containing these matched elements. | [
"FindMatcher",
"gets",
"the",
"descendants",
"of",
"each",
"element",
"in",
"the",
"current",
"set",
"of",
"matched",
"elements",
"filtered",
"by",
"the",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"matched",
"el... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L30-L32 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | FindSelection | func (s *Selection) FindSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, nil)
}
return s.FindNodes(sel.Nodes...)
} | go | func (s *Selection) FindSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, nil)
}
return s.FindNodes(sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FindSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"pushStack",
"(",
"s",
",",
"nil",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"FindNodes",
"... | // FindSelection gets the descendants of each element in the current
// Selection, filtered by a Selection. It returns a new Selection object
// containing these matched elements. | [
"FindSelection",
"gets",
"the",
"descendants",
"of",
"each",
"element",
"in",
"the",
"current",
"Selection",
"filtered",
"by",
"a",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L37-L42 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | FindNodes | func (s *Selection) FindNodes(nodes ...*html.Node) *Selection {
return pushStack(s, mapNodes(nodes, func(i int, n *html.Node) []*html.Node {
if sliceContains(s.Nodes, n) {
return []*html.Node{n}
}
return nil
}))
} | go | func (s *Selection) FindNodes(nodes ...*html.Node) *Selection {
return pushStack(s, mapNodes(nodes, func(i int, n *html.Node) []*html.Node {
if sliceContains(s.Nodes, n) {
return []*html.Node{n}
}
return nil
}))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FindNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"mapNodes",
"(",
"nodes",
",",
"func",
"(",
"i",
"int",
",",
"n",
"*",
"html",
... | // FindNodes gets the descendants of each element in the current
// Selection, filtered by some nodes. It returns a new Selection object
// containing these matched elements. | [
"FindNodes",
"gets",
"the",
"descendants",
"of",
"each",
"element",
"in",
"the",
"current",
"Selection",
"filtered",
"by",
"some",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L47-L54 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Contents | func (s *Selection) Contents() *Selection {
return pushStack(s, getChildrenNodes(s.Nodes, siblingAllIncludingNonElements))
} | go | func (s *Selection) Contents() *Selection {
return pushStack(s, getChildrenNodes(s.Nodes, siblingAllIncludingNonElements))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Contents",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getChildrenNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAllIncludingNonElements",
")",
")",
"\n",
"}"
] | // Contents gets the children of each element in the Selection,
// including text and comment nodes. It returns a new Selection object
// containing these elements. | [
"Contents",
"gets",
"the",
"children",
"of",
"each",
"element",
"in",
"the",
"Selection",
"including",
"text",
"and",
"comment",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L59-L61 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ContentsFiltered | func (s *Selection) ContentsFiltered(selector string) *Selection {
if selector != "" {
return s.ChildrenFiltered(selector)
}
return s.Contents()
} | go | func (s *Selection) ContentsFiltered(selector string) *Selection {
if selector != "" {
return s.ChildrenFiltered(selector)
}
return s.Contents()
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ContentsFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"if",
"selector",
"!=",
"\"",
"\"",
"{",
"return",
"s",
".",
"ChildrenFiltered",
"(",
"selector",
")",
"\n",
"}",
"\n",
"return",
"s",
"... | // ContentsFiltered gets the children of each element in the Selection,
// filtered by the specified selector. It returns a new Selection
// object containing these elements. Since selectors only act on Element nodes,
// this function is an alias to ChildrenFiltered unless the selector is empty,
// in which case it is ... | [
"ContentsFiltered",
"gets",
"the",
"children",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"the",
"specified",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"elements",
".",
"Since",
"selecto... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L68-L73 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Children | func (s *Selection) Children() *Selection {
return pushStack(s, getChildrenNodes(s.Nodes, siblingAll))
} | go | func (s *Selection) Children() *Selection {
return pushStack(s, getChildrenNodes(s.Nodes, siblingAll))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Children",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getChildrenNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAll",
")",
")",
"\n",
"}"
] | // Children gets the child elements of each element in the Selection.
// It returns a new Selection object containing these elements. | [
"Children",
"gets",
"the",
"child",
"elements",
"of",
"each",
"element",
"in",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L85-L87 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ChildrenFiltered | func (s *Selection) ChildrenFiltered(selector string) *Selection {
return filterAndPush(s, getChildrenNodes(s.Nodes, siblingAll), compileMatcher(selector))
} | go | func (s *Selection) ChildrenFiltered(selector string) *Selection {
return filterAndPush(s, getChildrenNodes(s.Nodes, siblingAll), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ChildrenFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getChildrenNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAll",
")",
",",
"compileMatcher",
"(",
"s... | // ChildrenFiltered gets the child elements of each element in the Selection,
// filtered by the specified selector. It returns a new
// Selection object containing these elements. | [
"ChildrenFiltered",
"gets",
"the",
"child",
"elements",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"the",
"specified",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L92-L94 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ChildrenMatcher | func (s *Selection) ChildrenMatcher(m Matcher) *Selection {
return filterAndPush(s, getChildrenNodes(s.Nodes, siblingAll), m)
} | go | func (s *Selection) ChildrenMatcher(m Matcher) *Selection {
return filterAndPush(s, getChildrenNodes(s.Nodes, siblingAll), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ChildrenMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getChildrenNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAll",
")",
",",
"m",
")",
"\n",
"}"
] | // ChildrenMatcher gets the child elements of each element in the Selection,
// filtered by the specified matcher. It returns a new
// Selection object containing these elements. | [
"ChildrenMatcher",
"gets",
"the",
"child",
"elements",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"the",
"specified",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"these",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L99-L101 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentFiltered | func (s *Selection) ParentFiltered(selector string) *Selection {
return filterAndPush(s, getParentNodes(s.Nodes), compileMatcher(selector))
} | go | func (s *Selection) ParentFiltered(selector string) *Selection {
return filterAndPush(s, getParentNodes(s.Nodes), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentNodes",
"(",
"s",
".",
"Nodes",
")",
",",
"compileMatcher",
"(",
"selector",
")",
")",
"... | // ParentFiltered gets the parent of each element in the Selection filtered by a
// selector. It returns a new Selection object containing the matched elements. | [
"ParentFiltered",
"gets",
"the",
"parent",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L111-L113 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentMatcher | func (s *Selection) ParentMatcher(m Matcher) *Selection {
return filterAndPush(s, getParentNodes(s.Nodes), m)
} | go | func (s *Selection) ParentMatcher(m Matcher) *Selection {
return filterAndPush(s, getParentNodes(s.Nodes), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentNodes",
"(",
"s",
".",
"Nodes",
")",
",",
"m",
")",
"\n",
"}"
] | // ParentMatcher gets the parent of each element in the Selection filtered by a
// matcher. It returns a new Selection object containing the matched elements. | [
"ParentMatcher",
"gets",
"the",
"parent",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L117-L119 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Closest | func (s *Selection) Closest(selector string) *Selection {
cs := compileMatcher(selector)
return s.ClosestMatcher(cs)
} | go | func (s *Selection) Closest(selector string) *Selection {
cs := compileMatcher(selector)
return s.ClosestMatcher(cs)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Closest",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"cs",
":=",
"compileMatcher",
"(",
"selector",
")",
"\n",
"return",
"s",
".",
"ClosestMatcher",
"(",
"cs",
")",
"\n",
"}"
] | // Closest gets the first element that matches the selector by testing the
// element itself and traversing up through its ancestors in the DOM tree. | [
"Closest",
"gets",
"the",
"first",
"element",
"that",
"matches",
"the",
"selector",
"by",
"testing",
"the",
"element",
"itself",
"and",
"traversing",
"up",
"through",
"its",
"ancestors",
"in",
"the",
"DOM",
"tree",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L123-L126 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ClosestMatcher | func (s *Selection) ClosestMatcher(m Matcher) *Selection {
return pushStack(s, mapNodes(s.Nodes, func(i int, n *html.Node) []*html.Node {
// For each node in the selection, test the node itself, then each parent
// until a match is found.
for ; n != nil; n = n.Parent {
if m.Match(n) {
return []*html.Node{... | go | func (s *Selection) ClosestMatcher(m Matcher) *Selection {
return pushStack(s, mapNodes(s.Nodes, func(i int, n *html.Node) []*html.Node {
// For each node in the selection, test the node itself, then each parent
// until a match is found.
for ; n != nil; n = n.Parent {
if m.Match(n) {
return []*html.Node{... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ClosestMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"mapNodes",
"(",
"s",
".",
"Nodes",
",",
"func",
"(",
"i",
"int",
",",
"n",
"*",
"html",
".",
"Node",
... | // ClosestMatcher gets the first element that matches the matcher by testing the
// element itself and traversing up through its ancestors in the DOM tree. | [
"ClosestMatcher",
"gets",
"the",
"first",
"element",
"that",
"matches",
"the",
"matcher",
"by",
"testing",
"the",
"element",
"itself",
"and",
"traversing",
"up",
"through",
"its",
"ancestors",
"in",
"the",
"DOM",
"tree",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L130-L141 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ClosestNodes | func (s *Selection) ClosestNodes(nodes ...*html.Node) *Selection {
set := make(map[*html.Node]bool)
for _, n := range nodes {
set[n] = true
}
return pushStack(s, mapNodes(s.Nodes, func(i int, n *html.Node) []*html.Node {
// For each node in the selection, test the node itself, then each parent
// until a matc... | go | func (s *Selection) ClosestNodes(nodes ...*html.Node) *Selection {
set := make(map[*html.Node]bool)
for _, n := range nodes {
set[n] = true
}
return pushStack(s, mapNodes(s.Nodes, func(i int, n *html.Node) []*html.Node {
// For each node in the selection, test the node itself, then each parent
// until a matc... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ClosestNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"set",
":=",
"make",
"(",
"map",
"[",
"*",
"html",
".",
"Node",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"n",
":... | // ClosestNodes gets the first element that matches one of the nodes by testing the
// element itself and traversing up through its ancestors in the DOM tree. | [
"ClosestNodes",
"gets",
"the",
"first",
"element",
"that",
"matches",
"one",
"of",
"the",
"nodes",
"by",
"testing",
"the",
"element",
"itself",
"and",
"traversing",
"up",
"through",
"its",
"ancestors",
"in",
"the",
"DOM",
"tree",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L145-L160 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ClosestSelection | func (s *Selection) ClosestSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, nil)
}
return s.ClosestNodes(sel.Nodes...)
} | go | func (s *Selection) ClosestSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, nil)
}
return s.ClosestNodes(sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ClosestSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"pushStack",
"(",
"s",
",",
"nil",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"ClosestNodes... | // ClosestSelection gets the first element that matches one of the nodes in the
// Selection by testing the element itself and traversing up through its ancestors
// in the DOM tree. | [
"ClosestSelection",
"gets",
"the",
"first",
"element",
"that",
"matches",
"one",
"of",
"the",
"nodes",
"in",
"the",
"Selection",
"by",
"testing",
"the",
"element",
"itself",
"and",
"traversing",
"up",
"through",
"its",
"ancestors",
"in",
"the",
"DOM",
"tree",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L165-L170 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Parents | func (s *Selection) Parents() *Selection {
return pushStack(s, getParentsNodes(s.Nodes, nil, nil))
} | go | func (s *Selection) Parents() *Selection {
return pushStack(s, getParentsNodes(s.Nodes, nil, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Parents",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"nil",
",",
"nil",
")",
")",
"\n",
"}"
] | // Parents gets the ancestors of each element in the current Selection. It
// returns a new Selection object with the matched elements. | [
"Parents",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"current",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L174-L176 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsFiltered | func (s *Selection) ParentsFiltered(selector string) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nil), compileMatcher(selector))
} | go | func (s *Selection) ParentsFiltered(selector string) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nil), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"nil",
",",
"nil",
")",
",",
"compileMatcher",
"(... | // ParentsFiltered gets the ancestors of each element in the current
// Selection. It returns a new Selection object with the matched elements. | [
"ParentsFiltered",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"current",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L180-L182 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsMatcher | func (s *Selection) ParentsMatcher(m Matcher) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nil), m)
} | go | func (s *Selection) ParentsMatcher(m Matcher) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nil), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"nil",
",",
"nil",
")",
",",
"m",
")",
"\n",
"}"
] | // ParentsMatcher gets the ancestors of each element in the current
// Selection. It returns a new Selection object with the matched elements. | [
"ParentsMatcher",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"current",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L186-L188 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsUntil | func (s *Selection) ParentsUntil(selector string) *Selection {
return pushStack(s, getParentsNodes(s.Nodes, compileMatcher(selector), nil))
} | go | func (s *Selection) ParentsUntil(selector string) *Selection {
return pushStack(s, getParentsNodes(s.Nodes, compileMatcher(selector), nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsUntil",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"compileMatcher",
"(",
"selector",
")",
",",
"nil",
")",... | // ParentsUntil gets the ancestors of each element in the Selection, up to but
// not including the element matched by the selector. It returns a new Selection
// object containing the matched elements. | [
"ParentsUntil",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"Selection",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L193-L195 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsUntilMatcher | func (s *Selection) ParentsUntilMatcher(m Matcher) *Selection {
return pushStack(s, getParentsNodes(s.Nodes, m, nil))
} | go | func (s *Selection) ParentsUntilMatcher(m Matcher) *Selection {
return pushStack(s, getParentsNodes(s.Nodes, m, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsUntilMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"m",
",",
"nil",
")",
")",
"\n",
"}"
] | // ParentsUntilMatcher gets the ancestors of each element in the Selection, up to but
// not including the element matched by the matcher. It returns a new Selection
// object containing the matched elements. | [
"ParentsUntilMatcher",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"Selection",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containi... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L200-L202 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsUntilSelection | func (s *Selection) ParentsUntilSelection(sel *Selection) *Selection {
if sel == nil {
return s.Parents()
}
return s.ParentsUntilNodes(sel.Nodes...)
} | go | func (s *Selection) ParentsUntilSelection(sel *Selection) *Selection {
if sel == nil {
return s.Parents()
}
return s.ParentsUntilNodes(sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsUntilSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"Parents",
"(",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"ParentsUntilNodes"... | // ParentsUntilSelection gets the ancestors of each element in the Selection,
// up to but not including the elements in the specified Selection. It returns a
// new Selection object containing the matched elements. | [
"ParentsUntilSelection",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"Selection",
"up",
"to",
"but",
"not",
"including",
"the",
"elements",
"in",
"the",
"specified",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"c... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L207-L212 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsUntilNodes | func (s *Selection) ParentsUntilNodes(nodes ...*html.Node) *Selection {
return pushStack(s, getParentsNodes(s.Nodes, nil, nodes))
} | go | func (s *Selection) ParentsUntilNodes(nodes ...*html.Node) *Selection {
return pushStack(s, getParentsNodes(s.Nodes, nil, nodes))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsUntilNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"nil",
",",
"nodes",
")",
"... | // ParentsUntilNodes gets the ancestors of each element in the Selection,
// up to but not including the specified nodes. It returns a
// new Selection object containing the matched elements. | [
"ParentsUntilNodes",
"gets",
"the",
"ancestors",
"of",
"each",
"element",
"in",
"the",
"Selection",
"up",
"to",
"but",
"not",
"including",
"the",
"specified",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"el... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L217-L219 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsFilteredUntil | func (s *Selection) ParentsFilteredUntil(filterSelector, untilSelector string) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, compileMatcher(untilSelector), nil), compileMatcher(filterSelector))
} | go | func (s *Selection) ParentsFilteredUntil(filterSelector, untilSelector string) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, compileMatcher(untilSelector), nil), compileMatcher(filterSelector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsFilteredUntil",
"(",
"filterSelector",
",",
"untilSelector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"compileMatcher",
"(",... | // ParentsFilteredUntil is like ParentsUntil, with the option to filter the
// results based on a selector string. It returns a new Selection
// object containing the matched elements. | [
"ParentsFilteredUntil",
"is",
"like",
"ParentsUntil",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L224-L226 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsFilteredUntilMatcher | func (s *Selection) ParentsFilteredUntilMatcher(filter, until Matcher) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, until, nil), filter)
} | go | func (s *Selection) ParentsFilteredUntilMatcher(filter, until Matcher) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, until, nil), filter)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsFilteredUntilMatcher",
"(",
"filter",
",",
"until",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
",",
"until",
",",
"nil",
")",
... | // ParentsFilteredUntilMatcher is like ParentsUntilMatcher, with the option to filter the
// results based on a matcher. It returns a new Selection object containing the matched elements. | [
"ParentsFilteredUntilMatcher",
"is",
"like",
"ParentsUntilMatcher",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L230-L232 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsFilteredUntilSelection | func (s *Selection) ParentsFilteredUntilSelection(filterSelector string, sel *Selection) *Selection {
return s.ParentsMatcherUntilSelection(compileMatcher(filterSelector), sel)
} | go | func (s *Selection) ParentsFilteredUntilSelection(filterSelector string, sel *Selection) *Selection {
return s.ParentsMatcherUntilSelection(compileMatcher(filterSelector), sel)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsFilteredUntilSelection",
"(",
"filterSelector",
"string",
",",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"ParentsMatcherUntilSelection",
"(",
"compileMatcher",
"(",
"filterSelector",
"... | // ParentsFilteredUntilSelection is like ParentsUntilSelection, with the
// option to filter the results based on a selector string. It returns a new
// Selection object containing the matched elements. | [
"ParentsFilteredUntilSelection",
"is",
"like",
"ParentsUntilSelection",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"e... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L237-L239 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsMatcherUntilSelection | func (s *Selection) ParentsMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
if sel == nil {
return s.ParentsMatcher(filter)
}
return s.ParentsMatcherUntilNodes(filter, sel.Nodes...)
} | go | func (s *Selection) ParentsMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
if sel == nil {
return s.ParentsMatcher(filter)
}
return s.ParentsMatcherUntilNodes(filter, sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsMatcherUntilSelection",
"(",
"filter",
"Matcher",
",",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"ParentsMatcher",
"(",
"filter",
")",
"\n",
"}... | // ParentsMatcherUntilSelection is like ParentsUntilSelection, with the
// option to filter the results based on a matcher. It returns a new
// Selection object containing the matched elements. | [
"ParentsMatcherUntilSelection",
"is",
"like",
"ParentsUntilSelection",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
".... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L244-L249 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsFilteredUntilNodes | func (s *Selection) ParentsFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nodes), compileMatcher(filterSelector))
} | go | func (s *Selection) ParentsFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nodes), compileMatcher(filterSelector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsFilteredUntilNodes",
"(",
"filterSelector",
"string",
",",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"N... | // ParentsFilteredUntilNodes is like ParentsUntilNodes, with the
// option to filter the results based on a selector string. It returns a new
// Selection object containing the matched elements. | [
"ParentsFilteredUntilNodes",
"is",
"like",
"ParentsUntilNodes",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L254-L256 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | ParentsMatcherUntilNodes | func (s *Selection) ParentsMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nodes), filter)
} | go | func (s *Selection) ParentsMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection {
return filterAndPush(s, getParentsNodes(s.Nodes, nil, nodes), filter)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ParentsMatcherUntilNodes",
"(",
"filter",
"Matcher",
",",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getParentsNodes",
"(",
"s",
".",
"Nodes",
... | // ParentsMatcherUntilNodes is like ParentsUntilNodes, with the
// option to filter the results based on a matcher. It returns a new
// Selection object containing the matched elements. | [
"ParentsMatcherUntilNodes",
"is",
"like",
"ParentsUntilNodes",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L261-L263 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Siblings | func (s *Selection) Siblings() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingAll, nil, nil))
} | go | func (s *Selection) Siblings() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingAll, nil, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Siblings",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAll",
",",
"nil",
",",
"nil",
")",
")",
"\n",
"}"
] | // Siblings gets the siblings of each element in the Selection. It returns
// a new Selection object containing the matched elements. | [
"Siblings",
"gets",
"the",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L267-L269 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | SiblingsFiltered | func (s *Selection) SiblingsFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingAll, nil, nil), compileMatcher(selector))
} | go | func (s *Selection) SiblingsFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingAll, nil, nil), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"SiblingsFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAll",
",",
"nil",
",",
"nil",
")",
",",
... | // SiblingsFiltered gets the siblings of each element in the Selection
// filtered by a selector. It returns a new Selection object containing the
// matched elements. | [
"SiblingsFiltered",
"gets",
"the",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L274-L276 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | SiblingsMatcher | func (s *Selection) SiblingsMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingAll, nil, nil), m)
} | go | func (s *Selection) SiblingsMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingAll, nil, nil), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"SiblingsMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingAll",
",",
"nil",
",",
"nil",
")",
",",
"m",
... | // SiblingsMatcher gets the siblings of each element in the Selection
// filtered by a matcher. It returns a new Selection object containing the
// matched elements. | [
"SiblingsMatcher",
"gets",
"the",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L281-L283 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Next | func (s *Selection) Next() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNext, nil, nil))
} | go | func (s *Selection) Next() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNext, nil, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Next",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNext",
",",
"nil",
",",
"nil",
")",
")",
"\n",
"}"
] | // Next gets the immediately following sibling of each element in the
// Selection. It returns a new Selection object containing the matched elements. | [
"Next",
"gets",
"the",
"immediately",
"following",
"sibling",
"of",
"each",
"element",
"in",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L287-L289 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextFiltered | func (s *Selection) NextFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNext, nil, nil), compileMatcher(selector))
} | go | func (s *Selection) NextFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNext, nil, nil), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNext",
",",
"nil",
",",
"nil",
")",
",",
"... | // NextFiltered gets the immediately following sibling of each element in the
// Selection filtered by a selector. It returns a new Selection object
// containing the matched elements. | [
"NextFiltered",
"gets",
"the",
"immediately",
"following",
"sibling",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L294-L296 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextMatcher | func (s *Selection) NextMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNext, nil, nil), m)
} | go | func (s *Selection) NextMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNext, nil, nil), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNext",
",",
"nil",
",",
"nil",
")",
",",
"m",
"... | // NextMatcher gets the immediately following sibling of each element in the
// Selection filtered by a matcher. It returns a new Selection object
// containing the matched elements. | [
"NextMatcher",
"gets",
"the",
"immediately",
"following",
"sibling",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L301-L303 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextAll | func (s *Selection) NextAll() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextAll, nil, nil))
} | go | func (s *Selection) NextAll() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextAll, nil, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextAll",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextAll",
",",
"nil",
",",
"nil",
")",
")",
"\n",
"}"
] | // NextAll gets all the following siblings of each element in the
// Selection. It returns a new Selection object containing the matched elements. | [
"NextAll",
"gets",
"all",
"the",
"following",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L307-L309 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextAllFiltered | func (s *Selection) NextAllFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextAll, nil, nil), compileMatcher(selector))
} | go | func (s *Selection) NextAllFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextAll, nil, nil), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextAllFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextAll",
",",
"nil",
",",
"nil",
")",
",... | // NextAllFiltered gets all the following siblings of each element in the
// Selection filtered by a selector. It returns a new Selection object
// containing the matched elements. | [
"NextAllFiltered",
"gets",
"all",
"the",
"following",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L314-L316 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextAllMatcher | func (s *Selection) NextAllMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextAll, nil, nil), m)
} | go | func (s *Selection) NextAllMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextAll, nil, nil), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextAllMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextAll",
",",
"nil",
",",
"nil",
")",
",",
"m... | // NextAllMatcher gets all the following siblings of each element in the
// Selection filtered by a matcher. It returns a new Selection object
// containing the matched elements. | [
"NextAllMatcher",
"gets",
"all",
"the",
"following",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L321-L323 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | Prev | func (s *Selection) Prev() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrev, nil, nil))
} | go | func (s *Selection) Prev() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrev, nil, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Prev",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrev",
",",
"nil",
",",
"nil",
")",
")",
"\n",
"}"
] | // Prev gets the immediately preceding sibling of each element in the
// Selection. It returns a new Selection object containing the matched elements. | [
"Prev",
"gets",
"the",
"immediately",
"preceding",
"sibling",
"of",
"each",
"element",
"in",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L327-L329 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevFiltered | func (s *Selection) PrevFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrev, nil, nil), compileMatcher(selector))
} | go | func (s *Selection) PrevFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrev, nil, nil), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrev",
",",
"nil",
",",
"nil",
")",
",",
"... | // PrevFiltered gets the immediately preceding sibling of each element in the
// Selection filtered by a selector. It returns a new Selection object
// containing the matched elements. | [
"PrevFiltered",
"gets",
"the",
"immediately",
"preceding",
"sibling",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L334-L336 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevMatcher | func (s *Selection) PrevMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrev, nil, nil), m)
} | go | func (s *Selection) PrevMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrev, nil, nil), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrev",
",",
"nil",
",",
"nil",
")",
",",
"m",
"... | // PrevMatcher gets the immediately preceding sibling of each element in the
// Selection filtered by a matcher. It returns a new Selection object
// containing the matched elements. | [
"PrevMatcher",
"gets",
"the",
"immediately",
"preceding",
"sibling",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L341-L343 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevAll | func (s *Selection) PrevAll() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevAll, nil, nil))
} | go | func (s *Selection) PrevAll() *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevAll, nil, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevAll",
"(",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevAll",
",",
"nil",
",",
"nil",
")",
")",
"\n",
"}"
] | // PrevAll gets all the preceding siblings of each element in the
// Selection. It returns a new Selection object containing the matched elements. | [
"PrevAll",
"gets",
"all",
"the",
"preceding",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L347-L349 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevAllFiltered | func (s *Selection) PrevAllFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevAll, nil, nil), compileMatcher(selector))
} | go | func (s *Selection) PrevAllFiltered(selector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevAll, nil, nil), compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevAllFiltered",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevAll",
",",
"nil",
",",
"nil",
")",
",... | // PrevAllFiltered gets all the preceding siblings of each element in the
// Selection filtered by a selector. It returns a new Selection object
// containing the matched elements. | [
"PrevAllFiltered",
"gets",
"all",
"the",
"preceding",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L354-L356 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevAllMatcher | func (s *Selection) PrevAllMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevAll, nil, nil), m)
} | go | func (s *Selection) PrevAllMatcher(m Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevAll, nil, nil), m)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevAllMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevAll",
",",
"nil",
",",
"nil",
")",
",",
"m... | // PrevAllMatcher gets all the preceding siblings of each element in the
// Selection filtered by a matcher. It returns a new Selection object
// containing the matched elements. | [
"PrevAllMatcher",
"gets",
"all",
"the",
"preceding",
"siblings",
"of",
"each",
"element",
"in",
"the",
"Selection",
"filtered",
"by",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L361-L363 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextUntil | func (s *Selection) NextUntil(selector string) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextUntil,
compileMatcher(selector), nil))
} | go | func (s *Selection) NextUntil(selector string) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextUntil,
compileMatcher(selector), nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextUntil",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextUntil",
",",
"compileMatcher",
"(",
"selector",
"... | // NextUntil gets all following siblings of each element up to but not
// including the element matched by the selector. It returns a new Selection
// object containing the matched elements. | [
"NextUntil",
"gets",
"all",
"following",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L368-L371 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextUntilMatcher | func (s *Selection) NextUntilMatcher(m Matcher) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextUntil,
m, nil))
} | go | func (s *Selection) NextUntilMatcher(m Matcher) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextUntil,
m, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextUntilMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextUntil",
",",
"m",
",",
"nil",
")",
")",
"\n"... | // NextUntilMatcher gets all following siblings of each element up to but not
// including the element matched by the matcher. It returns a new Selection
// object containing the matched elements. | [
"NextUntilMatcher",
"gets",
"all",
"following",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matc... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L376-L379 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextUntilSelection | func (s *Selection) NextUntilSelection(sel *Selection) *Selection {
if sel == nil {
return s.NextAll()
}
return s.NextUntilNodes(sel.Nodes...)
} | go | func (s *Selection) NextUntilSelection(sel *Selection) *Selection {
if sel == nil {
return s.NextAll()
}
return s.NextUntilNodes(sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextUntilSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"NextAll",
"(",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"NextUntilNodes",
"(... | // NextUntilSelection gets all following siblings of each element up to but not
// including the element matched by the Selection. It returns a new Selection
// object containing the matched elements. | [
"NextUntilSelection",
"gets",
"all",
"following",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L384-L389 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextUntilNodes | func (s *Selection) NextUntilNodes(nodes ...*html.Node) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextUntil,
nil, nodes))
} | go | func (s *Selection) NextUntilNodes(nodes ...*html.Node) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingNextUntil,
nil, nodes))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextUntilNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextUntil",
",",
"nil",
... | // NextUntilNodes gets all following siblings of each element up to but not
// including the element matched by the nodes. It returns a new Selection
// object containing the matched elements. | [
"NextUntilNodes",
"gets",
"all",
"following",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L394-L397 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevUntil | func (s *Selection) PrevUntil(selector string) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
compileMatcher(selector), nil))
} | go | func (s *Selection) PrevUntil(selector string) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
compileMatcher(selector), nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevUntil",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevUntil",
",",
"compileMatcher",
"(",
"selector",
"... | // PrevUntil gets all preceding siblings of each element up to but not
// including the element matched by the selector. It returns a new Selection
// object containing the matched elements. | [
"PrevUntil",
"gets",
"all",
"preceding",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L402-L405 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevUntilMatcher | func (s *Selection) PrevUntilMatcher(m Matcher) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
m, nil))
} | go | func (s *Selection) PrevUntilMatcher(m Matcher) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
m, nil))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevUntilMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevUntil",
",",
"m",
",",
"nil",
")",
")",
"\n"... | // PrevUntilMatcher gets all preceding siblings of each element up to but not
// including the element matched by the matcher. It returns a new Selection
// object containing the matched elements. | [
"PrevUntilMatcher",
"gets",
"all",
"preceding",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matc... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L410-L413 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevUntilSelection | func (s *Selection) PrevUntilSelection(sel *Selection) *Selection {
if sel == nil {
return s.PrevAll()
}
return s.PrevUntilNodes(sel.Nodes...)
} | go | func (s *Selection) PrevUntilSelection(sel *Selection) *Selection {
if sel == nil {
return s.PrevAll()
}
return s.PrevUntilNodes(sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevUntilSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"PrevAll",
"(",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"PrevUntilNodes",
"(... | // PrevUntilSelection gets all preceding siblings of each element up to but not
// including the element matched by the Selection. It returns a new Selection
// object containing the matched elements. | [
"PrevUntilSelection",
"gets",
"all",
"preceding",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"Selection",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L418-L423 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevUntilNodes | func (s *Selection) PrevUntilNodes(nodes ...*html.Node) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
nil, nodes))
} | go | func (s *Selection) PrevUntilNodes(nodes ...*html.Node) *Selection {
return pushStack(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
nil, nodes))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevUntilNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevUntil",
",",
"nil",
... | // PrevUntilNodes gets all preceding siblings of each element up to but not
// including the element matched by the nodes. It returns a new Selection
// object containing the matched elements. | [
"PrevUntilNodes",
"gets",
"all",
"preceding",
"siblings",
"of",
"each",
"element",
"up",
"to",
"but",
"not",
"including",
"the",
"element",
"matched",
"by",
"the",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L428-L431 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextFilteredUntil | func (s *Selection) NextFilteredUntil(filterSelector, untilSelector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
compileMatcher(untilSelector), nil), compileMatcher(filterSelector))
} | go | func (s *Selection) NextFilteredUntil(filterSelector, untilSelector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
compileMatcher(untilSelector), nil), compileMatcher(filterSelector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextFilteredUntil",
"(",
"filterSelector",
",",
"untilSelector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextUntil",
",",
... | // NextFilteredUntil is like NextUntil, with the option to filter
// the results based on a selector string.
// It returns a new Selection object containing the matched elements. | [
"NextFilteredUntil",
"is",
"like",
"NextUntil",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L436-L439 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextFilteredUntilMatcher | func (s *Selection) NextFilteredUntilMatcher(filter, until Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
until, nil), filter)
} | go | func (s *Selection) NextFilteredUntilMatcher(filter, until Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
until, nil), filter)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextFilteredUntilMatcher",
"(",
"filter",
",",
"until",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingNextUntil",
",",
"until... | // NextFilteredUntilMatcher is like NextUntilMatcher, with the option to filter
// the results based on a matcher.
// It returns a new Selection object containing the matched elements. | [
"NextFilteredUntilMatcher",
"is",
"like",
"NextUntilMatcher",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L444-L447 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextFilteredUntilSelection | func (s *Selection) NextFilteredUntilSelection(filterSelector string, sel *Selection) *Selection {
return s.NextMatcherUntilSelection(compileMatcher(filterSelector), sel)
} | go | func (s *Selection) NextFilteredUntilSelection(filterSelector string, sel *Selection) *Selection {
return s.NextMatcherUntilSelection(compileMatcher(filterSelector), sel)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextFilteredUntilSelection",
"(",
"filterSelector",
"string",
",",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"NextMatcherUntilSelection",
"(",
"compileMatcher",
"(",
"filterSelector",
")",
... | // NextFilteredUntilSelection is like NextUntilSelection, with the
// option to filter the results based on a selector string. It returns a new
// Selection object containing the matched elements. | [
"NextFilteredUntilSelection",
"is",
"like",
"NextUntilSelection",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"element... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L452-L454 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextMatcherUntilSelection | func (s *Selection) NextMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
if sel == nil {
return s.NextMatcher(filter)
}
return s.NextMatcherUntilNodes(filter, sel.Nodes...)
} | go | func (s *Selection) NextMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
if sel == nil {
return s.NextMatcher(filter)
}
return s.NextMatcherUntilNodes(filter, sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextMatcherUntilSelection",
"(",
"filter",
"Matcher",
",",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"NextMatcher",
"(",
"filter",
")",
"\n",
"}",
"... | // NextMatcherUntilSelection is like NextUntilSelection, with the
// option to filter the results based on a matcher. It returns a new
// Selection object containing the matched elements. | [
"NextMatcherUntilSelection",
"is",
"like",
"NextUntilSelection",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L459-L464 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextFilteredUntilNodes | func (s *Selection) NextFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
nil, nodes), compileMatcher(filterSelector))
} | go | func (s *Selection) NextFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
nil, nodes), compileMatcher(filterSelector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextFilteredUntilNodes",
"(",
"filterSelector",
"string",
",",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Node... | // NextFilteredUntilNodes is like NextUntilNodes, with the
// option to filter the results based on a selector string. It returns a new
// Selection object containing the matched elements. | [
"NextFilteredUntilNodes",
"is",
"like",
"NextUntilNodes",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
".... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L469-L472 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | NextMatcherUntilNodes | func (s *Selection) NextMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
nil, nodes), filter)
} | go | func (s *Selection) NextMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil,
nil, nodes), filter)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NextMatcherUntilNodes",
"(",
"filter",
"Matcher",
",",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",... | // NextMatcherUntilNodes is like NextUntilNodes, with the
// option to filter the results based on a matcher. It returns a new
// Selection object containing the matched elements. | [
"NextMatcherUntilNodes",
"is",
"like",
"NextUntilNodes",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L477-L480 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevFilteredUntil | func (s *Selection) PrevFilteredUntil(filterSelector, untilSelector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
compileMatcher(untilSelector), nil), compileMatcher(filterSelector))
} | go | func (s *Selection) PrevFilteredUntil(filterSelector, untilSelector string) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
compileMatcher(untilSelector), nil), compileMatcher(filterSelector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevFilteredUntil",
"(",
"filterSelector",
",",
"untilSelector",
"string",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevUntil",
",",
... | // PrevFilteredUntil is like PrevUntil, with the option to filter
// the results based on a selector string.
// It returns a new Selection object containing the matched elements. | [
"PrevFilteredUntil",
"is",
"like",
"PrevUntil",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L485-L488 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevFilteredUntilMatcher | func (s *Selection) PrevFilteredUntilMatcher(filter, until Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
until, nil), filter)
} | go | func (s *Selection) PrevFilteredUntilMatcher(filter, until Matcher) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
until, nil), filter)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevFilteredUntilMatcher",
"(",
"filter",
",",
"until",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",",
"siblingPrevUntil",
",",
"until... | // PrevFilteredUntilMatcher is like PrevUntilMatcher, with the option to filter
// the results based on a matcher.
// It returns a new Selection object containing the matched elements. | [
"PrevFilteredUntilMatcher",
"is",
"like",
"PrevUntilMatcher",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L493-L496 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevFilteredUntilSelection | func (s *Selection) PrevFilteredUntilSelection(filterSelector string, sel *Selection) *Selection {
return s.PrevMatcherUntilSelection(compileMatcher(filterSelector), sel)
} | go | func (s *Selection) PrevFilteredUntilSelection(filterSelector string, sel *Selection) *Selection {
return s.PrevMatcherUntilSelection(compileMatcher(filterSelector), sel)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevFilteredUntilSelection",
"(",
"filterSelector",
"string",
",",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"PrevMatcherUntilSelection",
"(",
"compileMatcher",
"(",
"filterSelector",
")",
... | // PrevFilteredUntilSelection is like PrevUntilSelection, with the
// option to filter the results based on a selector string. It returns a new
// Selection object containing the matched elements. | [
"PrevFilteredUntilSelection",
"is",
"like",
"PrevUntilSelection",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"element... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L501-L503 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevMatcherUntilSelection | func (s *Selection) PrevMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
if sel == nil {
return s.PrevMatcher(filter)
}
return s.PrevMatcherUntilNodes(filter, sel.Nodes...)
} | go | func (s *Selection) PrevMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
if sel == nil {
return s.PrevMatcher(filter)
}
return s.PrevMatcherUntilNodes(filter, sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevMatcherUntilSelection",
"(",
"filter",
"Matcher",
",",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"PrevMatcher",
"(",
"filter",
")",
"\n",
"}",
"... | // PrevMatcherUntilSelection is like PrevUntilSelection, with the
// option to filter the results based on a matcher. It returns a new
// Selection object containing the matched elements. | [
"PrevMatcherUntilSelection",
"is",
"like",
"PrevUntilSelection",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L508-L513 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevFilteredUntilNodes | func (s *Selection) PrevFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
nil, nodes), compileMatcher(filterSelector))
} | go | func (s *Selection) PrevFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
nil, nodes), compileMatcher(filterSelector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevFilteredUntilNodes",
"(",
"filterSelector",
"string",
",",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Node... | // PrevFilteredUntilNodes is like PrevUntilNodes, with the
// option to filter the results based on a selector string. It returns a new
// Selection object containing the matched elements. | [
"PrevFilteredUntilNodes",
"is",
"like",
"PrevUntilNodes",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
".... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L518-L521 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | PrevMatcherUntilNodes | func (s *Selection) PrevMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
nil, nodes), filter)
} | go | func (s *Selection) PrevMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection {
return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil,
nil, nodes), filter)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"PrevMatcherUntilNodes",
"(",
"filter",
"Matcher",
",",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"filterAndPush",
"(",
"s",
",",
"getSiblingNodes",
"(",
"s",
".",
"Nodes",
",... | // PrevMatcherUntilNodes is like PrevUntilNodes, with the
// option to filter the results based on a matcher. It returns a new
// Selection object containing the matched elements. | [
"PrevMatcherUntilNodes",
"is",
"like",
"PrevUntilNodes",
"with",
"the",
"option",
"to",
"filter",
"the",
"results",
"based",
"on",
"a",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"containing",
"the",
"matched",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L526-L529 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | filterAndPush | func filterAndPush(srcSel *Selection, nodes []*html.Node, m Matcher) *Selection {
// Create a temporary Selection with the specified nodes to filter using winnow
sel := &Selection{nodes, srcSel.document, nil}
// Filter based on matcher and push on stack
return pushStack(srcSel, winnow(sel, m, true))
} | go | func filterAndPush(srcSel *Selection, nodes []*html.Node, m Matcher) *Selection {
// Create a temporary Selection with the specified nodes to filter using winnow
sel := &Selection{nodes, srcSel.document, nil}
// Filter based on matcher and push on stack
return pushStack(srcSel, winnow(sel, m, true))
} | [
"func",
"filterAndPush",
"(",
"srcSel",
"*",
"Selection",
",",
"nodes",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"// Create a temporary Selection with the specified nodes to filter using winnow",
"sel",
":=",
"&",
"Selecti... | // Filter and push filters the nodes based on a matcher, and pushes the results
// on the stack, with the srcSel as previous selection. | [
"Filter",
"and",
"push",
"filters",
"the",
"nodes",
"based",
"on",
"a",
"matcher",
"and",
"pushes",
"the",
"results",
"on",
"the",
"stack",
"with",
"the",
"srcSel",
"as",
"previous",
"selection",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L533-L538 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | findWithMatcher | func findWithMatcher(nodes []*html.Node, m Matcher) []*html.Node {
// Map nodes to find the matches within the children of each node
return mapNodes(nodes, func(i int, n *html.Node) (result []*html.Node) {
// Go down one level, becausejQuery's Find selects only within descendants
for c := n.FirstChild; c != nil; ... | go | func findWithMatcher(nodes []*html.Node, m Matcher) []*html.Node {
// Map nodes to find the matches within the children of each node
return mapNodes(nodes, func(i int, n *html.Node) (result []*html.Node) {
// Go down one level, becausejQuery's Find selects only within descendants
for c := n.FirstChild; c != nil; ... | [
"func",
"findWithMatcher",
"(",
"nodes",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"m",
"Matcher",
")",
"[",
"]",
"*",
"html",
".",
"Node",
"{",
"// Map nodes to find the matches within the children of each node",
"return",
"mapNodes",
"(",
"nodes",
",",
"func",
... | // Internal implementation of Find that return raw nodes. | [
"Internal",
"implementation",
"of",
"Find",
"that",
"return",
"raw",
"nodes",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L541-L552 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | getSiblingNodes | func getSiblingNodes(nodes []*html.Node, st siblingType, untilm Matcher, untilNodes []*html.Node) []*html.Node {
var f func(*html.Node) bool
// If the requested siblings are ...Until, create the test function to
// determine if the until condition is reached (returns true if it is)
if st == siblingNextUntil || st ... | go | func getSiblingNodes(nodes []*html.Node, st siblingType, untilm Matcher, untilNodes []*html.Node) []*html.Node {
var f func(*html.Node) bool
// If the requested siblings are ...Until, create the test function to
// determine if the until condition is reached (returns true if it is)
if st == siblingNextUntil || st ... | [
"func",
"getSiblingNodes",
"(",
"nodes",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"st",
"siblingType",
",",
"untilm",
"Matcher",
",",
"untilNodes",
"[",
"]",
"*",
"html",
".",
"Node",
")",
"[",
"]",
"*",
"html",
".",
"Node",
"{",
"var",
"f",
"func"... | // Internal implementation of sibling nodes that return a raw slice of matches. | [
"Internal",
"implementation",
"of",
"sibling",
"nodes",
"that",
"return",
"a",
"raw",
"slice",
"of",
"matches",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L578-L601 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | getChildrenNodes | func getChildrenNodes(nodes []*html.Node, st siblingType) []*html.Node {
return mapNodes(nodes, func(i int, n *html.Node) []*html.Node {
return getChildrenWithSiblingType(n, st, nil, nil)
})
} | go | func getChildrenNodes(nodes []*html.Node, st siblingType) []*html.Node {
return mapNodes(nodes, func(i int, n *html.Node) []*html.Node {
return getChildrenWithSiblingType(n, st, nil, nil)
})
} | [
"func",
"getChildrenNodes",
"(",
"nodes",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"st",
"siblingType",
")",
"[",
"]",
"*",
"html",
".",
"Node",
"{",
"return",
"mapNodes",
"(",
"nodes",
",",
"func",
"(",
"i",
"int",
",",
"n",
"*",
"html",
".",
"N... | // Gets the children nodes of each node in the specified slice of nodes,
// based on the sibling type request. | [
"Gets",
"the",
"children",
"nodes",
"of",
"each",
"node",
"in",
"the",
"specified",
"slice",
"of",
"nodes",
"based",
"on",
"the",
"sibling",
"type",
"request",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L605-L609 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | getChildrenWithSiblingType | func getChildrenWithSiblingType(parent *html.Node, st siblingType, skipNode *html.Node,
untilFunc func(*html.Node) bool) (result []*html.Node) {
// Create the iterator function
var iter = func(cur *html.Node) (ret *html.Node) {
// Based on the sibling type requested, iterate the right way
for {
switch st {
... | go | func getChildrenWithSiblingType(parent *html.Node, st siblingType, skipNode *html.Node,
untilFunc func(*html.Node) bool) (result []*html.Node) {
// Create the iterator function
var iter = func(cur *html.Node) (ret *html.Node) {
// Based on the sibling type requested, iterate the right way
for {
switch st {
... | [
"func",
"getChildrenWithSiblingType",
"(",
"parent",
"*",
"html",
".",
"Node",
",",
"st",
"siblingType",
",",
"skipNode",
"*",
"html",
".",
"Node",
",",
"untilFunc",
"func",
"(",
"*",
"html",
".",
"Node",
")",
"bool",
")",
"(",
"result",
"[",
"]",
"*",... | // Gets the children of the specified parent, based on the requested sibling
// type, skipping a specified node if required. | [
"Gets",
"the",
"children",
"of",
"the",
"specified",
"parent",
"based",
"on",
"the",
"requested",
"sibling",
"type",
"skipping",
"a",
"specified",
"node",
"if",
"required",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L613-L674 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | getParentNodes | func getParentNodes(nodes []*html.Node) []*html.Node {
return mapNodes(nodes, func(i int, n *html.Node) []*html.Node {
if n.Parent != nil && n.Parent.Type == html.ElementNode {
return []*html.Node{n.Parent}
}
return nil
})
} | go | func getParentNodes(nodes []*html.Node) []*html.Node {
return mapNodes(nodes, func(i int, n *html.Node) []*html.Node {
if n.Parent != nil && n.Parent.Type == html.ElementNode {
return []*html.Node{n.Parent}
}
return nil
})
} | [
"func",
"getParentNodes",
"(",
"nodes",
"[",
"]",
"*",
"html",
".",
"Node",
")",
"[",
"]",
"*",
"html",
".",
"Node",
"{",
"return",
"mapNodes",
"(",
"nodes",
",",
"func",
"(",
"i",
"int",
",",
"n",
"*",
"html",
".",
"Node",
")",
"[",
"]",
"*",
... | // Internal implementation of parent nodes that return a raw slice of Nodes. | [
"Internal",
"implementation",
"of",
"parent",
"nodes",
"that",
"return",
"a",
"raw",
"slice",
"of",
"Nodes",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L677-L684 | train |
henrylee2cn/pholcus | common/goquery/traversal.go | mapNodes | func mapNodes(nodes []*html.Node, f func(int, *html.Node) []*html.Node) (result []*html.Node) {
set := make(map[*html.Node]bool)
for i, n := range nodes {
if vals := f(i, n); len(vals) > 0 {
result = appendWithoutDuplicates(result, vals, set)
}
}
return result
} | go | func mapNodes(nodes []*html.Node, f func(int, *html.Node) []*html.Node) (result []*html.Node) {
set := make(map[*html.Node]bool)
for i, n := range nodes {
if vals := f(i, n); len(vals) > 0 {
result = appendWithoutDuplicates(result, vals, set)
}
}
return result
} | [
"func",
"mapNodes",
"(",
"nodes",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"f",
"func",
"(",
"int",
",",
"*",
"html",
".",
"Node",
")",
"[",
"]",
"*",
"html",
".",
"Node",
")",
"(",
"result",
"[",
"]",
"*",
"html",
".",
"Node",
")",
"{",
"s... | // Internal map function used by many traversing methods. Takes the source nodes
// to iterate on and the mapping function that returns an array of nodes.
// Returns an array of nodes mapped by calling the callback function once for
// each node in the source nodes. | [
"Internal",
"map",
"function",
"used",
"by",
"many",
"traversing",
"methods",
".",
"Takes",
"the",
"source",
"nodes",
"to",
"iterate",
"on",
"and",
"the",
"mapping",
"function",
"that",
"returns",
"an",
"array",
"of",
"nodes",
".",
"Returns",
"an",
"array",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L690-L698 | train |
henrylee2cn/pholcus | common/goquery/array.go | Eq | func (s *Selection) Eq(index int) *Selection {
if index < 0 {
index += len(s.Nodes)
}
if index >= len(s.Nodes) || index < 0 {
return newEmptySelection(s.document)
}
return s.Slice(index, index+1)
} | go | func (s *Selection) Eq(index int) *Selection {
if index < 0 {
index += len(s.Nodes)
}
if index >= len(s.Nodes) || index < 0 {
return newEmptySelection(s.document)
}
return s.Slice(index, index+1)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Eq",
"(",
"index",
"int",
")",
"*",
"Selection",
"{",
"if",
"index",
"<",
"0",
"{",
"index",
"+=",
"len",
"(",
"s",
".",
"Nodes",
")",
"\n",
"}",
"\n\n",
"if",
"index",
">=",
"len",
"(",
"s",
".",
"No... | // Eq reduces the set of matched elements to the one at the specified index.
// If a negative index is given, it counts backwards starting at the end of the
// set. It returns a new Selection object, and an empty Selection object if the
// index is invalid. | [
"Eq",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"the",
"one",
"at",
"the",
"specified",
"index",
".",
"If",
"a",
"negative",
"index",
"is",
"given",
"it",
"counts",
"backwards",
"starting",
"at",
"the",
"end",
"of",
"the",
"set",
".",
... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L25-L35 | train |
henrylee2cn/pholcus | common/goquery/array.go | Slice | func (s *Selection) Slice(start, end int) *Selection {
if start < 0 {
start += len(s.Nodes)
}
if end < 0 {
end += len(s.Nodes)
}
return pushStack(s, s.Nodes[start:end])
} | go | func (s *Selection) Slice(start, end int) *Selection {
if start < 0 {
start += len(s.Nodes)
}
if end < 0 {
end += len(s.Nodes)
}
return pushStack(s, s.Nodes[start:end])
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Slice",
"(",
"start",
",",
"end",
"int",
")",
"*",
"Selection",
"{",
"if",
"start",
"<",
"0",
"{",
"start",
"+=",
"len",
"(",
"s",
".",
"Nodes",
")",
"\n",
"}",
"\n",
"if",
"end",
"<",
"0",
"{",
"end"... | // Slice reduces the set of matched elements to a subset specified by a range
// of indices. | [
"Slice",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"a",
"subset",
"specified",
"by",
"a",
"range",
"of",
"indices",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L39-L47 | train |
henrylee2cn/pholcus | common/goquery/array.go | Get | func (s *Selection) Get(index int) *html.Node {
if index < 0 {
index += len(s.Nodes) // Negative index gets from the end
}
return s.Nodes[index]
} | go | func (s *Selection) Get(index int) *html.Node {
if index < 0 {
index += len(s.Nodes) // Negative index gets from the end
}
return s.Nodes[index]
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Get",
"(",
"index",
"int",
")",
"*",
"html",
".",
"Node",
"{",
"if",
"index",
"<",
"0",
"{",
"index",
"+=",
"len",
"(",
"s",
".",
"Nodes",
")",
"// Negative index gets from the end",
"\n",
"}",
"\n",
"return"... | // Get retrieves the underlying node at the specified index.
// Get without parameter is not implemented, since the node array is available
// on the Selection object. | [
"Get",
"retrieves",
"the",
"underlying",
"node",
"at",
"the",
"specified",
"index",
".",
"Get",
"without",
"parameter",
"is",
"not",
"implemented",
"since",
"the",
"node",
"array",
"is",
"available",
"on",
"the",
"Selection",
"object",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L52-L57 | train |
henrylee2cn/pholcus | common/goquery/array.go | Index | func (s *Selection) Index() int {
if len(s.Nodes) > 0 {
return newSingleSelection(s.Nodes[0], s.document).PrevAll().Length()
}
return -1
} | go | func (s *Selection) Index() int {
if len(s.Nodes) > 0 {
return newSingleSelection(s.Nodes[0], s.document).PrevAll().Length()
}
return -1
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Index",
"(",
")",
"int",
"{",
"if",
"len",
"(",
"s",
".",
"Nodes",
")",
">",
"0",
"{",
"return",
"newSingleSelection",
"(",
"s",
".",
"Nodes",
"[",
"0",
"]",
",",
"s",
".",
"document",
")",
".",
"PrevAl... | // Index returns the position of the first element within the Selection object
// relative to its sibling elements. | [
"Index",
"returns",
"the",
"position",
"of",
"the",
"first",
"element",
"within",
"the",
"Selection",
"object",
"relative",
"to",
"its",
"sibling",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L61-L66 | train |
henrylee2cn/pholcus | common/goquery/array.go | IndexSelector | func (s *Selection) IndexSelector(selector string) int {
if len(s.Nodes) > 0 {
sel := s.document.Find(selector)
return indexInSlice(sel.Nodes, s.Nodes[0])
}
return -1
} | go | func (s *Selection) IndexSelector(selector string) int {
if len(s.Nodes) > 0 {
sel := s.document.Find(selector)
return indexInSlice(sel.Nodes, s.Nodes[0])
}
return -1
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IndexSelector",
"(",
"selector",
"string",
")",
"int",
"{",
"if",
"len",
"(",
"s",
".",
"Nodes",
")",
">",
"0",
"{",
"sel",
":=",
"s",
".",
"document",
".",
"Find",
"(",
"selector",
")",
"\n",
"return",
"... | // IndexSelector returns the position of the first element within the
// Selection object relative to the elements matched by the selector, or -1 if
// not found. | [
"IndexSelector",
"returns",
"the",
"position",
"of",
"the",
"first",
"element",
"within",
"the",
"Selection",
"object",
"relative",
"to",
"the",
"elements",
"matched",
"by",
"the",
"selector",
"or",
"-",
"1",
"if",
"not",
"found",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L71-L77 | train |
henrylee2cn/pholcus | common/goquery/array.go | IndexMatcher | func (s *Selection) IndexMatcher(m Matcher) int {
if len(s.Nodes) > 0 {
sel := s.document.FindMatcher(m)
return indexInSlice(sel.Nodes, s.Nodes[0])
}
return -1
} | go | func (s *Selection) IndexMatcher(m Matcher) int {
if len(s.Nodes) > 0 {
sel := s.document.FindMatcher(m)
return indexInSlice(sel.Nodes, s.Nodes[0])
}
return -1
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IndexMatcher",
"(",
"m",
"Matcher",
")",
"int",
"{",
"if",
"len",
"(",
"s",
".",
"Nodes",
")",
">",
"0",
"{",
"sel",
":=",
"s",
".",
"document",
".",
"FindMatcher",
"(",
"m",
")",
"\n",
"return",
"indexIn... | // IndexMatcher returns the position of the first element within the
// Selection object relative to the elements matched by the matcher, or -1 if
// not found. | [
"IndexMatcher",
"returns",
"the",
"position",
"of",
"the",
"first",
"element",
"within",
"the",
"Selection",
"object",
"relative",
"to",
"the",
"elements",
"matched",
"by",
"the",
"matcher",
"or",
"-",
"1",
"if",
"not",
"found",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L82-L88 | train |
henrylee2cn/pholcus | common/goquery/array.go | IndexOfNode | func (s *Selection) IndexOfNode(node *html.Node) int {
return indexInSlice(s.Nodes, node)
} | go | func (s *Selection) IndexOfNode(node *html.Node) int {
return indexInSlice(s.Nodes, node)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IndexOfNode",
"(",
"node",
"*",
"html",
".",
"Node",
")",
"int",
"{",
"return",
"indexInSlice",
"(",
"s",
".",
"Nodes",
",",
"node",
")",
"\n",
"}"
] | // IndexOfNode returns the position of the specified node within the Selection
// object, or -1 if not found. | [
"IndexOfNode",
"returns",
"the",
"position",
"of",
"the",
"specified",
"node",
"within",
"the",
"Selection",
"object",
"or",
"-",
"1",
"if",
"not",
"found",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L92-L94 | train |
henrylee2cn/pholcus | common/goquery/array.go | IndexOfSelection | func (s *Selection) IndexOfSelection(sel *Selection) int {
if sel != nil && len(sel.Nodes) > 0 {
return indexInSlice(s.Nodes, sel.Nodes[0])
}
return -1
} | go | func (s *Selection) IndexOfSelection(sel *Selection) int {
if sel != nil && len(sel.Nodes) > 0 {
return indexInSlice(s.Nodes, sel.Nodes[0])
}
return -1
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IndexOfSelection",
"(",
"sel",
"*",
"Selection",
")",
"int",
"{",
"if",
"sel",
"!=",
"nil",
"&&",
"len",
"(",
"sel",
".",
"Nodes",
")",
">",
"0",
"{",
"return",
"indexInSlice",
"(",
"s",
".",
"Nodes",
",",
... | // IndexOfSelection returns the position of the first node in the specified
// Selection object within this Selection object, or -1 if not found. | [
"IndexOfSelection",
"returns",
"the",
"position",
"of",
"the",
"first",
"node",
"in",
"the",
"specified",
"Selection",
"object",
"within",
"this",
"Selection",
"object",
"or",
"-",
"1",
"if",
"not",
"found",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L98-L103 | train |
henrylee2cn/pholcus | common/config/config.go | Register | func Register(name string, adapter Config) {
if adapter == nil {
panic("config: Register adapter is nil")
}
if _, ok := adapters[name]; ok {
panic("config: Register called twice for adapter " + name)
}
adapters[name] = adapter
} | go | func Register(name string, adapter Config) {
if adapter == nil {
panic("config: Register adapter is nil")
}
if _, ok := adapters[name]; ok {
panic("config: Register called twice for adapter " + name)
}
adapters[name] = adapter
} | [
"func",
"Register",
"(",
"name",
"string",
",",
"adapter",
"Config",
")",
"{",
"if",
"adapter",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"adapters",
"[",
"name",
"]",
";",
"ok",
"{",
"panic",
... | // Register makes a config adapter available by the adapter name.
// If Register is called twice with the same name or if driver is nil,
// it panics. | [
"Register",
"makes",
"a",
"config",
"adapter",
"available",
"by",
"the",
"adapter",
"name",
".",
"If",
"Register",
"is",
"called",
"twice",
"with",
"the",
"same",
"name",
"or",
"if",
"driver",
"is",
"nil",
"it",
"panics",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/config/config.go#L80-L88 | train |
henrylee2cn/pholcus | common/config/config.go | ParseBool | func ParseBool(val interface{}) (value bool, err error) {
if val != nil {
switch v := val.(type) {
case bool:
return v, nil
case string:
switch v {
case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On":
return true, nil
case "0", "f", "F", "false", "FALSE", "... | go | func ParseBool(val interface{}) (value bool, err error) {
if val != nil {
switch v := val.(type) {
case bool:
return v, nil
case string:
switch v {
case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On":
return true, nil
case "0", "f", "F", "false", "FALSE", "... | [
"func",
"ParseBool",
"(",
"val",
"interface",
"{",
"}",
")",
"(",
"value",
"bool",
",",
"err",
"error",
")",
"{",
"if",
"val",
"!=",
"nil",
"{",
"switch",
"v",
":=",
"val",
".",
"(",
"type",
")",
"{",
"case",
"bool",
":",
"return",
"v",
",",
"n... | // ParseBool returns the boolean value represented by the string.
//
// It accepts 1, 1.0, t, T, TRUE, true, True, YES, yes, Yes,Y, y, ON, on, On,
// 0, 0.0, f, F, FALSE, false, False, NO, no, No, N,n, OFF, off, Off.
// Any other value returns an error. | [
"ParseBool",
"returns",
"the",
"boolean",
"value",
"represented",
"by",
"the",
"string",
".",
"It",
"accepts",
"1",
"1",
".",
"0",
"t",
"T",
"TRUE",
"true",
"True",
"YES",
"yes",
"Yes",
"Y",
"y",
"ON",
"on",
"On",
"0",
"0",
".",
"0",
"f",
"F",
"F... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/config/config.go#L115-L144 | train |
henrylee2cn/pholcus | common/websocket/server.go | ServeHTTP | func (h Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
s := Server{Handler: h, Handshake: checkOrigin}
s.serveWebSocket(w, req)
} | go | func (h Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
s := Server{Handler: h, Handshake: checkOrigin}
s.serveWebSocket(w, req)
} | [
"func",
"(",
"h",
"Handler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"s",
":=",
"Server",
"{",
"Handler",
":",
"h",
",",
"Handshake",
":",
"checkOrigin",
"}",
"\n",
"s",
".",
"se... | // ServeHTTP implements the http.Handler interface for a WebSocket | [
"ServeHTTP",
"implements",
"the",
"http",
".",
"Handler",
"interface",
"for",
"a",
"WebSocket"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/websocket/server.go#L111-L114 | train |
henrylee2cn/pholcus | common/mahonia/kuten.go | Reverse | func (t *kutenTable) Reverse() {
t.once.Do(func() {
t.FromUnicode = make([][2]byte, 65536)
for ku := range t.Data {
for ten, unicode := range t.Data[ku] {
t.FromUnicode[unicode] = [2]byte{byte(ku), byte(ten)}
}
}
})
} | go | func (t *kutenTable) Reverse() {
t.once.Do(func() {
t.FromUnicode = make([][2]byte, 65536)
for ku := range t.Data {
for ten, unicode := range t.Data[ku] {
t.FromUnicode[unicode] = [2]byte{byte(ku), byte(ten)}
}
}
})
} | [
"func",
"(",
"t",
"*",
"kutenTable",
")",
"Reverse",
"(",
")",
"{",
"t",
".",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"t",
".",
"FromUnicode",
"=",
"make",
"(",
"[",
"]",
"[",
"2",
"]",
"byte",
",",
"65536",
")",
"\n",
"for",
"ku",
"... | // Reverse generates FromUnicode. | [
"Reverse",
"generates",
"FromUnicode",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/kuten.go#L25-L34 | train |
henrylee2cn/pholcus | common/mahonia/kuten.go | DecodeLow | func (t *kutenTable) DecodeLow(p []byte) (c rune, size int, status Status) {
if len(p) < 2 {
return 0, 0, NO_ROOM
}
ku := p[0] - 0x21
ten := p[1] - 0x21
if ku > 93 || ten > 93 {
return utf8.RuneError, 1, INVALID_CHAR
}
u := t.Data[ku][ten]
if u == 0 {
return utf8.RuneError, 1, INVALID_CHAR
}
return rune... | go | func (t *kutenTable) DecodeLow(p []byte) (c rune, size int, status Status) {
if len(p) < 2 {
return 0, 0, NO_ROOM
}
ku := p[0] - 0x21
ten := p[1] - 0x21
if ku > 93 || ten > 93 {
return utf8.RuneError, 1, INVALID_CHAR
}
u := t.Data[ku][ten]
if u == 0 {
return utf8.RuneError, 1, INVALID_CHAR
}
return rune... | [
"func",
"(",
"t",
"*",
"kutenTable",
")",
"DecodeLow",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"c",
"rune",
",",
"size",
"int",
",",
"status",
"Status",
")",
"{",
"if",
"len",
"(",
"p",
")",
"<",
"2",
"{",
"return",
"0",
",",
"0",
",",
"NO_ROOM... | // DecodeLow decodes a character from an encoding that does not have the high
// bit set. | [
"DecodeLow",
"decodes",
"a",
"character",
"from",
"an",
"encoding",
"that",
"does",
"not",
"have",
"the",
"high",
"bit",
"set",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/kuten.go#L38-L52 | train |
henrylee2cn/pholcus | common/mahonia/kuten.go | EncodeHigh | func (t *kutenTable) EncodeHigh(p []byte, c rune) (size int, status Status) {
if len(p) < 2 {
return 0, NO_ROOM
}
if c > 0xffff {
p[0] = '?'
return 1, INVALID_CHAR
}
kuten := t.FromUnicode[c]
if kuten == [2]byte{0, 0} && c != rune(t.Data[0][0]) {
p[0] = '?'
return 1, INVALID_CHAR
}
p[0] = kuten[0] + 0... | go | func (t *kutenTable) EncodeHigh(p []byte, c rune) (size int, status Status) {
if len(p) < 2 {
return 0, NO_ROOM
}
if c > 0xffff {
p[0] = '?'
return 1, INVALID_CHAR
}
kuten := t.FromUnicode[c]
if kuten == [2]byte{0, 0} && c != rune(t.Data[0][0]) {
p[0] = '?'
return 1, INVALID_CHAR
}
p[0] = kuten[0] + 0... | [
"func",
"(",
"t",
"*",
"kutenTable",
")",
"EncodeHigh",
"(",
"p",
"[",
"]",
"byte",
",",
"c",
"rune",
")",
"(",
"size",
"int",
",",
"status",
"Status",
")",
"{",
"if",
"len",
"(",
"p",
")",
"<",
"2",
"{",
"return",
"0",
",",
"NO_ROOM",
"\n",
... | // EncodeHigh encodes a character in an encoding that has the high bit set. | [
"EncodeHigh",
"encodes",
"a",
"character",
"in",
"an",
"encoding",
"that",
"has",
"the",
"high",
"bit",
"set",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/kuten.go#L72-L88 | train |
henrylee2cn/pholcus | common/mahonia/reader.go | NewReader | func (d Decoder) NewReader(rd io.Reader) *Reader {
b := new(Reader)
b.buf = make([]byte, defaultBufSize)
b.rd = rd
b.decode = d
return b
} | go | func (d Decoder) NewReader(rd io.Reader) *Reader {
b := new(Reader)
b.buf = make([]byte, defaultBufSize)
b.rd = rd
b.decode = d
return b
} | [
"func",
"(",
"d",
"Decoder",
")",
"NewReader",
"(",
"rd",
"io",
".",
"Reader",
")",
"*",
"Reader",
"{",
"b",
":=",
"new",
"(",
"Reader",
")",
"\n",
"b",
".",
"buf",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"defaultBufSize",
")",
"\n",
"b",
".",... | // NewReader creates a new Reader that uses the receiver to decode text. | [
"NewReader",
"creates",
"a",
"new",
"Reader",
"that",
"uses",
"the",
"receiver",
"to",
"decode",
"text",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/reader.go#L29-L35 | train |
henrylee2cn/pholcus | common/mahonia/reader.go | ReadRune | func (b *Reader) ReadRune() (c rune, size int, err error) {
read:
c, size, status := b.decode(b.buf[b.r:b.w])
if status == NO_ROOM && b.err == nil {
b.fill()
goto read
}
if status == STATE_ONLY {
b.r += size
goto read
}
if b.r == b.w {
return 0, 0, b.err
}
if status == NO_ROOM {
c = 0xfffd
siz... | go | func (b *Reader) ReadRune() (c rune, size int, err error) {
read:
c, size, status := b.decode(b.buf[b.r:b.w])
if status == NO_ROOM && b.err == nil {
b.fill()
goto read
}
if status == STATE_ONLY {
b.r += size
goto read
}
if b.r == b.w {
return 0, 0, b.err
}
if status == NO_ROOM {
c = 0xfffd
siz... | [
"func",
"(",
"b",
"*",
"Reader",
")",
"ReadRune",
"(",
")",
"(",
"c",
"rune",
",",
"size",
"int",
",",
"err",
"error",
")",
"{",
"read",
":",
"c",
",",
"size",
",",
"status",
":=",
"b",
".",
"decode",
"(",
"b",
".",
"buf",
"[",
"b",
".",
"r... | // ReadRune reads a single Unicode character and returns the
// rune and its size in bytes. | [
"ReadRune",
"reads",
"a",
"single",
"Unicode",
"character",
"and",
"returns",
"the",
"rune",
"and",
"its",
"size",
"in",
"bytes",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/reader.go#L125-L151 | train |
henrylee2cn/pholcus | common/mahonia/convert_string.go | ConvertString | func (e Encoder) ConvertString(s string) string {
dest := make([]byte, len(s)+10)
destPos := 0
for _, rune := range s {
retry:
size, status := e(dest[destPos:], rune)
if status == NO_ROOM {
newDest := make([]byte, len(dest)*2)
copy(newDest, dest)
dest = newDest
goto retry
}
if status == STATE... | go | func (e Encoder) ConvertString(s string) string {
dest := make([]byte, len(s)+10)
destPos := 0
for _, rune := range s {
retry:
size, status := e(dest[destPos:], rune)
if status == NO_ROOM {
newDest := make([]byte, len(dest)*2)
copy(newDest, dest)
dest = newDest
goto retry
}
if status == STATE... | [
"func",
"(",
"e",
"Encoder",
")",
"ConvertString",
"(",
"s",
"string",
")",
"string",
"{",
"dest",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"s",
")",
"+",
"10",
")",
"\n",
"destPos",
":=",
"0",
"\n\n",
"for",
"_",
",",
"rune",
":="... | // ConvertString converts a string from UTF-8 to e's encoding. | [
"ConvertString",
"converts",
"a",
"string",
"from",
"UTF",
"-",
"8",
"to",
"e",
"s",
"encoding",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/convert_string.go#L8-L32 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.