web

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, config *Config) error

func Clear

func Clear(text any) any

func ClearLeft

func ClearLeft(text any) any

func ClearRight

func ClearRight(text any) any

func Indent

func Indent(tabs int, text any) any

func Lower

func Lower(text any) any

func Replace

func Replace(text any, old, new string) any

func Sequence

func Sequence(first, last int64) any

func TemplateFuncs

func TemplateFuncs(source TemplateSource) map[string]any

func Text

func Text(text string) any

func Upper

func Upper(text any) any

func Year

func Year() any

Types

type Config

type Config struct {
	RootDir   string               `json:"-"`
	Base      string               `json:"base"`
	Title     string               `json:"title"`
	Languages map[string]*Language `json:"languages"`
	Values    map[string]string    `json:"values"`
}

func (*Config) Dir

func (c *Config) Dir(name string) string

func (*Config) DirFS

func (c *Config) DirFS(name string) fs.FS

type L10n

type L10n struct {
	Values map[string]string
}

type Language

type Language struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

type Page

type Page struct {
	Name        string         `json:"name,omitempty"` // explicitly defined name by user
	Title       string         `json:"title,omitempty"`
	Description string         `json:"description,omitempty"`
	Options     *PageOptions   `json:"options,omitempty"`
	Values      map[string]any `json:"values,omitempty"`
	Path        string         `json:"-"` // full path including language and file extensions (never starts to slash)
	Language    string         `json:"-"` // language extracted from path (first element) or empty string
	PathName    string         `json:"-"` // name derived from path excluding language, index or file extension
	Template    *Template      `json:"-"` // current page has template "content", all templates are also added
	List        []*Page        `json:"-"` // all pages with the same language located in the same directory (only for index.html)
	Web         *Web           `json:"-"`
}

func ParsePage

func ParsePage(web *Web, path string, data []byte) (*Page, error)
func (p *Page) Link() string

func (*Page) NameOrPathName

func (p *Page) NameOrPathName() string

func (*Page) OutputPath

func (p *Page) OutputPath() string

func (*Page) PageData

func (p *Page) PageData() *PageData

type PageData

type PageData struct {
	Web         *WebData
	Name        string
	Title       string
	Description string
	Path        string
	Language    string
	Link        string
	List        []*PageData
	Values      map[string]any
}

func (*PageData) Value

func (p *PageData) Value(key string) any

type PageOptions

type PageOptions struct {
	Flat bool // preserve file path as link, do not move to subfolder as index.html
	Hide bool // page will not be part of sitemap
	Skip bool // skip this page during loading phase
}

func (*PageOptions) MarshalJSON

func (p *PageOptions) MarshalJSON() ([]byte, error)

func (*PageOptions) UnmarshalJSON

func (p *PageOptions) UnmarshalJSON(data []byte) error

type Template

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

func ParseTemplate

func ParseTemplate(web *Web, name, data string) (*Template, error)

func (*Template) Error

func (t *Template) Error(err error)

func (*Template) Execute

func (t *Template) Execute(w io.Writer, page *Page) error

func (*Template) L10n

func (t *Template) L10n(name string) string
func (t *Template) Link(name, language string) string

func (*Template) Page

func (t *Template) Page(name string) (*Page, error)

func (*Template) Render

func (t *Template) Render(w io.Writer, name string) error

type TemplateSource

type TemplateSource interface {
	L10n(name string) string
	Link(name, language string) string
	Page(name string) (*Page, error)
	Error(err error)
}

type Web

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

func Load

func Load(c *Config) (*Web, error)

func (*Web) Compile

func (w *Web) Compile() error
func (w *Web) Link(page *Page) string

func (*Web) WebData

func (w *Web) WebData() *WebData

type WebData

type WebData struct {
	Base   string
	Title  string
	Values map[string]string
}

Directories

Path Synopsis
Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus
Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

Jump to

Keyboard shortcuts

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