jsjohnst-jekyll 0.4.1.999.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/History.txt +106 -0
  2. data/README.textile +555 -0
  3. data/VERSION.yml +4 -0
  4. data/bin/jekyll +146 -0
  5. data/lib/jekyll.rb +81 -0
  6. data/lib/jekyll/albino.rb +121 -0
  7. data/lib/jekyll/converters/csv.rb +26 -0
  8. data/lib/jekyll/converters/mephisto.rb +79 -0
  9. data/lib/jekyll/converters/mt.rb +59 -0
  10. data/lib/jekyll/converters/rss.rb +44 -0
  11. data/lib/jekyll/converters/textpattern.rb +50 -0
  12. data/lib/jekyll/converters/typo.rb +49 -0
  13. data/lib/jekyll/converters/wordpress.rb +55 -0
  14. data/lib/jekyll/convertible.rb +71 -0
  15. data/lib/jekyll/core_ext.rb +22 -0
  16. data/lib/jekyll/filters.rb +87 -0
  17. data/lib/jekyll/layout.rb +47 -0
  18. data/lib/jekyll/page.rb +64 -0
  19. data/lib/jekyll/post.rb +232 -0
  20. data/lib/jekyll/site.rb +221 -0
  21. data/lib/jekyll/tags/highlight.rb +53 -0
  22. data/lib/jekyll/tags/include.rb +49 -0
  23. data/lib/jekyll/tasks.rb +68 -0
  24. data/test/helper.rb +14 -0
  25. data/test/source/_includes/sig.markdown +3 -0
  26. data/test/source/_layouts/default.html +27 -0
  27. data/test/source/_layouts/simple.html +1 -0
  28. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  29. data/test/source/_posts/2008-02-02-published.textile +8 -0
  30. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  31. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  32. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  33. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  34. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  35. data/test/source/_posts/2009-01-27-category.textile +7 -0
  36. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  37. data/test/source/category_test.html +13 -0
  38. data/test/source/css/screen.css +76 -0
  39. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  40. data/test/source/index.html +22 -0
  41. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  42. data/test/suite.rb +9 -0
  43. data/test/test_filters.rb +49 -0
  44. data/test/test_generated_site.rb +37 -0
  45. data/test/test_jekyll.rb +0 -0
  46. data/test/test_post.rb +174 -0
  47. data/test/test_site.rb +51 -0
  48. data/test/test_tags.rb +52 -0
  49. metadata +186 -0
@@ -0,0 +1,106 @@
1
+ ==
2
+ * Minor Enhancements
3
+ * Ability to specify files to ignore during processing using a .jekyllignore file [github.com/al]
4
+ * Ability to set post categories via YAML [github.com/qrush]
5
+ * Ability to set prevent a post from publishing via YAML [github.com/qrush]
6
+ * Add textilize filter [github.com/willcodeforfoo]
7
+ * Bug Fixes
8
+ * Use block syntax of popen4 to ensure that subprocesses are properly disposed [github.com/jqr]
9
+
10
+ == 0.4.1
11
+ * Minor Enhancements
12
+ * Changed date format on wordpress converter (zeropadding) [github.com/dysinger]
13
+ * Bug Fixes
14
+ * Add jekyll binary as executable to gemspec [github.com/dysinger]
15
+
16
+ == 0.4.0 / 2009-02-03
17
+ * Major Enhancements
18
+ * Switch to Jeweler for packaging tasks
19
+ * Minor Enhancements
20
+ * Type importer [github.com/codeslinger]
21
+ * site.topics accessor [github.com/baz]
22
+ * Add array_to_sentence_string filter [github.com/mchung]
23
+ * Add a converter for textpattern [github.com/PerfectlyNormal]
24
+ * Add a working Mephisto / MySQL converter [github.com/ivey]
25
+ * Allowing .htaccess files to be copied over into the generated site [github.com/briandoll]
26
+ * Add option to not put file date in permalink URL [github.com/mreid]
27
+ * Add line number capabilities to highlight blocks [github.com/jcon]
28
+ * Bug Fixes
29
+ * Fix permalink behavior [github.com/cavalle]
30
+ * Fixed an issue with pygments, markdown, and newlines [github.com/zpinter]
31
+ * Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
32
+ * Test and fix the site.categories hash [github.com/zzot]
33
+ * Fix site payload available to files [github.com/matrix9180]
34
+
35
+ == 0.3.0 / 2008-12-24
36
+ * Major Enhancements
37
+ * Added --server option to start a simple WEBrick server on destination directory [github.com/johnreilly and github.com/mchung]
38
+ * Minor Enhancements
39
+ * Added post categories based on directories containing _posts [github.com/mreid]
40
+ * Added post topics based on directories underneath _posts
41
+ * Added new date filter that shows the full month name [github.com/mreid]
42
+ * Merge Post's YAML front matter into its to_liquid payload [github.com/remi]
43
+ * Restrict includes to regular files underneath _includes
44
+ * Bug Fixes
45
+ * Change YAML delimiter matcher so as to not chew up 2nd level markdown headers [github.com/mreid]
46
+ * Fix bug that meant page data (such as the date) was not available in templates [github.com/mreid]
47
+ * Properly reject directories in _layouts
48
+
49
+ == 0.2.1 / 2008-12-15
50
+ * Major Changes
51
+ * Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
52
+ * Allow use of RDiscount with --rdiscount flag
53
+ * Minor Enhancements
54
+ * Don't load directory_watcher unless it's needed [github.com/pjhyett]
55
+
56
+ == 0.2.0 / 2008-12-14
57
+ * Major Changes
58
+ * related_posts is now found in site.related_posts
59
+
60
+ == 0.1.6 / 2008-12-13
61
+ * Major Features
62
+ * Include files in _includes with {% include x.textile %}
63
+
64
+ == 0.1.5 / 2008-12-12
65
+ * Major Features
66
+ * Code highlighting with Pygments if --pygments is specified
67
+ * Disable true LSI by default, enable with --lsi
68
+ * Minor Enhancements
69
+ * Output informative message if RDiscount is not available [github.com/JackDanger]
70
+ * Bug Fixes
71
+ * Prevent Jekyll from picking up the output directory as a source [github.com/JackDanger]
72
+ * Skip related_posts when there is only one post [github.com/JackDanger]
73
+
74
+ == 0.1.4 / 2008-12-08
75
+ * Bug Fixes
76
+ * DATA does not work properly with rubygems
77
+
78
+ == 0.1.3 / 2008-12-06
79
+ * Major Features
80
+ * Markdown support [github.com/vanpelt]
81
+ * Mephisto and CSV converters [github.com/vanpelt]
82
+ * Code hilighting [github.com/vanpelt]
83
+ * Autobuild
84
+ * Bug Fixes
85
+ * Accept both \r\n and \n in YAML header [github.com/vanpelt]
86
+
87
+ == 0.1.2 / 2008-11-22
88
+ * Major Features
89
+ * Add a real "related posts" implementation using Classifier
90
+ * Command Line Changes
91
+ * Allow cli to be called with 0, 1, or 2 args intuiting dir paths
92
+ if they are omitted
93
+
94
+ == 0.1.1 / 2008-11-22
95
+ * Minor Additions
96
+ * Posts now support introspectional data e.g. {{ page.url }}
97
+
98
+ == 0.1.0 / 2008-11-05
99
+ * First release
100
+ * Converts posts written in Textile
101
+ * Converts regular site pages
102
+ * Simple copy of binary files
103
+
104
+ == 0.0.0 / 2008-10-19
105
+ * Birthday!
106
+
@@ -0,0 +1,555 @@
1
+ h1. Jekyll
2
+
3
+ Jekyll is a simple, blog aware, static site generator. It takes a template
4
+ directory (representing the raw form of a website), runs it through Textile or
5
+ Markdown and Liquid converters, and spits out a complete, static website
6
+ suitable for serving with Apache or your favorite web server. Visit
7
+ "http://tom.preston-werner.com":http://tom.preston-werner.com to see an
8
+ example of a Jekyll generated blog.
9
+
10
+ To understand how this all works, open up my
11
+ "TPW":http://github.com/mojombo/tpw repo in a new browser window. I'll be
12
+ referencing the code there.
13
+
14
+ Take a look at
15
+ "index.html":http://github.com/mojombo/tpw/tree/master/index.html. This file
16
+ represents the homepage of the site. At the top of the file is a chunk of YAML
17
+ that contains metadata about the file. This data tells Jekyll what layout to
18
+ give the file, what the page's title should be, etc. In this case, I specify
19
+ that the "default" template should be used. You can find the layout files in
20
+ the "_layouts":http://github.com/mojombo/tpw/tree/master/_layouts directory.
21
+ If you open
22
+ "default.html":http://github.com/mojombo/tpw/tree/master/_layouts/default.html
23
+ you can see that the homepage is constructed by wrapping index.html with this
24
+ layout.
25
+
26
+ You'll also notice Liquid templating code in these files.
27
+ "Liquid":http://www.liquidmarkup.org/ is a simple, extensible templating
28
+ language that makes it easy to embed data in your templates. For my homepage I
29
+ wanted to have a list of all my blog posts. Jekyll hands me a Hash containing
30
+ various data about my site. A reverse chronological list of all my blog posts
31
+ can be found in <code>site.posts</code>. Each post, in turn, contains various
32
+ fields such as <code>title</code> and <code>date</code>.
33
+
34
+ Jekyll gets the list of blog posts by parsing the files in any
35
+ "_posts":http://github.com/mojombo/tpw/tree/master/_posts directory found in
36
+ subdirectories below the root.
37
+ Each post's filename contains (by default) the publishing date and slug (what shows up in the
38
+ URL) that the final HTML file should have. Open up the file corresponding to a
39
+ blog post:
40
+ "2008-11-17-blogging-like-a-hacker.textile":http://github.com/mojombo/tpw/tree/master/_posts/2008-11-17-blogging-like-a-hacker.textile.
41
+ GitHub renders textile files by default, so to better understand the file,
42
+ click on the
43
+ "raw":http://github.com/mojombo/tpw/tree/master/_posts/2008-11-17-blogging-like-a-hacker.textile?raw=true
44
+ view to see the original file. Here I've specified the <code>post</code>
45
+ layout. If you look at that file you'll see an example of a nested layout.
46
+ Layouts can contain other layouts allowing you a great deal of flexibility in
47
+ how pages are assembled. In my case I use a nested layout in order to show
48
+ related posts for each blog entry. The YAML also specifies the post's title
49
+ which is then embedded in the post's body via Liquid.
50
+
51
+ Posts are handled in a special way by Jekyll. The date you specify in the
52
+ filename is used to construct the URL in the generated site. The example post,
53
+ for instance, ends up at
54
+ <code>http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html</code>.
55
+
56
+ Categories for posts are derived from the directory structure the posts were
57
+ found within. A post that appears in the directory foo/bar/_posts is placed in
58
+ the categories 'foo' and 'bar'. By selecting posts from particular categories
59
+ in your Liquid templates, you will be able to host multiple blogs within a
60
+ site.
61
+
62
+ Files that do not reside in directories prefixed with an underscore are
63
+ mirrored into a corresponding directory structure in the generated site. If a
64
+ file does not have a YAML preface, it is not run through the Liquid
65
+ interpreter. Binary files are copied over unmodified.
66
+
67
+ Jekyll is still a very young project. I've only developed the exact
68
+ functionality that I've needed. As time goes on I'd like to see the project
69
+ mature and support additional features. If you end up using Jekyll for your
70
+ own blog, drop me a line and let me know what you'd like to see in future
71
+ versions. Better yet, fork the project over at GitHub and hack in the features
72
+ yourself!
73
+
74
+ h2. Example Proto-Site
75
+
76
+ My own personal site/blog is generated with Jekyll.
77
+
78
+ The proto-site repo
79
+ ("http://github.com/mojombo/tpw":http://github.com/mojombo/tpw) is converted
80
+ into the actual site
81
+ ("http://tom.preston-werner.com/":http://tom.preston-werner.com)
82
+
83
+ h2. Install
84
+
85
+ The best way to install Jekyll is via RubyGems:
86
+
87
+ $ sudo gem install jsjohnst-jekyll -s http://gems.github.com/
88
+
89
+ Jekyll requires the gems `directory_watcher`, `liquid`, `open4`, `RedCloth`
90
+ `redgreen` and `maruku` (for markdown support). These are automatically
91
+ installed by the gem install command.
92
+
93
+ Maruku comes with optional support for LaTeX to PNG rendering via
94
+ "blahtex":http://gva.noekeon.org/blahtexml/ (Version 0.6) which must be in
95
+ your $PATH along with `dvips`.
96
+
97
+ (NOTE: the version of maruku I am using is `remi-maruku` on GitHub as it
98
+ does not assume a fixed location for `dvips`.)
99
+
100
+ h2. Run
101
+
102
+ $ cd /path/to/proto/site
103
+ $ jekyll
104
+
105
+ This will generate the site and place it in /path/to/proto/site/_site. If
106
+ you'd like the generated site placed somewhere else:
107
+
108
+ $ jekyll /path/to/place/generated/site
109
+
110
+ And if you don't want to be in the proto site root to run Jekyll:
111
+
112
+ $ jekyll /path/to/proto/site /path/to/place/generated/site
113
+
114
+ h2. Run Options
115
+
116
+ There is an autobuild feature that will regenerate your site if any of the
117
+ files change. The autobuild feature can be used on any of the invocations:
118
+
119
+ $ jekyll --auto
120
+
121
+ By default, the "related posts" functionality will produce crappy results.
122
+ In order to get high quality results with a true LSI algorithm, you must
123
+ enable it (it may take some time to run if you have many posts):
124
+
125
+ $ jekyll --lsi
126
+
127
+ For static code highlighting, you can install Pygments (see below) and then
128
+ use that to make your code blocks look pretty. To activate Pygments support
129
+ during the conversion:
130
+
131
+ $ jekyll --pygments
132
+
133
+ By default, Jekyll uses "Maruku":http://maruku.rubyforge.org (pure Ruby) for
134
+ Markdown support. If you'd like to use RDiscount (faster, but requires
135
+ compilation), you must install it (gem install rdiscount) and then you can
136
+ have it used instead:
137
+
138
+ $ jekyll --rdiscount
139
+
140
+ As another alternative, just because to make it a hat trick, you can also
141
+ use BlueCloth (gem install bluecloth).
142
+
143
+ $ jekyll --bluecloth
144
+
145
+ When previewing complex sites locally, simply opening the site in a web
146
+ browser (using file://) can cause problems with links that are relative to
147
+ the site root (e.g., "/stylesheets/style.css"). To get around this, Jekyll
148
+ can launch a simple WEBrick server (works well in conjunction with --auto).
149
+ Default port is 4000:
150
+
151
+ $ jekyll --server [PORT]
152
+
153
+ By default, the permalink for each post begins with its date in 'YYYY/MM/DD'
154
+ format. The default is to use <code>slug/index.html</code> style URLs (<code>pretty</code>) but if you
155
+ would prefer having <code>slug.html</code> then pass <code>date</code> as the option.
156
+ If you do not wish to have the date appear in the URL of each post,
157
+ you can change the permalink style to 'none' so that only the 'slug' part of
158
+ the filename is used. For example, with the permalink style set to 'none' the
159
+ file '2009-01-01-happy-new-year.markdown' will have a permalink like
160
+ 'http://yoursite.com/happy-new-year.html'. The date of the post will still be
161
+ read from the filename (and is required!) to be used elsewhere in Jekyll.
162
+ Also supported is the permalink format <code>shortdate</code>, which will use the YYYY/M/D
163
+ for days and months < 10. You can also choose <code>month</code> to just include
164
+ month and year or <code>year</code> to only include the year.
165
+ Example usage:
166
+
167
+ $ jekyll --permalink none
168
+
169
+ h2. Ignoring Files
170
+
171
+ Often your project will include files which you do not wish Jekyll to process
172
+ or make available in the generated site. For example, a README, a TODO file, or
173
+ a Capfile. Whilst Jekyll will always ignore files with names that begin with a
174
+ period . (except .htaccess) or an underscore (except _posts) you may specify
175
+ more files which should be ignored with the use of a .jekyllignore file.
176
+
177
+ A .jekyllignore file may be placed in the root of your project and should
178
+ simply contain Ruby compatible regular expressions (one per line) identifying
179
+ files to ignore. A typical .jekyllignore file might contain the following:
180
+ <pre>
181
+ <code>
182
+ ^README$
183
+ ^TODO$
184
+ ^Capfile$
185
+ ^config(/*)?$
186
+ </code>
187
+ </pre>
188
+
189
+ Note that Jekyll no longer automatically ignores files with names terminating
190
+ with a tilde ~. Instead you must explicitly specify that such backup files be
191
+ ignored with an entry in your .jekyllignore like:
192
+ <pre>
193
+ <code>
194
+ ^.*~$
195
+ </code>
196
+ </pre>
197
+ or for Emacs users:
198
+ <pre>
199
+ <code>
200
+ ^#.*#$
201
+ </code>
202
+ </pre>
203
+
204
+ h2. Data
205
+
206
+ Jekyll traverses your site looking for files to process. Any files with YAML
207
+ front matter (see below) are subject to processing. For each of these files,
208
+ Jekyll makes a variety of data available to the pages via the Liquid
209
+ templating system. The following is a reference of the available data.
210
+
211
+ h3. Global
212
+
213
+ site
214
+ Sitewide information.
215
+
216
+ page
217
+ For Posts, this is the union of the data in the YAML front matter and the
218
+ computed data (such as URL and date). For regular pages, this is just the
219
+ YAML front matter.
220
+
221
+ content
222
+ In layout files, this contains the content of the subview(s). In Posts or
223
+ Pages, this is undefined.
224
+
225
+ h3. Site
226
+
227
+ site.time
228
+ The current Time (when you run the jekyll command).
229
+
230
+ site.posts
231
+ A reverse chronological list of all Posts.
232
+
233
+ site.related_posts
234
+ If the page being processed is a Post, this contains a list of up to ten
235
+ related Posts. By default, these are low quality but fast to compute. For
236
+ high quality but slow to compute results, run the jekyll command with the
237
+ --lsi (latent semantic indexing) option.
238
+
239
+ site.categories.CATEGORY
240
+ The list of all Posts in category CATEGORY.
241
+
242
+ h3. Post
243
+
244
+ post.title
245
+ The title of the Post.
246
+
247
+ post.url
248
+ The URL of the Post without the domain.
249
+ e.g. /2008/12/14/my-post.html
250
+
251
+ post.date
252
+ The Date assigned to the Post.
253
+
254
+ post.id
255
+ An identifier unique to the Post (useful in RSS feeds).
256
+ e.g. /2008/12/14/my-post
257
+
258
+ post.categories
259
+ The list of categories to which this post belongs. Categories are
260
+ derived from the directory structure above the _posts directory. For
261
+ example, a post at /work/code/_posts/2008-12-24-closures.textile
262
+ would have this field set to ['work', 'code'].
263
+
264
+ post.topics
265
+ The list of topics for this Post. Topics are derived from the directory
266
+ structure beneath the _posts directory. For example, a post at
267
+ /_posts/music/metal/2008-12-24-metalocalypse.textile would have this field
268
+ set to ['music', 'metal'].
269
+
270
+ post.content
271
+ The content of the Post.
272
+
273
+ post.folded
274
+ A boolean value which is True if the post contains an HR tag. Authors can use this
275
+ to break up certain posts so that the full text is displayed only on the full post
276
+ page. The first-encountered HR is used as the fold marker.
277
+
278
+ h2. YAML Front Matter
279
+
280
+ Any files that contain a YAML front matter block will be processed by Jekyll
281
+ as special files. The front matter must be the first thing in the file and
282
+ takes the form of:
283
+
284
+ <pre>
285
+ ---
286
+ layout: post
287
+ title: Blogging Like a Hacker
288
+ ---
289
+ </pre>
290
+
291
+ Between the triple-dashed lines, you can set predefined variables (see below
292
+ for a reference) or custom data of your own.
293
+
294
+ h3. Predefined Global Variables
295
+
296
+ layout
297
+ If set, this specifies the layout file to use. Use the layout file
298
+ name without file extension. Layout files must be placed in the
299
+ <code>_layouts</code> directory.
300
+
301
+ h3. Predefined Post Variables
302
+
303
+ permalink
304
+ If you need your processed URLs to be something other than the default
305
+ /year/month/day/title.html then you can set this variable and it will
306
+ be used as the final URL.
307
+
308
+ published
309
+ Set to false if you don't want a post to show up when the site is
310
+ generated.
311
+
312
+ category/categories
313
+ Instead of placing posts inside of folders, you can specify one or more
314
+ categories that the post belongs to. When the site is generated the post
315
+ will act as though it had been set with these categories normally.
316
+
317
+ h3. Custom Variables
318
+
319
+ Any variables in the front matter that are not predefined are mixed into the
320
+ data that is sent to the Liquid templating engine during the conversion. For
321
+ instance, if you set a <code>title</code>, you can use that in your layout to
322
+ set the page title:
323
+
324
+ <pre>
325
+ <title>{{ page.title }}</title>
326
+ </pre>
327
+
328
+ h2. Filters, Tags, and Blocks
329
+
330
+ In addition to the built-in Liquid filters, tags, and blocks, Jekyll provides
331
+ some additional items that you can use in your site.
332
+
333
+ h3. Date to XML Schema (Filter)
334
+
335
+ Convert a Time into XML Schema format.
336
+
337
+ {{ site.time | date_to_xmlschema }}
338
+
339
+ becomes
340
+
341
+ 2008-11-17T13:07:54-08:00
342
+
343
+ h3. XML Escape (Filter)
344
+
345
+ Escape some text for use in XML.
346
+
347
+ {{ post.content | xml_escape }}
348
+
349
+ h3. Number of Words (Filter)
350
+
351
+ Count the number of words in some text.
352
+
353
+ {{ post.content | number_of_words }}
354
+
355
+ becomes
356
+
357
+ 1337
358
+
359
+ h3. Array to Sentence String
360
+
361
+ Convert an array into a sentence.
362
+
363
+ {{ page.tags | array_to_sentence_string }}
364
+
365
+ becomes
366
+
367
+ foo, bar, and baz
368
+
369
+ h3. Textilize
370
+
371
+ Convert a Textile-formatted string into HTML, formatted via RedCloth
372
+
373
+ {{ page.excerpt | textilize }}
374
+
375
+ h3. Post folding
376
+
377
+ Displays all text in the given Post before the first-encountered HR tag.
378
+
379
+ {{ page.content | before_fold }}
380
+
381
+ h3. Include (Tag)
382
+
383
+ If you have small page fragments that you wish to include in multiple places
384
+ on your site, you can use the <code>include</code> tag.
385
+
386
+ <pre>{% include sig.textile %}</pre>
387
+
388
+ Jekyll expects all include files to be placed in an <code>_includes</code>
389
+ directory at the root of your source dir. So this will embed the contents of
390
+ <code>/path/to/proto/site/_includes/sig.textile</code> into the calling file.
391
+
392
+ An alternate syntax which supports using page variables is the following:
393
+
394
+ <pre>{% include from page.includefile %}</pre>
395
+
396
+ which allows you to pass in the name of the file to include from a YAML front matter block.
397
+
398
+ This means if <code>{{ page.includefile }}</code> outputs <code>flickr.html</code> then
399
+ the above include would load <code>_includes/flickr.html</code>.
400
+
401
+ h3. Code Highlighting (Block)
402
+
403
+ Jekyll has built in support for syntax highlighting of over "100
404
+ languages":http://pygments.org/languages/ via "Pygments":http://pygments.org/.
405
+ In order to take advantage of this you'll need to have Pygments installed, and
406
+ the pygmentize binary must be in your path. When you run Jekyll, make sure you
407
+ run it with Pygments support:
408
+
409
+ $ jekyll --pygments
410
+
411
+ To denote a code block that should be highlighted:
412
+
413
+ <pre>
414
+ {% highlight ruby %}
415
+ def foo
416
+ puts 'foo'
417
+ end
418
+ {% endhighlight %}
419
+ </pre>
420
+
421
+ The argument to <code>highlight</code> is the language identifier. To find the
422
+ appropriate identifier to use for your favorite language, look for the "short
423
+ name" on the "Lexers":http://pygments.org/docs/lexers/ page.
424
+
425
+ There is a second argument to <code>highlight</code> called
426
+ <code>linenos</code> that is optional. Including the <code>linenos</code>
427
+ argument will force the highlighted code to include line numbers. For
428
+ instance, the following code block would include line numbers next to each
429
+ line:
430
+
431
+ <pre>
432
+ {% highlight ruby linenos %}
433
+ def foo
434
+ puts 'foo'
435
+ end
436
+ {% endhighlight %}
437
+ </pre>
438
+
439
+ In order for the highlighting to show up, you'll need to include a
440
+ highlighting stylesheet. For an example stylesheet you can look at
441
+ "syntax.css":http://github.com/mojombo/tpw/tree/master/css/syntax.css. These
442
+ are the same styles as used by GitHub and you are free to use them for your
443
+ own site. If you use linenos, you might want to include an additional CSS
444
+ class definition for <code>lineno</code> in syntax.css to distinguish the line
445
+ numbers from the highlighted code.
446
+
447
+ h2. Categories
448
+
449
+ Posts are placed into categories based on the directory structure they are
450
+ found within (see above for an example). The categories can be accessed from
451
+ within a Liquid template as follows:
452
+
453
+ <pre>
454
+ {% for post in site.categories.foo %}
455
+ <li><span>{{ post.date | date_to_string }}</span> - {{ post.title }}</li>
456
+ {% endfor %}
457
+ </pre>
458
+
459
+ This would list all the posts in the category 'foo' by date and title.
460
+
461
+ The posts within each category are sorted in reverse chronological order.
462
+
463
+ h2. Blog migrations
464
+
465
+ h3. Movable Type
466
+
467
+ To migrate your MT blog into Jekyll, you'll need read access to the database.
468
+ The lib/jekyll/converters/mt.rb module provides a simple convert to create
469
+ .markdown files in a _posts directory based on the entries contained therein.
470
+
471
+ $ export DB=my_mtdb
472
+ $ export USER=dbuser
473
+ $ export PASS=dbpass
474
+ $ ruby -r './lib/jekyll/converters/mt' -e 'Jekyll::MT.process( \
475
+ "#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")'
476
+
477
+ You may need to adjust the SQL query used to retrieve MT entries. Left alone,
478
+ it will attempt to pull all entries across all blogs regardless of status.
479
+ Please check the results and verify the posts before publishing.
480
+
481
+ h3. Typo 4+
482
+
483
+ To migrate your Typo blog into Jekyll, you'll need read access to the MySQL
484
+ database. The lib/jekyll/converters/typo.rb module provides a simple convert
485
+ to create .html, .textile, or .markdown files in a _posts directory based on
486
+ the entries contained therein.
487
+
488
+ $ export DB=my_typo_db
489
+ $ export USER=dbuser
490
+ $ export PASS=dbpass
491
+ $ ruby -r './lib/jekyll/converters/typo' -e 'Jekyll::Typo.process( \
492
+ "#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")'
493
+
494
+ You may need to adjust the code used to filter Typo entries. Left alone,
495
+ it will attempt to pull all entries across all blogs that were published.
496
+ This code also has only been tested with Typo version 4+. Previous versions
497
+ of Typo may not convert correctly. Please check the results and verify the
498
+ posts before publishing.
499
+
500
+ h3. TextPattern 4
501
+
502
+ To migrate your TextPattern blog into Jekyll, you'll need read access to the MySQL
503
+ database. The lib/jekyll/converters/textpattern.rb module provides a simple convert to create .textile files in a _posts directory based on
504
+ the entries contained therein.
505
+
506
+ $ ruby -r './lib/jekyll/converters/textpattern' -e 'Jekyll::TextPattern.process( \
507
+ "database_name", "username", "password", "hostname")'
508
+
509
+ The hostname defaults to _localhost_, all other variables are needed
510
+ You may need to adjust the code used to filter entries. Left alone,
511
+ it will attempt to pull all entries that are live or sticky.
512
+
513
+ h2. Contribute
514
+
515
+ If you'd like to hack on Jekyll, start by forking my repo on GitHub:
516
+
517
+ http://github.com/mojombo/jekyll
518
+
519
+ To get all of the dependencies, install the gem first. The best way to get
520
+ your changes merged back into core is as follows:
521
+
522
+ # Clone down your fork
523
+ # Create a topic branch to contain your change
524
+ # Hack away
525
+ # Add tests and make sure everything still passes by running `rake`
526
+ # If you are adding new functionality, document it in README.textile
527
+ # Do not change the version number, I will do that on my end
528
+ # If necessary, rebase your commits into logical chunks, without errors
529
+ # Push the branch up to GitHub
530
+ # Send me (mojombo) a pull request for your branch
531
+
532
+ h2. License
533
+
534
+ (The MIT License)
535
+
536
+ Copyright (c) 2008 Tom Preston-Werner
537
+
538
+ Permission is hereby granted, free of charge, to any person obtaining
539
+ a copy of this software and associated documentation files (the
540
+ 'Software'), to deal in the Software without restriction, including
541
+ without limitation the rights to use, copy, modify, merge, publish,
542
+ distribute, sublicense, and/or sell copies of the Software, and to
543
+ permit persons to whom the Software is furnished to do so, subject to
544
+ the following conditions:
545
+
546
+ The above copyright notice and this permission notice shall be
547
+ included in all copies or substantial portions of the Software.
548
+
549
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
550
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
551
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
552
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
553
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
554
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
555
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.