aboutsummaryrefslogtreecommitdiff
path: root/parser.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-04-05 15:19:10 +0700
committerShulhan <m.shulhan@gmail.com>2020-04-05 15:19:10 +0700
commit826f56cf7ea4ca350078538d39fd6fee6f05bf9a (patch)
tree2211e5051c97369557811b9e290edd381375ffdb /parser.go
parent3061f6561c746f216586c271a10219515dcdb2d7 (diff)
downloadkamusku-826f56cf7ea4ca350078538d39fd6fee6f05bf9a.tar.xz
all: simplify html parser using github.com/shuLhan/share/lib/net/html
Diffstat (limited to 'parser.go')
-rw-r--r--parser.go51
1 files changed, 0 insertions, 51 deletions
diff --git a/parser.go b/parser.go
deleted file mode 100644
index 8a66e6f..0000000
--- a/parser.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2020, Shulhan <m.shulhan@gmail.com>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package kbbi
-
-import (
- "strings"
-
- "golang.org/x/net/html"
-)
-
-func getAttrValue(attrs []html.Attribute) string {
- for _, attr := range attrs {
- if attr.Key == attrNameValue {
- return attr.Val
- }
- }
- return ""
-}
-
-//
-// getFirstChild get the first non-empty child.
-//
-func getFirstChild(node *html.Node) *html.Node {
- el := node.FirstChild
- for el != nil {
- if el.Type == html.TextNode {
- if len(strings.TrimSpace(el.Data)) == 0 {
- el = el.NextSibling
- continue
- }
- }
- break
- }
- return el
-}
-
-func getNextSibling(node *html.Node) *html.Node {
- el := node.NextSibling
- for el != nil {
- if el.Type == html.TextNode {
- if len(strings.TrimSpace(el.Data)) == 0 {
- el = el.NextSibling
- continue
- }
- }
- break
- }
- return el
-}