diff --git a/docs/content/doc/configuration.md b/docs/content/doc/configuration.md index 09cfb48f3..670a8e994 100644 --- a/docs/content/doc/configuration.md +++ b/docs/content/doc/configuration.md @@ -1,7 +1,7 @@ --- title: "Configuring Hugo" pubdate: "2013-07-01" -... +--- The directory structure and templates provide the majority of the configuration for a site. In fact a config file isn't even needed for many websites diff --git a/docs/content/doc/contributing.md b/docs/content/doc/contributing.md index 6b8aa8233..6ddb241f1 100644 --- a/docs/content/doc/contributing.md +++ b/docs/content/doc/contributing.md @@ -1,7 +1,7 @@ --- title: "Contributing to Hugo" Pubdate: "2013-07-01" -... +--- 1. Fork it from https://github.com/spf13/hugo 2. Create your feature branch (`git checkout -b my-new-feature`) diff --git a/docs/content/doc/contributors.md b/docs/content/doc/contributors.md index e8a8ad976..3a7d7e647 100644 --- a/docs/content/doc/contributors.md +++ b/docs/content/doc/contributors.md @@ -1,7 +1,7 @@ --- title: "Contributors" Pubdate: "2013-07-01" -... +--- Hugo was built with love and golang by: diff --git a/docs/content/doc/example.md b/docs/content/doc/example.md index 03595ad10..ab409c595 100644 --- a/docs/content/doc/example.md +++ b/docs/content/doc/example.md @@ -1,7 +1,7 @@ --- title: "Example Content File" Pubdate: "2013-07-01" -... +--- Somethings are better shown than explained. The following is a very basic example of a content file: diff --git a/docs/content/doc/front-matter.md b/docs/content/doc/front-matter.md index af930b25f..e4342099f 100644 --- a/docs/content/doc/front-matter.md +++ b/docs/content/doc/front-matter.md @@ -1,7 +1,7 @@ --- title: "Front Matter" Pubdate: "2013-07-01" -... +--- The front matter is one of the features that gives Hugo it's strength. It enables you to include the meta data of the content right with it. Hugo supports a few @@ -16,7 +16,7 @@ different formats. The main format supported is YAML. Here is an example: - "Development" - "VIM" Slug: "spf13-vim-3-0-release-and-new-website" - ... + --- ### Variables diff --git a/docs/content/doc/installing.md b/docs/content/doc/installing.md index 1f0f02ded..92a07dec9 100644 --- a/docs/content/doc/installing.md +++ b/docs/content/doc/installing.md @@ -1,7 +1,7 @@ --- title: "Installing Hugo" Pubdate: "2013-07-01" -... +--- Hugo is written in GoLang with support for Windows, Linux, FreeBSD and OSX. diff --git a/docs/content/doc/license.md b/docs/content/doc/license.md index 43eba11e6..613a7ed27 100644 --- a/docs/content/doc/license.md +++ b/docs/content/doc/license.md @@ -1,7 +1,7 @@ --- title: "License" Pubdate: "2013-07-01" -... +--- Hugo is released under the Simple Public License. diff --git a/docs/content/doc/organization.md b/docs/content/doc/organization.md index 23238b26d..f524c59d0 100644 --- a/docs/content/doc/organization.md +++ b/docs/content/doc/organization.md @@ -1,7 +1,7 @@ --- title: "Organization" Pubdate: "2013-07-01" -... +--- Hugo uses markdown files with headers commonly called the front matter. Hugo respects the organization that you provide for your content to minimize any extra configuration, though this can be overridden diff --git a/docs/content/doc/release-notes.md b/docs/content/doc/release-notes.md index a4b9e11e5..e268a5c3e 100644 --- a/docs/content/doc/release-notes.md +++ b/docs/content/doc/release-notes.md @@ -1,7 +1,7 @@ --- title: "Release Notes" Pubdate: "2013-07-01" -... +--- * **0.7.0** July 4, 2013 * Hugo now includes a simple server diff --git a/docs/content/doc/roadmap.md b/docs/content/doc/roadmap.md index 7cc5bc812..93a7a83d4 100644 --- a/docs/content/doc/roadmap.md +++ b/docs/content/doc/roadmap.md @@ -1,7 +1,7 @@ --- title: "Roadmap" Pubdate: "2013-07-01" -... +--- In no particular order, here is what I'm working on: diff --git a/docs/content/doc/rst.rst b/docs/content/doc/rst.rst new file mode 100644 index 000000000..c2838eb0a --- /dev/null +++ b/docs/content/doc/rst.rst @@ -0,0 +1,14 @@ +--- +Markup: 'rst' +... + + +============== +This is a Test +============== + + +Really +------ + +text *here* and **HERE**. diff --git a/docs/content/doc/shortcodes.md b/docs/content/doc/shortcodes.md index abca668fe..222963b03 100644 --- a/docs/content/doc/shortcodes.md +++ b/docs/content/doc/shortcodes.md @@ -1,7 +1,7 @@ --- title: "Shortcodes" Pubdate: "2013-07-01" -... +--- Because Hugo uses markdown for it's content format, it was clear that there's a lot of things that markdown doesn't support well. This is good, the simple nature of markdown is exactly why we chose it. diff --git a/docs/content/doc/source-directory.md b/docs/content/doc/source-directory.md index a33adb279..9b0d1ae7e 100644 --- a/docs/content/doc/source-directory.md +++ b/docs/content/doc/source-directory.md @@ -1,7 +1,7 @@ --- title: "Source Directory Organization" Pubdate: "2013-07-01" -... +--- Hugo takes a single directory and uses it as the input for creating a complete website. diff --git a/docs/content/doc/templates.md b/docs/content/doc/templates.md index c2164feb8..6b6e0f34c 100644 --- a/docs/content/doc/templates.md +++ b/docs/content/doc/templates.md @@ -1,7 +1,7 @@ --- title: "Templates" Pubdate: "2013-07-01" -... +--- Hugo uses the excellent golang html/template library for it's template engine. It is an extremely lightweight engine that provides a very small amount of logic. In our diff --git a/docs/content/doc/usage.md b/docs/content/doc/usage.md index 950c4abc8..772c10394 100644 --- a/docs/content/doc/usage.md +++ b/docs/content/doc/usage.md @@ -1,7 +1,7 @@ --- title: "Using Hugo" Pubdate: "2013-07-01" -... +--- Make sure either hugo is in your path or provide a path to it. diff --git a/docs/content/doc/variables.md b/docs/content/doc/variables.md index a5d70739b..8a80fa175 100644 --- a/docs/content/doc/variables.md +++ b/docs/content/doc/variables.md @@ -1,7 +1,7 @@ --- title: "Variables" Pubdate: "2013-07-01" -... +--- Hugo makes a set of values available to the templates. Go templates are context based. The following are available in the context for the templates. diff --git a/hugolib/page.go b/hugolib/page.go index 61b3cf0d3..b8863be2a 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -154,18 +154,17 @@ func (page *Page) parseYamlMetaData(data []byte) ([]string, error) { // must be on their own lines (for now) var found = 0 for i, line := range lines { - line = strings.TrimSpace(line) - if line == "---" { + if strings.HasPrefix(line, "---") { found += 1 } - if line == "..." { + if strings.HasPrefix(line, "---") { found -= 1 } if found == 0 { - datum = lines[0 : i+1] + datum = lines[0: i+1] lines = lines[i+1:] break } @@ -189,13 +188,11 @@ func (p *Page) Permalink() template.HTML { } func (page *Page) handleYamlMetaData(datum []byte) error { - var f interface{} - if err := goyaml.Unmarshal(datum, &f); err != nil { - return fmt.Errorf("Invalide YAML in $v \nError parsing page meta data: %s", page.FileName, err) + m := map[string]interface{}{} + if err := goyaml.Unmarshal(datum, &m); err != nil { + return fmt.Errorf("Invalid YAML in $v \nError parsing page meta data: %s", page.FileName, err) } - m := f.(map[string]interface{}) - for k, v := range m { switch strings.ToLower(k) { case "title": @@ -261,47 +258,6 @@ func (page *Page) GetParam(key string) interface{} { return nil } -func (page *Page) parseFileMetaData(data []byte) ([]string, error) { - lines := strings.Split(string(data), "\n") - - // go through content parse from --- to --- - var found = 0 - for i, line := range lines { - line = strings.TrimSpace(line) - - if found == 1 { - // parse line for param - colonIndex := strings.Index(line, ":") - if colonIndex > 0 { - key := strings.TrimSpace(line[:colonIndex]) - value := strings.TrimSpace(line[colonIndex+1:]) - value = strings.Trim(value, "\"") //remove quotes - switch key { - case "title": - page.Title = value - case "layout": - page.layout = value - case "extension": - page.Extension = "." + value - default: - page.Params[key] = value - } - } - - } else if found >= 2 { - // params over - lines = lines[i:] - break - } - - if line == "---" { - found += 1 - } - } - - return lines, nil -} - func (page *Page) Err(message string) { fmt.Println(page.FileName + " : " + message) } @@ -311,9 +267,6 @@ func (page *Page) parseFileHeading(data []byte) ([]string, error) { if len(data) == 0 { page.Err("Empty File, skipping") } else { - if data[0] == '-' { - return page.parseFileMetaData(data) - } return page.parseYamlMetaData(data) } return nil, nil