hexo

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFileCanHexoPre

func CheckFileCanHexoPre(fileName string) bool

CheckFileCanHexoPre 检测是否可能是 hexo文件,防止遍历全文.

func CheckFileHasFirmCode

func CheckFileHasFirmCode(fileName string, content []string, firmCode []string) error

CheckFileHasFirmCode 检测是否有公司代码.

func GetAllMarkDownPage

func GetAllMarkDownPage(dir string) ([]string, error)

func GetAllPage

func GetAllPage(dir string, ignoreLine []string) ([]string, error)

func NewCommand

func NewCommand() command.Command

func Run

func Run(ctx context.Context, dir string, targetDir string, firmCode []string, ignore []string) error

Run targetDir: /Users/bytedance/note/note/hexo-home/source/_posts dir: /Users/bytedance/note/note

Types

type CheckFileCanHexoResult

type CheckFileCanHexoResult struct {
	CanHexo       bool
	HasAbstract   bool
	Content       []string
	Config        *Config
	FileInfo      os.FileInfo
	FileName      string // 源文件
	WriteFilePath string // 写入的目录
	NeedWrite     bool   // 是否需要重新写入
	ContentData   []byte
}

func CheckFileCanHexo

func CheckFileCanHexo(fileName string, fileParentPath string) (*CheckFileCanHexoResult, error)

CheckFileCanHexo 检测文件是否可以转换为hexo文件.

func (*CheckFileCanHexoResult) WriteFile

func (c *CheckFileCanHexoResult) WriteFile() error

WriteFile 1. 生成文件内容 2. 同时格式化源文件.

type Config

type Config struct {
	Title      string   `yaml:"title"`       // 标题(如果没有设置,为源文件的名称)
	TargetFile string   `yaml:"target_file"` // 目标文件,值得是生成的文件
	OriginFile string   `yaml:"origin_file"` // 原文件,指的是我们写的文件
	Date       string   `yaml:"date"`        // 日期(为文件的修改日期)
	Tags       []string `yaml:"tags,omitempty"`
	Categories []string `yaml:"categories,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL