Skip to content

Commit

Permalink
Merge pull request #39 from DanielFillol/daniel
Browse files Browse the repository at this point in the history
ParseHtmlToString
  • Loading branch information
DanielFillol authored Aug 18, 2024
2 parents e996a55 + ca97874 commit 80ea655
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion goSpider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,8 @@ func calculateDateDifference(startDate, endDate time.Time) (int, int, int) {
return years, months, days
}

func PrintHtml(pageSource *html.Node) (string, error) {
// ParseHtmlToString used for parsing html.node into string for debugging purposes
func ParseHtmlToString(pageSource *html.Node) (string, error) {
var sb strings.Builder
err := html.Render(&sb, pageSource)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions goSpider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,9 @@ func TestPrintHtml(t *testing.T) {
t.Errorf("GetPageSource error: %v", err)
}

s, err := PrintHtml(ps)
s, err := ParseHtmlToString(ps)
if err != nil {
t.Errorf("PrintHtml error: %v", err)
t.Errorf("ParseHtmlToString error: %v", err)
}

fmt.Println(s)
Expand Down

0 comments on commit 80ea655

Please sign in to comment.