Documentation ¶
Index ¶
- func ExportHTML(srv *drive.Service, f *drive.File) ([]byte, error)
- func FileInfoToMeta(fileInfo *drive.File) map[string]interface{}
- func GdocAttr(root *html.Node) error
- func GdocBlockquote(root *html.Node) error
- func GdocBlockquotePre(root *html.Node) error
- func GdocCodeBlock(root *html.Node) error
- func GdocImg(root *html.Node) error
- func GdocSpan(root *html.Node) error
- func GdocTable(root *html.Node) error
- func HugoContentWrite(content []byte, metamap map[string]interface{}) ([]byte, error)
- func HugoFrontMatter(root *html.Node) (map[string]interface{}, error)
- func IsDir(f *drive.File) bool
- func IsGoogleDoc(f *drive.File) bool
- func MetaMerge(a, b map[string]interface{}) map[string]interface{}
- func Setup() (*drive.Service, error)
- func URLize(path string) string
- func UnicodeSanitize(s string) string
- func Walk(srv *drive.Service, root string, walkfn WalkFunc) error
- type AddClassAttr
- type Converter
- type LinkInsecure
- type LinkRelative
- type NarrowTag
- type Punc
- type RemoveEmptyTag
- type Runner
- type UnsmartCode
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileInfoToMeta ¶
func FileInfoToMeta(fileInfo *drive.File) map[string]interface{}
output map is the one used by Hugo
func GdocAttr ¶
GDocAttr remove all unnessecary attributes from a GDoc HTML tree in particular removes all attributes except
- id
- href
- colspan,rowspan if not "1"
TODO: probably can optimize this by skipping recusion on text-nodes
func GdocBlockquote ¶
GdocBlockquote converts a sequence of <p style="margin-left:36pt"> to a blockquote
func GdocBlockquotePre ¶
func GdocCodeBlock ¶
func GdocImg ¶
converts <p><span><img/></span><sup><a></a></sup></p> into a nice <p><img> comment is in form of
<sup><a href="#cmnt1" id="cmnt_ref1">[a]</a></sup>
func GdocTable ¶
ConvertGdocTables cleans up tables found in gdocs
Removes redundant <p> inside each <td> If first row had bold <td> elements, convert the row into a <thead> with <th> elements
func HugoContentWrite ¶
HugoContent takes front-matter data, content and writes it to output stream
func IsGoogleDoc ¶
func IsGoogleDoc(f *drive.File) bool
func Setup ¶
func Setup() (*drive.Service, error)
setup is a temp function to read secrets and make a drive service
func UnicodeSanitize ¶
UnicodeSanitize sanitizes string to be used in Hugo URL's, allowing only a predefined set of special Unicode characters. If RemovePathAccents configuration flag is enabled, Uniccode accents are also removed. TODO: From Hugo github.com/gohugoio/hugo/helpers/path.go
Types ¶
type AddClassAttr ¶
type AddClassAttr struct {
// contains filtered or unexported fields
}
type LinkInsecure ¶
type LinkInsecure struct { Whitelist []string // contains filtered or unexported fields }
func (*LinkInsecure) Init ¶ added in v0.0.4
func (n *LinkInsecure) Init(list []string) (err error)
type LinkRelative ¶
type LinkRelative struct {
// contains filtered or unexported fields
}
func (*LinkRelative) Init ¶ added in v0.0.4
func (n *LinkRelative) Init(host string) (err error)
type RemoveEmptyTag ¶
type RemoveEmptyTag struct {
// contains filtered or unexported fields
}
remove some empty tags <p></p> is used a typically unintended line spaces <a></a> is in docs for unknown reasons
func (*RemoveEmptyTag) Init ¶ added in v0.0.4
func (n *RemoveEmptyTag) Init() (err error)
type UnsmartCode ¶
type UnsmartCode struct {
// contains filtered or unexported fields
}
func (*UnsmartCode) Init ¶ added in v0.0.4
func (n *UnsmartCode) Init() (err error)
Source Files ¶
- add-class-attr.go
- auth.go
- config.go
- convert.go
- entities.go
- gdoc-attr.go
- gdoc-blockquote-pre.go
- gdoc-blockquote.go
- gdoc-codeblock.go
- gdoc-img.go
- gdoc-span.go
- gdoc-table.go
- googledrive.go
- html2html.go
- hugo-front-matter.go
- link-insecure.go
- link-relative.go
- nodes.go
- punc.go
- remove-empty.go
- shortcodes.go
- unsmart.go
- urlize.go