Commit graph

1009 commits

Author SHA1 Message Date
Derek Perkins 717f702e2f Added delimit & sort template functions, tests and docs 2014-12-18 22:28:12 -05: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 e6541c45ab ERROR-log on symbolic links
filepath.Walk does not follow symbolic links.
There's no easy fix for that outside of Go, so the best we can do for now is to give notice to the end user by ERROR log statements.

This commit also fixes a related panic situation in GenerateTemplateNameFrom when the layout dir was a symbolic link.

Fixes #283
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
Tatsushi Demachi a0d956c2ad Add Ace template engine support 2014-12-03 15:38:36 +01:00
bep 53c707bb1d Add markdownify template filter
Note that this is a Markdownify filter, and is named as such; it's not a Asccidoc filter or in any way connected to a Page.

Fixes #524
2014-11-24 23:17:25 -05:00
spf13 cdbc741cb8 fixed #656. Templates work properly when watching. 2014-11-24 17:10:38 -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