utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InputHelpMessage   string = "Path to a .txt / .md file OR a folder containing .txt / .md files to be turned into HTML"
	OutputHelpMessage  string = "Optional. Additionaly changes the output path of generated HTML"
	HelpHelpMessage    string = "Display detailed help message"
	VersionHelpMessage string = "Display installed version of SSGo"
	ConfigHelpMessage  string = "Path to a .json file containing SSGo configuration options"
)

Help message configuration

View Source
const DefaultOutput string = "dist"

Default output directory name (relative or absolute)

Variables

View Source
var AcceptedInputFileTypes = map[string]bool{
	".txt": true,
	".md":  true,
}

Hashset for easier lookup

Functions

func GenerateHTML

func GenerateHTML(input string, output string, name string)

Takes path to .txt file as an input, reads it, and creates name.html in output folder

func GetNameAndExt

func GetNameAndExt(basename string) (string, string)

Returns split name and extension of a filename

func ParseMarkdown

func ParseMarkdown(fileBytes []byte) []byte

func ParseText

func ParseText(fileString string) (string, string)

Reads string slice of lines and returns HTML and title of the

func PrintHelp

func PrintHelp()

func ProcessConfig

func ProcessConfig(config string)

Takes path to .json file, reads it, and calls ProcessInput using contained options

func ProcessInput

func ProcessInput(input string, output string)

Takes input path, validates single .txt file OR folder and checks all files in the folder

Types

type File

type File struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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