Documentation
¶
Index ¶
- Constants
- func CheckMarker(listSkip, listSplit *FileCutterList, filename string)
- func DirFileMapInit()
- func MappedFileSync()
- func ReadmeBlogMapPrint()
- type FileCutter
- func (self *FileCutter) Join(bottom *FileCutter) *FileCutter
- func (self *FileCutter) Read(filename string) *FileCutter
- func (self *FileCutter) ReadBottom(filename string) *FileCutter
- func (self *FileCutter) ReadContent(filename string, readTop bool, readBottom bool) *FileCutter
- func (self *FileCutter) ReadTop(filename string) *FileCutter
- func (self *FileCutter) Reset() *FileCutter
- func (self *FileCutter) Save(filename string) *FileCutter
- type FileCutterList
- type FileMap
- type TypeConf
- type TypeFlag
Constants ¶
View Source
const ( DEFAULT_MD_EXT = ".md" DEFAULT_README = "README.md" DEFAULT_MARKER_SKIP = "<!--skip-sync-->" DEFAULT_MARKER_SPLIT = "<!--more-->" TXT_IN_SAME_DIR = " in same directory." TXT_SAME_DIR = " are same directories." TXT_NOT_DIR = " is not directory." TXT_NOT_FILE = " is not a regular file." )
Variables ¶
This section is empty.
Functions ¶
func CheckMarker ¶
func CheckMarker(listSkip, listSplit *FileCutterList, filename string)
func DirFileMapInit ¶
func DirFileMapInit()
Create map[blog file full path](repository readme full path)
- map is created if simplified blog name == simplified repository name
Types ¶
type FileCutter ¶
type FileCutter struct { Bottom *[]string `json:"bottom"` // out: content after split marker Filename string `json:"filename"` // in: filename NoSkip bool `json:"noSkip"` // in: ignore skip-marker Skipped bool `json:"skip"` // out: true if skip-marker found SkipMarker string `json:"skipMarker"` // in: skip marker Split bool `json:"split"` // out: true if split-marker is found SplitMarker string `json:"splitMarker"` // in: split marker SplitLine int `json:"splitLine"` // out: Line number split-marker is found Top *[]string `json:"top"` // out: content before split marker }
func FileCutterNew ¶
func FileCutterNew(filename string) *FileCutter
Create *FileCutter
- Set markers using Flag
func (*FileCutter) Join ¶
func (self *FileCutter) Join(bottom *FileCutter) *FileCutter
Use <bottom>.Bottom
func (*FileCutter) Read ¶
func (self *FileCutter) Read(filename string) *FileCutter
Read file and split content
- If <filename> empty, self.Filename will be used
- clear self.Top, save content before split-marker to self.Top
- clear self.Bottom, save content after split-marker to self.Bottom
- Set self.Split = true if split-marker found, set self.SplitLn
- Set self.Skip = true if skip-marker found, clear self.SplitLn, self.Found
func (*FileCutter) ReadBottom ¶
func (self *FileCutter) ReadBottom(filename string) *FileCutter
Read file and split content
- If <filename> empty, self.Filename will be used
- clear self.Bottom, save content after split-marker to self.Bottom
- Set self.Split = true if split-marker found, set self.SplitLn
- Set self.Skip = true if skip-marker found, clear self.SplitLn, self.Found
func (*FileCutter) ReadContent ¶
func (self *FileCutter) ReadContent(filename string, readTop bool, readBottom bool) *FileCutter
Read file and split content base on parameters
- If <filename> empty, self.Filename will be used
- If readTop, clear self.Top, save content before split-marker to self.Top
- If readBottom, clear self.Bottom, save content after split-marker to self.Bottom
- Set self.Split = true if split-marker found, set self.SplitLn
- Set self.Skip = true if skip-marker found, clear self.SplitLn, self.Found
func (*FileCutter) ReadTop ¶
func (self *FileCutter) ReadTop(filename string) *FileCutter
Read file and split content
- If <filename> empty, self.Filename will be used
- clear self.Top, save content before split-marker to self.Top
- Set self.Split = true if split-marker found, set self.SplitLn
- Set self.Skip = true if skip-marker found, clear self.SplitLn, self.Found
func (*FileCutter) Reset ¶
func (self *FileCutter) Reset() *FileCutter
Reset all values except markers
func (*FileCutter) Save ¶
func (self *FileCutter) Save(filename string) *FileCutter
Save split content to file
- If <filename> empty, self.Filename will be used
- Save self.Top, split-maker, self.Bottom
- Not save if self.Top or self.Bottom is nil
type FileCutterList ¶
type FileCutterList []*FileCutter
func (*FileCutterList) GetNames ¶
func (self *FileCutterList) GetNames() *[]string
type FileMap ¶
func (*FileMap) Join ¶
If self[<name>] and map2[<name>] exist, map3[self[<name>]] = map2[<name>].
- If an index exist in both maps, create a mapping with their values
- Return pointer of new map3
func (*FileMap) MapDirFile ¶
Create map[simplified dir name](file full path)
- create mapping between simplified dir names and full path of specific file it contains
type TypeConf ¶
type TypeConf struct { File string `json:"file"` Blog FileMap `json:"blog"` Readme FileMap `json:"readme"` ReadmeBlog FileMap `json:"readmeBlog"` }
var Conf TypeConf
type TypeFlag ¶
type TypeFlag struct { Args []string // Args from command line Debug bool // Enable debug output DefaultMdExt string // Default md extension DefaultReadme string // Default readme filename DirBlog string // Hugo blog content dir DirOut string // Output directory DirSrc string // Parent directory of repositories(not dir repo itself) FileBlog string // Single blog file to be process FileOut string // Output file FileReadme string // Single readme to be process Forced bool // Allow overwriting original file MarkerSkip string // skip marker MarkerSplit string // split marker NoError bool // Do not print error NoParallel bool // Do not process in parallel(go routine) NoSkip bool // Flag for ignoring skip marker ShowFileList bool // Show file list in directory mode }
Holding all flags from command line
var Flag TypeFlag
Click to show internal directories.
Click to hide internal directories.