Commit graph

485 commits

Author SHA1 Message Date
David Calavera
d5c77bdf68 Allow to reverse taxonomy entries. 2015-05-12 18:26:40 +02:00
bep
bec90e0850 Make page 1 alias ugly
When `uglyurls = true`

Fixes #1121
2015-05-10 18:28:44 +02:00
bep
0e00ca6a6e Fix paginator with uglyurls
Fixes #1120
2015-05-10 15:23:36 +02:00
bep
bef496b97e Fix .Truncated in manual summaries
Fixes #1119
2015-05-10 13:34:02 +02:00
bep
be325a3088 Fix IsMenuCurrent for SectionPagesMenu
Pretty sure it has worked at some point, but that PR probably has been rebased to pieces.

This refactors the fix by @dannys42 into a method, as this URL fix is applied several places.

Fixes #1114
2015-05-09 20:53:58 +02:00
bep
a52e508d46 Update test logs for uniformity and consistency
Many minor fixes to make test logs more consistent and correct a
mispelling.

Standardize on "[%i] got X but expected Y" for log messages. Using
a consistent layout makes it easier to read the test results. This
was mostly changing "Got" to "got". Swapped the order of values on
several calls to bring them in line with the convention.

A few log messages had a sequence number added to identify the
exact scenario that failed. Otherwise, there would be no way to
ascertain which failed When there are many scenarios.

Correct spelling of "expected."

Fixes #1028
Merged be2097e1ad

[close #1040]
2015-05-08 22:27:00 -04:00
Danny Sung
2b91b480d0 IsMenuCurrent now resolving correctly when baseUrl is not at the root path 2015-05-08 22:22:50 -04:00
Anthony Fok
563a6302a0 Very experimental support for mmark
Either name the content files as `*.mmark`,
or add `markup = "mmark"` in the front matter
of your `*.md` content files.
2015-05-08 22:05:41 -04:00
bep
d4acacd4f5 Section menu for the lazy blogger
The current menu system works great, but is too much work if all you want is a simple menu with the sections as menu items, and having these menu items connected to the pages in a way that enables setting the correct menu item as active for both the section lists and the pages itself.

This commit adds a new option `SectionPagesMenu' which, if set, will create a new menu with that name with all the sections as menu items. The pages in the sections will behave as "shadow members" of these section items as `blogpage.HasMenuCurrent "sectionmenu" $sectionmenuitem` will return true.

If a menu item with the same `identifier` is defined in site config, *that* item will take precedence.
2015-05-08 21:28:19 -04:00
bep
beb4ab162d Make RSS output test more realistic
By setting a non-default RSS uri config value.
2015-05-08 20:33:37 +02:00
Dana H. P'Simer
fd08e16ec8 Add RSSUri to specify the name of the RSS file 2015-05-07 22:20:00 +02:00
bep
bec2c1e37a Add shortcode support for HTML files
Fixes #674
2015-05-06 19:11:42 +02:00
bep
bea9280fb3 Do not add trailing slash to baseURL
Fixes #1105
2015-05-05 16:02:44 +02:00
bep
be9df84772 shortcodeparser: fix panic on slash following opening shortcode comment
Fixes #1093
2015-04-30 15:59:07 +02:00
bep
be15b07733 Fix typo in test 2015-04-29 19:22:11 +02:00
bep
bee1358e48 Return error from HandleShortcodes
To be able to test for it.
2015-04-29 19:08:27 +02:00
bep
be2c67ad45 Fix broken Travis tests
No idea why these suddenly starts to fail.
2015-04-22 18:59:42 +02:00
bep
beb32af7a2 Do not fail on unknown files in /data
Fixes #1068
2015-04-22 18:35:56 +02:00
bep
be366bfe1e pagination: export pager to make Golint happy 2015-04-21 21:25:34 +02:00
bep
be8e6d4f1f Use fmt.Errorf to make Golint happy 2015-04-21 21:13:30 +02:00
bep
be01f8430e Add shortcut to Scratch from shortcode 2015-04-19 14:50:27 +02:00
bep
be46a4b9b0 Polish func naming in shortcode handling 2015-04-18 00:40:59 +02:00
bep
bed053071e Remove unused types Shortcode and ShortcodeFunc 2015-04-18 00:31:56 +02:00
bep
bee52f85ae Fix broken Highlight test 2015-04-16 02:20:10 +02:00
bep
be6a92c8b6 Temporarily disable Highlight test 2015-04-16 00:58:21 +02:00
bep
be01d04870 hugolib: make Page implement the ReaderFrom interface 2015-04-03 21:41:24 +02:00
bep
bec4bdae99 Return error on wrong use of the Paginator
`Paginate`now returns error when

1) `.Paginate` is called after `.Paginator`
2) `.Paginate` is repeatedly called with different arguments

This should help remove some confusion.

This commit also introduces DistinctErrorLogger, to prevent spamming the log for duplicate rendering errors from the pagers.

Fixes #993
2015-03-31 22:33:17 +02:00
bep
bec22f8981 Add pager size argument to paginator methods
Fixes #1013
2015-03-31 19:12:56 +02:00
bep
be1429fa88 Fix shortcode handling in ToC
Fixes #1010
2015-03-29 22:27:21 +02:00
Anthony Fok
0921761e47 Add missing ".adoc" extension in handler_page.go
Commit 358dcce supposedly added ".adoc" extension recognition
for AsciiDoc, but one place was missed.

Thanks to @sjfloat for reporting the bug!
See discussions at #470.
2015-03-24 20:27:06 -06:00
bep
9cc3d67c57 Pull Data Files tests into its own file 2015-03-19 17:23:14 +01:00
bep
efb564775a Change safeHTtml to safeHTML in sitemap template 2015-03-18 21:27:29 +01:00
bep
658cfb287e Remove URL param from exported AbsURL methods
This is to make it clear that there is only one URL in play,
the BaseURL.
2015-03-18 20:03:34 +01:00
bep
3273fce044 Refactor Hugo version
Put version handling into the helpers package so it can be used by many,
and split version and suffix to make it possible to calculate the next Hugo version.
2015-03-18 12:23:13 +01:00
bep
49f20bbc9b Add UrlPath to the deprecated list 2015-03-18 11:30:37 +01:00
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
bep
bcdad02c06 Use ReaderToString in site tests
Since a string is what's really needed.
2015-03-17 18:14:29 +01:00
bep
e1340c060b Fix crossrefs on Windows
Have to convert path slashes to file path slashes before the URL path is compared to a file path.

Fixes #957
2015-03-17 16:29:10 +01:00
Anthony Fok
358dcce7a6 Experimental AsciiDoc support with external helpers
See #470

 * Based on existing support for reStructuredText files

 * Handles content files with extensions `.asciidoc` and `.ad`

 * Pipes content through `asciidoctor --safe -`.
   If `asciidoctor` is not installed, then `asciidoc --safe -`.

 * To make sure `asciidoctor` or `asciidoc` is found, after adding
   a piece of AsciiDoc content, run `hugo` with the `-v` flag
   and look for this message:

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

Caveats:

 * The final "Last updated" timestamp is currently not stripped.

 * When `hugo` is run with `-v`, you may see a lot of these messages

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

   if you have lots of `*.ad`, `*.adoc` or `*.asciidoc` files.

 * Some versions of `asciidoc` may have trouble with its safe mode.
   To test if you are affected, try this:

        $ echo "Hello" | asciidoc --safe -
        asciidoc: ERROR: unsafe: ifeval invalid
        asciidoc: FAILED: ifeval invalid safe document

   If so, I recommend that you install `asciidoctor` instead.

Feedback and patches welcome!

Ideally, we should be using https://github.com/VonC/asciidocgo,
@VonC's wonderful Go implementation of Asciidoctor.  However,
there is still a bit of work needed for asciidocgo to expose
its API so that Hugo can actually use it.

Until then, hope this "experimental AsciiDoc support through external
helpers" can serve as a stopgap solution for our community. :-)

2015-01-30: Updated for the replaceShortcodeTokens() syntax change
2015-02-21: Add `.adoc` extension as suggested by @Fale

Conflicts:
	helpers/content.go
2015-03-12 22:01:49 -04:00
Anthony Fok
232398f1b9 Remove trailing space from site build statistics 2015-03-12 08:46:42 -06: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
91d16fbba0 Fix UglyUrls on Windows
Fixes #958
2015-03-07 18:03:17 +01:00
bep
602ceec06d Handle 404 thread safely
Replaces hack that temporarily changes a global flag.

Fixes #955
Fixes #939
2015-03-07 15:18:00 +01:00
bep
851badcb7e There is only one s.PageTarget() - so we cannot change it, even tempoararily. We have to find another solution to this.
...

Prevent 404.html from prettifying into 404/index.html

Restore @realchaseadams's commit 348e123
"Force `UglyUrls` option to force `404.html` file name"
which got lost after some refactoring (commit 8db3c0b).

Remove the equivalent "force `UglyUrls`" code for `sitemap.xml`
because the refactored code now calls `renderAndWriteXML()`
which uses `WriteDestFile()` which does not prettify a filename.

Fixes #939 (reverted from commit c4c19ad303)
2015-03-07 13:22:02 +01:00
bep
e007c9b25d hugolib: apply some more Golint rules 2015-03-07 12:53:20 +01:00
bep
5759007874 menu: make receiver name on Page methods consistent
Apply some Golint rules on Menu, esp. making the method receiver names consistent.
2015-03-07 12:52:29 +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
8539f78143 hugolib: apply some Hugolint rules 2015-03-07 00:13:06 +01:00
bep
b9f8c0c120 author: fix doc 2015-03-07 00:10:00 +01:00
bep
103ea842f8 Fix errors reported by Go Vet 2015-03-06 15:25:19 +01:00