Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultIndexPage is default index filename of parent directories. DefaultIndexPage = "index.html" // DefaultHomeName is default breadcrumb name of root directory. DefaultHomeName = "home" // DefaultIndexName is default breadcrumb name of index page. DefaultIndexName = "index" // DefaultHTMLExtension is default extension of HTML files. DefaultHTMLExtension = "html" // DefaultTargetSelector is default selector for specifying where you want to insert breadcrumbs in html. DefaultTargetSelector = "#header" // DefaultTagName is a default tag name of breadcrumb's root element in html. DefaultTagName = "div" // DefaultBreadcrumbID is default id attribute's value contained in breadcrumb's root element in html. (default: id="breadcrumb") DefaultBreadcrumbID = "breadcrumb" // DefaultBreadcrumbLinkClass is default class names of breadcrumb which is linked to some page. DefaultBreadcrumbLinkClass = "breadcrumb-link" // DefaultBreadcrumbNoLinkClass is default class names of breadcrumb which is not linked to any page. DefaultBreadcrumbNoLinkClass = "breadcrumb-text" // DefaultSeparator is default hierarchy separator of breadcrumbs. (default: ">") DefaultSeparator = ">" )
Variables ¶
This section is empty.
Functions ¶
func InsertBreadcrumbs ¶
func InsertBreadcrumbs(config *BreadcrumbConfig, rootDirNode *DirNode) error
InsertBreadcrumbs inserts breadcrumbs into HTML files with specified config and directories.
Types ¶
type BreadcrumbConfig ¶
type BreadcrumbConfig struct { // BreadcrumbStruct is a tree structure which have infomation to insert breadcrumbs. BreadcrumbStruct BreadcrumbNode `yaml:"BreadcrumbStruct"` // OnlyRemove is an option. If this value is true, this tool only remove breadcrumbs already inserted. OnlyRemove bool `yaml:"-"` // DefaultIndex is a name of default index pages. (default "index.html") DefaultIndex string `yaml:"DefaultIndex"` // HTMLExtension is a file extension of HTML files. HTMLExtension string `yaml:"HTMLExtension"` // TagName is a tag name of breadcrumb's root element. TagName string `yaml:"TagName"` // BreadcrumbRootID is an id attribute's value contained in breadcrumb's root element. BreadcrumbRootID string `yaml:"BreadcrumbRootID"` // BreadcrumbLinkClass is class names contained in 'a' tags which is linked to a page in breadcrumbs. BreadcrumbLinkClass string `yaml:"BreadcrumbLinkClass"` // BreadcrumbNoLinkClass is class names contained in 'span' tags which is not linked to a page in breadcrumbs. BreadcrumbNoLinkClass string `yaml:"BreadcrumbNoLinkClass"` // Separator is a breadcrumb hierarchy separator. Separator string `yaml:"Separator"` // TargetSelector is a target selector for inserting breadcrumb. TargetSelector string `yaml:"TargetSelector"` }
BreadcrumbConfig is configuration struct for this tool.
func LoadBreadcrumbConfig ¶
func LoadBreadcrumbConfig(yamlFileName string) (*BreadcrumbConfig, error)
LoadBreadcrumbConfig loads a breadcrumb config from a specified YAML file.
type BreadcrumbNode ¶
type BreadcrumbNode struct { IndexName string HiddenIndex bool NameMap map[string]string DirMap map[string]*BreadcrumbNode }
BreadcrumbNode is node struct for representing breadcrumb info.
func (*BreadcrumbNode) UnmarshalYAML ¶
func (n *BreadcrumbNode) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a YAML Data to load a breadcrumb config.
type DirNode ¶
DirNode is node struct for representing directory structure
func GetHTMLFiles ¶
GetHTMLFiles gets all HTML files in a specified directory recursively
type EntireConfig ¶
type EntireConfig struct { OnlyRemove bool IndexPage string Extension string SelectorName string BreadcrumbID string BreadcrumbLinkClass string BreadcrumbNoLinkClass string TagName string Separator string }
EntireConfig is an injection config struct which is referred when injecting breadcrumbs
Click to show internal directories.
Click to hide internal directories.