lonnon-jekyll 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/.gitignore +6 -0
  2. data/History.txt +151 -0
  3. data/README.textile +613 -0
  4. data/Rakefile +91 -0
  5. data/VERSION.yml +4 -0
  6. data/bin/jekyll +166 -0
  7. data/features/create_sites.feature +57 -0
  8. data/features/embed_filters.feature +74 -0
  9. data/features/pagination.feature +40 -0
  10. data/features/permalinks.feature +65 -0
  11. data/features/post_data.feature +153 -0
  12. data/features/site_configuration.feature +63 -0
  13. data/features/site_data.feature +82 -0
  14. data/features/step_definitions/jekyll_steps.rb +136 -0
  15. data/features/support/env.rb +16 -0
  16. data/lib/jekyll.rb +86 -0
  17. data/lib/jekyll/albino.rb +122 -0
  18. data/lib/jekyll/converters/csv.rb +26 -0
  19. data/lib/jekyll/converters/mephisto.rb +79 -0
  20. data/lib/jekyll/converters/mt.rb +59 -0
  21. data/lib/jekyll/converters/textpattern.rb +50 -0
  22. data/lib/jekyll/converters/typo.rb +49 -0
  23. data/lib/jekyll/converters/wordpress.rb +61 -0
  24. data/lib/jekyll/convertible.rb +139 -0
  25. data/lib/jekyll/core_ext.rb +37 -0
  26. data/lib/jekyll/filters.rb +56 -0
  27. data/lib/jekyll/haml_helpers.rb +15 -0
  28. data/lib/jekyll/layout.rb +37 -0
  29. data/lib/jekyll/page.rb +112 -0
  30. data/lib/jekyll/pager.rb +45 -0
  31. data/lib/jekyll/post.rb +316 -0
  32. data/lib/jekyll/site.rb +326 -0
  33. data/lib/jekyll/tags/highlight.rb +56 -0
  34. data/lib/jekyll/tags/include.rb +31 -0
  35. data/test/helper.rb +27 -0
  36. data/test/source/_includes/sig.markdown +3 -0
  37. data/test/source/_layouts/default.html +27 -0
  38. data/test/source/_layouts/simple.html +1 -0
  39. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  40. data/test/source/_posts/2008-02-02-published.textile +8 -0
  41. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  42. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  43. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  44. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  45. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  46. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  47. data/test/source/_posts/2009-01-27-category.textile +7 -0
  48. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  49. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  50. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  51. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  52. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  53. data/test/source/_posts/2009-11-27-more-divider.markdown +5 -0
  54. data/test/source/about.html +6 -0
  55. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  56. data/test/source/contacts.html +5 -0
  57. data/test/source/css/screen.css +76 -0
  58. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  59. data/test/source/index.html +22 -0
  60. data/test/source/paginated/_posts/2009-11-29-one-page.markdown +3 -0
  61. data/test/source/paginated/_posts/2009-11-29-red-page.markdown +4 -0
  62. data/test/source/paginated/_posts/2009-11-29-two-page.markdown +3 -0
  63. data/test/source/sitemap.xml +23 -0
  64. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  65. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  66. data/test/suite.rb +9 -0
  67. data/test/test_configuration.rb +29 -0
  68. data/test/test_filters.rb +54 -0
  69. data/test/test_generated_site.rb +40 -0
  70. data/test/test_page.rb +98 -0
  71. data/test/test_pager.rb +47 -0
  72. data/test/test_post.rb +317 -0
  73. data/test/test_site.rb +85 -0
  74. data/test/test_tags.rb +115 -0
  75. metadata +196 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ test/dest
2
+ *.gem
3
+ pkg/
4
+ *.swp
5
+ *~
6
+ _site/
data/History.txt ADDED
@@ -0,0 +1,151 @@
1
+ == 0.5.4 / 2009-08-23
2
+ * Bug Fixes
3
+ * Do not allow symlinks (security vulnerability)
4
+
5
+ == 0.5.3 / 2009-07-14
6
+ * Bug Fixes
7
+ * Solving the permalink bug where non-html files wouldn't work [github.com/jeffrydegrande]
8
+
9
+ == 0.5.2 / 2009-06-24
10
+ * Enhancements
11
+ * Added --paginate option to the executable along with a paginator object for the payload [github.com/calavera]
12
+ * Upgraded RedCloth to 4.2.1, which makes <notextile> tags work once again.
13
+ * Configuration options set in config.yml are now available through the site payload [github.com/vilcans]
14
+ * Posts can now have an empty YAML front matter or none at all [github.com/bahuvrihi]
15
+ * Bug Fixes
16
+ * Fixing Ruby 1.9 issue that requires to_s on the err object [github.com/Chrononaut]
17
+ * Fixes for pagination and ordering posts on the same day [github.com/ujh]
18
+ * Made pages respect permalinks style and permalinks in yml front matter [github.com/eugenebolshakov]
19
+ * Index.html file should always have index.html permalink [github.com/eugenebolshakov]
20
+ * Added trailing slash to pretty permalink style so Apache is happy [github.com/eugenebolshakov]
21
+ * Bad markdown processor in config fails sooner and with better message [github.com/gcnovus]
22
+ * Allow CRLFs in yaml frontmatter [github.com/juretta]
23
+ * Added Date#xmlschema for Ruby versions < 1.9
24
+
25
+ == 0.5.1 / 2009-05-06
26
+ * Major Enhancements
27
+ * Next/previous posts in site payload [github.com/pantulis, github.com/tomo]
28
+ * Permalink templating system
29
+ * Moved most of the README out to the GitHub wiki
30
+ * Exclude option in configuration so specified files won't be brought over with generated site [github.com/duritong]
31
+ * Bug Fixes
32
+ * Making sure config.yaml references are all gone, using only config.yml
33
+ * Fixed syntax highlighting breaking for UTF-8 code [github.com/henrik]
34
+ * Worked around RDiscount bug that prevents Markdown from getting parsed after highlight [github.com/henrik]
35
+ * CGI escaped post titles [github.com/Chrononaut]
36
+
37
+ == 0.5.0 / 2009-04-07
38
+ * Minor Enhancements
39
+ * Ability to set post categories via YAML [github.com/qrush]
40
+ * Ability to set prevent a post from publishing via YAML [github.com/qrush]
41
+ * Add textilize filter [github.com/willcodeforfoo]
42
+ * Add 'pretty' permalink style for wordpress-like urls [github.com/dysinger]
43
+ * Made it possible to enter categories from YAML as an array [github.com/Chrononaut]
44
+ * Ignore Emacs autosave files [github.com/Chrononaut]
45
+ * Bug Fixes
46
+ * Use block syntax of popen4 to ensure that subprocesses are properly disposed [github.com/jqr]
47
+ * Close open4 streams to prevent zombies [github.com/rtomayko]
48
+ * Only query required fields from the WP Database [github.com/ariejan]
49
+ * Prevent _posts from being copied to the destination directory [github.com/bdimcheff]
50
+ * Refactors
51
+ * Factored the filtering code into a method [github.com/Chrononaut]
52
+ * Fix tests and convert to Shoulda [github.com/qrush, github.com/technicalpickles]
53
+ * Add Cucumber acceptance test suite [github.com/qrush, github.com/technicalpickles]
54
+
55
+ == 0.4.1
56
+ * Minor Enhancements
57
+ * Changed date format on wordpress converter (zeropadding) [github.com/dysinger]
58
+ * Bug Fixes
59
+ * Add jekyll binary as executable to gemspec [github.com/dysinger]
60
+
61
+ == 0.4.0 / 2009-02-03
62
+ * Major Enhancements
63
+ * Switch to Jeweler for packaging tasks
64
+ * Minor Enhancements
65
+ * Type importer [github.com/codeslinger]
66
+ * site.topics accessor [github.com/baz]
67
+ * Add array_to_sentence_string filter [github.com/mchung]
68
+ * Add a converter for textpattern [github.com/PerfectlyNormal]
69
+ * Add a working Mephisto / MySQL converter [github.com/ivey]
70
+ * Allowing .htaccess files to be copied over into the generated site [github.com/briandoll]
71
+ * Add option to not put file date in permalink URL [github.com/mreid]
72
+ * Add line number capabilities to highlight blocks [github.com/jcon]
73
+ * Bug Fixes
74
+ * Fix permalink behavior [github.com/cavalle]
75
+ * Fixed an issue with pygments, markdown, and newlines [github.com/zpinter]
76
+ * Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
77
+ * Test and fix the site.categories hash [github.com/zzot]
78
+ * Fix site payload available to files [github.com/matrix9180]
79
+
80
+ == 0.3.0 / 2008-12-24
81
+ * Major Enhancements
82
+ * Added --server option to start a simple WEBrick server on destination directory [github.com/johnreilly and github.com/mchung]
83
+ * Minor Enhancements
84
+ * Added post categories based on directories containing _posts [github.com/mreid]
85
+ * Added post topics based on directories underneath _posts
86
+ * Added new date filter that shows the full month name [github.com/mreid]
87
+ * Merge Post's YAML front matter into its to_liquid payload [github.com/remi]
88
+ * Restrict includes to regular files underneath _includes
89
+ * Bug Fixes
90
+ * Change YAML delimiter matcher so as to not chew up 2nd level markdown headers [github.com/mreid]
91
+ * Fix bug that meant page data (such as the date) was not available in templates [github.com/mreid]
92
+ * Properly reject directories in _layouts
93
+
94
+ == 0.2.1 / 2008-12-15
95
+ * Major Changes
96
+ * Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
97
+ * Allow use of RDiscount with --rdiscount flag
98
+ * Minor Enhancements
99
+ * Don't load directory_watcher unless it's needed [github.com/pjhyett]
100
+
101
+ == 0.2.0 / 2008-12-14
102
+ * Major Changes
103
+ * related_posts is now found in site.related_posts
104
+
105
+ == 0.1.6 / 2008-12-13
106
+ * Major Features
107
+ * Include files in _includes with {% include x.textile %}
108
+
109
+ == 0.1.5 / 2008-12-12
110
+ * Major Features
111
+ * Code highlighting with Pygments if --pygments is specified
112
+ * Disable true LSI by default, enable with --lsi
113
+ * Minor Enhancements
114
+ * Output informative message if RDiscount is not available [github.com/JackDanger]
115
+ * Bug Fixes
116
+ * Prevent Jekyll from picking up the output directory as a source [github.com/JackDanger]
117
+ * Skip related_posts when there is only one post [github.com/JackDanger]
118
+
119
+ == 0.1.4 / 2008-12-08
120
+ * Bug Fixes
121
+ * DATA does not work properly with rubygems
122
+
123
+ == 0.1.3 / 2008-12-06
124
+ * Major Features
125
+ * Markdown support [github.com/vanpelt]
126
+ * Mephisto and CSV converters [github.com/vanpelt]
127
+ * Code hilighting [github.com/vanpelt]
128
+ * Autobuild
129
+ * Bug Fixes
130
+ * Accept both \r\n and \n in YAML header [github.com/vanpelt]
131
+
132
+ == 0.1.2 / 2008-11-22
133
+ * Major Features
134
+ * Add a real "related posts" implementation using Classifier
135
+ * Command Line Changes
136
+ * Allow cli to be called with 0, 1, or 2 args intuiting dir paths
137
+ if they are omitted
138
+
139
+ == 0.1.1 / 2008-11-22
140
+ * Minor Additions
141
+ * Posts now support introspectional data e.g. {{ page.url }}
142
+
143
+ == 0.1.0 / 2008-11-05
144
+ * First release
145
+ * Converts posts written in Textile
146
+ * Converts regular site pages
147
+ * Simple copy of binary files
148
+
149
+ == 0.0.0 / 2008-10-19
150
+ * Birthday!
151
+
data/README.textile ADDED
@@ -0,0 +1,613 @@
1
+ h1. Jekyll
2
+
3
+ By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
4
+
5
+ Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind "GitHub Pages":http://pages.github.com, which you can use to host your project's page or blog right here from GitHub.
6
+
7
+ h2. Getting Started
8
+
9
+ * "Install":http://wiki.github.com/mojombo/jekyll/install the gem
10
+ * Read up about its "Usage":http://wiki.github.com/mojombo/jekyll/usage and "Configuration":http://wiki.github.com/mojombo/jekyll/configuration
11
+ * Take a gander at some existing "Sites":http://wiki.github.com/mojombo/jekyll/sites
12
+ * Fork and "Contribute":http://wiki.github.com/mojombo/jekyll/contribute your own modifications
13
+ * Have questions? Post them on the "Mailing List":http://groups.google.com/group/jekyll-rb
14
+
15
+ h2. Diving In
16
+
17
+ * "Migrate":http://wiki.github.com/mojombo/jekyll/blog-migrations from your previous system
18
+ * Learn how the "YAML Front Matter":http://wiki.github.com/mojombo/jekyll/yaml-front-matter works
19
+ * Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data
20
+ * Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with
21
+ * Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier
22
+
23
+ h2. Dependencies
24
+
25
+ * RedCloth: Textile support
26
+ * Liquid: Templating system
27
+ * Classifier: Generating related posts
28
+ * Maruku: Default markdown engine
29
+ * Directory Watcher: Auto-regeneration of sites
30
+ * Open4: Talking to pygments for syntax highlighting
31
+ =======
32
+ Posts are handled in a special way by Jekyll. The date you specify in the
33
+ filename is used to construct the URL in the generated site. The example post,
34
+ for instance, ends up at
35
+ <code>http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html</code>.
36
+
37
+ Jekyll also supports specifying the post time in the filename. The format is e.g.
38
+ '2009-04-13_23-45-my-post.html'. Note that the time is prefixed by an underscore,
39
+ not a dash, so post slugs starting with numbers won't be parsed incorrectly.
40
+ Times in the filename must be on a 24-hour clock. Times and dates are treated by
41
+ Jekyll as local time.
42
+
43
+ Categories for posts are derived from the directory structure the posts were
44
+ found within. A post that appears in the directory foo/bar/_posts is placed in
45
+ the categories 'foo' and 'bar'. By selecting posts from particular categories
46
+ in your Liquid templates, you will be able to host multiple blogs within a
47
+ site.
48
+
49
+ Files that do not reside in directories prefixed with an underscore are
50
+ mirrored into a corresponding directory structure in the generated site. If a
51
+ file does not have a YAML preface, it is not run through the Liquid
52
+ interpreter. Binary files are copied over unmodified.
53
+
54
+ Jekyll is still a very young project. I've only developed the exact
55
+ functionality that I've needed. As time goes on I'd like to see the project
56
+ mature and support additional features. If you end up using Jekyll for your
57
+ own blog, drop me a line and let me know what you'd like to see in future
58
+ versions. Better yet, fork the project over at GitHub and hack in the features
59
+ yourself!
60
+
61
+ h2. Example Proto-Site
62
+
63
+ My own personal site/blog is generated with Jekyll.
64
+
65
+ The proto-site repo
66
+ ("http://github.com/mojombo/tpw":http://github.com/mojombo/tpw) is converted
67
+ into the actual site
68
+ ("http://tom.preston-werner.com/":http://tom.preston-werner.com)
69
+
70
+ h2. Install
71
+
72
+ The best way to install Jekyll is via RubyGems:
73
+
74
+ $ sudo gem install mojombo-jekyll -s http://gems.github.com/
75
+
76
+ Jekyll requires the gems `directory_watcher`, `liquid`, `open4`,
77
+ and `maruku` (for markdown support). These are automatically
78
+ installed by the gem install command.
79
+
80
+ Maruku comes with optional support for LaTeX to PNG rendering via
81
+ "blahtex":http://gva.noekeon.org/blahtexml/ (Version 0.6) which must be in
82
+ your $PATH along with `dvips`.
83
+
84
+ (NOTE: the version of maruku I am using is `remi-maruku` on GitHub as it
85
+ does not assume a fixed location for `dvips`.)
86
+
87
+ h2. Run
88
+
89
+ $ cd /path/to/proto/site
90
+ $ jekyll
91
+
92
+ This will generate the site and place it in /path/to/proto/site/_site. If
93
+ you'd like the generated site placed somewhere else:
94
+
95
+ $ jekyll /path/to/place/generated/site
96
+
97
+ And if you don't want to be in the proto site root to run Jekyll:
98
+
99
+ $ jekyll /path/to/proto/site /path/to/place/generated/site
100
+
101
+ h2. Run Options
102
+
103
+ h3. Autobuild
104
+
105
+ There is an autobuild feature that will regenerate your site if any of the
106
+ files change. The autobuild feature can be used on any of the invocations:
107
+
108
+ $ jekyll --auto
109
+
110
+ h3. Related Posts
111
+
112
+ By default, the "related posts" functionality will produce crappy results.
113
+ In order to get high quality results with a true LSI algorithm, you must
114
+ enable it (it may take some time to run if you have many posts):
115
+
116
+ $ jekyll --lsi
117
+
118
+ h3. Code Highlighting
119
+
120
+ For static code highlighting, you can install Pygments (see below) and then
121
+ use that to make your code blocks look pretty. To activate Pygments support
122
+ during the conversion:
123
+
124
+ $ jekyll --pygments
125
+
126
+ Highlighting a blog post can take a second or two, and with a lot of posts,
127
+ it adds up. You can tell Jekyll to cache pygments output in a directory for
128
+ faster re-rendering:
129
+
130
+ $ jekyll --pygments-cache [PATH]
131
+
132
+ h3. Markdown Processor
133
+
134
+ By default, Jekyll uses "Maruku":http://maruku.rubyforge.org (pure Ruby) for
135
+ Markdown support. If you'd like to use RDiscount (faster, but requires
136
+ compilation), you must install it (gem install rdiscount) and then you can
137
+ have it used instead:
138
+
139
+ $ jekyll --rdiscount
140
+
141
+ h3. Sass
142
+
143
+ To transform all ".sass":http://github.com/nex3/haml/tree/master
144
+ files anywhere in your file tree to CSS (e.g. '/css/site.sass' will
145
+ generate '/css/site.css'):
146
+
147
+ $ jekyll --sass
148
+
149
+ h3. Haml
150
+
151
+ To transform ".haml":http://github.com/nex3/haml/tree/master files to HTML
152
+ (e.g. '/about.haml' will generate '/about.html'):
153
+
154
+ $ jekyll --haml
155
+
156
+ Note that pages and posts must have a YAML metadata block at the top to be
157
+ converted. Layouts don't need to.
158
+
159
+ Haml content is intentionally not filtered, so you can use any Ruby code.
160
+
161
+ If you want to define methods you can call from your Haml files, create
162
+ a _helpers.rb file in the root of your blog and put the methods there,
163
+ inside a module named Helpers.
164
+
165
+ Jekyll provides some helpers out of the box:
166
+
167
+ h(string)
168
+ HTML entity-escapes the input string.
169
+
170
+ link_to(text, url)
171
+ Creates a link to the URL with the linked text (or markup).
172
+
173
+ h3. Local Server
174
+
175
+ When previewing complex sites locally, simply opening the site in a web
176
+ browser (using file://) can cause problems with links that are relative to
177
+ the site root (e.g., "/stylesheets/style.css"). To get around this, Jekyll
178
+ can launch a simple WEBrick server (works well in conjunction with --auto).
179
+ Default port is 4000:
180
+
181
+ $ jekyll --server [PORT]
182
+
183
+ h3. Permalink Style
184
+
185
+ By default, the permalink for each post begins with its date in 'YYYY/MM/DD'
186
+ format.
187
+
188
+ If you do not wish to have the date appear in the URL of each post,
189
+ you can change the permalink style to 'none' so that only the 'slug' part of
190
+ the filename is used. For example, with the permalink style set to 'none' the
191
+ file '2009-01-01-happy-new-year.markdown' will have a permalink like
192
+ 'http://yoursite.com/happy-new-year.html'. The date of the post will still be
193
+ read from the filename (and is required!) to be used elsewhere in Jekyll.
194
+
195
+ If you want WordPress-style pretty URLs that leave off the .html, you can
196
+ change the permalink style to 'pretty' and directories corresponding to the
197
+ date parts and post name will be made and an index.html will be placed in the
198
+ leaf directory resulting in URLs like 2008/11/17/blogging-like-a-hacker/.
199
+
200
+ $ jekyll --permalink [date|none|pretty]
201
+
202
+ Another way to leave off the .html is to configure Apache with 'Options +MultiViews'.
203
+ Just link to pages without the extension (and without a trailing slash, like '/about').
204
+ Then tell Jekyll not to add '.html' when linking to blog posts, like so:
205
+
206
+ $ jekyll --multiviews
207
+
208
+ Note that this has no effect with '--permalink pretty' since that makes an index.html
209
+ file in a directory.
210
+
211
+ h2. Configuration File
212
+
213
+ All of the options listed above can be specified on a site-by-site basis in
214
+ a '_config.yml' file at the root of the site's source. As the filename
215
+ suggests, the configuration is given in "YAML":http://www.yaml.org/. As
216
+ well as all of the options discussed in the last section, there are a few
217
+ additional options:
218
+
219
+ destination: [PATH] # Specify where the site should be rendered
220
+ markdown: [maruku|rdiscount] # Which markdown renderer to use?
221
+
222
+ maruku: # This is a YAML hash for Maruku settings
223
+ use_divs: [BOOLEAN] # Use the div element Maruku extension
224
+ use_tex: [BOOLEAN] # Use the LaTeX extension to Maruku
225
+ png_dir: [PATH] # Where should the math PNGs be stored?
226
+ png_url: [URL] # A relative URL for the PNGs
227
+
228
+ The default configuration is shown below as in YAML format:
229
+
230
+ destination: ./_site
231
+ auto: false
232
+ lsi: false
233
+ server_port: 4000
234
+ pygments: false
235
+ markdown: maruku
236
+ permalink: date
237
+
238
+ maruku:
239
+ use_tex: false
240
+ use_divs: false
241
+ png_dir: images/latex
242
+ png_url: /images/latex
243
+
244
+ Parameters set in a configuration file override the default values. Parameters
245
+ set using command line options override both the default values and those set
246
+ in a configuration file.
247
+
248
+ Additionally, you can set defaults for the post data blocks. For example, you
249
+ can set the default layout for posts, so you don't have to specify it in every
250
+ post:
251
+
252
+ post_defaults:
253
+ layout: post
254
+
255
+ Any values set in the actual post will override these defaults.
256
+
257
+ h2. Data
258
+
259
+ Jekyll traverses your site looking for files to process. Any files with YAML
260
+ front matter (see below) are subject to processing. For each of these files,
261
+ Jekyll makes a variety of data available to the pages via Haml or the Liquid
262
+ Liquid templating system. The following is a reference of the available data.
263
+
264
+ h3. Global
265
+
266
+ site
267
+ Sitewide information.
268
+
269
+ page
270
+ For Posts, this is the union of the data in the YAML front matter and the
271
+ computed data (such as URL and date). For regular pages, this is just the
272
+ YAML front matter.
273
+
274
+ content
275
+ In layout files, this contains the content of the subview(s). In Posts or
276
+ Pages, this is undefined.
277
+
278
+ h3. Site
279
+
280
+ site.time
281
+ The current Time (when you run the jekyll command).
282
+
283
+ site.posts
284
+ A reverse chronological list of all Posts.
285
+
286
+ site.collated_posts
287
+ A nested hash by year, then month number, then day, then a list of Posts.
288
+ Suitable for post archives. You probably need to show these with Haml
289
+ since Liquid is too limited. For example:
290
+ - site.collated_posts.sort.reverse.each do |year,months|
291
+ %h2= year
292
+ - months.sort.reverse.each do |month,days|
293
+ %h3= Date::MONTHNAMES[month]
294
+ - days.sort.reverse.each do |day,posts|
295
+ %ol
296
+ - posts.each do |post|
297
+ %li
298
+ %strong= "#{day}:"
299
+ = link_to(h(post.title), post.url)
300
+
301
+ site.related_posts
302
+ If the page being processed is a Post, this contains a list of up to ten
303
+ related Posts. By default, these are low quality but fast to compute. For
304
+ high quality but slow to compute results, run the jekyll command with the
305
+ --lsi (latent semantic indexing) option.
306
+
307
+ site.categories.CATEGORY
308
+ The list of all Posts in category CATEGORY.
309
+
310
+ site.tags.TAG
311
+ The list of all Posts tagged TAG.
312
+
313
+ h3. Post
314
+
315
+ post.title
316
+ The title of the Post.
317
+
318
+ post.url
319
+ The URL of the Post without the domain.
320
+ e.g. /2008/12/14/my-post.html
321
+
322
+ post.date
323
+ The Date (actually a Time object) assigned to the Post.
324
+
325
+ post.id
326
+ An identifier unique to the Post (useful in RSS feeds).
327
+ e.g. /2008/12/14/my-post
328
+
329
+ post.categories
330
+ The list of categories to which this post belongs. Categories are
331
+ derived from the directory structure above the _posts directory. For
332
+ example, a post at /work/code/_posts/2008-12-24-closures.textile
333
+ would have this field set to ['work', 'code'].
334
+
335
+ post.topics
336
+ The list of topics for this Post. Topics are derived from the directory
337
+ structure beneath the _posts directory. For example, a post at
338
+ /_posts/music/metal/2008-12-24-metalocalypse.textile would have this field
339
+ set to ['music', 'metal'].
340
+
341
+ post.tags
342
+ The list of tags on this post. Tags are much like topics, but can only be
343
+ specified in the YAML part of a post, and are not reflected in the URL.
344
+
345
+ post.content
346
+ The content of the Post.
347
+
348
+ h2. YAML Front Matter
349
+
350
+ Any files that contain a YAML front matter block will be processed by Jekyll
351
+ as special files. The front matter must be the first thing in the file and
352
+ takes the form of:
353
+
354
+ <pre>
355
+ ---
356
+ layout: post
357
+ title: Blogging Like a Hacker
358
+ ---
359
+ </pre>
360
+
361
+ Between the triple-dashed lines, you can set predefined variables (see below
362
+ for a reference) or custom data of your own.
363
+
364
+ h3. Predefined Global Variables
365
+
366
+ layout
367
+ If set, this specifies the layout file to use. Use the layout file
368
+ name without file extension. Layout files must be placed in the
369
+ <code>_layouts</code> directory.
370
+
371
+ A default layout for posts can be set in the configuration file.
372
+ See above.
373
+
374
+ h3. Predefined Post Variables
375
+
376
+ permalink
377
+ If you need your processed URLs to be something other than the default
378
+ /year/month/day/title.html then you can set this variable and it will
379
+ be used as the final URL.
380
+
381
+ published
382
+ Set to false if you don't want a post to show up when the site is
383
+ generated.
384
+
385
+ time
386
+ If you want posts to have a time, you can set this to e.g. '23:45' or
387
+ '11:45 pm'. This overrides any time specified in the filename like
388
+ '2009-04-12_23-44-my-post.html'. Note that you must quote the time:
389
+ time: "23:45"
390
+
391
+ category/categories
392
+ Instead of placing posts inside of folders, you can specify one or more
393
+ categories that the post belongs to. When the site is generated the post
394
+ will act as though it had been set with these categories normally.
395
+
396
+ tags
397
+ Similar to categories and topics but not reflected in the URL.
398
+
399
+ h3. Custom Variables
400
+
401
+ Any variables in the front matter that are not predefined are mixed into the
402
+ data that is sent to the Liquid templating engine during the conversion. For
403
+ instance, if you set a <code>title</code>, you can use that in your layout to
404
+ set the page title:
405
+
406
+ <pre>
407
+ <title>{{ page.title }}</title>
408
+ </pre>
409
+
410
+ h2. Filters, Tags, and Blocks
411
+
412
+ In addition to the built-in Liquid filters, tags, and blocks, Jekyll provides
413
+ some additional items that you can use in your site.
414
+
415
+ h3. Date to XML Schema (Filter)
416
+
417
+ Convert a Time into XML Schema format.
418
+
419
+ {{ site.time | date_to_xmlschema }}
420
+
421
+ becomes
422
+
423
+ 2008-11-17T13:07:54-08:00
424
+
425
+ h3. XML Escape (Filter)
426
+
427
+ Escape some text for use in XML.
428
+
429
+ {{ post.content | xml_escape }}
430
+
431
+ h3. Number of Words (Filter)
432
+
433
+ Count the number of words in some text.
434
+
435
+ {{ post.content | number_of_words }}
436
+
437
+ becomes
438
+
439
+ 1337
440
+
441
+ h3. Array to Sentence String
442
+
443
+ Convert an array into a sentence.
444
+
445
+ {{ page.tags | array_to_sentence_string }}
446
+
447
+ becomes
448
+
449
+ foo, bar, and baz
450
+
451
+ h3. Textilize
452
+
453
+ Convert a Textile-formatted string into HTML, formatted via RedCloth
454
+
455
+ {{ page.excerpt | textilize }}
456
+
457
+ h3. Include (Tag)
458
+
459
+ If you have small page fragments that you wish to include in multiple places
460
+ on your site, you can use the <code>include</code> tag.
461
+
462
+ <pre>{% include sig.textile %}</pre>
463
+
464
+ Jekyll expects all include files to be placed in an <code>_includes</code>
465
+ directory at the root of your source dir. So this will embed the contents of
466
+ <code>/path/to/proto/site/_includes/sig.textile</code> into the calling file.
467
+
468
+ h3. Code Highlighting (Block)
469
+
470
+ Jekyll has built in support for syntax highlighting of over "100
471
+ languages":http://pygments.org/languages/ via "Pygments":http://pygments.org/.
472
+ In order to take advantage of this you'll need to have Pygments installed, and
473
+ the pygmentize binary must be in your path. When you run Jekyll, make sure you
474
+ run it with Pygments support:
475
+
476
+ $ jekyll --pygments
477
+
478
+ To denote a code block that should be highlighted:
479
+
480
+ <pre>
481
+ {% highlight ruby %}
482
+ def foo
483
+ puts 'foo'
484
+ end
485
+ {% endhighlight %}
486
+ </pre>
487
+
488
+ The argument to <code>highlight</code> is the language identifier. To find the
489
+ appropriate identifier to use for your favorite language, look for the "short
490
+ name" on the "Lexers":http://pygments.org/docs/lexers/ page.
491
+
492
+ There is a second argument to <code>highlight</code> called
493
+ <code>linenos</code> that is optional. Including the <code>linenos</code>
494
+ argument will force the highlighted code to include line numbers. For
495
+ instance, the following code block would include line numbers next to each
496
+ line:
497
+
498
+ <pre>
499
+ {% highlight ruby linenos %}
500
+ def foo
501
+ puts 'foo'
502
+ end
503
+ {% endhighlight %}
504
+ </pre>
505
+
506
+ In order for the highlighting to show up, you'll need to include a
507
+ highlighting stylesheet. For an example stylesheet you can look at
508
+ "syntax.css":http://github.com/mojombo/tpw/tree/master/css/syntax.css. These
509
+ are the same styles as used by GitHub and you are free to use them for your
510
+ own site. If you use linenos, you might want to include an additional CSS
511
+ class definition for <code>lineno</code> in syntax.css to distinguish the line
512
+ numbers from the highlighted code.
513
+
514
+ h2. Categories
515
+
516
+ Posts are placed into categories based on the directory structure they are
517
+ found within (see above for an example). The categories can be accessed from
518
+ within a Liquid template as follows:
519
+
520
+ <pre>
521
+ {% for post in site.categories.foo %}
522
+ <li><span>{{ post.date | date_to_string }}</span> - {{ post.title }}</li>
523
+ {% endfor %}
524
+ </pre>
525
+
526
+ This would list all the posts in the category 'foo' by date and title.
527
+
528
+ The posts within each category are sorted in reverse chronological order.
529
+
530
+ h2. Tags
531
+
532
+ Tags are like categories or topics but not reflected in the URL.
533
+
534
+ h2. Blog migrations
535
+
536
+ h3. Movable Type
537
+
538
+ To migrate your MT blog into Jekyll, you'll need read access to the database.
539
+ The lib/jekyll/converters/mt.rb module provides a simple convert to create
540
+ .markdown files in a _posts directory based on the entries contained therein.
541
+
542
+ $ export DB=my_mtdb
543
+ $ export USER=dbuser
544
+ $ export PASS=dbpass
545
+ $ ruby -r './lib/jekyll/converters/mt' -e 'Jekyll::MT.process( \
546
+ "#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")'
547
+
548
+ You may need to adjust the SQL query used to retrieve MT entries. Left alone,
549
+ it will attempt to pull all entries across all blogs regardless of status.
550
+ Please check the results and verify the posts before publishing.
551
+
552
+ h3. Typo 4+
553
+
554
+ To migrate your Typo blog into Jekyll, you'll need read access to the MySQL
555
+ database. The lib/jekyll/converters/typo.rb module provides a simple convert
556
+ to create .html, .textile, or .markdown files in a _posts directory based on
557
+ the entries contained therein.
558
+
559
+ $ export DB=my_typo_db
560
+ $ export USER=dbuser
561
+ $ export PASS=dbpass
562
+ $ ruby -r './lib/jekyll/converters/typo' -e 'Jekyll::Typo.process( \
563
+ "#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")'
564
+
565
+ You may need to adjust the code used to filter Typo entries. Left alone,
566
+ it will attempt to pull all entries across all blogs that were published.
567
+ This code also has only been tested with Typo version 4+. Previous versions
568
+ of Typo may not convert correctly. Please check the results and verify the
569
+ posts before publishing.
570
+
571
+ h3. TextPattern 4
572
+
573
+ To migrate your TextPattern blog into Jekyll, you'll need read access to the MySQL
574
+ database. The lib/jekyll/converters/textpattern.rb module provides a simple convert to create .textile files in a _posts directory based on
575
+ the entries contained therein.
576
+
577
+ $ ruby -r './lib/jekyll/converters/textpattern' -e 'Jekyll::TextPattern.process( \
578
+ "database_name", "username", "password", "hostname")'
579
+
580
+ The hostname defaults to _localhost_, all other variables are needed
581
+ You may need to adjust the code used to filter entries. Left alone,
582
+ it will attempt to pull all entries that are live or sticky.
583
+
584
+ h2. Contribute
585
+
586
+ If you'd like to hack on Jekyll, start by forking my repo on GitHub:
587
+
588
+ http://github.com/mojombo/jekyll
589
+
590
+ To get all of the dependencies, install the gem first. The best way to get
591
+ your changes merged back into core is as follows:
592
+
593
+ # Clone down your fork
594
+ # Create a topic branch to contain your change
595
+ # Hack away
596
+ # Add tests and make sure everything still passes by running `rake`
597
+ # If you are adding new functionality, document it in README.textile
598
+ # Do not change the version number, I will do that on my end
599
+ # If necessary, rebase your commits into logical chunks, without errors
600
+ # Push the branch up to GitHub
601
+ # Create an issue on mojombo/grit with a description and link to your branch
602
+
603
+ h2. License
604
+
605
+ (The MIT License)
606
+
607
+ Copyright (c) 2008 Tom Preston-Werner
608
+
609
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
610
+
611
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
612
+
613
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.