henrik-jekyll 0.5.0

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