Commit graph

245 commits

Author SHA1 Message Date
Anthony Fok 8b8fb417ae More initialism corrections (golint)
Thanks to @bep's new, brilliant helpers.Deprecated() function,
the following functions or variables are transitioned to their
new names, preserving backward compatibility for v0.14
and warning the user of upcoming obsolescence in v0.15:

 * .Url → .URL (for node, menu and paginator)
 * .Site.BaseUrl → .Site.BaseURL
 * .Site.Indexes → .Site.Taxonomies
 * .Site.Recent → .Site.Pages
 * getJson → getJSON
 * getCsv → getCSV
 * safeHtml → safeHTML
 * safeCss → safeCSS
 * safeUrl → safeURL

Also fix related initialisms in strings and comments.

Continued effort in fixing #959.
2015-03-18 11:30:37 +01:00
Anthony Fok 67df33f500 Correct initialisms as suggested by golint
First step to use initialisms that golint suggests,
for example:

    Line 116: func GetHtmlRenderer should be GetHTMLRenderer

as see on http://goreportcard.com/report/spf13/hugo

Thanks to @bep for the idea!

Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.

First step in fixing #959.
2015-03-11 21:55:00 +01:00
bep e24a775962 page: make receiver name on Page methods consistent
Apply some Golint rules on Page, esp. making the method receiver names consistent:

(page *Page) ==> (p *Page)
2015-03-07 12:25:38 +01:00
bep 103ea842f8 Fix errors reported by Go Vet 2015-03-06 15:25:19 +01:00
bep 22d85c2a18 Avoid converting summary to []byte and back to string 2015-02-10 14:37:29 +01:00
bep 48b6777ea2 Fix Truncate
TruncateWordsToWholeSentence knows if the summary is truncated, so let "him" decide.

Fixes #880
2015-02-05 14:04:48 -07:00
bep f8704c1bf2 Avoid calling strings.Fields multiple times with same content
This should be a relief for big sites.
2015-02-05 00:38:50 +01:00
bep 11a19e0760 Build PageMenus only once 2015-02-04 21:27:27 +01:00
bep b984ec96bc Optimize for the common case in Blackfriday config 2015-01-31 23:45:38 +01:00
Naoya Inada d1364ffb68 Fix defaults for Blackfriday 2015-01-31 22:06:50 +01:00
bep 47c8f32967 Prevent site config being overwritten
Fixed #867
2015-01-31 19:14:13 +01:00
spf13 e1e6aaed2f Merge branch 'master' of github.com:spf13/hugo 2015-01-31 01:04:28 -05:00
Jeffrey Tolar 366c557251 Use a regular expression in replaceShortcodeTokens
This fixes a bug where a shortcode needs to be expanded multiple times,
which can arise in practice when using reference links.
2015-01-30 20:58:25 +01:00
spf13 77074127e0 page source creation using BBP 2015-01-30 11:42:02 -08:00
Naoya Inada 407e80a9ab Add site-wide/per-page [blackfriday] extensions option 2015-01-26 09:55:37 +01:00
Anthony Fok 803865f870 Fix for page.GetParam() for JSON and TOML maps
Setting per-page Blackfriday angledQuotes did not work
with TOML or JSON front matter, but it does work with YAML.

It turns out that page.Params("blackfriday") returns
type map[interface{}]interface{} for YAML, but
type map[string]interface{} for JSON and TOML.

This patch updates page.GetParam() to catch the latter,
with an error message if page.GetParam() does not recognize
a type.  A test is also added.
2015-01-24 15:25:44 +01:00
bep 1b42dc572a Fix RelPermalink() and Urls in menus vs canonifyUrls
canonifyUrls=true, RelPermalink and baseUrl with sub-path did not work.

This fixes that by adding a check for canonifyUrl=trues=true in RelPermalink().

So given

- baseUrl "http://somehost.com/sub/"
- the path "some-path/file.html"

For canonifyUrls=false RelPermalink() returns "/sub/some-path/file.html"
For canonifyUrls=true RelPermalink() returns "/some-path/file.html"

In the last case, the Url will be made absolute and clickable in a later step.

This commit also makes the menu urls defined in site config releative. To make them work with canonifying of urls, the context root is prepended if canonifying is turned off.

Fixes #519
Fixes #711
2015-01-23 14:13:00 +01:00
bep c8f8f48e96 Cache the page's rendering context flags
This map can potentially be used many times for a given page, and altough the cost of re-creating the map should be minimal, caching it is simple -- and could save some GC and CPU cycles.
2015-01-21 15:30:03 +01:00
bep 1cc6386937 Make ref and relref respect plainIdAnchors
Fixes #813
2015-01-21 14:35:33 +01:00
Anthony Fok 02da49597d Fix string comparison for .Truncated page variable
Instead of `strings.TrimSpace()`, use `strings.Join(strings.Fields(s), " ")`
to collapse all whitespaces into single spaces, in order to match the
behaviour of helpers.TruncateWordsToWholeSentence(),
in order to detect non-truncated content correctly.
2015-01-20 15:50:32 -07:00
Dave Johnston a5f5106154 Add in-section Next/Prev content pointers
Conflicts:
	docs/content/meta/release-notes.md
	docs/content/templates/variables.md
2015-01-05 18:26:09 +01:00
bep 837922d32b Add ERROR logging on invalid date and publishdate
Having correct dates is important in Hugo. Previously date parsing errors were swallowed, leading to confusing results.

This commit adds ERROR logging when date or publishdate in front matter cannot be parsed into a time.Time.
2015-01-05 12:44:41 +01:00
bep fbf8bcacc4 Add configurable support for angled quotes
The flag `HTML_SMARTYPANTS_ANGLED_QUOTES` was added to Blackfriday on Black Friday. This configures rendering of double quotes as angled left and right quotes («
»).

Typical use cases would be either or, or combined, but never in the same
document. As an example would be a person from Norway; he has a blog in both
English and Norwegian (his native tongue); he would then configure Blackfriday
to use angled quotes for the Norwegian section, but keep them as reqular
double quotes for the English.

This commit adds configuration support for this new flag, configuration that can be set in the site configuration, but overridden in page front matter.

Fixes #605
2014-12-26 14:31:55 +01:00
Derek Perkins 8f6f871f53 Added AuthorList, Author, AuthorSocial, SiteSocial, Image and Video structs
Added Page.Author(s) functions
Added schema, opengraph, twitter_cards, google_news metadata templates
Added "" template
2014-12-18 22:26:10 -05:00
Austin Ziegler 112c3c5c04 Provide (relative) reference funcs & shortcodes.
-   `.Ref` and `.RelRef` take a reference (the logical filename for a
    page, including extension and/or a document fragment ID) and return
    a permalink (or relative permalink) to the referenced document.

    -   If the reference is a page name (such as `about.md`), the page
        will be discovered and the permalink will be returned: `/about/`
    -   If the reference is a page name with a fragment (such as
        `about.md#who`), the page will be discovered and used to add the
        `page.UniqueID()` to the resulting fragment and permalink:
        `/about/#who:deadbeef`.
    -   If the reference is a fragment and `.*Ref` has been called from
        a `Node` or `SiteInfo`, it will be returned as is: `#who`.
    -   If the reference is a fragment and `.*Ref` has been called from
        a `Page`, it will be returned with the page’s unique ID:
        `#who:deadbeef`.

-   `.*Ref` can be called from either `Node`, `SiteInfo` (e.g.,
    `Node.Site`), `Page` objects, or `ShortcodeWithPage` objects in
    templates.

-   `.*Ref` cannot be used in content, so two shortcodes have been
    created to provide the functionality to content: `ref` and `relref`.
    These are intended to be used within markup, like `[Who]({{% ref
    about.md#who %}})` or `<a href="{{% ref about.md#who %}}">Who</a>`.

-   There are also `ref` and `relref` template functions (used to create
    the shortcodes) that expect a `Page` or `Node` object and the
    reference string (e.g., `{{ relref . "about.md" }}` or `{{
    "about.md" | ref . }}`). It actually looks for `.*Ref` as defined on
    `Node` or `Page` objects.

-   Shortcode handling had to use a *differently unique* wrapper in
    `createShortcodePlaceholder` because of the way that the `ref` and
    `relref` are intended to be used in content.
2014-12-18 22:18:36 -05:00
bep 9b04c27998 Revert "Make Urls in menus respect CanonifyUrls"
This reverts commit 3ccb397902.
2014-12-11 05:33:40 +01:00
bep 3ccb397902 Make Urls in menus respect CanonifyUrls
Fixes #519
2014-12-10 20:32:39 +01:00
bep 9f77f93071 Fix various Windows-issues
File handling was broken on Windows. This commit contains a revision of the path handling with separation of file paths and urls where needed.

There may be remaining issues and there may be better ways to do this, but it is easier to start that refactoring job with a set of passing tests.

Fixes #687
Fixes #660
2014-12-09 09:43:15 -05:00
spf13 4a2f16f91e refactor handlers to use types instead of structs. 2014-11-20 12:43:34 -05:00
spf13 73f203ad86 Move template library into it's own package (tpl). No longer dependent on hugolib. Can be used externally. 2014-11-20 12:36:57 -05:00
bep 55fcd2f30f Shortcode rewrite, take 2
This commit contains a restructuring and partial rewrite of the shortcode handling.

Prior to this commit rendering of the page content was mingled with handling of the shortcodes. This led to several oddities.

The new flow is:

1. Shortcodes are extracted from page and replaced with placeholders.
2. Shortcodes are processed and rendered
3. Page is processed
4. The placeholders are replaced with the rendered shortcodes

The handling of summaries is also made simpler by this.

This commit also introduces some other chenges:

1. distinction between shortcodes that need further processing and those who do not:

* `{{< >}}`: Typically raw HTML. Will not be processed.
* `{{% %}}`: Will be processed by the page's markup engine (Markdown or (infuture) Asciidoctor)

The above also involves a new shortcode-parser, with lexical scanning inspired by Rob Pike's talk called "Lexical Scanning in Go",
which should be easier to understand, give better error messages and perform better.

2. If you want to exclude a shortcode from being processed (for documentation etc.), the inner part of the shorcode must be commented out, i.e. `{{%/* movie 47238zzb */%}}`. See the updated shortcode section in the documentation for further examples.

The new parser supports nested shortcodes. This isn't new, but has two related design choices worth mentioning:

* The shortcodes will be rendered individually, so If both `{{< >}}` and `{{% %}}` are used in the nested hierarchy, one will be passed through the page's markdown processor, the other not.
* To avoid potential costly overhead of always looking far ahead for a possible closing tag, this implementation looks at the template itself, and is branded as a container with inner content if it contains a reference to `.Inner`

Fixes #565
Fixes #480
Fixes #461

And probably some others.
2014-11-17 18:32:06 -05:00
Joel Scoble 2c51bba0c3 converted path 2 filepath 2014-11-13 22:38:21 -05:00
spf13 141f3e19e0 Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00
spf13 93f3d604c6 Handlers WIP 2014-10-20 17:42:16 -04:00
spf13 5dfc1dedb8 Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
Austin Ziegler 9cdd2e54c2 Use md5 against the file path for uniqueness. 2014-10-07 16:45:23 -04:00
Austin Ziegler 603b24a163 Make each generated page’s footnotes unique.
If content pages are fully rendered in a list page, footnotes that use
the same reference (`[^fn]`) will have duplicated anchors. This change
builds on #526 to put the page filename (`Page.File.Name`) as part of
the anchor for a footnote.

This would fix discussion [116](http://discuss.gohugo.io/t/footnote-references-are-duplicated-on-list-pages/116).
2014-10-07 16:44:28 -04:00
Austin Ziegler e68e7ef96f Configure footnote rendering.
- The config file can provide FootnoteAnchorPrefix, which will be used
  by blackfriday when rendering to HTML. A value of `q:` has the effect
  of making the anchor for a footnote `[^footie]` be `fn:q:footie`. The
  default is `""`.

- The config file can provide FootnoteReturnLinkContents, which will be
  used by blackfriday when rendering to HTML. A value of `^` has the
  effect of making the return link be `^` instead of `[return]`.
2014-10-07 16:43:33 -04:00
Joel Scoble 4e9b04086a fix tags not being in lowercase, #491 2014-09-11 17:03:31 -04:00
Nate Finch acf9561a31 fix zero date 2014-09-08 11:55:54 -04:00
Nate Finch b97c6c7082 add Name to File, which is the filename minus the extension 2014-09-08 11:44:50 -04:00
Dave Johnston 13a317b975 Enable header id blackfriday extension 2014-08-30 14:12:53 -04:00
Joel Scoble c750a95e22 support for futre/draft summary info output 2014-08-20 14:21:15 -04:00
spf13 aae1ff3c92 Adding IsNode & IsPage functions to Page & Node 2014-08-19 21:27:13 -04:00
Andrew Jones 5969315c8f switch back to master blackfriday; enable footnotes 2014-06-30 15:14:42 -04:00
spf13 4483a6655a Centralizing the template execution logic in one place 2014-06-06 17:27:31 -04:00
spf13 4e99d6b54c Adding proper error message when view is not found.. fixing #303 2014-06-04 12:33:27 -04:00
spf13 640ab3c72e fixed #303. Adding theme support to views 2014-06-03 17:53:00 -04:00
Jake Mitchell e0ea6b9955 Support embedding <script> tags in markdown pages 2014-06-03 15:14:38 -04:00
spf13 c502f078bc Add handling for publishDates (which will be ignored if in the future). Fixed #260 2014-05-29 00:48:40 -04:00
spf13 a4a1e39a51 Fixing issue when two menu items have the same name. 2014-05-14 18:08:11 -04:00
Dato Simó 05b76dcb6f Add a blank line after the front matter when writing back a page.
Could also be done in parser.InterfaceToFrontMatter(), but logically the
extra blank line belongs to the page, not the front matter itself.
2014-05-12 15:46:58 -04:00
Vincent Batoufflet 2a902bbca6 Add Sitemaps config values handling 2014-05-09 23:11:33 -04:00
spf13 08c30b6e44 Using new helpers in page.go 2014-05-02 01:04:48 -04:00
spf13 fb7d45e613 permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
spf13 859a78e1bd Providing the ability to save (write) a content's source file. 2014-05-01 13:21:37 -04:00
spf13 1302ef9f63 Making site page initialization a bit more granular and accessible 2014-05-01 13:20:58 -04:00
spf13 cbd9506c29 moving front matter parsing (and creation) to parse package 2014-05-01 13:20:09 -04:00
spf13 bdf7cd9f9d Creating site menu configuration and have the docs site use it 2014-04-24 16:11:08 -06:00
spf13 9ecf58e29b new menus system including active link & nesting 2014-04-23 02:59:19 -04:00
spf13 69c1944f1f Add handling of deeply nested front matter 2014-04-23 02:55:43 -04:00
spf13 4a8de8ea46 Add Disqus support out of the box. Move template/bundle into hugolib. 2014-04-23 02:53:12 -04:00
spf13 c8269d6dbc Making node.Keywords the correct length 2014-04-08 21:40:03 -04:00
spf13 62dd1d45c1 Hugo config abstracted into a general purpose config library called "Viper".
Hugo casting now in own library called "cast"
2014-04-05 01:40:33 -04:00
spf13 e50b9d8ac1 Adding support for logging & verbose logging. Consolidation of error handling. Integration of jWalterWeatherman library. Fixed #137 2014-03-31 13:23:34 -04:00
Ask Bjørn Hansen 0becad727a Make error message when encountering unrecognized file extensions more helpful 2014-02-28 22:11:41 -05:00
Ask Bjørn Hansen ea8d0981d5 Make per-page url overrides take precedence over section permalink settings
This seems more reasonable to me.

I didn't understand why the pUrl comparision was on len > 2; I changed it to 0.

Closes #212.
2014-02-28 11:55:37 -05:00
spf13 14227351fa Reorganization of helpers. Centralized Url/Path logic. Fixed #175. 2014-02-27 20:33:18 -05:00
Anton Ageev 72ba6d633d Fix permalink bug in uglyurls mode (refs #187). 2014-02-02 00:56:01 -05:00
Niels Widger c1b9380dfd Add back blackfriday extensions during Markdown conversion
Modified markdownRender and markdownRenderWithTOC in hugolib/page.go to
use the same flags and extensions as were previously used when we simply
called blackfriday.MarkdownCommon to convert Markdown to HTML.  These
flags/extensions were dropped during the refactor that added the
`.TableOfContents` page variable, and caused features like Markdown
tables to no longer work.

Modified the expected output for TestTableOfContents in page_test.go,
apparently changing the flags/extensions caused an `&mdash;` to become
`&ndash;`.
2014-01-30 23:04:37 -05:00
Tibor Vass 6dd2e9a49a gofmt all go code 2014-01-29 18:03:35 -05:00
spf13 1882ffabc6 Adding support for boolean params 2014-01-28 23:24:59 -05:00
spf13 1da3fd039a Continue with TOC integration and page refactor. Updated a few tests to match new generated output. 2014-01-28 23:11:05 -05:00
spf13 9666f33e2f Don’t render short codes on summary twice 2014-01-27 17:32:36 -05:00
spf13 d0825a211a Big refactor of pages code. Changed TOC code to only parse when actually used 2014-01-27 17:20:20 -05:00
Niels Widger f62e3e9940 Add new TableOfContents Page variable (Markdown only)
Added TableOfContents field to hugolib.Page struct.  New function
getTableOfContents is used in convertMarkdown to set the TableOfContents
field.

Added new test file hugolib/page_toc_test.go with a simple test of the
new functionality.

Conflicts:
	hugolib/page.go
2014-01-23 17:27:08 -05:00
spf13 3851117c25 renaming MinRead to ReadingTime and adding to documentation. 2014-01-21 20:08:24 -05:00
spf13 065928fcf0 Adding page sorting by weight function (the default) 2013-12-28 12:56:12 -05:00
spf13 70745e8cb5 Complete refactor of indexes, move (and rewrite) page sorting to page.go, add tests 2013-12-20 09:10:05 -05:00
spf13 0e04b9a029 Moving processing short codes to the page 2013-12-06 23:57:24 -05:00
spf13 d0ef3d43bd better handling of detecting markup format 2013-12-06 23:56:51 -05:00
spf13 f432b187a0 render shortcodes prior to converting to html 2013-12-06 23:32:00 -05:00
spf13 44d57fdc0c Reorganize helpers 2013-12-05 09:29:41 -05:00
Tim Esselens 860f982cc4 fixed trailing dir slash when using slug
See testcase, dir + slug contained double slash when dir had a trailing
slash.

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-11-20 15:32:22 -08:00
Phil Pennock 07978e4a49 configurable permalinks support
A sample config.yaml for a site might contain:

```yaml
permalinks:
  post: /:year/:month/:title/
```

Then, any article in the `post` section, will have the canonical URL
formed via the permalink specification given.

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-11-18 13:32:56 -08:00
Phil Pennock 40d05f12a7 Truncated; .Site.Params; First function
* Add `.Truncated` bool to each page; will be set true if the
  `.Summary` is truncated and it's worth showing a "more" link of some
  kind.
* Add `Params` to the site config, defining `.Site.Params` accessible
  to each page; this lets the site maintainer associate arbitrary data
  with names, on a site-wide basis.
* Provide a `First` function to templates:
  * Use-case: `{{range First 5 .Site.Recent}}` or anything else which
    is a simple iterable provided by hugolib
* Tests by me for `.Truncated` and `First`

Also @noahcampbell contributed towards this:

* Add UnitTest for `.Site.Params`:
> Digging into this test case a bit more, I'm realizing that we need
> to create a param test case to ensure that for each type we render
> (page, index, homepage, rss, etc.) that the proper fields are
> represented.  This will help us refactor without fear in the
> future.

Sample config.yaml:

```yaml
title: "Test site"
params:
  Subtitle: "More tests always good"
  AuthorName: "John Doe"
  SidebarRecentLimit: 5
```

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-11-12 22:49:54 +00:00
spf13 9388f23606 Adding support for linkTitles 2013-10-25 18:37:53 -04:00
spf13 471fb1ff69 Adding support for date field in front matter as date (as TOML provides) 2013-10-24 15:18:57 -07:00
spf13 f3c816eabd Adding support for more front matter types (int, float & date) 2013-10-24 14:31:04 -07:00
spf13 3558e3d6f0 Add support for weighted pages
Now pages can be sorted by other than date
2013-10-18 11:01:31 -04:00
spf13 4263094d75 Adding support for MinRead. Closed #106 2013-10-15 09:32:21 -04:00
spf13 be5ace1588 Wordcount restored. fixed #92 2013-10-15 09:15:52 -04:00
Noah Campbell 4993152dda Permalink to include multiple directories levels 2013-10-08 18:44:15 +02:00
Noah Campbell 9500ec1b6b Refactor layout selection code
The render code path would use a fallback if there was an exception.
This change instead relies on explicit declaration of the layout to use
and includes a check to see if the layout indeed exists before
attempting to render it.
2013-10-08 18:44:15 +02:00
Noah Campbell 197aacb647 Add support for Relative Permalinks 2013-10-08 18:42:03 +02:00
Noah Campbell 06da609138 Refactor Permalink to private function
This will allow for reuse of this particular function.
2013-10-08 18:42:03 +02:00
spf13 266f583a8c Restoring former snippet behavior & adding test to ensure future behavior 2013-10-04 12:28:28 -04:00
spf13 18f2b82658 Switching to the rjson library which is more friendly to human generated json. 2013-10-01 22:45:24 -04:00
Noah Campbell db50154e75 Support index.html indexes in content directory
If a file named index.html exists in a directory, or root, it will be
rendered as if ugly urls are turned on.  This allows for top level
content to not need a supporting layout file and content in content.
This change should not affect anyone who is using the perscribed way.

I also cleaned up a bunch of one off functions in site.go.
2013-09-24 21:27:25 -07:00
Noah Campbell bffe4baf42 Create a TargetPath() method that provides OutFile
Moved the generation of the target path to the page breaking all
dependecies on Site.
2013-09-20 17:24:25 -07:00
Noah Campbell 52e8c7a0ac Section is determined by the source, not the url
This change allows for top level html content to exists.
2013-09-20 17:03:43 -07:00
Noah Campbell 311e102223 Allow non-markdown content in content directory
Allow content that is not markdown and does not need to be rendered to
exists in the content directory.  Currently any valid html or xml
document can exist.  Templates are applied to these documents as well.
If you need to have content that doesn't have templates or AbsUrlify
like operations, then continue to put this content in static and it will
be copied over.
2013-09-18 14:21:27 -07:00
Noah Campbell 67b2abaf09 Add IsRenderable to Page
As pages are read from the target, they will be assessed if they should
be rendered or not.  The logic for IsRenderable is in the parser/page.go
and looks for anything exception '<'.
2013-09-18 10:17:43 -07:00
Noah Campbell d8e1834910 Fix parsing edge case of frontmatter
When the frontmatter contains a - (or other delimiter) close to the
closing frontmatter delimiter, frontmatter detection would fail.
2013-09-18 09:15:46 -07:00
Noah Campbell a82efe5bb1 Merge remote-tracking branch 'origin/parser' into mrg_praser
Also brought in parse for github.com/noahcampbell/akebia

Conflicts:
	hugolib/page.go
	hugolib/page_test.go
2013-09-17 15:52:40 -07:00
Noah Campbell d45fb72f67 Add /index.html to unadorned alias paths
Bring code to be better in line with documentation.
2013-09-13 14:51:28 -07:00
Noah Campbell 803a0fce1e Remove RenderedContent from page.
The output is written directly to disk after being written.  Not
entirely sure why it was split into two steps.
2013-09-13 10:30:27 -07:00
Noah Campbell 74b55fc7c8 Normalize paths within hugo
filepath was used inconsistently throughout the hugolib.  With the
introduction of source and target modules, all path are normalized to
"/".  This simplifies the processing of paths.  It does mean that
contributors need to be aware of using path/filepath in any module other
than source or target is not recommended.  The current exception is
hugolib/config.go
2013-09-12 10:48:59 -07:00
Noah Campbell d4d9da9f3a Remove page module dependence on opening files
The site is responsible for reading files, page only operates on
buffers.
2013-09-04 19:36:06 -07:00
Noah Campbell 79d9f82e79 Code reorg, helpers.go has been decomposed.
It started with wanting to move templates in template bundles and the
rest followed.  I did my best to start grouping related functions
together, but there are some that I missed.  There is also the method
Urlize that seems to be a special function used in both worlds.  I'll
need to revisit this method.
2013-09-03 16:16:07 -07:00
Noah Campbell 3ecc698f5e Remove hugolib.HTML and hugolib.URL types
These types were not be rendered correctly by the html/template package.
Removing them gets the correct behavior.

Fixes #74
2013-09-03 12:43:56 -07:00
Fabrizio (Misto) Milo ba82a20321 Add support for amber files
If a layout file ends with .amber it will interpreted as a Amber file

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 19:51:32 -07:00
Fabrizio (Misto) Milo ee5865f239 Abstract html/template dependency
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 19:51:27 -07:00
Mark Sanborn 6c8e7edbb4 The <!--more--> (summary divider) now works even if it is on the same line as content
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 07:44:29 -07:00
Noah Campbell bc3c229002 Ensure Section is set before returning Page object. 2013-08-30 20:13:22 -07:00
Fabrizio (Misto) Milo 3ab5245049 clean up logic
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-28 20:39:58 -07:00
Noah Campbell 554375b2ad Using new parser. 2013-08-25 20:27:03 -07:00
Ross Lawley 9930011ea2 Wordpress summaries
Allow full control of summaries which can be rendered as html rather
than text.  Using a `<!--more-->` html comment in your markdown / rst
you can indiciate where the summary should end and have the summary
converted to html.

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>

Conflicts:
	hugolib/page_test.go
2013-08-23 16:46:19 -07:00
Noah Campbell 599e6672f7 Removing GetSection
Using GetXXX is not idiomatic to Go.  Also added a bunch of unit testing
around this method.
2013-08-23 14:14:54 -07:00
elij b9e835b101 avoid handling a redirect from slug to slug/
because the url lacks a trailing /, many webservers will issue a
redirect to the canonical url with trailing slash for directory index
w/index.htm(l).
Append a slash to avoid this.
2013-08-16 13:14:20 -07:00
spf13 480e01eb15 Further work on path/section stuff. Tests passing now. 2013-08-14 08:57:14 -04:00
spf13 b4bcc591e4 Now support for nested paths. Better section detection. 2013-08-13 19:39:24 -04:00
spf13 d5518c0966 Adding support for aliases (redirects) 2013-08-10 15:35:34 +01:00
spf13 45ce6e2b30 Merge branch 'redirect' of https://github.com/rozza/hugo into rozza-redirect
Conflicts:
	hugolib/page.go
2013-08-10 14:08:38 +01:00
Noah Campbell e26b43f6d9 Adding more test cases 2013-08-09 17:36:32 -07:00
Noah Campbell 085ce15f7c Adding ability to read from io.Reader
This allows for testing without relying on the file system.  Parsing algorithm to not read the entire file into memory.
2013-08-09 17:36:32 -07:00
Noah Campbell 274d324c8b Introduce unit testing for page.go 2013-08-09 17:36:32 -07:00
Noah Campbell 0595f27e6d Using a composite literal to create a page.
Wonder why the need for composite structs.  Not sure if my go knowledge is lacking or if this is cruft from other programming language doctrine.
2013-08-09 17:36:32 -07:00
Noah Campbell 19538a1bd6 Support pages without folders 2013-08-09 17:36:31 -07:00
Ross Lawley e2a28114d1 Add redirect to page parameters and redirects example 2013-08-09 21:57:22 +01:00
Noah Campbell c9a09418e7 Fixed section labels causing panic on windows.
The filename path was being split using a unix specific path seperator.  This fix uses the os.PathSeperator to ensure proper evaluation regardless of platform.
2013-08-01 13:27:56 -07:00
spf13 92c31bbe10 permalink now respects pretty urls 2013-07-26 09:56:00 -04:00
spf13 8fae5f0dd6 Default is now pretty urls (without .html)
Adding --uglyurls option to retain previous behavior
2013-07-19 00:10:42 -07:00
spf13 e76c3feb52 Fix bug with JSON front matter parsing. 2013-07-09 19:04:22 -04:00
spf13 a6914e9c4c Better error handling for parsing front matter 2013-07-09 18:53:08 -04:00
tycho garen 4951ff998c rst: fixing rst output processing 2013-07-09 08:16:29 -04:00
spf13 d2a6267ad7 Adding support for TOML, updating documentation 2013-07-08 22:23:54 -04:00
spf13 3c80cd323c YAML support similar to jekyll (start and end with '---') 2013-07-08 17:57:01 -04:00
tycho garen f851c4162b fix: changing terminal yaml line, generalizing forematter splitting 2013-07-07 10:01:53 -04:00
tycho garen b024454ea9 fixes: returning json parsing, error messages, yaml header offsets 2013-07-07 01:03:12 -04:00
tycho garen 67f4da30b1 revert: adding json support 2013-07-06 23:52:14 -04:00
tycho garen 6c42d3d490 fix: parsing of yaml forematter 2013-07-06 23:37:47 -04:00
tycho garen 431fa0e2d7 changing to suport yaml rather than json and adding optional restructuredtext support 2013-07-06 22:48:12 -04:00
tycho garen a7f5f97bc2 sanity: move from json to yaml 2013-07-06 22:32:50 -04:00
spf13 6e16449e5f adding hugo 2013-07-04 11:32:55 -04:00