Documentation
¶
Overview ¶
* Copyright (c) 2013 Dario Castañé. * This file is part of Zas. * * Zas is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Zas 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Zas. If not, see <http://www.gnu.org/licenses/>.
* Copyright (c) 2013 Dario Castañé. * This file is part of Zas. * * Zas is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Zas 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Zas. If not, see <http://www.gnu.org/licenses/>.
* Copyright (c) 2013 Dario Castañé. * This file is part of Zas. * * Zas is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Zas 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Zas. If not, see <http://www.gnu.org/licenses/>.
* Copyright (c) 2013 Dario Castañé. * This file is part of Zas. * * Zas is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Zas 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Zas. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func NewI18n(mainlang string) (i18n gt.Strings, err error)
- type ConfigSection
- type Generator
- func (gen *Generator) BuildDeployPath(path string) string
- func (gen *Generator) Generate(path string, data *ZasData) (err error)
- func (gen *Generator) GetDeployPath() string
- func (gen *Generator) Html(e *goquery.Selection, doc *goquery.Document, data *ZasData) (err error)
- func (gen *Generator) Markdown(e *goquery.Selection, doc *goquery.Document, data *ZasData) (err error)
- func (gen *Generator) Plain(e *goquery.Selection, doc *goquery.Document, data *ZasData) (err error)
- func (gen *Generator) Run() error
- type Init
- type Subcommand
- type ZasData
- func (zd *ZasData) E(s string, a ...interface{}) (t string)
- func (zd *ZasData) Extra(keypath string) (value string, err error)
- func (zd *ZasData) H(s string, a ...interface{}) (h thtml.HTML)
- func (zd *ZasData) IsHome() bool
- func (zd *ZasData) Language() (language string)
- func (zd *ZasData) Resolve(id string) string
- func (zd *ZasData) Title() (title string)
- func (zd *ZasData) URL() string
- type ZasSiteData
Constants ¶
This section is empty.
Variables ¶
var ZAS = "zas"
var ZAS_CONF_FILE = filepath.Join(ZAS_DIR, "config.yml")
var ZAS_DEFAULT_CONF = ConfigSection{ ZAS: ConfigSection{ "layout": filepath.Join(ZAS_DIR, "layout.html"), "deploy": filepath.Join(ZAS_DIR, "deploy"), }, "site": ConfigSection{ "baseurl": "http://example.com", "language": "en", }, "mimetypes": ConfigSection{ "text/markdown": "markdown", "text/plain": "plain", "text/html": "html", }, }
var ZAS_DEFAULT_DIR_PERM = 0755
var ZAS_DEFAULT_FILE_PERM = 0644
var ZAS_DIR = fmt.Sprintf(".%s", ZAS)
var ZAS_DIR_CONF_FILE = fmt.Sprintf(".%s.yml", ZAS)
var ZAS_I18N_FILE = filepath.Join(ZAS_DIR, "i18n.yml")
var ZAS_PREFIX = "zs"
Functions ¶
Types ¶
type ConfigSection ¶
type ConfigSection map[interface{}]interface{}
* Aliasing goyaml's default map type.
func NewConfig ¶
func NewConfig() (config ConfigSection, err error)
* Loads ZAS_CONF_FILE (as defined in constants.go). * It must be a YAML file.
func (ConfigSection) GetSection ¶
func (cs ConfigSection) GetSection(key string) (value ConfigSection)
* Returns a subsection from current section.
func (ConfigSection) GetString ¶
func (cs ConfigSection) GetString(key string) (value string)
* Returns a string value from current section.
func (ConfigSection) GetZString ¶
func (cs ConfigSection) GetZString(key string) string
* Returns a string value from default Zas section.
type Generator ¶
type Generator struct {
// Verbose output.
Verbose bool
// Full generation (non-incremental mode).
Full bool
// Config from ZAS_CONF_FILE.
Config ConfigSection
// Default layout from Config[ZAS]["layout"].
Layout *thtml.Template
// i18n helper.
I18n *gt.Build
// contains filtered or unexported fields
}
* Convenience type to group relevant rendering info.
func (*Generator) BuildDeployPath ¶
* Builds deployment path for specific file pointed by path.
func (*Generator) GetDeployPath ¶
* Returns deployment base path in config.
func (*Generator) Markdown ¶
func (gen *Generator) Markdown(e *goquery.Selection, doc *goquery.Document, data *ZasData) (err error)
* Embeds a Markdown file.
type Subcommand ¶
type Subcommand struct {
// Runs the subcommand
// The args are the arguments after the subcommand name.
Run func()
// UsageLine is the one-line usage message.
// The first word in the line is taken to be the subcommand name.
UsageLine string
// Name is the name of the subcommand.
Name string
// Flag is a set of flags specific to this command.
Flag flag.FlagSet
}
* Zas internal subcommand. * * Inspired by go command.
func NewSubcommand ¶
func NewSubcommand(usageLine string, run func()) *Subcommand
type ZasData ¶
type ZasData struct {
// Template used as body from current file.
Body thtml.HTML
// Current path (usable in URLs).
Path string
// Title from first level header (H1).
FirstTitle string
// Site configuration, as found in ZAS_CONF_FILE.
Site ZasSiteData
// In-page configuration, from first HTML comment (expected as YAML map).
Page map[interface{}]interface{}
// Current directory configuration, from ZAS_DIR_CONF_FILE.
Directory ConfigSection
// contains filtered or unexported fields
}
* Context data store used in templates.
func NewZasData ¶
type ZasSiteData ¶
* Site configuration. * * They are required fields in order to complete social/semantic meta tags.
