Commit graph

209 commits

Author SHA1 Message Date
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 f45c6bc38a Moved TOC test into page_test. Some general page_test cleanup. 2014-01-28 23:09:24 -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 f0634ec059 fixed #171. RSSlink is now RSSLink (and matches existing docs).
Added backwards compatibility accessor for existing templates.
2014-01-18 22:16:19 -05:00
spf13 ae15ff0968 Fixing test which erroneously checked values and order, rather than just values. 2014-01-18 21:26:34 -05:00
spf13 44186c6af1 Extending rss item limit to 50… can reduce further in template with ‘first N’ functionality. 2014-01-18 21:18:54 -05:00
spf13 cb04053385 RSS improvements, now limit to 15 items and provide accurate date. fixed #172 2014-01-18 11:05:50 -05:00
Phil Pennock 438c219892 Add canonifyurls config option.
Be able to inhibit AbsURL canonicalization of content, on a site
configuration basis. Advantages of being able to inhibit this include
making it easier to rendering on other hostnames, and being able to
include resources on http or https depending on how this page was
retrieved, avoiding mixed-mode client complaints without adding latency
for plain http.
2014-01-13 10:06:12 -05:00
spf13 3fd6c1a24e Adding some embedded short codes (including code highlighting) 2014-01-10 21:27:32 -05:00
spf13 8055838c70 Allowing empty files (ignored) so you can touch a new file while watching 2013-12-28 13:47:34 -05:00
Egon Elbre e46148f948 Fix static file change detection on Windows.
Fixed windows uses different filepath separator. The filepath.ToSlash
shouldn't be used, because it can cause errors in filepath suffix and prefix
testing since "c:\a" isn't a prefix of "c:/a/b/c".
2013-12-28 13:45:38 -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
Henry 6aa3e51228 Added PageSorter and PagesByDate 2013-12-16 17:55:37 -05:00
Caleb Spare 6da23f7449 Gofmt
Command: `gofmt -l -s -w .`
2013-12-16 17:40:10 -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 a45de56db1 adding support for shortcodes with opening and closing tags 2013-12-06 23:14:54 -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
spf13 ad2c0b5616 Homepage now has all content available, use sorting and first to control rendering 2013-11-14 09:37:58 -05: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
Noah Campbell 86233c00a0 Remove the hugo-nav function
Remove the hugo-nav since it relied on a slow library.  The current
build reimplements the absurl functionality based on string replace.
Discovered that my prior implementation missed the requirement for
making absolute paths (/path) absolute with the host, whereas a relative
path is left untouched.  Updated the test cases to support this if this
is reimplemented.
2013-11-05 22:28:06 +00:00
Noah Campbell 1cebce12ad Adding RSS test case.
Checks to make sure the xml document starts with <?xml.  Previously, the
html translate package would write additional details into the document
that caused it to fail.
2013-11-05 07:03:02 +00:00
Noah Campbell b22364570b Fix Test Name 2013-11-05 06:39:50 +00:00
spf13 1fbcaf9279 Buffers instead of pipes 2013-11-05 00:28:08 -05:00
Noah Campbell 9af47f07d3 Improve rendering time
50% speedup.  Fix #91

to run the benchmark:

		go test -test.run=NONE -bench=".*" -test.benchmem=true ./transform/ > new.txt

to compare the results:

		/usr/local/go/misc/benchcmp baseline.txt new.txt

Speedup and memory improvements

		benchmark             old ns/op    new ns/op    delta
		BenchmarkChain           101219        50453  -50.15%
		BenchmarkTransform        51625        45531  -11.80%

		benchmark            old allocs   new allocs    delta
		BenchmarkChain              222          103  -53.60%
		BenchmarkTransform          135          106  -21.48%

		benchmark             old bytes    new bytes    delta
		BenchmarkChain            23919        10998  -54.02%
		BenchmarkTransform        11858        10665  -10.06%
2013-11-01 09:59:57 -07:00
Noah Campbell 789aa6ad76 Removing check for directory: static, layouts
Removed these checks so a single file in content can generate a site.

For example, given a site with a content directory and an index.html,
running hugo -s dir will generate a project without any more input.
2013-10-31 16:06:24 -07:00
spf13 a7dae30a8f More work on indexes 2013-10-31 09:49:29 -04:00
spf13 df0523ff7f Flipping around weight order. higher weight at the bottom. use negative to pin to top. 2013-10-26 00:20:48 -04:00
spf13 d20b41a2cf Big index overhaul. Now supporting ordering tokens by count or alphabetically. Also made full indexes available to the Site variable. 2013-10-25 18:40:55 -04:00
spf13 9388f23606 Adding support for linkTitles 2013-10-25 18:37:53 -04:00
spf13 b580a25d1f Better error handling when rendering error found when in watch mode
In watch mode it should continue to watch for changes, in any other mode it should exit with a -1 error code so can check for success when scripting
2013-10-25 18:03:14 -04:00
spf13 a5606b06ca Adding support for ordering content in indexes by other than date (weighted indexes) 2013-10-24 15:24:47 -07: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 90090175f8 Adding preliminary support for weighted indexes (for ordering by other than date) 2013-10-17 23:57:25 -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
spf13 e58d8fe791 fixed #95, fixed #93 2013-10-09 23:38:51 -04:00
spf13 f5fda80486 simplified buildSite & better error handling around it 2013-10-09 19:14:26 -04:00
Noah Campbell 4993152dda Permalink to include multiple directories levels 2013-10-08 18:44:15 +02:00
Noah Campbell 6e1268f45b Test case for permalink functionality 2013-10-08 18:44:15 +02:00