Commit graph

727 commits

Author SHA1 Message Date
Owen Waller bf07dc9293 WriteToDisk and SafeWriteToDisk tests now pass
This is the first time that both the WriteToDisk and SafeWriteToDisk
tests pass
2014-11-04 19:18:46 -05:00
Owen Waller a54ad2bf39 Fix: Test TestSafeWriteToDisk now works
Oops, my bad.
Despite the function intending to test SafeWriteToDisk it was actually
calling WriteToDisk. WriteToDisk does not return the file exists error
that SafeWriteToDisk does, which the test checks for.
2014-11-04 19:18:36 -05:00
Owen Waller e8bbc44ab0 Added the path modules test files
Added the new path modules test file. This replaces the old
helpers_test.go file.

The currently failing tests are:
TestReplaceExtension
TestFilename
TestFileAndExt
TestGuessSection
TestFindCWD
TestWriteToDisk

In addition the TestSafeWriteToDisk test case is currently disabled.
It will panic if enabled.

In addition there are some minor changes to path.go. They are:
Refactored MakePathToLower to simplify it.
Commented out, pending removal, Sanitize as it appears to be unused.
Fixed the resource leak in UnicodeSanitize

Conflicts:
	helpers/path.go
2014-11-04 19:18:04 -05:00
Owen Waller 6b619d2cd6 Added the url modules test files.
Added the new url module test file. This replaces the original
helpers_test.go file.

The TestUrlPrep test currently fails.

The only minor change to url.go is to add some trace printf's to
UrlPrep.
2014-11-04 19:16:07 -05:00
Owen Waller 57cd953997 Added the general modules test files
Added the new general module's test file, general_test.go. This replaces the
helpers_test.go file.

There is also a minor defect fix in general.go's StripHTML function.
The correct xhtml tag for a break is <br /> not </br>. I've also removed
the unnecessary spaces before the replacement "\n".

The new test module also reflects this change.

Conflicts:
	helpers/general.go
2014-11-04 11:13:41 -05:00
Owen Waller b87402e8cd Remove the helpers_test.go file
The helpers_test.go file has been split into three new
test files, one each for the path, url and general modules.

Conflicts:
	helpers/helpers_test.go
2014-11-04 11:10:55 -05:00
spf13 8a5dd06ad0 Use page.Markup to determine which PageHandler to use if it's set. 2014-11-04 00:44:30 -05:00
spf13 ade2ca6072 Adding an html file handler 2014-11-04 00:43:09 -05:00
spf13 7fba250023 Adding a proper css file handler (with automatic minification) 2014-11-04 00:42:36 -05:00
spf13 4dcf734acd Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
spf13 7b960ac121 New targets & new renderers and write methods [WIP] 2014-11-04 00:39:37 -05:00
spf13 e02dc6742a Cleanup file conversion handling 2014-11-04 00:36:05 -05:00
spf13 3616d16701 Better error messages for show_plan_test 2014-11-04 00:32:55 -05:00
spf13 07f2ef9c5e Page Group functions now work even when an uppercase field / method is provided. 2014-11-04 00:31:57 -05:00
spf13 4b9ea105c2 Setting to filesystems to the afero.fs interface so can be easily swapped out. 2014-11-04 00:30:35 -05:00
spf13 ad69374f8b Source files can provide content as String or Bytes or Reader 2014-11-04 00:28:20 -05:00
spf13 dcea0fa5ce Adding ReaderTo and ToReader helper functions 2014-11-04 00:26:56 -05:00
spf13 2cb89a523a Update menu test to work with revised source struct 2014-11-03 10:14:10 -05:00
Austin Ziegler 8cc7684a91 Change the type of .Site.Author from…
…`map[string]string` to `map[string]interface{}`.

This allows values other than `string` values to be saved to Author,
such as:

    ```toml
    # config.toml
    …
    [Author]
      name = "Austin Ziegler"
      social-site = [ "Facebook", "Twitter", "GitHub" ]
    ```

My specific use-case is that I’m trying to make something work similar
whether it’s specified in `.Params.Author` or in `.Site.Author` without
introducing `.Site.Params.Author`.
2014-11-02 00:45:33 -04:00
Kartik Singhal f3e9cbc7bd Fix #593 problem with hugo -w 2014-11-02 00:44:55 -04:00
Austin Ziegler c1942e915a Change permalink validation and substitution. 2014-11-02 00:43:01 -04:00
Austin Ziegler c07b10bba9 Output a timestamp with hugo server --watch
Per a [discussion][thread] on discuss, I have implemented one possible
way to do this.

[thread]: http://discuss.gohugo.io/t/output-a-timestamp-with-hugo-watch/213
2014-11-02 00:29:11 -04:00
Mike Dillon 2060031c1f Fix sourceLink for Hugo 2014-11-01 23:39:49 -04:00
Michael Henderson d036ddf237 Create creating-a-new-theme.md 2014-11-01 23:12:01 -04:00
Justin Calleja 11ddc308e3 Fix for issue 583 2014-11-01 23:10:52 -04:00
Kartik Singhal 6c238e140d Fix broken link 2014-11-01 23:08:48 -04:00
Kartik Singhal 649a7d2bbf Minor doc corrections 2014-11-01 23:03:29 -04:00
Tatsushi Demachi af47e5a2cf Extend template's mod and modBool functions to accept any int types
Fixes #575
2014-11-01 23:00:46 -04:00
Joel Scoble d4ed59198a added note about pygment example code and markdown processing, updated example 2014-11-01 22:58:44 -04:00
Joel Scoble 8e368e25b1 540: add support for build information output to version command 2014-11-01 22:56:48 -04:00
bep 8cb435f1f4 Fix redirect-loop for Hugo server
An extra slash was added to the path if baseUrl had a sub-directory, causing infinite redirect loop in Go's HTTP server.

Fixes #510
2014-11-01 22:49:26 -04:00
Tatsushi Demachi 5e28606b84 Add sort and grouping functions for publish date and param of Page
`GroupBy` is modified to allow it to receive a method name argument for
example `Type` as its first argument. It is only allowed to call with
a method which takes no arguments and returns a result or a pair of
a result and an error.

The functions discussed at #443 are also added

- `ByPublishDate`: Order contents by `PublishDate` front matter variable
- `GroupByPublishDate(format, order)`: Group contents by `PublishDate`
  front matter variable formatted in string like `GroupByDate`
- `GroupByParam(key, order)`: Group contents by `Param` front matter
  variable specified by `key` argument
- `GroupByParamDate(key, format, order)`: Group contents by `Param`
  front matter variable specified by `key` argument and formatted in
  string like `GroupByDate`. It's effective against `time.Time` type
  front matter variable
2014-11-01 22:41:04 -04:00
bep d013edb7f8 Implement HasMenuCurrent and IsMenuCurrent for Nodes
Prior to this commit, `HasMenuCurrent` and `IsMenuCurrent` on `Node` always returned false.

This made it hard (if possible at all) to mark the currently selected menu item/group for non-Page content (home page, category pages etc.), i.e. for menus defined in the site configuration.

This commit provides an implementation of these two methods.

Notable design choices:

* These menu items have a loose coupling to the the resources they navigate to; the `Url` is the best common identificator. To facilitate a consistent matching, and to get it in line with the menu items connected to `Page`, relative Urls (Urls starting with '/') for menu items in the site configuration are converted to permaLinks using the same rules used for others’.
* `IsMenuCurrent` only looks at the children of the current node; this is in line with the implementation on `Page`.
* Due to this loose coupling, `IsMenuCurrent` have to search downards in the tree to make sure that the node is inside the current menu. This could have been made simpler if it could answer `yes` to any match of any menu item matching the current resource.

This commit also adds a set of unit tests for the menu system.

Fixes #367
2014-11-01 22:34:49 -04:00
Marcelo Glezer 2b412d4ac7 fixed server reporting Web Server is available at https://localhost:1313 when server always serve http 2014-11-01 22:33:43 -04:00
Joel Scoble 73ec09258b update summary doc 2014-11-01 22:27:54 -04:00
Joel Scoble 9e029fe412 #463 add summary.md page 2014-11-01 22:27:47 -04:00
spf13 c5f1031e45 Handler WIP 2014-11-01 12:05:37 -04:00
spf13 141f3e19e0 Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00
spf13 dfb8482569 Handlers WIP - Convert now working 2014-10-20 20:15:33 -04:00
spf13 30d4a26ba0 Handlers WIP (builds) 2014-10-20 17:51:53 -04:00
spf13 93f3d604c6 Handlers WIP 2014-10-20 17:42:16 -04:00
spf13 8bd0ffba43 Initial Handler Architecture WIP 2014-10-17 16:57:48 -04:00
spf13 20467e36b4 Improved error message when config file not found. 2014-10-16 20:20:39 -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
bep 24bbfe7d32 Set Content-Type for livereload.js
The Content-Type was not set for livereload.js and was interpreteted by the browser as text/plain.

This commit sets it to application/javascript.

Fixes #562
2014-10-15 12:45:29 -04:00
bep 0167fb4803 Copy content from archetype
Prior to this commit only metadata were copied from archetype on content creation.

This commit includes the content if set in archetype. This is useful in situations with similar page structure.

Fixes #556
2014-10-15 12:40:12 -04:00
bep da5d98e958 Make First accept any int
TOML and YAML handles integers differently, creating issues when using integer values from configuration or front matter in the First template function.

This currently works in YAML (parses into int), but not in TOML (parses into int64).

This commit modifies First so it accepts any int.

Fixes #551
2014-10-15 12:39:09 -04:00
Jian Zhou d064139cee Fix spf13/hugo#467. RSSLink now point to index.xml 2014-10-15 12:36:06 -04:00
bep 16330cea91 Add nil-check to Intersect
The Intersect template-method would fail if one or both of the lists were nil (post vs page; post has tags, page has not).

This commit adds a nil-check and returns an empty result if any of the inputs are nil.

See #537
2014-10-15 12:31:22 -04:00
Will Stevens 1d4dde7ac3 added docs for 'intersect' and 'in' template functions 2014-10-15 12:30:10 -04:00