Skip to content

Releases: nfx/go-htmltable

v0.4.0

27 Dec 15:49
@nfx nfx
5f367df
Compare
Choose a tag to compare

Added htmltable.NewSliceFromPage convenience helper:

url := "https://en.wikipedia.org/wiki/List_of_S%26P_500_companies"
p, _ := htmltable.NewFromURL(url)
out, _ := htmltable.NewSliceFromPage[Ticker](p)
println(len(out)) // 500

v0.3.0

05 Nov 14:42
@nfx nfx
4470783
Compare
Choose a tag to compare

Now complex tables with row and col spans are natively supported as well. You can also annotate string, int, and bool fields. Any bool field value is true if it is equal in lowercase to one of yes, y, true, t.

Wikipedia

type AM4 struct {
    Model             string `header:"Model"`
    ReleaseDate       string `header:"Release date"`
    PCIeSupport       string `header:"PCIesupport[a]"`
    MultiGpuCrossFire bool   `header:"Multi-GPU CrossFire"`
    MultiGpuSLI       bool   `header:"Multi-GPU SLI"`
    USBSupport        string `header:"USBsupport[b]"`
    SATAPorts         int    `header:"Storage features SATAports"`
    RAID              string `header:"Storage features RAID"`
    AMDStoreMI        bool   `header:"Storage features AMD StoreMI"`
    Overclocking      string `header:"Processoroverclocking"`
    TDP               string `header:"TDP"`
    SupportExcavator  string `header:"CPU support[14] Excavator"`
    SupportZen        string `header:"CPU support[14] Zen"`
    SupportZenPlus    string `header:"CPU support[14] Zen+"`
    SupportZen2       string `header:"CPU support[14] Zen 2"`
    SupportZen3       string `header:"CPU support[14] Zen 3"`
    Architecture      string `header:"Architecture"`
}
am4Chipsets, _ := htmltable.NewSliceFromURL[AM4]("https://en.wikipedia.org/wiki/List_of_AMD_chipsets")
fmt.Println(am4Chipsets[2].Model)
fmt.Println(am4Chipsets[2].SupportZen2)

// Output:
// X370
// Varies[c]

v0.2.1

18 Sep 17:34
@nfx nfx
626f7da
Compare
Choose a tag to compare

Fixed bug with panic in Each2/ Each3 on non-conforming rows

v0.2.0

18 Sep 17:11
@nfx nfx
201b328
Compare
Choose a tag to compare

Exposed htmltable.Page and htmltable.Table types for a more convenient usage.

v0.1.0

17 Sep 14:19
@nfx nfx
Compare
Choose a tag to compare

Initial release in this repository, after around six months in the scope of the another repository. It's now possible to use it as dependency-free library:

import "github.com/nfx/go-htmltable"

type Ticker struct {
    Symbol   string `header:"Symbol"`
    Security string `header:"Security"`
    CIK      string `header:"CIK"`
}

url := "https://en.wikipedia.org/wiki/List_of_S%26P_500_companies"
out, _ := htmltable.NewSliceFromURL[Ticker](url)
fmt.Println(out[0].Symbol)
fmt.Println(out[0].Security)

// Output: 
// MMM
// 3M