Commit graph

221 commits

Author SHA1 Message Date
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
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
Noah Campbell
6fa6f69a4a Change transformer order 2013-10-08 18:42:03 +02:00
Noah Campbell
d712d6f331 Moving transformation on a per-page level 2013-10-08 18:42:03 +02:00
Noah Campbell
9032a228b0 Better handle missing layouts
Panic is too extreme.  Instead the library will write out a message in
verbose mode.
2013-10-08 18:42:02 +02:00
Noah Campbell
54a2790fce Use io.Pipe for chaning render tasks.
Also clean up logic for finding layouts.
2013-10-08 18:42:02 +02:00
Noah Campbell
19cb6c7819 Move writing next to rendering
All render(Thing) calls have a WritePublic call directly after it.  This
refactor creates one function that makes the specific call sequence.
2013-10-08 18:40:40 +02:00
Noah Campbell
2176d2c197 Reducing scope of RenderThing* 2013-10-08 18:37:50 +02:00
Noah Campbell
ff8b52758d Move in memory target into target module. 2013-10-08 18:37:50 +02:00
Noah Campbell
80009b427f Change the order of Apply to be more Unixy
Typically the destination is on the left and the src is on the right.
2013-10-08 18:37:50 +02:00
Noah Campbell
f0211b84a1 Rename Transform to AbsURL 2013-10-08 18:37:49 +02:00
spf13
5e14af957a Proper handling of 404 page return value 2013-10-07 09:24:13 -04:00
spf13
7468292c4e Fixing bug where RSS for site was rendered in wrong location 2013-10-07 09:23:42 -04:00
spf13
d829e05036 Fixing bug where only the first index list was created. 2013-10-07 09:07:14 -04:00
spf13
2aaf92b515 Summary can now contain short codes when using <!--more--> to define end of summary. 2013-10-04 16:07:24 -04:00
spf13
266f583a8c Restoring former snippet behavior & adding test to ensure future behavior 2013-10-04 12:28:28 -04:00
spf13
dcfcbac589 Enabling Nitro ('--stepAnalysis') again. Fix #58 2013-10-03 09:44:45 -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
spf13
92cff05582 go fmt so code 2013-09-29 02:10:29 -04:00
spf13
ff2b98c9dd Better error message when no source content is found. 2013-09-29 02:10:29 -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
4250bf8e30 Fixes #80 - Homepage now renders correctly
I mistakenly make RenderHomePage a NOP.  Bad programmer.
2013-09-24 14:41:21 -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
784077da4d Fix fragments being AbsUrlified in final html
Found that fragments were getting the BaseURL applied creating a proper
anchor url and redirecting off the page.
2013-09-18 15:48:36 -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
5374242ff7 More expressive --check output 2013-09-18 11:52:30 -07:00
Noah Campbell
c510140c0c Add renderer information to --check
Now reports if the page will be rendered or not and by which render
engine.
2013-09-18 10:27:56 -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
6b0752e8c0 Move AbUrlify to post content transformation
Currently the a@href and script@src elements will have BaseUrl applied
to their elements prior to being written to disk.
2013-09-17 14:16:06 -07:00
Noah Campbell
172ff5ea7a Initialize HTMLRedirectAlias before ShowPlan()
Without it, no alias information is generated when running --check
2013-09-13 15:06:37 -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
2ebfb33fe0 Move alias logic to target module
I want to move all logic to writing aliases to target so I can pave the
way for writing aliases specific to other runtimes (like .htaccess for
apache or a script for updating AWS or symlinking on a filesystem).
2013-09-12 21:20:00 -07:00
Noah Campbell
2f10da1570 Move alias rendering to target 2013-09-12 16:18:30 -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
6274aa0a64 Homepage "/" respects PublishDir
It wasn't taking the value of PublishDir into consideration for the
special case of the homepage "/".

Fixes #75
2013-09-05 09:57:25 -07:00
Noah Campbell
610c06e658 Introduce source.Filesystem
This provides an abstraction over how files are processed by Hugo.  This
allows for alternatives like CMS systems or Dropbox, etc.
2013-09-04 22:42:52 -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
cb00917af6 Expand the ShowPlan functionality 2013-09-03 20:52:50 -07:00
Noah Campbell
4004687fb2 Move to target.Filesystem
Moving the ugly urls logic to the target.  There is still UglyUrl logic
in page for the permlink but this is dealing with the generate of urls.
2013-09-03 20:01:55 -07:00
Noah Campbell
7919603fb5 Add Translate to target
Translate handles Ugly Urls.
2013-09-03 20:00:22 -07:00
Noah Campbell
c6ad532b94 Add file reporting to planner 2013-09-03 20:00:22 -07:00
Noah Campbell
13d2c55206 Adding Planner 2013-09-03 20:00:21 -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
207d8fb7af Date rendering unit tests in pages
Tests to ensure rendering dates in templates is working correctly.
Actually, I was running into invalid templates not giving warnings when
I was trying to render a date.
2013-09-03 14:51:06 -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
Noah Campbell
a591a10626 Include building hugo docs as part of test.
If the building of the doc fails, tarvis will fail.  This will help with
pull requests.
2013-09-03 11:29:43 -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
Fabrizio (Misto) Milo
0a9dc705f3 Use s everywhere for consistency
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 19:51:21 -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
4349216deb Small code cleanup 2013-08-31 20:00:57 -07:00
Noah Campbell
0fdea0c2c2 Return an error with WritePublic 2013-08-30 21:24:25 -07:00
Noah Campbell
097b782a80 Removing site.Directories.
Please revert if this is used somewhere.
2013-08-30 21:13:50 -07:00
Noah Campbell
b14b61af37 Externalize the writing of content to a target
Introducing the target module in hugo.  This provides the simple
interface for writing content given a label (filename) and a io.Reader
containing the content to be written.

If site.Target is not set, it defaults back to the original behavior of
writing to file system.

In hugolib/site_url_test.go I have an InMemoryTarget for testing
purposes and use it to see if the final output of a render matches.
2013-08-30 20:45:42 -07:00
Noah Campbell
bc3c229002 Ensure Section is set before returning Page object. 2013-08-30 20:13:22 -07:00
Noah Campbell
c32f401b15 Revert "Return errors when rendering"
This reverts commit e66ba5d2a7.

Fixed #69
2013-08-30 20:08:13 -07:00
Noah Campbell
a792ec09ce Cleanup formatting - go fmt ./...
Remember to run go fmt ./... before committing.  Looks sternly in mirror
2013-08-30 14:39:12 -07:00
Mark Sanborn
4ed43e8076 Fixed bug where Url specified in front matter as pretty url wouldnt render
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-30 14:39:11 -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
Ross Lawley
1bb00b8c19 Refactored added RenderThingOrDefault and tests
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>

Conflicts:
	hugolib/site.go
2013-08-27 12:40:53 -07:00
Noah Campbell
554375b2ad Using new parser. 2013-08-25 20:27:03 -07:00
Hugo Duncan
1de1992664 Return any error reported by RenderHomePage
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-23 16:55:40 -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
Ross Lawley
7b1f0960e3 Add 404.html for gh-pages
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-23 16:38:35 -07:00
Noah Campbell
f28a8fa0c2 RenderThing test cases
Provide unit test support RenderThing.

One observation is that creating the site.Tmpl variable is a one time
event.  site.Tmpl doesn't like additional templates with the same name.
This means that updating a template while in --watch mode requires
throwing away the entire Site object and creating a new one.  Not that
this is a bad idea, but it is something I discovered while working on
these unit tests.
2013-08-23 16:21:28 -07:00
Noah Campbell
9d15262ee5 Test cases for ignoreDotFile
Meant to commit this earlier, but it's a basic unit test.
2013-08-23 14:57:21 -07:00
Noah Campbell
7461ed63ae Fix benchmark so the buffer is read each time.
The bytes.Buffer was exhausted after the first read.  Creating a new
reader each invocation catpures the correctly timing.
2013-08-23 14:16:37 -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
Noah Campbell
ae7112977d Skip "dot" files in layout
As a vim user, .filename.swp files pop up.  This change prevents hugo
from reading those files.
2013-08-23 13:58:52 -07:00
Hugo Duncan
301d2bafcd Print error if index value in a page is wrong type
This was causing a panic with no information displayed about the
page causing the error.
2013-08-20 16:39:26 -04:00
Steve Francia
c4bcdebc59 Merge pull request #44 from cactus/avoid-redirect-with-slugs
avoid possible redirects with non-ugly slug urls
2013-08-17 21:04:51 -07:00
Steve Francia
e2744d403c Merge pull request #43 from hugoduncan/feature/allow-xhtml-aliases
Enable aliases from .xhtml paths
2013-08-17 21:04:14 -07:00
Steve Francia
2542836bbc Merge pull request #41 from rozza/skipStatic
Skip Static directory if its in your content directory
2013-08-17 20:59:07 -07:00
Noah Campbell
c713beba4d Formatting cleanup 2013-08-17 23:52:16 -04:00
Noah Campbell
ec821739bc Removing the use of slash
An oversight on my behalf.  The FromSlash method is used when writing
out the public file name.  There is one place where the slashes are
required which is setting the output file.  I replaced those instances
with filepath.Join which should do the right thing depending on the OS.
2013-08-17 23:46:57 -04:00
Noah Campbell
8eca8f8aa0 Detect missed index from front matter 2013-08-17 23:45:03 -04:00
Noah Campbell
e66ba5d2a7 Return errors when rendering 2013-08-17 23:45:03 -04: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
Hugo Duncan
23a98ad05c Enable aliases from .xhtml paths
When redirecting an alias from a .xhtml path, served with default content type,
a redirect only works if the html element has a xmlns attribute.  This adds the
attribute when the alias path ends in .xhtml
2013-08-16 00:29:46 -04:00
Ross Lawley
0f143dcf14 Skip Static directory if its in your content directory
Allows organisation where all source files are in one directory:

```
`config.yaml`:

contentdir: "source"
staticdir: "source/static"
...

 .
	└── source
		├── post
		|	├── firstpost.md	// <- http://site.com/post/firstpost.html
		|	└── secondpost.md	// <- http://site.com/post/secondpost.html
		└── static
			└── css
				 └── site.css	// <- http://site.com/css/site.css
```
2013-08-15 20:05:46 +01:00
spf13
3c3fc45d3c Merge branch 'master' of github.com:spf13/hugo 2013-08-14 10:19:59 -04:00
spf13
480e01eb15 Further work on path/section stuff. Tests passing now. 2013-08-14 08:57:14 -04:00
Steve Francia
7a51a8a5a3 Merge pull request #38 from noahcampbell/workflow_dotfile
Workflow dotfile
2013-08-13 20:03:18 -07:00