From ca97874276e1fac383c73b2a65cb104aca525bd8 Mon Sep 17 00:00:00 2001 From: "daniel_fillol@hotmail.com" <55287657+DanielFillol@users.noreply.github.com> Date: Sun, 18 Aug 2024 17:29:36 -0300 Subject: [PATCH] feat: new signature for PrintHtml -> ParseHtmlToString --- goSpider.go | 3 ++- goSpider_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/goSpider.go b/goSpider.go index 1fc123d..bd9a841 100644 --- a/goSpider.go +++ b/goSpider.go @@ -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 { diff --git a/goSpider_test.go b/goSpider_test.go index c45fca8..35b80a9 100644 --- a/goSpider_test.go +++ b/goSpider_test.go @@ -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)