aboutsummaryrefslogtreecommitdiff
path: root/word.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-04-06 16:32:57 +0700
committerShulhan <ms@kilabit.info>2024-04-06 16:32:57 +0700
commit772747f4051085443b38db8fb8f01ada41e89fc5 (patch)
tree940c196b79018ff9ae1e592c6db9a000eb4044fe /word.go
parent424583f727bf5d7da0552780ba369834a73c36d3 (diff)
downloadkbbi-772747f4051085443b38db8fb8f01ada41e89fc5.tar.xz
all: replace "share" module with "pakakeh.go" module
The "share" module repository has been moved to SourceHut with new name "pakakeh.go". For more information on why we moved, see the project page at https://sr.ht/~shulhan/pakakeh.go.
Diffstat (limited to 'word.go')
-rw-r--r--word.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/word.go b/word.go
index 8bc0da0..89dc837 100644
--- a/word.go
+++ b/word.go
@@ -7,12 +7,10 @@ package kamusku
import (
"bytes"
- "github.com/shuLhan/share/lib/net/html"
+ "git.sr.ht/~shulhan/pakakeh.go/lib/html"
)
-//
// Word store the single root word and its definitions.
-//
type Word struct {
Root string `json:"dasar,omitempty"` // The root word
Definition []*WordDefinition `json:"definisi"` // The word definition.
@@ -24,17 +22,13 @@ type Word struct {
err error
}
-//
// Err return an error from retrieving definition.
-//
func (word *Word) Err() error {
return word.err
}
-//
// parseHTMLEntri parse HTML body from "/entri/<word>" page to find the
// definition of the word.
-//
func (word *Word) parseHTMLEntri(in string, htmlBody []byte) (err error) {
iter, err := html.Parse(bytes.NewReader(htmlBody))
if err != nil {
@@ -73,10 +67,8 @@ func (word *Word) parseHTMLEntri(in string, htmlBody []byte) (err error) {
return nil
}
-//
// parseRootWord given an HMTL element "h2" find a possible root word and
// return true; otherwise it will return false.
-//
func (word *Word) parseRootWord(h2 *html.Node) bool {
el := h2.GetFirstChild()
if el.Data != tagNameSpan {