Commit graph

30 commits

Author SHA1 Message Date
Vas Sudanagunta
91bb774ae4 Support pages without front matter
* Page without front matter now treated same as a page with empty front matter.
* Test cases added to cover this and repro issue #4320.
* Type safety of front matter code improved.

Fixes #4320
2018-01-26 09:17:27 +01:00
Bjørn Erik Pedersen
7f82b41a24 parser: Final (!) fix for issue with escaped JSON front matter
Fixes #3682
2017-07-08 18:43:36 +02:00
Bjørn Erik Pedersen
84db6c74a0 parser: Fix issue with escaped JSON front matter
Fixes #3682
2017-07-08 10:56:56 +02:00
Bjørn Erik Pedersen
e10e51a008 parser: Fix handling of JSON front matter with escaped quotes
Fixes #3661
2017-07-03 09:01:54 +02:00
Bjørn Erik Pedersen
3183b9a29d parser: Fix handling of quoted brackets in JSON front matter
Also remove a broken JSON test.

Fixes #3511
2017-06-19 16:45:52 +02:00
crasm
ede452d34e parser: Accept JSON frontmatter without leading "{\n"
Accept JSON frontmatter without leading "{\n" so that one line
frontmatters such as `{"param":"paramvalue"}` no longer silently render
empty html.
2017-03-13 17:19:03 +01:00
Cameron Moore
f039e3be9e parser: Refactor frontmatter parser and add tests
Lots of cleanups here:

- Refactor InterfaceToConfig and InterfaceToFrontMatter to use io.Writer.
- Simplify InterfaceToFrontMatter by wrapping InterfaceToConfig.
- Export FrontmatterType since we return it in DetectFrontMatter.
- Refactor removeTOMLIdentifier to avoid blindly replacing "+++".
- Update HandleJSONMetaData to return an empty map on nil input.
- Updates vendored goorgeous package and test for org-mode frontmatter.
- Add tests and godoc comments.

Coverage for parser package increased from 45.2% to 85.2%.
2017-03-11 17:52:25 +01:00
Chase Adams
86e8dd62f0 all: Add org-mode support
Fixes #1483 
See #936
2017-02-21 08:46:03 +01:00
bogem
4d1cb50003 parser: Use strings.Contains instead of strings.Index
Closes #2400
2016-09-11 12:23:15 +02:00
Henrique Dias
16b71bbbb4 Export "detectFrontMatter" to fix caddy-hugo
Closes #2108
2016-04-26 22:28:47 +02:00
Mattias Wadman
5d50c46482 Chomp Unicode BOM if present
Useful if using or sharing files with users that use editors that
append a unicode byte order marker header (like Windows notepad).

This will still assume files are UTF-8 encoded.

Closes #2075
2016-04-14 10:46:27 +02:00
Bjørn Erik Pedersen
b71f391cd7 parser: Remove unused vars 2016-03-24 21:34:34 +01:00
Bjørn Erik Pedersen
1cb7ed6ac7 parser: Spring code cleaning 2016-03-23 14:51:16 +01:00
Bjørn Erik Pedersen
3a82ae7114 parser: Unexport some internals 2016-03-14 17:52:11 +01:00
Derek Perkins
bac1ba4655 Fix spelling and go vet errors 2016-02-13 19:08:48 +08:00
Anthony Fok
8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
Sven Dowideit
a1e32439fb Allow for any (short) line begining or ending with html comment
Fixes #1428
2015-09-25 18:32:32 +02:00
Icaro Seara
e791835e6d Fix typo, "delemiters" -> "delimiters" 2015-08-19 08:06:13 -06:00
Tatsushi Demachi
98659bf3b8 Fix searching YAML/TOML delimiters in frontmatter
When a YAML/TOML's delimiter character sequence is included in a
frontmatter string, parser mistakes it as a delimiter. This fixes it by
checking a character right before the delimiter sequence is '\n' or it
is the beginning of the frontmatter.

Fix #1320
2015-08-03 18:30:55 +02:00
Jeff Hodges
8d28686edc Trim trailing spaces from YAML and TOML delimiters
When someone hits space after typing "---" (or "+++") but before they
hit return, hugo silently failed to parse the file. This corrects that.
2015-08-02 14:46:46 +02:00
Joel Scoble
b4871787f0 add undraft command 2015-05-08 22:18:51 -04:00
bep
63ffb916d6 parser: apply some Golint rules 2015-03-07 12:59:04 +01:00
Tatsushi Demachi
78e9229c52 Fix "hugo new" EOF error with an archetype file without the final EOL
This rewrites `extractFrontMatterDelims` function to make it work with
an archetype file without the final EOL and adds more detailed error
messages and comments.

It also removes `matches` and `matches_quick` functions which aren't
called anywhere.
2015-01-10 19:48:35 +01:00
spf13
cbd9506c29 moving front matter parsing (and creation) to parse package 2014-05-01 13:20:09 -04:00
Mike Keesey
2540d884d8 Fixing issues go vet reports. 2014-03-01 09:56:17 -05:00
Ask Bjørn Hansen
1dbed5ee06 Call the json delimiter 'json_lead' instead of 'java_lead' 2014-02-18 18:44:27 -05:00
Egon Elbre
1c60d5bf20 Don't shutdown hugo on an empty file. 2013-12-28 13:47:21 -05: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