alpha

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

alpha

Alpha Hatsuseno from the amazing Yokohama Kaidashi Kikō. She runs her quite cafe at the end of the world, for everyone to enjoy life as it passes by.

I like to think of the story more of as a beginning, rather than the end. This is why, the package alpha is responsible for bootstrapping darkness with all the settings, properties, etc. when ingesting config files, etc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorConfig

type AuthorConfig struct {
	// AuthorImage is the header image (can be empty)
	Image yunyun.RelativePathFile `toml:"image"`

	// ImagePreComputed is what actually gets stubbed in.
	ImagePreComputed yunyun.FullPathFile `toml:"-"`

	// Name is the name of the author
	Name string `toml:"name"`

	// Email is the email of the author
	Email string `toml:"email"`

	// NameEnable will not show the name in the menu
	// if disabled, but will use it for metadata.
	NameEnable bool `toml:"name_enable"`

	// EmailEnable will hide the email if false.
	EmailEnable bool `toml:"email_enable"`
}

AuthorConfig is the author section of the config

type DarknessConfig

type DarknessConfig struct {
	// Navigation is the navigation section of the config
	Navigation map[string]NavigationConfig `toml:"navigation"`

	// Title is the title of the site
	Title string `toml:"title"`

	// Url is the Url of the site
	Url string `toml:"url"`

	// RSS is the rss config.
	RSS RSSConfig `toml:"rss"`

	// Author is the author section of the config
	Author AuthorConfig `toml:"author"`

	// Project is the project section of the config
	Project ProjectConfig `toml:"project"`

	// Website is the website section of the config
	Website WebsiteConfig `toml:"website"`

	// Runtime holds the state we use during the runtime.
	Runtime RuntimeConfig `toml:"-"`
}

DarknessConfig is the global darkness config

func BuildConfig

func BuildConfig(options Options) *DarknessConfig

BuildConfig builds the config from the passed options.

type NavigationConfig struct {
	// Link is the link of the navigation item
	Link yunyun.RelativePathDir `toml:"link"`

	// Title is the title of the navigation item
	Title string `toml:"title"`

	// Hide is the path where to hide the element
	Hide yunyun.RelativePathDir `toml:"hide"`

	// Will hide the element if this value is encountered.
	HideIf yunyun.RelativePathDir `toml:"hide_if"`
}

NavigationConfig is the navigation section of the config

type Options

type Options struct {
	// DarknessConfig is the location of darkness's toml config file.
	DarknessConfig string

	// Url is a custom website url, usually used for serving from localhost.
	Url string

	// OutputExtension overrides whatever is in the file.
	OutputExtension string

	// WorkDir is the working directory of the darkness project.
	WorkDir string

	// Dev enables Url generation through local paths.
	Dev bool

	// Test enables test environment, where darkness config is not needed.
	Test bool

	// VendorGalleries dictates whether we should stub in local gallery images.
	VendorGalleries bool
}

Options is used for passing options when initiating emilia.

type ProjectConfig

type ProjectConfig struct {
	ExcludeRegex *regexp.Regexp `toml:"-"`
	// Input is the input format (default ".org")
	Input string `toml:"input"`

	// Output is the output format (defaulte ".html")
	Output string `toml:"output"`

	// DarknessVendorDirectory where to vendor, default to `darkness_vendor`.
	DarknessVendorDirectory yunyun.RelativePathDir `toml:"vendor_directory"`

	// DarknessPreviewDirectory where to store previews, default to `darkness_preview`.
	DarknessPreviewDirectory yunyun.RelativePathDir `toml:"preview_directory"`

	// Excludes is the list of relative paths to exclude from the project
	Exclude []yunyun.RelativePathDir `toml:"exclude"`

	ExcludeEnabled bool `toml:"-"`
}

ProjectConfig is the project section of the config

func (ProjectConfig) InputFilenameToOutput

func (p ProjectConfig) InputFilenameToOutput(file yunyun.FullPathFile) string

InputFilenameToOutput converts input filename to the filename to write.

type RSSConfig

type RSSConfig struct {
	// The language the channel is written in. This allows
	// aggregators to group all Italian language sites, for
	// example, on a single page. A list of allowable values
	// for this element, as provided by Netscape, is here.
	// You may also use values defined by the W3C.
	//
	// Example: "en-us"
	Language string `toml:"language"`

	// Phrase or sentence describing the channel.
	//
	// The latest news from GoUpstate.com, a Spartanburg
	// Herald-Journal Web site.
	Description string `toml:"description"`

	// Copyright notice for content in the channel.
	//
	// Example: "Copyright 2002, Spartanburg Herald-Journal"
	Copyright string `toml:"copyright"`

	// Email address for person responsible for editorial content.
	//
	// Example: "geo@herald.com (George Matesky)"
	ManagingEditor string `toml:"managing_editor"`

	// DefaultAuthor name to use for posts. Overwritten by posts'
	// author directives.
	//
	// Example: "Sandy Urazayev"
	DefaultAuthor string `toml:"default_author"`

	// Email address for person responsible for technical issues
	// relating to channel.
	//
	// Example: "betty@herald.com (Betty Guernsey)"
	WebMaster string `toml:"web_master"`

	// Specify one or more categories that the channel belongs to.
	// Follows the same rules as the <item>-level category element.
	//
	// Example: "<category>Newspapers</category>"
	Category string `toml:"category"`

	// If true, darkness will add the rss icon to the menu.
	Enable bool `toml:"enable"`

	// Timezone sets the default timezone for RSS timestamps.
	Timezone string `toml:"timezone"`

	// DefaultHour defines the hour value in RSS timestamp if one
	// is not provided. Use the 24 hrs.
	DefaultHour int `toml:"default_hour"`
}

RSSConfig is for filling out rss stuff.

type RuntimeConfig

type RuntimeConfig struct {
	// WorkDir is the directory of where darkness project lives.
	WorkDir WorkingDirectory

	// UrlPath is the parsed Url of the site
	UrlPath *url.URL

	// VendorGalleries tells us if we need to stub local copies
	// of remote links in galleries.
	VendorGalleries bool

	// HtmlHighlightLanguages is a map of languages that we want to
	// highlight in HTML.
	HtmlHighlightLanguages map[string]struct{}

	// Logger is the logger that we use.
	Logger *l.Logger
	// contains filtered or unexported fields
}

RuntimeConfig the config that is not a part of the config file, but us building when processing stuff.

func (RuntimeConfig) Join

func (conf RuntimeConfig) Join(relative ...yunyun.RelativePathFile) yunyun.FullPathFile

Join joins the target path with the final root path (url or local).

func (RuntimeConfig) JoinGeneric

func (conf RuntimeConfig) JoinGeneric(what ...string) string

JoinGeneric joins the target path with the final root path (url or local).

func (RuntimeConfig) Rel

Rel returns path trimmed by the workspace or url.

type WebsiteConfig

type WebsiteConfig struct {
	// SyntaxHighlightingLanguages is the location of highlight.js languages
	SyntaxHighlightingLanguages yunyun.RelativePathDir `toml:"syntax_highlighting_languages"`

	// Color is the color of the site
	Color string `toml:"color"`

	// Twitter is the twitter handle of the site
	Twitter string `toml:"twitter"`

	// Preview is the filename of the picture in the
	// same directory to use as a page preview. defaults to preview.png
	Preview yunyun.RelativePathFile `toml:"preview"`

	// Locale is the locale of the site
	Locale string `toml:"locale"`

	// SyntaxHighlightingTheme decides what theme to use from highlight.js
	SyntaxHighlightingTheme yunyun.RelativePathFile `toml:"syntax_highlighting_theme"`

	// Styles is the list of relative paths to css files for the site
	Styles []yunyun.RelativePathFile `toml:"styles"`

	// Tombs is the list of relative paths where to include the tombstones
	Tombs []yunyun.RelativePathDir `toml:"tombs"`

	// ExtraHead is the list of html directives to insert in <head>
	ExtraHead []string `toml:"extra_head"`

	// Description length dictates on how many characters do we extract
	// from the page to show in the web prewies, like OpenGraph and Twitter
	DescriptionLength int `toml:"description_length"`

	// SyntaxHighlighting decides whether to enable code blocks'
	// syntax highlighting with highlight.js
	SyntaxHighlighting bool `toml:"syntax_highlighting"`

	// ClickableImages marks whether the images should href to the img link.
	ClickableImages bool `toml:"clickable_images"`

	// FootnoteBrackets decides whether to use brackets on footnotes
	FootnoteBrackets bool `toml:"footnote_brackets"`

	// RomanFootnotes tells if we have to use roman numerals for footnotes
	RomanFootnotes bool `toml:"roman_footnotes"`
}

WebsiteConfig is the website section of the config

type WorkingDirectory

type WorkingDirectory string

WorkingDirectory is the directory of where darkness project lives.

func (WorkingDirectory) Join

Join joins target path with the working directory.

func (WorkingDirectory) JoinGeneric

func (workDir WorkingDirectory) JoinGeneric(target string) string

JoinGeneric joins target path with the working directory.

func (WorkingDirectory) PackRel

func (workDir WorkingDirectory) PackRel(filename yunyun.FullPathFile, data string) (yunyun.RelativePathFile, string)

PackRel cleans the filename from absolute workspace prefix.

func (WorkingDirectory) PackRelRef

func (workDir WorkingDirectory) PackRelRef(filename *yunyun.FullPathFile, data *string) (yunyun.RelativePathFile, string)

PackRelRef cleans the filename from absolute workspace prefix by refs.

func (WorkingDirectory) Rel

Rel returns path trimmed by the workspace

Jump to

Keyboard shortcuts

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