Commit Graph

68 Commits

Author SHA1 Message Date
Abiola Ibrahim
2e295b51b3 Use channel instead for a synchronous interval. 2015-12-09 20:18:18 +01:00
Abiola Ibrahim
59dbea768c Fix race condition on AppVeyor. Increase timeout a bit. 2015-12-09 19:22:20 +01:00
Matthew Holt
fd14f257df markdown: Add (currently failing) test for empty body 2015-12-02 17:09:43 -07:00
Abiola Ibrahim
6f4835f91a Markdown: Fix "metadata not closed" bug. More tests. 2015-12-03 00:41:12 +01:00
Tw
fbc18c5b85 markdown: fix json format parse issue
We can't use json meta parser's remaining buffered data as the markdown body
because it may not contain the entire original content.
Now we adopt the way like toml and yaml parser's way to extract the meta content
at first.

Also when spilting the meta data and content body, additional io.Copy is
unnecessary.

Fix issue #355

Signed-off-by: Tw <tw19881113@gmail.com>
2015-11-25 08:32:14 +08:00
Matthew Holt
02213402e8 Unexport internal types; improved markdown summaries 2015-11-09 07:45:37 -07:00
Matthew Holt
171fd34b3c markdown: Make base path optional, always generate links
The base path being optional in the Caddyfile is convenient when you just want the whole site to be markdown-enabled. The other change is to always generate links... this is because an index page for markdown files may not be statically generated, but it should still show links. Commit 09341fc was a regression, and this fixes it.
2015-11-07 20:24:17 -07:00
Matthew Holt
bcea5182c6 Don't truncate process log; more consistent output 2015-11-05 17:01:08 -07:00
buddhamagnet
57f1d3c205 pass golint
pass all tests

respond to maintainer comments

reinstate assignment of t

correct typo

correct typo

pass linter some more
2015-11-05 00:40:35 +00:00
Matthew Holt
09341fca12 markdown: Don't generate static site or links unless sitegen is enabled 2015-11-02 20:15:42 -07:00
Matt Holt
a3f0fff734 Merge pull request #296 from Makpoc/last-modified
markdown, templates: Add Last-Modified header
2015-10-29 10:31:38 -06:00
Matthew Holt
234783548f markdown: Enable tables, fenced code, and strikethrough (closes #294) 2015-10-29 09:59:32 -06:00
makpoc
5a29107f3b Add Last-Modified header when serving markdown and templates 2015-10-29 11:06:35 +02:00
Zac Bergquist
e158cda057 Fix test failures on Windows.
Most of the Windows test failures are due to the path separator not being "/".  The general approach I took here was to keep paths in "URL form" (ie using "/" separators) as much as possible, and only convert to native paths when we attempt to open a file.  This will allow the most consistency between different host OS.  For example, data structures that store paths still store them with "/" delimiters.  Functions that accepted paths as input and return them as outputs still use "/".

There are still a few test failures that need to be sorted out.

- config/setup/TestRoot (I hear this has already been fixed by someone else)
- middleware/basicauth/TestBrowseTemplate and middleware/templates/Test (a line endings issue that I'm still working through)
2015-10-13 19:49:53 -04:00
Zac Bergquist
f9bc74626d Address various lint and gocyclo warnings. Fixes #253 2015-10-11 16:28:02 -04:00
Alexander Morozov
faaef83954 Use less strict condition to avoid problems with concurrency
In latest go versions TestWatcher fails pretty often, because it is
"more concurrent" now. Reproducible with go master:
while go test github.com/mholt/caddy/middleware/markdown; do :; done

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-11 10:25:13 -07:00
Abiola Ibrahim
7545755b00 Merge pull request #240 from LK4D4/fix_map_race
markdown: fix race in accessing map
2015-09-11 17:00:24 +01:00
Alexander Morozov
a5128da67a markdown: fix race in accessing map
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-11 08:34:52 -07:00
Alexander Morozov
37eedf5cdc Fix race in test
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-11 08:34:08 -07:00
Alexander Morozov
da7b9a6bbc Use markdown.Config as pointer everywhere
* As value mutex was copied and therefore synchronization worked wrong
* It's pretty big structure with reference types, so copying create unnecessary
  pressure on GC

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-10 15:12:50 -07:00
Matthew Holt
2e8a74ecff markdown: Prefix log messages, and slight refactor
Also change sha1 to md5 for the directory scans; slightly faster.
2015-08-05 08:15:52 -06:00
Matthew Holt
7173764d6d markdown: Render lists as part of summary (upstream bug workaround)
See github.com/russross/blackfriday/issues/189
2015-08-05 07:37:51 -06:00
Abiola Ibrahim
3b910645e7 Markdown: generate static sites after links. 2015-08-05 09:55:04 +01:00
Abiola Ibrahim
b5d79bdccc Markdown: Removed unused constant. 2015-08-05 01:01:57 +01:00
Abiola Ibrahim
2ab466599d Markdown: Modify development mode to generate links on page requests. 2015-08-05 00:41:04 +01:00
Abiola Ibrahim
851026d3fa Markdown: Watch for file changes. Removed sitegen dependency for links. 2015-08-04 23:35:09 +01:00
Matthew Holt
36fa6e857b markdown: Sitegen only occurs if directory exists
We do this by returning an error and stopping link generation (which scans the markdown path for files)
2015-08-01 16:09:10 -06:00
Matthew Holt
f7129b219e Fix markdown tests that I broke 2015-07-29 17:47:33 -06:00
Matthew Holt
ff28bc8b0a markdown: Change .Url -> .URL, increase summary length
Also, summary truncated at nearest space instead of middle of word, and code spans become part of summary.
2015-07-29 17:43:00 -06:00
Maxime
ec51e14451 Merge branch 'master' of https://github.com/mholt/caddy 2015-07-29 23:43:26 +02:00
Abiola Ibrahim
aa89f30f2a renamed sorter to byDate. 2015-07-29 18:06:53 +01:00
Maxime
da794a866e Change date of the files in test to serve the static file and not generate a new one 2015-07-29 18:00:08 +02:00
Maxime
705cd16dee Fixed path issue: was absolute path but should be relative path 2015-07-29 17:12:32 +02:00
Maxime
0168a627a4 Added test on markdown static files generation 2015-07-29 16:21:35 +02:00
Abiola Ibrahim
7b29568eb1 Code cleanups.
Fix more race conditions.
2015-07-29 12:21:34 +01:00
Abiola Ibrahim
e240cd5ba2 Metadata variables flattened.
Fix race condition on parsers.
Added page links generator.
2015-07-28 05:21:09 +01:00
Maxime
d1eb2ea9e2 Changed metadata variables type:
from map[string]interface{} to map[string]string
2015-07-26 18:32:34 +02:00
Matthew Holt
453d3eb567 markdown: Fix when md file has front matter but empty body 2015-07-25 15:47:33 -06:00
Matt Holt
bf47951f3a Merge pull request #196 from evermax/master
markdown, browse: Integrated Context struct for templating
2015-07-25 15:15:51 -06:00
Maxime
604c8abb59 Remove debug line, add file name as default title 2015-07-25 22:39:13 +02:00
Maxime
ef4a4b0ab8 Removed attribute not needed. 2015-07-24 22:17:14 +02:00
Maxime
24bdb433c9 Changed .Var to .Doc in Markdown templates
Put the title into the .Doc variables as well.
Changed the test template file to use new names.
2015-07-24 22:14:05 +02:00
Maxime
97dcc79a7f Remove undesired committed debug logs 2015-07-23 11:53:15 +02:00
Maxime
bc2feece4b Moved test files to testdata folder.
Changed the tests accordingly.
2015-07-23 09:35:46 +02:00
Maxime
2df30d186e Added a test on markdown for the default template 2015-07-21 17:45:32 +02:00
Maxime
6451e10d3e Add context to markdown template
Created a struct containing middleware.Context, Title, Markdown and the
variables from the user to use to render the template.
The title now can be accessed via {{.Title}}.
The variables can now be accessed via {{.Var.myVariableName}}.
2015-07-21 07:58:34 +02:00
Matthew Holt
00997db5ae markdown: Fix large markdown files that got truncated 2015-07-18 12:57:16 -06:00
Zac Bergquist
41e1f1ffa5 Update error strings (start with lowercase letters) 2015-06-07 20:49:17 -04:00
Zac Bergquist
e4b50aa814 Fix more lint warnings 2015-05-24 22:52:34 -04:00
Abiola Ibrahim
8394d72f48 Fix for Issue 72: Markdown: 500 for YAML metadata 2015-05-13 00:44:35 +01:00