Documentation
¶
Index ¶
- Constants
- type AssetFilter
- type CategoryFilter
- type CodeFilter
- type Crawler
- func (c Crawler) RenderArchiveIndex(w io.Writer, year int, entries []blog.Entry) error
- func (c Crawler) RenderCategoryIndex(w io.Writer, category string, entries []blog.Entry) error
- func (c Crawler) RenderLanding(w io.Writer, title string, categories []string, years []int) error
- func (c Crawler) Start(ctx context.Context) error
- type DataStore
- type DateTimeFilter
- type Downloader
- type DraftFilter
- type EncodingFilter
- type Filter
- type HatenaKeywordFilter
- type ImagePathFilter
- type ImageURLExtractor
- type IndexPageValue
- type LandingValue
- type LinkFilter
- type Path
- func (p Path) ArchiveFilePath(year int) string
- func (p Path) ArchiveUrlPath(year int) string
- func (p Path) CategoryFilePath(name string) string
- func (p Path) CategoryUrlPath(name string) string
- func (p Path) EntryFilePath(entry blog.Entry) string
- func (p Path) EntryURLPath(entry blog.Entry) string
- func (p Path) ImageFilePath(entry blog.Entry, name string) string
- func (p Path) ImageURLPath(entry blog.Entry, name string) string
- func (p Path) LandingFilePath() string
- func (p Path) LandingURLPath() string
- type TitleFilter
- type TransformFunc
- type Transformer
- type WalkFunc
- type Walker
Constants ¶
const IndexPageTemplate = `` /* 325-byte string literal not displayed */
const LandingPageTemplate = `` /* 448-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetFilter ¶
type CategoryFilter ¶
type CategoryFilter struct{}
CategoryFilter presents a filter to add categories into the <head> tag. The categories are provided by <meta> tags as the following:
<meta property="hatena:category" content="Games" /> <meta property="hatena:category" content="Hobby" />
type CodeFilter ¶
type CodeFilter struct{}
CodeFilter presents a filter to make styled codes to plain text in the <pre> tags.
type Crawler ¶
type Crawler struct { BlogClient *blog.Client DataStore *DataStore Path *Path CSSPath string HatenaID string BlogID string Filters []Filter }
func (Crawler) RenderArchiveIndex ¶
func (Crawler) RenderCategoryIndex ¶
func (Crawler) RenderLanding ¶
type DateTimeFilter ¶
type DateTimeFilter struct{}
DateTimeFilter presents a filter to add timestamp on editted, published, and updated the entry as a meta tag.
type Downloader ¶
func (*Downloader) Download ¶
func (c *Downloader) Download(ctx context.Context, url string) (io.ReadCloser, error)
type DraftFilter ¶
type DraftFilter struct{}
DraftFilter presents a filter to add draft information as a meta tag.
type EncodingFilter ¶
type EncodingFilter struct{}
EncodingFilter presents a filter to provide a charset attribute (UTF-8) by the <meta> tag.
type HatenaKeywordFilter ¶
type HatenaKeywordFilter struct{}
HatenaKeywordFilter presents a filter to remove links of hatena keyword from HTML from the entry.
type ImagePathFilter ¶
type ImagePathFilter struct{}
ImagePathFilter presents a filter to fix image's url as a relative path as a base name.
It converts a src attribute in the <img> tag:
<img src="https://my-cdn.example.com/2020/03/01/foobar.png" />
to:
<img src="foobar.png" />
type ImageURLExtractor ¶
type ImageURLExtractor struct{}
func (*ImageURLExtractor) ExtractImageURLs ¶
func (e *ImageURLExtractor) ExtractImageURLs(root *html.Node) []string
type IndexPageValue ¶
type LandingValue ¶
type LinkFilter ¶
type LinkFilter struct{}
type Path ¶
type Path struct {
URLPrefix string
}
func (Path) ArchiveFilePath ¶
func (Path) ArchiveUrlPath ¶
func (Path) CategoryFilePath ¶
func (Path) CategoryUrlPath ¶
func (Path) LandingFilePath ¶
func (Path) LandingURLPath ¶
type TitleFilter ¶
type TitleFilter struct{}
TitleFilter presents a filter to add <title> into <head> and <h1> tag to the body from the entry..
type Transformer ¶
type Transformer struct {
Func TransformFunc
}
func (Transformer) WalkTransform ¶
func (w Transformer) WalkTransform(root *html.Node) error