Commit graph

234 commits

Author SHA1 Message Date
Carmen La
52457c7b64 Add :today key to params for compiling posts 2016-09-03 15:33:37 -04:00
Arsene Rei
f383661e5e Fallback to resources/templates/{pages,posts}
By default, when using markdown files, Cryogen will look for
`resources/templates/md/pages/*.md`. This commits allows Cryogen to fall back to
`resources/templates/pages/*.md` in the case that it can't find any files in the
former directory. It works similarly for posts and Asciidoc files.

Since we're looking specifically for `*.md` for Markdown files and `*.asc` for
Ascii files, this is an opportunity to eliminate redundancy.
2016-05-27 11:52:41 -04:00
Carmen La
3e7d43b212 update dependencies/version 2016-04-18 22:44:09 -04:00
Jan Stępień
0d1149a9c2 Use Hawk in cryogen-core.watcher
This is a follow-up to PR #46. It replaces the 300ms loop with a file
watcher. Hawk is a wrapper around java.nio.file.WatchService coming with
proper OS X support.

Now rebuilds should be instantaneous.
2016-03-13 16:43:14 +01:00
Dan Hable
683bcad292 Make archive grouping configurable
The blog that I'm moving to cryogen currently groups the posts by year instead of by year/month. This change makes the grouping configurable while defaulting to the current behavior of year/month grouping on posts.
2016-03-08 20:22:20 -06:00
Tom L
0c4156f43f Add servlet context to tags, archives rendering. 2016-02-15 20:31:40 -06:00
Tom L
c18c3d60f2 Implement clean URLs feature (Issue #89)
When `clean-urls?` is set in config, emit pages as subdirectories
`prefix/root/page-name/index.html` instead of
`prefix/root/page-name.html`. Links in emitted HTML then point to
`prefix/root/page-name/`. When `clean-urls?` not set, behaves as
before.

Refactor most URI generation into a new `page-uri` function.
`page-uri` replaces most calls* to `path`, all calls to `post-uri`
and all calls to the old `page-uri`.

Introduce function `create-file-recursive`. Function creates
file parent if not exists.

Introduce function `write-html`. When `clean-urls?` is set, spits
emitted HTML into subdirectories as described above; otherwise
behaves like `create-file`. Replaces most* calls to `create-file`
Calls `create-file` or `create-file-recursive`.

* Exceptions made for sitemap XML and RSS feed XML pages
2016-02-11 20:04:56 -06:00
Tomasz Biernacki
c84b550f92 Add multiple authors filtering support 2016-02-10 03:13:06 +01:00
Tomasz Biernacki
e5395a362a Add author and (short) description for RSS 2016-02-09 03:01:10 +01:00
Sean
852b431d71 Add home to index params when previews are enabled 2016-02-04 04:07:17 -08:00
ponkore
556fe84ef8 content-with-more-marker returns with correct tags
`content-with-more-marker` returns a HTML string when the `content`
conteins more marker ("<!--more-->").

In many case, HTML tags in `content` is balanced.
ex.
------------------------------
<div id='post'>
  <div class='post-content'>
    this post has more marker
<!--more-->
and more content.
  </div>
</div>
------------------------------

But original code breaks the balance.
------------------------------
<div id='post'>
  <div class='post-content'>
    this post has more marker
------------------------------

Afer this patch applied, `tagsoup` read above text and `hiccup`
re-render to HTML text with correct balanced tags.
------------------------------
<div id='post'>
  <div class='post-content'>
    this post has more marker
</div></div>
------------------------------
2016-01-11 21:30:21 +09:00
ponkore
792833facb rewrite-hrefs bug fix (when :blog-prefix is blank)
When :blog-prefix in `config.edn` is set nil or "",
rewrite-hrefs should return `text` itself.
2016-01-10 23:40:19 +09:00
Carmen La
839ed5c469 Remove unnecesasry tag-root key 2016-01-08 20:44:07 -05:00
Carmen La
1abc4c6137 Fix bug with rewrite-href function 2016-01-08 18:51:40 -05:00
Sergiy BONDARYEV
eea999e1d7 add Blog/Page/Post/Tag uri customisation
add :tag-root-uri :page-root-uri :post-root-uri parsing

replace {entity}-root with {entity}-root-uri parameters to set uri

fix root-path call

fix root-path function params order
(worked erlier because of keyword<->map transposition)

fix keyword :{entity}-root-uri to :{entity}-root transformation

misprint: congig -> config

add function to compose file path

add create-file function

add function to compose a path

handle empty blog-path using path function

fix filename for preview
2016-01-08 22:59:10 +01:00
Yogthos
5b13b3b761 added :draft? key to allow creation of draft posts that won't be published 2015-12-17 14:36:09 -05:00
Jeff Rabinowitz
e34ea8c989 Fixed a regression under which the old style of using :toc true would throw an exception because the tag was not properly cast to a :ul or :ol tag. Added unit testing for all cases. 2015-11-08 20:35:04 -05:00
Jeff Rabinowitz
365df0e680 Reimplemented TOC logic using zippers to ensure state is always internally valid. Also added unit testing to provide a regression testing suite. This should fix issue #19. 2015-11-01 19:34:06 -05:00
Carmen La
1063704f4f Swap order of _list-types and list-type in toc.clj 2015-10-31 14:50:51 -04:00
Carmen La
30b3503abc add '.html' ending to prev/next links in preview pages 2015-10-31 14:50:03 -04:00
Carmen La
21e3c0e75f Add ".html" ending to preview pages.
cryogen-project/cryogen#92
2015-10-31 13:54:37 -04:00
Jeff Rabinowitz
61e93a3480 fixed bug with threading macro in wrong order. fixed bug with where space not present between tag and class for top level ul/ol.. 2015-10-27 22:58:22 -04:00
Jeff Rabinowitz
482700a311 Submitting a feature request for the :toc to support both ordered and unordered lists by expanding the vocabulary of the existing :toc directive to include :ul and :ol 2015-10-25 19:14:43 -04:00
Jan Stępień
2a95e477de Parallelize read-posts with pmap
This makes each markup implementation process posts in parallel.

In case of a simple test blog with 4 markdown pages mean compilation
time was reduced from 395 to 330ms. In the experiment I used OpenJDK 8
running `lein ring server` on a 4 core CPU.
2015-09-23 21:46:11 +02:00
Jan Stępień
aa7ac4d98c require pandect.algo.md5 instead of pandect.core
This makes compilation of cryogen-core.watcher faster by reducing the
number of its dependencies. Now it depends just on pandect.algo.md5
instead of all pandect.algo.*
2015-09-21 15:23:13 +02:00
Jan Stępień
c557fa8478 Simplify load-plugins with enumeration-seq 2015-09-20 22:52:51 +02:00
Jan Stępień
1a7c48731a Simplify create-previews with map 2015-09-18 22:22:40 +02:00
Jan Stępień
f6a7d17213 Don't invoke select-keys on post in create-preview
This allows preview templates to access all of post's metadata.
2015-09-18 22:22:13 +02:00
Jan Stępień
1b4306c3a3 create-preview: simplify the more marker lookup
This commit replaces a regular expression lookup with a simple
String/indexOf substring search.

It addresses pathological cases in which re-find took several
seconds to process contents of a blog post. An example of such
a case was a post with 16kB of nested HTML tags in a single line.
2015-09-17 17:13:45 +02:00
Marko Kocic
8e5b3a9fee Fix type hint cast 2015-09-15 18:24:51 +02:00
Marko Kocic
f4888b26d9 Clear reflection warnings 2015-09-14 12:06:35 +02:00
Randall Mason
03cfabcbb9 Add enclosure tag to facilitate Podcasting with Cryogen
Add an enclosure tag to a post's metadata to let a podcast client
to deliver your audio content.  It should look like this:

:enclosure [{:url "<full-url>"}]

Without the brackets, you end up with NullPointerExceptions, so
make sure you have that.

The URL should be the full location of where the audio file is
hosted (not relative), so for example:

:enclosure [{:url "http://www.example.com/01_episode_IV.mp3"}]

I created a bunch of markdown files with just the enclosure and
info about the audiobook with the following bash snippet:

find -L books -type f -iname "*mp3" | sort | while read mp3; do name=$(basename $mp3 .mp3); book=$(basename "$(dirname $mp3)"); echo "{:title \"$name\"\n:layout :post\n:tags [\"audiobooks\" \"$book\"]\n:enclosure [{:url \"http://clashthebunny.mason.ch/blog/$mp3\"}]}\n $book - $name\n==================" > md/posts/"$(date "+%Y-$name").md"; done

Each book was in it's own subdirectory of books:
books/Dracula/1-01-Chapter1_part01.mp3
books/Dracula/1-02-Chapter1_part02.mp3
books/Dracula/2-01-Chapter2_part01.mp3

Note that the above script requires the prefix of the episode to
be "date-like".  It should be fairly easy to work out a way to get
your podcast up and running.

Add the book names to your rss-filters array, e.g.:
["Dracula" "Pride & Prejudice"]

Most podcasting clients support authentication, so just password
protect those directories and you should be good to go, even
if you are hosting copyrighted content.
2015-09-03 11:27:55 -05:00
Chris
8eb0e9ff29 Add active-page key to config map
For certain pages a key with a boolean value is added to the config map which can then be used in templates to determine if it is the page being rendered. Not all pages have this key and boolean value. Instead of adding additional keys for every page a new generic key, 'active-page', has been added and its value is the page name, ex: 'home', 'archives', 'tags', etc. The default value is 'home'. This key can then be used in any template to check the page which is currently being rendered.
2015-08-17 07:30:23 -07:00
Carmen La
837f855726 Merge branch 'post-date' of https://github.com/powernoodle/cryogen-core into powernoodle-post-date 2015-08-06 13:37:50 -04:00
Kirill Kondratenko
71bb80cf49 Use the default locale for the instance of the JVM
instead of the hardcoded "en" locale
2015-08-06 00:27:54 +03:00
Brendon Walsh
e710f08679 Optional :date key can be provided in metadata 2015-07-29 11:50:00 -04:00
Carmen La
64a9830f6d Only make the "prev" link in the second page when the second page actually exists 2015-07-08 16:55:31 -04:00
Carmen La
d6941823fd Added option for post preview pages rather than a single index page. Issue #28 2015-07-08 16:34:39 -04:00
Carmen La
7153e9d522 Added page with all tags - for issue #31 2015-07-08 12:15:11 -04:00
InDevLand
82d3a5677f fixed compile-pages now use :layout 2015-07-06 04:02:42 +02:00
Carmen La
e7636e7586 Fixed pubDate not showing up in filtered rss feeds 2015-06-23 10:08:26 -04:00
lacarmen
4511536cc9 Cleanup + fixes for config based themes 2015-06-14 11:16:35 -04:00
Albert Lai
2119ed52aa merge posts image fix 2015-06-14 18:42:04 +08:00
Albert Lai
7c443a8b5c add experimental theme support 2015-06-14 18:23:58 +08:00
Albert Lai
bc62c8a790 fix issue #24 image handling in Post is generally broken 2015-06-14 13:47:18 +08:00
Yogthos
e0d3676196 added an error check for parsing the config.edn 2015-04-02 22:22:17 -04:00
Eric Somdahl
6b45fdc35a Modification to allow the generated rss xml to pass xsd validation.
1) Removed the <author> tag from each <item>.  The presence of this tag is ok here but the xsd requires that the content include a valid email address, not just the name string coming from the site config (Forms that pass validation are "test@xyz.com" or "test@xyz.com (Test McTester)" ).  And who would want to advertise their real email like that?  :)
2) Removed the <author> tag from the <channel>.  <author> isn't a valid child element of a channel.  There is a child element called <webMaster> that is a close analogue but it also requires content as above.
2015-03-10 21:29:04 -04:00
William Roe
c52d3d1aa6 Pass all config to templates
This allows people to use any parameter from their config as well as the
params that were already being used.
2015-02-23 18:14:31 +00:00
William Roe
5587cc88ef Run SASS relative to sass/
This is so that SASS/Compass can find images and other assets
2015-02-21 23:36:20 +00:00
William Roe
52244956aa Option maps are easier to use when calling functions
... with more than a couple of parameters.
2015-02-21 22:15:40 +00:00
William Roe
0c7743e605 Ensure sass errors printed visably in red
Also include the standard output as it frequently includes crucial
information in narrowing down where errors lie in SASS files
2015-02-21 22:07:41 +00:00
William Roe
7595cbcf70 Include --compass when it is available 2015-02-21 21:56:38 +00:00
Stefan Pfeiffer, DL1ELY
f74c05711b Fix overly eager replacement of file extensions in uris
As the filename extensions given by the render plugins are also used as
regex for replacing them with .html to generate URIs, the dot in front of
the extension was interpreted as an arbitrary character for the regex.
Also, it matched in the middle of a string. Now dots get quoted and a $
added to only match at the end of the filename.

Fix #16
2015-01-28 22:19:01 +01:00
Stefan Pfeiffer, DL1ELY
a73e2f664e Fix garbled UTF-8 characters in TOC generation
Fixes #13
2015-01-28 15:43:32 +01:00
lacarmen
9de65df523 Added :content key to grouped tags in order to fix filtered rss generation 2015-01-22 12:18:32 -05:00
Yogthos
fee46ddf54 updated to use init function to load plugins 2015-01-14 22:07:51 -05:00
Yogthos
96502bd517 updated to use parser modules 2015-01-14 20:49:51 -05:00
Adam Tankanow
8ff3f19362 find-assets handles get-resource returning nilern
- this can/will happen if a user doesn't have a resource root directory,
  e.g. if the resources/templates/asc/posts directory doesn't exist.
2015-01-11 14:20:10 -05:00
Adam Tankanow
cb18e5734d Merge branch 'master' into add-asciidoc-support
Conflicts:
	project.clj
2015-01-09 09:15:54 -05:00
Adam Tankanow
5609772cd3 Add docstring and support for creating links for header id attributes
- this method will now look for both of the following references, this
  commit adds support for (2)

(1) <h1><a name="href">Reference Text</a></h1>
and
(2) <h1 id="href">Reference Text</h1>
2015-01-09 07:16:22 -05:00
Adam Tankanow
b3bad2e279 add docstring to get-headings function 2015-01-09 07:13:35 -05:00
Adam Tankanow
eda815a5ae remove asciidoc options/attributes and add rewrite-href post processing 2015-01-09 07:12:56 -05:00
Adam Tankanow
1cff8eadf2 refactor rewrite-hrefs into 2 functions
- (1) can be reused by the asciidoc processing, it simply does the text
  replace
- (2) is a transformer using (1) for use in markdown.core
2015-01-09 07:11:38 -05:00
Adam Tankanow
21d825d0cd fix spacing in markdown method 2015-01-09 07:10:49 -05:00
J Irving
072c093342 Copy each file rather than the whole directory 2015-01-07 23:54:58 -05:00
lacarmen
656cc2d0c9 Added curated RSS generation based on :rss-filters in the config 2015-01-03 20:36:30 -05:00
J Irving
4eb0036ef5 Use checksums instead of last modified times.
Also add pandect dependency.
2015-01-02 00:21:21 -05:00
J Irving
6f7cb79a65 Sass compilation respects :ignored-files config
This is an oversight from lacarmen/cryogen-core#4.

Also some slight refactoring.
2015-01-01 03:49:03 -05:00
lacarmen
bca0e89aa2 Added uri and site-url selmer tags for canonical url meta tags 2014-12-31 23:21:38 -05:00
lacarmen
73338935fa Cleanup 2014-12-31 16:55:29 -05:00
Adam Tankanow
b68779fcbe Abstract Markup language details and add Asciidoc support:
1. create markup namespace to hold Markup protocol and its Markdown and
Asciidoc implementations.
2. Update compiler ns to iterate through available Markups and pass
Markup to fns that need Markup info.
3. Refactor compiler ns parse fns to be more granular.
2014-12-30 07:31:46 -05:00
Adam Tankanow
68b82be959 add markup ns to abstract markdown vs asciidoc 2014-12-29 11:15:48 -05:00
J Irving
efbe831261 Support :ignored-file config key
Prevent the compiler attempting to process files defined by a list of
regexps. By default ignore emacs and vi backup files.
2014-12-27 02:47:55 -05:00
Yogthos
a49bda02bc removed main 2014-12-26 23:50:25 -05:00
Yogthos
9381c08853 formatting 2014-12-25 11:29:48 -05:00
Yogthos
faf60f5c37 added System/exit in the main 2014-12-25 11:28:42 -05:00
Yogthos
8173f5e103 fixed sass paths 2014-12-25 11:24:25 -05:00
Dmitri Sotnikov
f43b751cfd support for ref links
fixes https://github.com/lacarmen/cryogen/issues/39
2014-12-24 16:53:25 -05:00
lacarmen
f83497b152 Cleanup 2014-12-14 13:37:59 -05:00
Martin Kremers
714f5c838d Enable multilevel table of contents 2014-12-14 15:17:02 +01:00
Martin Kremers
d9fe01d8f6 Make images from md folders available, so a post or page can be one unit in a folder 2014-12-07 17:50:24 +01:00
lacarmen
6483b0ea1f Updated the compiler to inject the blog prefix in front of local links and added docstrings 2014-12-05 16:37:04 -05:00
lacarmen
9ee0968a0f Renamed to cryogen-core 2014-12-05 10:56:40 -05:00
lacarmen
410d9ce298 Initial commit 2014-12-04 11:38:48 -05:00