Compare commits

..

2 Commits
v1.3.0 ... book

Author SHA1 Message Date
Tom Preston-Werner
cf71631c34 More writing. 2011-03-14 00:44:43 -07:00
Tom Preston-Werner
6c0e4b37b9 Start work on the book. 2011-03-13 21:45:29 -07:00
220 changed files with 2524 additions and 13664 deletions

7
.gitignore vendored
View File

@@ -6,10 +6,3 @@ pkg/
*~
_site/
.bundle/
.DS_Store
bbin/
gh-pages/
site/_site/
coverage
.ruby-version
.sass-cache

View File

@@ -1,22 +0,0 @@
language: ruby
before_install:
- gem install bundler
rvm:
- 2.0.0
- 1.9.3
- 1.9.2
- 1.8.7
script: bundle exec rake
notifications:
irc:
on_success: change
on_failure: change
channels:
- "irc.freenode.org#jekyll"
#on_success: change
#on_failure: change
template:
- "%{repository}#%{build_number} (%{branch}) %{message} %{build_url}"
email:
on_success: never
on_failure: never

View File

@@ -1,91 +0,0 @@
Contribute
==========
So you've got an awesome idea to throw into Jekyll. Great! Please keep the
following in mind:
* **Contributions will not be accepted without tests.**
* If you're creating a small fix or patch to an existing feature, just a simple
test will do. Please stay in the confines of the current test suite and use
[Shoulda](http://github.com/thoughtbot/shoulda/tree/master) and
[RR](http://github.com/btakita/rr/tree/master).
* If it's a brand new feature, make sure to create a new
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
where appropriate. Also, whipping up some documentation in your fork's `site`
would be appreciated, and once merged it will be transferred over to the main
`site`, jekyllrb.com.
* If your contribution changes any Jekyll behavior, make sure to update the
documentation. It lives in `site/docs`. If the docs are missing information,
please feel free to add it in. Great docs make a great project!
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
when modifying Ruby code.
* Please do your best to submit **small pull requests**. The easier the proposed
change is to review, the more likely it will be merged.
* When submitting a pull request, please make judicious use of the pull request
body. A description of what changes were made, the motivations behind the
changes and [any tasks completed or left to complete](http://git.io/gfm-tasks)
will also speed up review time.
Test Dependencies
-----------------
To run the test suite and build the gem you'll need to install Jekyll's
dependencies. Jekyll uses Bundler, so a quick run of the bundle command and
you're all set!
$ bundle
Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly):
$ bundle exec rake test
$ bundle exec rake features
Workflow
--------
Here's the most direct way to get your work merged into the project:
* Fork the project.
* Clone down your fork ( `git clone git@github.com:<username>/jekyll.git` ).
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
* Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running `rake`.
* If necessary, rebase your commits into logical chunks, without errors.
* Push the branch up ( `git push origin my_awesome_feature` ).
* Create a pull request against mojombo/jekyll and describe what your change
does and the why you think it should be merged.
Updating Documentation
----------------------
We want the Jekyll documentation to be the best it can be. We've
open-sourced our docs and we welcome any pull requests if you find it
lacking.
You can find the documentation for jekyllrb.com in the
[site](https://github.com/mojombo/jekyll/tree/master/site) directory of
Jekyll's repo on GitHub.com.
All documentation pull requests should be directed at `master`. Pull
requests directed at another branch will not be accepted.
The [Jekyll wiki](https://github.com/mojombo/jekyll/wiki) on GitHub
can be freely updated without a pull request as all GitHub users have access.
Gotchas
-------
* If you want to bump the gem version, please put that in a separate commit.
This way, the maintainers can control when the gem gets released.
* Try to keep your patch(es) based from the latest commit on mojombo/jekyll.
The easier it is to apply your work, the less work the maintainers have to do,
which is always a good thing.
* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
actively read the issues and will label it once they come across it.
Finally...
----------
Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure
out, let us know so we can improve our process or documentation!

View File

@@ -1,2 +1,2 @@
source 'https://rubygems.org'
source :rubygems
gemspec

View File

@@ -1,801 +0,0 @@
## HEAD
### Major Enhancements
### Minor Enhancements
### Bug Fixes
### Development Fixes
### Site Enhancements
## v1.3.0 / 2013-11-04
### Major Enhancements
* Add support for adding data as YAML files under a site's `_data`
directory (#1003)
* Allow variables to be used with `include` tags (#1495)
* Allow using gems for plugin management (#1557)
### Minor Enhancements
* Decrease the specificity in the site template CSS (#1574)
* Add `encoding` configuration option (#1449)
* Provide better error handling for Jekyll's custom Liquid tags
(#1514)
* If an included file causes a Liquid error, add the path to the
include file that caused the error to the error message (#1596)
* If a layout causes a Liquid error, change the error message so that
we know it comes from the layout (#1601)
* Update Kramdown dependency to `~> 1.2` (#1610)
* Update `safe_yaml` dependency to `~> 0.9.7` (#1602)
* Allow layouts to be in subfolders like includes (#1622)
* Switch to listen for site watching while serving (#1589)
* Add a `json` liquid filter to be used in sites (#1651)
* Point people to the migration docs when the `jekyll-import` gem is
missing (#1662)
### Bug Fixes
* Fix up matching against source and destination when the two
locations are similar (#1556)
* Fix the missing `pathname` require in certain cases (#1255)
* Use `+` instead of `Array#concat` when building `Post` attribute list (#1571)
* Print server address when launching a server (#1586)
* Downgrade to Maruku `~> 0.6.0` in order to avoid changes in rendering (#1598)
* Fix error with failing include tag when variable was file name (#1613)
* Downcase lexers before passing them to pygments (#1615)
* Capitalize the short verbose switch because it conflicts with the
built-in Commander switch (#1660)
* Fix compatibility with 1.8.x (#1665)
* Fix an error with the new file watching code due to library version
incompatibilities (#1687)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
* Refactor the Liquid `include` tag (#1490)
* Update launchy dependency to `~> 2.3` (#1608)
* Update rr dependency to `~> 1.1` (#1604)
* Update cucumber dependency to `~> 1.3` (#1607)
* Update coveralls dependency to `~> 0.7.0` (#1606)
* Update rake dependency to `~> 10.1` (#1603)
* Clean up `site.rb` comments to be more concise/uniform (#1616)
* Use the master branch for the build badge in the readme (#1636)
* Refactor Site#render (#1638)
* Remove duplication in command line options (#1637)
* Add tests for all the coderay options (#1543)
* Improve some of the cucumber test code (#1493)
* Improve comparisons of timestamps by ignoring the seconds (#1582)
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
* Add `jekyll-suggested-tweet` to list of third-party plugins (#1555)
* Link to Liquid's docs for tags and filters (#1553)
* Add note about installing Xcode on the Mac in the Installation docs (#1561)
* Simplify/generalize pagination docs (#1577)
* Add documentation for the new data sources feature (#1503)
* Add more information on how to create generators (#1590, #1592)
* Improve the instructions for mimicking GitHub Flavored Markdown
(#1614)
* Add `jekyll-import` warning note of missing dependencies (#1626)
* Fix grammar in the Usage section (#1635)
* Add documentation for the use of gems as plugins (#1656)
* Document the existence of a few additional plugins (#1405)
* Document that the `date_to_string` always returns a two digit day (#1663)
* Fix navigation in the "Working with Drafts" page (#1667)
* Fix an error with the data documentation (#1691)
## 1.2.1 / 2013-09-14
### Minor Enhancements
* Print better messages for detached server. Mute output on detach. (#1518)
* Disable reverse lookup when running `jekyll serve` (#1363)
* Upgrade RedCarpet dependency to `~> 2.3.0` (#1515)
* Upgrade to Liquid `>= 2.5.2, < 2.6` (#1536)
### Bug Fixes
* Fix file discrepancy in gemspec (#1522)
* Force rendering of Include tag (#1525)
### Development Fixes
* Add a rake task to generate a new release post (#1404)
* Mute LSI output in tests (#1531)
* Update contributor documentation (#1537)
### Site Enhancements
* Fix a couple of validation errors on the site (#1511)
* Make navigation menus reusable (#1507)
* Fix link to History page from Release v1.2.0 notes post.
* Fix markup in History file for command line options (#1512)
* Expand 1.2 release post title to 1.2.0 (#1516)
## 1.2.0 / 2013-09-06
### Major Enhancements
* Disable automatically-generated excerpts when `excerpt_separator` is `""`. (#1386)
* Add checking for URL conflicts when running `jekyll doctor` (#1389)
### Minor Enhancements
* Catch and fix invalid `paginate` values (#1390)
* Remove superfluous `div.container` from the default html template for
`jekyll new` (#1315)
* Add `-D` short-form switch for the drafts option (#1394)
* Update the links in the site template for Twitter and GitHub (#1400)
* Update dummy email address to example.com domain (#1408)
* Update normalize.css to v2.1.2 and minify; add rake task to update
normalize.css with greater ease. (#1430)
* Add the ability to detach the server ran by `jekyll serve` from it's
controlling terminal (#1443)
* Improve permalink generation for URLs with special characters (#944)
* Expose the current Jekyll version to posts and pages via a new
`jekyll.version` variable (#1481)
### Bug Fixes
* Markdown extension matching matches only exact matches (#1382)
* Fixed NoMethodError when message passed to `Stevenson#message` is nil (#1388)
* Use binary mode when writing file (#1364)
* Fix 'undefined method `encoding` for "mailto"' errors w/ Ruby 1.8 and
Kramdown > 0.14.0 (#1397)
* Do not force the permalink to be a dir if it ends on .html (#963)
* When a Liquid Exception is caught, show the full path rel. to site source (#1415)
* Properly read in the config options when serving the docs locally
(#1444)
* Fixed `--layouts` option for `build` and `serve` commands (#1458)
* Remove kramdown as a runtime dependency since it's optional (#1498)
* Provide proper error handling for invalid file names in the include
tag (#1494)
### Development Fixes
* Remove redundant argument to
Jekyll::Commands::New#scaffold_post_content (#1356)
* Add new dependencies to the README (#1360)
* Fix link to contributing page in README (#1424)
* Update TomDoc in Pager#initialize to match params (#1441)
* Refactor `Site#cleanup` into `Jekyll::Site::Cleaner` class (#1429)
* Several other small minor refactorings (#1341)
* Ignore `_site` in jekyllrb.com deploy (#1480)
* Add Gem version and dependency badge to README (#1497)
### Site Enhancements
* Add info about new releases (#1353)
* Update plugin list with jekyll-rss plugin (#1354)
* Update the site list page with Ruby's official site (#1358)
* Add `jekyll-ditaa` to list of third-party plugins (#1370)
* Add `postfiles` to list of third-party plugins (#1373)
* For internal links, use full path including trailing `/` (#1411)
* Use curly apostrophes in the docs (#1419)
* Update the docs for Redcarpet in Jekyll (#1418)
* Add `pluralize` and `reading_time` filters to docs (#1439)
* Fix markup for the Kramdown options (#1445)
* Fix typos in the History file (#1454)
* Add trailing slash to site's post URL (#1462)
* Clarify that `--config` will take multiple files (#1474)
* Fix docs/templates.md private gist example (#1477)
* Use `site.repository` for Jekyll's GitHub URL (#1463)
* Add `jekyll-pageless-redirects` to list of third-party plugins (#1486)
* Clarify that `date_to_xmlschema` returns an ISO 8601 string (#1488)
* Add `jekyll-good-include` to list of third-party plugins (#1491)
* XML escape the blog post title in our feed (#1501)
* Add `jekyll-toc-generator` to list of third-party plugins (#1506)
## 1.1.2 / 2013-07-25
### Bug Fixes
* Require Liquid 2.5.1 (#1349)
## 1.1.1 / 2013-07-24
### Minor Enhancements
* Remove superfluous `table` selector from main.css in `jekyll new` template (#1328)
* Abort with non-zero exit codes (#1338)
### Bug Fixes
* Fix up the rendering of excerpts (#1339)
### Site Enhancements
* Add Jekyll Image Tag to the plugins list (#1306)
* Remove erroneous statement that `site.pages` are sorted alphabetically.
* Add info about the `_drafts` directory to the directory structure
docs (#1320)
* Improve the layout of the plugin listing by organizing it into
categories (#1310)
* Add generator-jekyllrb and grunt-jekyll to plugins page (#1330)
* Mention Kramdown as option for markdown parser on Extras page (#1318)
* Update Quick-Start page to include reminder that all requirements must be installed (#1327)
* Change filename in `include` example to an HTML file so as not to indicate that Jekyll
will automatically convert them. (#1303)
* Add an RSS feed for commits to Jekyll (#1343)
## 1.1.0 / 2013-07-14
### Major Enhancements
* Add `docs` subcommand to read Jekyll's docs when offline. (#1046)
* Support passing parameters to templates in `include` tag (#1204)
* Add support for Liquid tags to post excerpts (#1302)
### Minor Enhancements
* Search the hierarchy of pagination path up to site root to determine template page for
pagination. (#1198)
* Add the ability to generate a new Jekyll site without a template (#1171)
* Use redcarpet as the default markdown engine in newly generated
sites (#1245, #1247)
* Add `redcarpet` as a runtime dependency so `jekyll build` works out-of-the-box for new
sites. (#1247)
* In the generated site, remove files that will be replaced by a
directory (#1118)
* Fail loudly if a user-specified configuration file doesn't exist (#1098)
* Allow for all options for Kramdown HTML Converter (#1201)
### Bug Fixes
* Fix pagination in subdirectories. (#1198)
* Fix an issue with directories and permalinks that have a plus sign
(+) in them (#1215)
* Provide better error reporting when generating sites (#1253)
* Latest posts first in non-LSI `related_posts` (#1271)
### Development Fixes
* Merge the theme and layout cucumber steps into one step (#1151)
* Restrict activesupport dependency to pre-4.0.0 to maintain compatibility with `<= 1.9.2`
* Include/exclude deprecation handling simplification (#1284)
* Convert README to Markdown. (#1267)
* Refactor Jekyll::Site (#1144)
### Site Enhancements
* Add "News" section for release notes, along with an RSS feed (#1093, #1285, #1286)
* Add "History" page.
* Restructured docs sections to include "Meta" section.
* Add message to "Templates" page that specifies that Python must be installed in order
to use Pygments. (#1182)
* Update link to the official Maruku repo (#1175)
* Add documentation about `paginate_path` to "Templates" page in docs (#1129)
* Give the quick-start guide its own page (#1191)
* Update ProTip on Installation page in docs to point to all the info about Pygments and
the 'highlight' tag. (#1196)
* Run `site/img` through ImageOptim (thanks @qrush!) (#1208)
* Added Jade Converter to `site/docs/plugins` (#1210)
* Fix location of docs pages in Contributing pages (#1214)
* Add ReadInXMinutes plugin to the plugin list (#1222)
* Remove plugins from the plugin list that have equivalents in Jekyll
proper (#1223)
* Add jekyll-assets to the plugin list (#1225)
* Add jekyll-pandoc-mulitple-formats to the plugin list (#1229)
* Remove dead link to "Using Git to maintain your blog" (#1227)
* Tidy up the third-party plugins listing (#1228)
* Update contributor information (#1192)
* Update URL of article about Blogger migration (#1242)
* Specify that RedCarpet is the default for new Jekyll sites on Quickstart page (#1247)
* Added site.pages to Variables page in docs (#1251)
* Add Youku and Tudou Embed link on Plugins page. (#1250)
* Add note that `gist` tag supports private gists. (#1248)
* Add `jekyll-timeago` to list of third-party plugins. (#1260)
* Add `jekyll-swfobject` to list of third-party plugins. (#1263)
* Add `jekyll-picture-tag` to list of third-party plugins. (#1280)
* Update the GitHub Pages documentation regarding relative URLs
(#1291)
* Update the S3 deployment documentation (#1294)
* Add suggestion for Xcode CLT install to troubleshooting page in docs (#1296)
* Add 'Working with drafts' page to docs (#1289)
* Add information about time zones to the documentation for a page's
date (#1304)
## 1.0.3 / 2013-06-07
### Minor Enhancements
* Add support to gist tag for private gists. (#1189)
* Fail loudly when MaRuKu errors out (#1190)
* Move the building of related posts into their own class (#1057)
* Removed trailing spaces in several places throughout the code (#1116)
* Add a `--force` option to `jekyll new` (#1115)
* Convert IDs in the site template to classes (#1170)
### Bug Fixes
* Fix typo in Stevenson constant "ERROR". (#1166)
* Rename Jekyll::Logger to Jekyll::Stevenson to fix inheritance issue (#1106)
* Exit with a non-zero exit code when dealing with a Liquid error (#1121)
* Make the `exclude` and `include` options backwards compatible with
versions of Jekyll prior to 1.0 (#1114)
* Fix pagination on Windows (#1063)
* Fix the application of Pygments' Generic Output style to Go code
(#1156)
### Site Enhancements
* Add a Pro Tip to docs about front matter variables being optional (#1147)
* Add changelog to site as History page in /docs/ (#1065)
* Add note to Upgrading page about new config options in 1.0.x (#1146)
* Documentation for `date_to_rfc822` and `uri_escape` (#1142)
* Documentation highlight boxes shouldn't show scrollbars if not necessary (#1123)
* Add link to jekyll-minibundle in the doc's plugins list (#1035)
* Quick patch for importers documentation
* Fix prefix for WordpressDotCom importer in docs (#1107)
* Add jekyll-contentblocks plugin to docs (#1068)
* Make code bits in notes look more natural, more readable (#1089)
* Fix logic for `relative_permalinks` instructions on Upgrading page (#1101)
* Add docs for post excerpt (#1072)
* Add docs for gist tag (#1072)
* Add docs indicating that Pygments does not need to be installed
separately (#1099, #1119)
* Update the migrator docs to be current (#1136)
* Add the Jekyll Gallery Plugin to the plugin list (#1143)
### Development Fixes
* Use Jekyll.logger instead of Jekyll::Stevenson to log things (#1149)
* Fix pesky Cucumber infinite loop (#1139)
* Do not write posts with timezones in Cucumber tests (#1124)
* Use ISO formatted dates in Cucumber features (#1150)
## 1.0.2 / 2013-05-12
### Major Enhancements
* Add `jekyll doctor` command to check site for any known compatibility problems (#1081)
* Backwards-compatibilize relative permalinks (#1081)
### Minor Enhancements
* Add a `data-lang="<lang>"` attribute to Redcarpet code blocks (#1066)
* Deprecate old config `server_port`, match to `port` if `port` isn't set (#1084)
* Update pygments.rb version to 0.5.0 (#1061)
* Update Kramdown version to 1.0.2 (#1067)
### Bug Fixes
* Fix issue when categories are numbers (#1078)
* Catching that Redcarpet gem isn't installed (#1059)
### Site Enhancements
* Add documentation about `relative_permalinks` (#1081)
* Remove pygments-installation instructions, as pygments.rb is bundled with it (#1079)
* Move pages to be Pages for realz (#985)
* Updated links to Liquid documentation (#1073)
## 1.0.1 / 2013-05-08
### Minor Enhancements
* Do not force use of toc_token when using generate_tok in RDiscount (#1048)
* Add newer `language-` class name prefix to code blocks (#1037)
* Commander error message now preferred over process abort with incorrect args (#1040)
### Bug Fixes
* Make Redcarpet respect the pygments configuration option (#1053)
* Fix the index build with LSI (#1045)
* Don't print deprecation warning when no arguments are specified. (#1041)
* Add missing `</div>` to site template used by `new` subcommand, fixed typos in code (#1032)
### Site Enhancements
* Changed https to http in the GitHub Pages link (#1051)
* Remove CSS cruft, fix typos, fix HTML errors (#1028)
* Removing manual install of Pip and Distribute (#1025)
* Updated URL for Markdown references plugin (#1022)
### Development Fixes
* Markdownify history file (#1027)
* Update links on README to point to new jekyllrb.com (#1018)
## 1.0.0 / 2013-05-06
### Major Enhancements
* Add `jekyll new` subcommand: generate a jekyll scaffold (#764)
* Refactored jekyll commands into subcommands: build, serve, and migrate. (#690)
* Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793)
* Added ability to render drafts in `_drafts` folder via command line (#833)
* Add ordinal date permalink style (/:categories/:year/:y_day/:title.html) (#928)
### Minor Enhancements
* Site template HTML5-ified (#964)
* Use post's directory path when matching for the post_url tag (#998)
* Loosen dependency on Pygments so it's only required when it's needed (#1015)
* Parse strings into Time objects for date-related Liquid filters (#1014)
* Tell the user if there is no subcommand specified (#1008)
* Freak out if the destination of `jekyll new` exists and is non-empty (#981)
* Add `timezone` configuration option for compilation (#957)
* Add deprecation messages for pre-1.0 CLI options (#959)
* Refactor and colorize logging (#959)
* Refactor Markdown parsing (#955)
* Added application/vnd.apple.pkpass to mime.types served by WEBrick (#907)
* Move template site to default markdown renderer (#961)
* Expose new attribute to Liquid via `page`: `page.path` (#951)
* Accept multiple config files from command line (#945)
* Add page variable to liquid custom tags and blocks (#413)
* Add paginator.previous_page_path and paginator.next_page_path (#942)
* Backwards compatibility for 'auto' (#821, #934)
* Added date_to_rfc822 used on RSS feeds (#892)
* Upgrade version of pygments.rb to 0.4.2 (#927)
* Added short month (e.g. "Sep") to permalink style options for posts (#890)
* Expose site.baseurl to Liquid templates (#869)
* Adds excerpt attribute to posts which contains first paragraph of content (#837)
* Accept custom configuration file via CLI (#863)
* Load in GitHub Pages MIME Types on `jekyll serve` (#847, #871)
* Improve debugability of error message for a malformed highlight tag (#785)
* Allow symlinked files in unsafe mode (#824)
* Add 'gist' Liquid tag to core (#822, #861)
* New format of Jekyll output (#795)
* Reinstate `--limit_posts` and `--future` switches (#788)
* Remove ambiguity from command descriptions (#815)
* Fix SafeYAML Warnings (#807)
* Relaxed Kramdown version to 0.14 (#808)
* Aliased `jekyll server` to `jekyll serve`. (#792)
* Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744)
* Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768)
* Rescue from import errors in Wordpress.com migrator (#671)
* Massively accelerate LSI performance (#664)
* Truncate post slugs when importing from Tumblr (#496)
* Add glob support to include, exclude option (#743)
* Layout of Page or Post defaults to 'page' or 'post', respectively (#580)
REPEALED by (#977)
* "Keep files" feature (#685)
* Output full path & name for files that don't parse (#745)
* Add source and destination directory protection (#535)
* Better YAML error message (#718)
* Bug Fixes
* Paginate in subdirectories properly (#1016)
* Ensure post and page URLs have a leading slash (#992)
* Catch all exceptions, not just StandardError descendents (#1007)
* Bullet-proof limit_posts option (#1004)
* Read in YAML as UTF-8 to accept non-ASCII chars (#836)
* Fix the CLI option `--plugins` to actually accept dirs and files (#993)
* Allow 'excerpt' in YAML Front-Matter to override the extracted excerpt (#946)
* Fix cascade problem with site.baseurl, site.port and site.host. (#935)
* Filter out directories with valid post names (#875)
* Fix symlinked static files not being correctly built in unsafe mode (#909)
* Fix integration with directory_watcher 1.4.x (#916)
* Accepting strings as arguments to jekyll-import command (#910)
* Force usage of older directory_watcher gem as 1.5 is broken (#883)
* Ensure all Post categories are downcase (#842, #872)
* Force encoding of the rdiscount TOC to UTF8 to avoid conversion errors (#555)
* Patch for multibyte URI problem with jekyll serve (#723)
* Order plugin execution by priority (#864)
* Fixed Page#dir and Page#url for edge cases (#536)
* Fix broken post_url with posts with a time in their YAML Front-Matter (#831)
* Look for plugins under the source directory (#654)
* Tumblr Migrator: finds `_posts` dir correctly, fixes truncation of long
post names (#775)
* Force Categories to be Strings (#767)
* Safe YAML plugin to prevent vulnerability (#777)
* Add SVG support to Jekyll/WEBrick. (#407, #406)
* Prevent custom destination from causing continuous regen on watch (#528, #820, #862)
### Site Enhancements
* Responsify (#860)
* Fix spelling, punctuation and phrasal errors (#989)
* Update quickstart instructions with `new` command (#966)
* Add docs for page.excerpt (#956)
* Add docs for page.path (#951)
* Clean up site docs to prepare for 1.0 release (#918)
* Bring site into master branch with better preview/deploy (#709)
* Redesigned site (#583)
### Development Fixes
* Exclude Cucumber 1.2.4, which causes tests to fail in 1.9.2 (#938)
* Added "features:html" rake task for debugging purposes, cleaned up
cucumber profiles (#832)
* Explicitly require HTTPS rubygems source in Gemfile (#826)
* Changed Ruby version for development to 1.9.3-p374 from p362 (#801)
* Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806)
* Added script/bootstrap (#776)
* Running Simplecov under 2 conditions: ENV(COVERAGE)=true and with Ruby version
of greater than 1.9 (#771)
* Switch to Simplecov for coverage report (#765)
## 0.12.1 / 2013-02-19
### Minor Enhancements
* Update Kramdown version to 0.14.1 (#744)
* Test Enhancements
* Update Rake version to 10.0.3 (#744)
* Update Shoulda version to 3.3.2 (#744)
* Update Redcarpet version to 2.2.2 (#744)
## 0.12.0 / 2012-12-22
### Minor Enhancements
* Add ability to explicitly specify included files (#261)
* Add --default-mimetype option (#279)
* Allow setting of RedCloth options (#284)
* Add post_url Liquid tag for internal post linking (#369)
* Allow multiple plugin dirs to be specified (#438)
* Inline TOC token support for RDiscount (#333)
* Add the option to specify the paginated url format (#342)
* Swap out albino for pygments.rb (#569)
* Support Redcarpet 2 and fenced code blocks (#619)
* Better reporting of Liquid errors (#624)
* Bug Fixes
* Allow some special characters in highlight names
* URL escape category names in URL generation (#360)
* Fix error with limit_posts (#442)
* Properly select dotfile during directory scan (#363, #431, #377)
* Allow setting of Kramdown smart_quotes (#482)
* Ensure front-matter is at start of file (#562)
## 0.11.2 / 2011-12-27
* Bug Fixes
* Fix gemspec
## 0.11.1 / 2011-12-27
* Bug Fixes
* Fix extra blank line in highlight blocks (#409)
* Update dependencies
## 0.11.0 / 2011-07-10
### Major Enhancements
* Add command line importer functionality (#253)
* Add Redcarpet Markdown support (#318)
* Make markdown/textile extensions configurable (#312)
* Add `markdownify` filter
### Minor Enhancements
* Switch to Albino gem
* Bundler support
* Use English library to avoid hoops (#292)
* Add Posterous importer (#254)
* Fixes for Wordpress importer (#274, #252, #271)
* Better error message for invalid post date (#291)
* Print formatted fatal exceptions to stdout on build failure
* Add Tumblr importer (#323)
* Add Enki importer (#320)
* Bug Fixes
* Secure additional path exploits
## 0.10.0 / 2010-12-16
* Bug Fixes
* Add --no-server option.
## 0.9.0 / 2010-12-15
### Minor Enhancements
* Use OptionParser's `[no-]` functionality for better boolean parsing.
* Add Drupal migrator (#245)
* Complain about YAML and Liquid errors (#249)
* Remove orphaned files during regeneration (#247)
* Add Marley migrator (#28)
## 0.8.0 / 2010-11-22
### Minor Enhancements
* Add wordpress.com importer (#207)
* Add --limit-posts cli option (#212)
* Add uri_escape filter (#234)
* Add --base-url cli option (#235)
* Improve MT migrator (#238)
* Add kramdown support (#239)
* Bug Fixes
* Fixed filename basename generation (#208)
* Set mode to UTF8 on Sequel connections (#237)
* Prevent `_includes` dir from being a symlink
## 0.7.0 / 2010-08-24
### Minor Enhancements
* Add support for rdiscount extensions (#173)
* Bug Fixes
* Highlight should not be able to render local files
* The site configuration may not always provide a 'time' setting (#184)
## 0.6.2 / 2010-06-25
* Bug Fixes
* Fix Rakefile 'release' task (tag pushing was missing origin)
* Ensure that RedCloth is loaded when textilize filter is used (#183)
* Expand source, destination, and plugin paths (#180)
* Fix page.url to include full relative path (#181)
## 0.6.1 / 2010-06-24
* Bug Fixes
* Fix Markdown Pygments prefix and suffix (#178)
## 0.6.0 / 2010-06-23
### Major Enhancements
* Proper plugin system (#19, #100)
* Add safe mode so unsafe converters/generators can be added
* Maruku is now the only processor dependency installed by default.
Other processors will be lazy-loaded when necessary (and prompt the
user to install them when necessary) (#57)
### Minor Enhancements
* Inclusion/exclusion of future dated posts (#59)
* Generation for a specific time (#59)
* Allocate site.time on render not per site_payload invocation (#59)
* Pages now present in the site payload and can be used through the
site.pages and site.html_pages variables
* Generate phase added to site#process and pagination is now a generator
* Switch to RakeGem for build/test process
* Only regenerate static files when they have changed (#142)
* Allow arbitrary options to Pygments (#31)
* Allow URL to be set via command line option (#147)
* Bug Fixes
* Render highlighted code for non markdown/textile pages (#116)
* Fix highlighting on Ruby 1.9 (#65)
* Fix extension munging when pretty permalinks are enabled (#64)
* Stop sorting categories (#33)
* Preserve generated attributes over front matter (#119)
* Fix source directory binding using Dir.pwd (#75)
## 0.5.7 / 2010-01-12
### Minor Enhancements
* Allow overriding of post date in the front matter (#62, #38)
* Bug Fixes
* Categories isn't always an array (#73)
* Empty tags causes error in read_posts (#84)
* Fix pagination to adhere to read/render/write paradigm
* Test Enhancement
* cucumber features no longer use site.posts.first where a better
alternative is available
## 0.5.6 / 2010-01-08
* Bug Fixes
* Require redcloth >= 4.2.1 in tests (#92)
* Don't break on triple dashes in yaml frontmatter (#93)
### Minor Enhancements
* Allow .mkd as markdown extension
* Use $stdout/err instead of constants (#99)
* Properly wrap code blocks (#91)
* Add javascript mime type for webrick (#98)
## 0.5.5 / 2010-01-08
* Bug Fixes
* Fix pagination % 0 bug (#78)
* Ensure all posts are processed first (#71)
## NOTE
* After this point I will no longer be giving credit in the history;
that is what the commit log is for.
## 0.5.4 / 2009-08-23
* Bug Fixes
* Do not allow symlinks (security vulnerability)
## 0.5.3 / 2009-07-14
* Bug Fixes
* Solving the permalink bug where non-html files wouldn't work
(@jeffrydegrande)
## 0.5.2 / 2009-06-24
* Enhancements
* Added --paginate option to the executable along with a paginator object
for the payload (@calavera)
* Upgraded RedCloth to 4.2.1, which makes `<notextile>` tags work once
again.
* Configuration options set in config.yml are now available through the
site payload (@vilcans)
* Posts can now have an empty YAML front matter or none at all
(@bahuvrihi)
* Bug Fixes
* Fixing Ruby 1.9 issue that requires to_s on the err object
(@Chrononaut)
* Fixes for pagination and ordering posts on the same day (@ujh)
* Made pages respect permalinks style and permalinks in yml front matter
(@eugenebolshakov)
* Index.html file should always have index.html permalink
(@eugenebolshakov)
* Added trailing slash to pretty permalink style so Apache is happy
(@eugenebolshakov)
* Bad markdown processor in config fails sooner and with better message
(@gcnovus)
* Allow CRLFs in yaml frontmatter (@juretta)
* Added Date#xmlschema for Ruby versions < 1.9
## 0.5.1 / 2009-05-06
### Major Enhancements
* Next/previous posts in site payload (@pantulis, @tomo)
* Permalink templating system
* Moved most of the README out to the GitHub wiki
* Exclude option in configuration so specified files won't be brought over
with generated site (@duritong)
* Bug Fixes
* Making sure config.yaml references are all gone, using only config.yml
* Fixed syntax highlighting breaking for UTF-8 code (@henrik)
* Worked around RDiscount bug that prevents Markdown from getting parsed
after highlight (@henrik)
* CGI escaped post titles (@Chrononaut)
## 0.5.0 / 2009-04-07
### Minor Enhancements
* Ability to set post categories via YAML (@qrush)
* Ability to set prevent a post from publishing via YAML (@qrush)
* Add textilize filter (@willcodeforfoo)
* Add 'pretty' permalink style for wordpress-like urls (@dysinger)
* Made it possible to enter categories from YAML as an array (@Chrononaut)
* Ignore Emacs autosave files (@Chrononaut)
* Bug Fixes
* Use block syntax of popen4 to ensure that subprocesses are properly disposed (@jqr)
* Close open4 streams to prevent zombies (@rtomayko)
* Only query required fields from the WP Database (@ariejan)
* Prevent `_posts` from being copied to the destination directory (@bdimcheff)
* Refactors
* Factored the filtering code into a method (@Chrononaut)
* Fix tests and convert to Shoulda (@qrush, @technicalpickles)
* Add Cucumber acceptance test suite (@qrush, @technicalpickles)
## 0.4.1
### Minor Enhancements
* Changed date format on wordpress converter (zeropadding) (@dysinger)
* Bug Fixes
* Add jekyll binary as executable to gemspec (@dysinger)
## 0.4.0 / 2009-02-03
### Major Enhancements
* Switch to Jeweler for packaging tasks
### Minor Enhancements
* Type importer (@codeslinger)
* site.topics accessor (@baz)
* Add `array_to_sentence_string` filter (@mchung)
* Add a converter for textpattern (@PerfectlyNormal)
* Add a working Mephisto / MySQL converter (@ivey)
* Allowing .htaccess files to be copied over into the generated site (@briandoll)
* Add option to not put file date in permalink URL (@mreid)
* Add line number capabilities to highlight blocks (@jcon)
* Bug Fixes
* Fix permalink behavior (@cavalle)
* Fixed an issue with pygments, markdown, and newlines (@zpinter)
* Ampersands need to be escaped (@pufuwozu, @ap)
* Test and fix the site.categories hash (@zzot)
* Fix site payload available to files (@matrix9180)
## 0.3.0 / 2008-12-24
### Major Enhancements
* Added --server option to start a simple WEBrick server on destination
directory (@johnreilly and @mchung)
### Minor Enhancements
* Added post categories based on directories containing `_posts` (@mreid)
* Added post topics based on directories underneath `_posts`
* Added new date filter that shows the full month name (@mreid)
* Merge Post's YAML front matter into its to_liquid payload (@remi)
* Restrict includes to regular files underneath `_includes`
* Bug Fixes
* Change YAML delimiter matcher so as to not chew up 2nd level markdown
headers (@mreid)
* Fix bug that meant page data (such as the date) was not available in
templates (@mreid)
* Properly reject directories in `_layouts`
## 0.2.1 / 2008-12-15
* Major Changes
* Use Maruku (pure Ruby) for Markdown by default (@mreid)
* Allow use of RDiscount with --rdiscount flag
### Minor Enhancements
* Don't load directory_watcher unless it's needed (@pjhyett)
## 0.2.0 / 2008-12-14
* Major Changes
* related_posts is now found in site.related_posts
## 0.1.6 / 2008-12-13
* Major Features
* Include files in `_includes` with `{% include x.textile %}`
## 0.1.5 / 2008-12-12
### Major Enhancements
* Code highlighting with Pygments if --pygments is specified
* Disable true LSI by default, enable with --lsi
### Minor Enhancements
* Output informative message if RDiscount is not available (@JackDanger)
* Bug Fixes
* Prevent Jekyll from picking up the output directory as a source (@JackDanger)
* Skip `related_posts` when there is only one post (@JackDanger)
## 0.1.4 / 2008-12-08
* Bug Fixes
* DATA does not work properly with rubygems
## 0.1.3 / 2008-12-06
* Major Features
* Markdown support (@vanpelt)
* Mephisto and CSV converters (@vanpelt)
* Code hilighting (@vanpelt)
* Autobuild
* Bug Fixes
* Accept both \r\n and \n in YAML header (@vanpelt)
## 0.1.2 / 2008-11-22
* Major Features
* Add a real "related posts" implementation using Classifier
* Command Line Changes
* Allow cli to be called with 0, 1, or 2 args intuiting dir paths
if they are omitted
## 0.1.1 / 2008-11-22
* Minor Additions
* Posts now support introspectional data e.g. `{{ page.url }}`
## 0.1.0 / 2008-11-05
* First release
* Converts posts written in Textile
* Converts regular site pages
* Simple copy of binary files
## 0.0.0 / 2008-10-19
* Birthday!

294
History.txt Normal file
View File

@@ -0,0 +1,294 @@
== HEAD
* Major Enhancements
* Add command line importer functionality (#253)
* Minor Enhancements
* Switch to Albino gem
* Bundler support
* Use English library to avoid hoops (#292)
* Add Posterous importer (#254)
* Fixes for Wordpress importer (#274, #252, #271)
* Better error message for invalid post date (#291)
* Print formatted fatal exceptions to stdout on build failure
* Bug Fixes
* Secure additional path exploits
== 0.10.0 / 2010-12-16
* Bug Fixes
* Add --no-server option.
== 0.9.0 / 2010-12-15
* Minor Enhancements
* Use OptionParser's [no-] functionality for better boolean parsing.
* Add Drupal migrator (#245)
* Complain about YAML and Liquid errors (#249)
* Remove orphaned files during regeneration (#247)
* Add Marley migrator (#28)
== 0.8.0 / 2010-11-22
* Minor Enhancements
* Add wordpress.com importer (#207)
* Add --limit-posts cli option (#212)
* Add uri_escape filter (#234)
* Add --base-url cli option (#235)
* Improve MT migrator (#238)
* Add kramdown support (#239)
* Bug Fixes
* Fixed filename basename generation (#208)
* Set mode to UTF8 on Sequel connections (#237)
* Prevent _includes dir from being a symlink
== 0.7.0 / 2010-08-24
* Minor Enhancements
* Add support for rdiscount extensions (#173)
* Bug Fixes
* Highlight should not be able to render local files
* The site configuration may not always provide a 'time' setting (#184)
== 0.6.2 / 2010-06-25
* Bug Fixes
* Fix Rakefile 'release' task (tag pushing was missing origin)
* Ensure that RedCloth is loaded when textilize filter is used (#183)
* Expand source, destination, and plugin paths (#180)
* Fix page.url to include full relative path (#181)
== 0.6.1 / 2010-06-24
* Bug Fixes
* Fix Markdown Pygments prefix and suffix (#178)
== 0.6.0 / 2010-06-23
* Major Enhancements
* Proper plugin system (#19, #100)
* Add safe mode so unsafe converters/generators can be added
* Maruku is now the only processor dependency installed by default.
Other processors will be lazy-loaded when necessary (and prompt the
user to install them when necessary) (#57)
* Minor Enhancements
* Inclusion/exclusion of future dated posts (#59)
* Generation for a specific time (#59)
* Allocate site.time on render not per site_payload invocation (#59)
* Pages now present in the site payload and can be used through the
site.pages and site.html_pages variables
* Generate phase added to site#process and pagination is now a generator
* Switch to RakeGem for build/test process
* Only regenerate static files when they have changed (#142)
* Allow arbitrary options to Pygments (#31)
* Allow URL to be set via command line option (#147)
* Bug Fixes
* Render highlighted code for non markdown/textile pages (#116)
* Fix highlighting on Ruby 1.9 (#65)
* Fix extension munging when pretty permalinks are enabled (#64)
* Stop sorting categories (#33)
* Preserve generated attributes over front matter (#119)
* Fix source directory binding using Dir.pwd (#75)
== 0.5.7 / 2010-01-12
* Minor Enhancements
* Allow overriding of post date in the front matter (#62, #38)
* Bug Fixes
* Categories isn't always an array (#73)
* Empty tags causes error in read_posts (#84)
* Fix pagination to adhere to read/render/write paradigm
* Test Enhancement
* cucumber features no longer use site.posts.first where a better
alternative is available
== 0.5.6 / 2010-01-08
* Bug Fixes
* Require redcloth >= 4.2.1 in tests (#92)
* Don't break on triple dashes in yaml frontmatter (#93)
* Minor Enhancements
* Allow .mkd as markdown extension
* Use $stdout/err instead of constants (#99)
* Properly wrap code blocks (#91)
* Add javascript mime type for webrick (#98)
== 0.5.5 / 2010-01-08
* Bug Fixes
* Fix pagination % 0 bug (#78)
* Ensure all posts are processed first (#71)
== NOTE
* After this point I will no longer be giving credit in the history;
that is what the commit log is for.
== 0.5.4 / 2009-08-23
* Bug Fixes
* Do not allow symlinks (security vulnerability)
== 0.5.3 / 2009-07-14
* Bug Fixes
* Solving the permalink bug where non-html files wouldn't work
[github.com/jeffrydegrande]
== 0.5.2 / 2009-06-24
* Enhancements
* Added --paginate option to the executable along with a paginator object
for the payload [github.com/calavera]
* Upgraded RedCloth to 4.2.1, which makes <notextile> tags work once
again.
* Configuration options set in config.yml are now available through the
site payload [github.com/vilcans]
* Posts can now have an empty YAML front matter or none at all
[github.com/bahuvrihi]
* Bug Fixes
* Fixing Ruby 1.9 issue that requires to_s on the err object
[github.com/Chrononaut]
* Fixes for pagination and ordering posts on the same day [github.com/ujh]
* Made pages respect permalinks style and permalinks in yml front matter
[github.com/eugenebolshakov]
* Index.html file should always have index.html permalink
[github.com/eugenebolshakov]
* Added trailing slash to pretty permalink style so Apache is happy
[github.com/eugenebolshakov]
* Bad markdown processor in config fails sooner and with better message
[github.com/gcnovus]
* Allow CRLFs in yaml frontmatter [github.com/juretta]
* Added Date#xmlschema for Ruby versions < 1.9
== 0.5.1 / 2009-05-06
* Major Enhancements
* Next/previous posts in site payload [github.com/pantulis,
github.com/tomo]
* Permalink templating system
* Moved most of the README out to the GitHub wiki
* Exclude option in configuration so specified files won't be brought over
with generated site [github.com/duritong]
* Bug Fixes
* Making sure config.yaml references are all gone, using only config.yml
* Fixed syntax highlighting breaking for UTF-8 code [github.com/henrik]
* Worked around RDiscount bug that prevents Markdown from getting parsed
after highlight [github.com/henrik]
* CGI escaped post titles [github.com/Chrononaut]
== 0.5.0 / 2009-04-07
* Minor Enhancements
* Ability to set post categories via YAML [github.com/qrush]
* Ability to set prevent a post from publishing via YAML
[github.com/qrush]
* Add textilize filter [github.com/willcodeforfoo]
* Add 'pretty' permalink style for wordpress-like urls
[github.com/dysinger]
* Made it possible to enter categories from YAML as an array
[github.com/Chrononaut]
* Ignore Emacs autosave files [github.com/Chrononaut]
* Bug Fixes
* Use block syntax of popen4 to ensure that subprocesses are properly
disposed [github.com/jqr]
* Close open4 streams to prevent zombies [github.com/rtomayko]
* Only query required fields from the WP Database [github.com/ariejan]
* Prevent _posts from being copied to the destination directory
[github.com/bdimcheff]
* Refactors
* Factored the filtering code into a method [github.com/Chrononaut]
* Fix tests and convert to Shoulda [github.com/qrush,
github.com/technicalpickles]
* Add Cucumber acceptance test suite [github.com/qrush,
github.com/technicalpickles]
== 0.4.1
* Minor Enhancements
* Changed date format on wordpress converter (zeropadding)
[github.com/dysinger]
* Bug Fixes
* Add jekyll binary as executable to gemspec [github.com/dysinger]
== 0.4.0 / 2009-02-03
* Major Enhancements
* Switch to Jeweler for packaging tasks
* Minor Enhancements
* Type importer [github.com/codeslinger]
* site.topics accessor [github.com/baz]
* Add array_to_sentence_string filter [github.com/mchung]
* Add a converter for textpattern [github.com/PerfectlyNormal]
* Add a working Mephisto / MySQL converter [github.com/ivey]
* Allowing .htaccess files to be copied over into the generated site
[github.com/briandoll]
* Add option to not put file date in permalink URL [github.com/mreid]
* Add line number capabilities to highlight blocks [github.com/jcon]
* Bug Fixes
* Fix permalink behavior [github.com/cavalle]
* Fixed an issue with pygments, markdown, and newlines
[github.com/zpinter]
* Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
* Test and fix the site.categories hash [github.com/zzot]
* Fix site payload available to files [github.com/matrix9180]
== 0.3.0 / 2008-12-24
* Major Enhancements
* Added --server option to start a simple WEBrick server on destination
directory [github.com/johnreilly and github.com/mchung]
* Minor Enhancements
* Added post categories based on directories containing _posts
[github.com/mreid]
* Added post topics based on directories underneath _posts
* Added new date filter that shows the full month name [github.com/mreid]
* Merge Post's YAML front matter into its to_liquid payload
[github.com/remi]
* Restrict includes to regular files underneath _includes
* Bug Fixes
* Change YAML delimiter matcher so as to not chew up 2nd level markdown
headers [github.com/mreid]
* Fix bug that meant page data (such as the date) was not available in
templates [github.com/mreid]
* Properly reject directories in _layouts
== 0.2.1 / 2008-12-15
* Major Changes
* Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
* Allow use of RDiscount with --rdiscount flag
* Minor Enhancements
* Don't load directory_watcher unless it's needed [github.com/pjhyett]
== 0.2.0 / 2008-12-14
* Major Changes
* related_posts is now found in site.related_posts
== 0.1.6 / 2008-12-13
* Major Features
* Include files in _includes with {% include x.textile %}
== 0.1.5 / 2008-12-12
* Major Features
* Code highlighting with Pygments if --pygments is specified
* Disable true LSI by default, enable with --lsi
* Minor Enhancements
* Output informative message if RDiscount is not available
[github.com/JackDanger]
* Bug Fixes
* Prevent Jekyll from picking up the output directory as a source
[github.com/JackDanger]
* Skip related_posts when there is only one post [github.com/JackDanger]
== 0.1.4 / 2008-12-08
* Bug Fixes
* DATA does not work properly with rubygems
== 0.1.3 / 2008-12-06
* Major Features
* Markdown support [github.com/vanpelt]
* Mephisto and CSV converters [github.com/vanpelt]
* Code hilighting [github.com/vanpelt]
* Autobuild
* Bug Fixes
* Accept both \r\n and \n in YAML header [github.com/vanpelt]
== 0.1.2 / 2008-11-22
* Major Features
* Add a real "related posts" implementation using Classifier
* Command Line Changes
* Allow cli to be called with 0, 1, or 2 args intuiting dir paths
if they are omitted
== 0.1.1 / 2008-11-22
* Minor Additions
* Posts now support introspectional data e.g. {{ page.url }}
== 0.1.0 / 2008-11-05
* First release
* Converts posts written in Textile
* Converts regular site pages
* Simple copy of binary files
== 0.0.0 / 2008-10-19
* Birthday!

View File

@@ -1,56 +0,0 @@
# Jekyll
[![Gem Version](https://badge.fury.io/rb/jekyll.png)](http://badge.fury.io/rb/jekyll)
[![Build Status](https://secure.travis-ci.org/mojombo/jekyll.png?branch=master)](https://travis-ci.org/mojombo/jekyll)
[![Code Climate](https://codeclimate.com/github/mojombo/jekyll.png)](https://codeclimate.com/github/mojombo/jekyll)
[![Dependency Status](https://gemnasium.com/mojombo/jekyll.png)](https://gemnasium.com/mojombo/jekyll)
[![Coverage Status](https://coveralls.io/repos/mojombo/jekyll/badge.png)](https://coveralls.io/r/mojombo/jekyll)
By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
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.
## Getting Started
* [Install](http://jekyllrb.com/docs/installation/) the gem
* Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/)
* Take a gander at some existing [Sites](http://wiki.github.com/mojombo/jekyll/sites)
* Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications
* Have questions? Check out `#jekyll` on irc.freenode.net.
## Diving In
* [Migrate](http://jekyllrb.com/docs/migrations/) from your previous system
* Learn how the [YAML Front Matter](http://jekyllrb.com/docs/frontmatter/) works
* Put information on your site with [Variables](http://jekyllrb.com/docs/variables/)
* Customize the [Permalinks](http://jekyllrb.com/docs/permalinks/) your posts are generated with
* Use the built-in [Liquid Extensions](http://jekyllrb.com/docs/templates/) to make your life easier
* Use custom [Plugins](http://jekyllrb.com/docs/plugins/) to generate content specific to your site
## Runtime Dependencies
* Commander: Command-line interface constructor (Ruby)
* Colorator: Colorizes command line output (Ruby)
* Classifier: Generating related posts (Ruby)
* Directory Watcher: Auto-regeneration of sites (Ruby)
* Liquid: Templating system (Ruby)
* Maruku: Default markdown engine (Ruby)
* Pygments.rb: Syntax highlighting (Ruby/Python)
* RedCarpet: Markdown engine (Ruby)
* Safe YAML: YAML Parser built for security (Ruby)
## Developer Dependencies
* Kramdown: Markdown-superset converter (Ruby)
* Launchy: Cross-platform file launcher (Ruby)
* RDiscount: Discount Markdown Processor (Ruby)
* RedCloth: Textile support (Ruby)
* RedGreen: Nicer test output (Ruby)
* RR: Mocking (Ruby)
* Shoulda: Test framework (Ruby)
* SimpleCov: Coverage framework (Ruby)
## License
See [LICENSE](https://github.com/mojombo/jekyll/blob/master/LICENSE).

40
README.textile Normal file
View File

@@ -0,0 +1,40 @@
h1. Jekyll
By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
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.
h2. Getting Started
* "Install":http://wiki.github.com/mojombo/jekyll/install the gem
* Read up about its "Usage":http://wiki.github.com/mojombo/jekyll/usage and "Configuration":http://wiki.github.com/mojombo/jekyll/configuration
* Take a gander at some existing "Sites":http://wiki.github.com/mojombo/jekyll/sites
* Fork and "Contribute":http://wiki.github.com/mojombo/jekyll/contribute your own modifications
* Have questions? Post them on the "Mailing List":http://groups.google.com/group/jekyll-rb
h2. Diving In
* "Migrate":http://wiki.github.com/mojombo/jekyll/blog-migrations from your previous system
* Learn how the "YAML Front Matter":http://wiki.github.com/mojombo/jekyll/yaml-front-matter works
* Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data
* Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with
* Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier
h2. Runtime Dependencies
* RedCloth: Textile support (Ruby)
* Liquid: Templating system (Ruby)
* Classifier: Generating related posts (Ruby)
* Maruku: Default markdown engine (Ruby)
* Directory Watcher: Auto-regeneration of sites (Ruby)
* Pygments: Syntax highlighting (Python)
h2. Developer Dependencies
* Shoulda: Test framework (Ruby)
* RR: Mocking (Ruby)
* RedGreen: Nicer test output (Ruby)
h2. License
See LICENSE.

203
Rakefile
View File

@@ -1,10 +1,6 @@
require 'rubygems'
require 'rake'
require 'rdoc'
require 'date'
require 'yaml'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
#############################################################################
#
@@ -25,10 +21,6 @@ def date
Date.today.to_s
end
def file_date
Date.today.strftime("%F")
end
def rubyforge_project
name
end
@@ -45,53 +37,13 @@ def replace_header(head, header_name)
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
end
def normalize_bullets(markdown)
markdown.gsub(/\s{2}\*{1}/, "-")
end
def linkify_prs(markdown)
markdown.gsub(/#(\d+)/) do |word|
"[#{word}]({{ site.repository }}/issues/#{word.delete("#")})"
end
end
def linkify_users(markdown)
markdown.gsub(/(@\w+)/) do |username|
"[#{username}](https://github.com/#{username.delete("@")})"
end
end
def linkify(markdown)
linkify_users(linkify_prs(markdown))
end
def liquid_escape(markdown)
markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
end
def remove_head_from_history(markdown)
index = markdown =~ /^##\s+\d+\.\d+\.\d+/
markdown[index..-1]
end
def converted_history(markdown)
remove_head_from_history(liquid_escape(linkify(normalize_bullets(markdown))))
end
#############################################################################
#
# Standard tasks
#
#############################################################################
if RUBY_VERSION > '1.9' && ENV["TRAVIS"] == "true"
require 'coveralls/rake/task'
Coveralls::RakeTask.new
task :default => [:test, :features, 'coveralls:push']
else
task :default => [:test, :features]
end
task :default => [:test, :features]
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
@@ -100,7 +52,15 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end
require 'rdoc/task'
desc "Generate RCov test coverage and open in your browser"
task :coverage do
require 'rcov'
sh "rm -fr coverage"
sh "rcov test/test_*.rb"
sh "open coverage/index.html"
end
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "#{name} #{version}"
@@ -108,21 +68,6 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.profile = "travis"
end
Cucumber::Rake::Task.new(:"features:html", "Run Cucumber features and produce HTML output") do |t|
t.profile = "html_report"
end
rescue LoadError
desc 'Cucumber rake task not available'
task :features do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end
desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -r ./lib/#{name}.rb"
@@ -130,118 +75,34 @@ end
#############################################################################
#
# Site tasks - http://jekyllrb.com
# Custom tasks (add your own tasks here)
#
#############################################################################
namespace :site do
desc "Generate and view the site locally"
task :preview do
require "launchy"
# Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and
# then open it in a browser. Someday we can do better than this, I hope.
Thread.new do
sleep 4
puts "Opening in browser..."
Launchy.open("http://localhost:4000")
end
# Generate the site in server mode.
puts "Running Jekyll..."
Dir.chdir("site") do
sh "#{File.expand_path('bin/jekyll', File.dirname(__FILE__))} serve --watch"
end
namespace :migrate do
desc "Migrate from mephisto in the current directory"
task :mephisto do
sh %q(ruby -r './lib/jekyll/migrators/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
end
desc "Update normalize.css library to the latest version and minify"
task :update_normalize_css do
Dir.chdir("site/css") do
sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
sh 'sass "normalize.scss":"normalize.css" --style compressed'
sh 'rm "normalize.scss"'
end
desc "Migrate from Movable Type in the current directory"
task :mt do
sh %q(ruby -r './lib/jekyll/migrators/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
end
desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
task :publish => [:history] do
# Ensure the gh-pages dir exists so we can generate into it.
puts "Checking for gh-pages dir..."
unless File.exist?("./gh-pages")
puts "No gh-pages directory found. Run the following commands first:"
puts " `git clone git@github.com:mojombo/jekyll gh-pages"
puts " `cd gh-pages"
puts " `git checkout gh-pages`"
exit(1)
end
# Ensure gh-pages branch is up to date.
Dir.chdir('gh-pages') do
sh "git pull origin gh-pages"
end
# Copy to gh-pages dir.
puts "Copying site to gh-pages branch..."
Dir.glob("site/*") do |path|
next if path.include? "_site"
sh "cp -R #{path} gh-pages/"
end
# Commit and push.
puts "Committing and pushing to GitHub Pages..."
sha = `git log`.match(/[a-z0-9]{40}/)[0]
Dir.chdir('gh-pages') do
sh "git add ."
sh "git commit -m 'Updating to #{sha}.'"
sh "git push origin gh-pages"
end
puts 'Done.'
desc "Migrate from Typo in the current directory"
task :typo do
sh %q(ruby -r './lib/jekyll/migrators/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
end
end
desc "Create a nicely formatted history page for the jekyll site based on the repo history."
task :history do
if File.exist?("History.markdown")
history_file = File.read("History.markdown")
front_matter = {
"layout" => "docs",
"title" => "History",
"permalink" => "/docs/history/",
"prev_section" => "contributing"
}
Dir.chdir('site/docs/') do
File.open("history.md", "w") do |file|
file.write("#{front_matter.to_yaml}---\n\n")
file.write(converted_history(history_file))
end
end
else
abort "You seem to have misplaced your History.markdown file. I can haz?"
end
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--format progress"
end
namespace :releases do
desc "Create new release post"
task :new, :version do |t, args|
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
today = Time.new.strftime('%Y-%m-%d')
release = args.version.to_s
filename = "site/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown"
File.open(filename, "wb") do |post|
post.puts("---")
post.puts("layout: news_item")
post.puts("title: 'Jekyll #{release} Released'")
post.puts("date: #{Time.new.strftime('%Y-%m-%d %H:%M:%S %z')}")
post.puts("author: ")
post.puts("version: #{version}")
post.puts("categories: [release]")
post.puts("---")
post.puts
post.puts
end
puts "Created #{filename}"
end
rescue LoadError
desc 'Cucumber rake task not available'
task :features do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end
@@ -256,7 +117,7 @@ task :release => :build do
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -m 'Release #{version}'"
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push origin v#{version}"
@@ -295,4 +156,4 @@ task :gemspec do
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
File.open(gemspec_file, 'w') { |io| io.write(spec) }
puts "Updated #{gemspec_file}"
end
end

View File

@@ -1,157 +1,276 @@
#!/usr/bin/env ruby
STDOUT.sync = true
$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
require 'commander/import'
help = <<HELP
Jekyll is a blog-aware, static site generator.
Basic Command Line Usage:
jekyll # . -> ./_site
jekyll <path to write generated site> # . -> <path>
jekyll <path to source> <path to write generated site> # <path> -> <path>
jekyll import <importer name> <options> # imports posts using named import script
Configuration is read from '<source>/_config.yml' but can be overriden
using the following options:
HELP
require 'optparse'
require 'jekyll'
Jekyll::Deprecator.process(ARGV)
program :name, 'jekyll'
program :version, Jekyll::VERSION
program :description, 'Jekyll is a blog-aware, static site generator in Ruby'
exec = {}
options = {}
opts = OptionParser.new do |opts|
opts.banner = help
default_command :default
global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
global_option '--safe', 'Safe mode (defaults to false)'
global_option '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
global_option '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
# Option names don't always directly match the configuration value we'd like.
# This method will rename options to match what Jekyll configuration expects.
#
# options - The Hash of options from Commander.
#
# Returns the normalized Hash.
def normalize_options(options)
if drafts_state = options.delete(:drafts)
options[:show_drafts] = drafts_state
opts.on("--file [PATH]", "File to import from") do |import_file|
options['file'] = import_file
end
options
end
def add_build_options(c)
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option '--future', 'Publishes posts with a future date'
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '-D', '--drafts', 'Render posts in the _drafts folder'
c.option '-V', '--verbose', 'Print verbose output.'
end
command :default do |c|
c.action do |args, options|
if args.empty?
command(:help).run
else
Jekyll.logger.abort_with "Invalid command. Use --help for more information"
end
opts.on("--dbname [TEXT]", "DB to import from") do |import_dbname|
options['dbname'] = import_dbname
end
end
command :new do |c|
c.syntax = 'jekyll new PATH'
c.description = 'Creates a new Jekyll site scaffold in PATH'
c.option '--force', 'Force creation even if PATH already exists'
c.option '--blank', 'Creates scaffolding but with empty files'
c.action do |args, options|
Jekyll::Commands::New.process(args, options.__hash__)
opts.on("--user [TEXT]", "Username to use when importing") do |import_user|
options['user'] = import_user
end
end
command :build do |c|
c.syntax = 'jekyll build [options]'
c.description = 'Build your site'
add_build_options(c)
c.action do |args, options|
options = normalize_options(options.__hash__)
options = Jekyll.configuration(options)
Jekyll::Commands::Build.process(options)
opts.on("--pass [TEXT]", "Password to use when importing") do |import_pass|
options['pass'] = import_pass
end
end
command :serve do |c|
c.syntax = 'jekyll serve [options]'
c.description = 'Serve your site locally'
add_build_options(c)
c.option '-B', '--detach', 'Run the server in the background (detach)'
c.option '-P', '--port [PORT]', 'Port to listen on'
c.option '-H', '--host [HOST]', 'Host to bind to'
c.option '-b', '--baseurl [URL]', 'Base URL'
c.action do |args, options|
options.default :serving => true
options = normalize_options(options.__hash__)
options = Jekyll.configuration(options)
Jekyll::Commands::Build.process(options)
Jekyll::Commands::Serve.process(options)
opts.on("--host [HOST ADDRESS]", "Host to import from") do |import_host|
options['host'] = import_host
end
end
alias_command :server, :serve
command :doctor do |c|
c.syntax = 'jekyll doctor'
c.description = 'Search site and print specific deprecation warnings'
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.action do |args, options|
options = normalize_options(options.__hash__)
options = Jekyll.configuration(options)
Jekyll::Commands::Doctor.process(options)
opts.on("--site [SITE NAME]", "Site to import from") do |import_site|
options['site'] = import_site
end
end
alias_command :hyde, :doctor
command :docs do |c|
c.syntax = 'jekyll docs'
c.description = "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
c.option '-p', '--port [PORT]', 'Port to listen on'
c.option '-u', '--host [HOST]', 'Host to bind to'
c.action do |args, options|
options = normalize_options(options.__hash__)
options = Jekyll.configuration(options.merge!({
'source' => File.expand_path("../site", File.dirname(__FILE__)),
'destination' => File.expand_path("../site/_site", File.dirname(__FILE__))
}))
puts options
Jekyll::Commands::Build.process(options)
Jekyll::Commands::Serve.process(options)
opts.on("--[no-]safe", "Safe mode (default unsafe)") do |safe|
options['safe'] = safe
end
end
command :import do |c|
c.syntax = 'jekyll import <platform> [options]'
c.description = 'Import your old blog to Jekyll'
opts.on("--[no-]auto", "Auto-regenerate") do |auto|
options['auto'] = auto
end
c.option '--source STRING', 'Source file or URL to migrate from'
c.option '--file STRING', 'File to migrate from'
c.option '--dbname STRING', 'Database name to migrate from'
c.option '--user STRING', 'Username to use when migrating'
c.option '--pass STRING', 'Password to use when migrating'
c.option '--host STRING', 'Host address to use when migrating'
opts.on("--server [PORT]", "Start web server (default port 4000)") do |port|
options['server'] = true
options['server_port'] = port unless port.nil?
end
c.action do |args, options|
opts.on("--no-server", "Do not start a web server") do |part|
options['server'] = false
end
opts.on("--base-url [BASE_URL]", "Serve website from a given base URL (default '/'") do |baseurl|
options['baseurl'] = baseurl
end
opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
options['lsi'] = lsi
end
opts.on("--[no-]pygments", "Use pygments to highlight code") do |pygments|
options['pygments'] = pygments
end
opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
options['markdown'] = 'rdiscount'
end
opts.on("--kramdown", "Use kramdown gem for Markdown") do
options['markdown'] = 'kramdown'
end
opts.on("--time [TIME]", "Time to generate the site for") do |time|
options['time'] = Time.parse(time)
end
opts.on("--[no-]future", "Render future dated posts") do |future|
options['future'] = future
end
opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
options['permalink'] = style unless style.nil?
end
opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
begin
require 'jekyll-import'
rescue LoadError
msg = "You must install the 'jekyll-import' gem before continuing.\n"
msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n"
abort msg
options['paginate'] = per_page.to_i
raise ArgumentError if options['paginate'] == 0
rescue
puts 'you must specify a number of posts by page bigger than 0'
exit 0
end
Jekyll::Commands::Import.process(args.first, options)
end
opts.on("--limit_posts [MAX_POSTS]", "Limit the number of posts to publish") do |limit_posts|
begin
options['limit_posts'] = limit_posts.to_i
raise ArgumentError if options['limit_posts'] < 1
rescue
puts 'you must specify a number of posts by page bigger than 0'
exit 0
end
end
opts.on("--url [URL]", "Set custom site.url") do |url|
options['url'] = url
end
opts.on("--version", "Display current version") do
puts "Jekyll " + Jekyll::VERSION
exit 0
end
end
# Read command line options into `options` hash
opts.parse!
# Check for import stuff
if ARGV.size > 0
if ARGV[0] == 'import'
migrator = ARGV[1]
if migrator.nil?
puts "Invalid options. Run `jekyll --help` for assistance."
exit(1)
else
migrator = migrator.downcase
end
cmd_options = []
['file', 'dbname', 'user', 'pass', 'host', 'site'].each do |p|
cmd_options << "\"#{options[p]}\"" unless options[p].nil?
end
# It's import time
puts "Importing..."
# Ideally, this shouldn't be necessary. Maybe parse the actual
# src files for the migrator name?
migrators = {
:posterous => 'Posterous',
:wordpressdotcom => 'WordpressDotCom',
:wordpress => 'Wordpress',
:csv => 'CSV',
:drupal => 'Drupal',
:mephisto => 'Mephisto',
:mt => 'MT',
:textpattern => 'TextPattern',
:typo => 'Typo'
}
app_root = File.join(File.dirname(__FILE__), '..')
require "#{app_root}/lib/jekyll/migrators/#{migrator}"
if Jekyll.const_defined?(migrators[migrator.to_sym])
migrator_class = Jekyll.const_get(migrators[migrator.to_sym])
migrator_class.process(*cmd_options)
else
puts "Invalid migrator. Run `jekyll --help` for assistance."
exit(1)
end
exit(0)
end
end
# Get source and destintation from command line
case ARGV.size
when 0
when 1
options['destination'] = ARGV[0]
when 2
options['source'] = ARGV[0]
options['destination'] = ARGV[1]
else
puts "Invalid options. Run `jekyll --help` for assistance."
exit(1)
end
options = Jekyll.configuration(options)
# Get source and destination directories (possibly set by config file)
source = options['source']
destination = options['destination']
# Files to watch
def globs(source)
Dir.chdir(source) do
dirs = Dir['*'].select { |x| File.directory?(x) }
dirs -= ['_site']
dirs = dirs.map { |x| "#{x}/**/*" }
dirs += ['*']
end
end
# Create the Site
site = Jekyll::Site.new(options)
# Run the directory watcher for auto-generation, if required
if options['auto']
require 'directory_watcher'
puts "Auto-regenerating enabled: #{source} -> #{destination}"
dw = DirectoryWatcher.new(source)
dw.interval = 1
dw.glob = globs(source)
dw.add_observer do |*args|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
puts "[#{t}] regeneration: #{args.size} files changed"
site.process
end
dw.start
unless options['server']
loop { sleep 1000 }
end
else
puts "Building site: #{source} -> #{destination}"
begin
site.process
rescue Jekyll::FatalException => e
puts
puts "ERROR: YOUR SITE COULD NOT BE BUILT:"
puts "------------------------------------"
puts e.message
exit(1)
end
puts "Successfully generated site: #{source} -> #{destination}"
end
# Run the server on the specified port, if required
if options['server']
require 'webrick'
include WEBrick
FileUtils.mkdir_p(destination)
mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
mime_types.store 'js', 'application/javascript'
s = HTTPServer.new(
:Port => options['server_port'],
:MimeTypes => mime_types
)
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination)
t = Thread.new {
s.start
}
trap("INT") { s.shutdown }
t.join()
end

View File

@@ -1,3 +1 @@
default: --format pretty
travis: --format progress
html_report: --format progress --format html --out=features_report.html
default: --format progress

1
doc/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
output

7
doc/.gitscribe Normal file
View File

@@ -0,0 +1,7 @@
---
publish: true
edition: 0.1
language: en
version: 1.0
author: Your Name
cover: image/cover.jpg

9
doc/README.asciidoc Normal file
View File

@@ -0,0 +1,9 @@
This Book
=========
This book is written using using the git-scribe toolchain, which can be found at:
http://github.com/schacon/git-scribe
Instructions on how to install the tool and use it for things like editing this book,
submitting errata and providing translations can be found at that site.

10
doc/book/book.asc Normal file
View File

@@ -0,0 +1,10 @@
Jekyll
======
:Author: Tom Preston-Werner
:Email: <tom@mojombo.com>
include::ch00-preface.asc[]
include::ch01-quick-start.asc[]
include::ch02-directory-layout.asc[]

41
doc/book/ch00-preface.asc Normal file
View File

@@ -0,0 +1,41 @@
== Preface
Jekyll was born out the desire to create a blog engine that would make it
possible to write posts in my local text editor, version those posts with Git,
and keep up with my desire to tweak the styles and layout of my site.
In other words, I wanted something that fit into my existing software
development workflow and toolchain. Jekyll handles not only this case, but a
wide variety of other situations that call for static site generation based on
converted content and layout templates.
At its core, Jekyll is a text transformation engine. The concept behind the
system is this: you give it text written in your favorite markup language, be
that Markdown, Textile, or just plain HTML, and it churns that through a
layout or series of layout files. Throughout that process you can tweak how
you want the site URLs to look, what data gets displayed on the layout and
much more.
If you're looking for a simple, yet powerful solution to your blogging or
static site needs, Jekyll may be just what you've been looking for.
=== What this book covers
_Chapter 1, Quick Start_ covers installation, introduces the Jekyll command
line interface, and runs through a quick example demonstrating the site
generator, post generator and how to convert your Jekyll site into a static
site.
_Chapter 2, Directory Layout_ covers the various files and directories that
comprise a Jekyll site.
_Chapter 3, Tags and Filters_
_Chapter X, Deploying your Jekyll Site_
_Chapter X, Customizing Jekyll with Plugins_
_Chapter X, Migrating to Jekyll from your Existing Blog_
_Chapter X, Configuration Reference_

View File

@@ -0,0 +1,153 @@
== Chapter 1: Quick Start
This chapter is designed to get you up and running with Jekyll as quickly as
possible.
=== Installation
The best way to install Jekyll is via RubyGems:
----
gem install jekyll
----
This is all you need in order to get started with a basic Jekyll site. Some
options require additional packages to be installed.
If you encounter errors during gem installation, you may need to install the
header files for compiling extension modules for ruby 1.8:
.Debian
----
sudo apt-get install ruby1.8-dev
----
.Red Hat / CentOS / Fedora systems
----
sudo yum install ruby-devel
----
.NearlyFreeSpeech
----
RB_USER_INSTALL=true gem install jekyll
----
If you encounter errors like +Failed to build gem native extension+ on Windows
you may need to install http://wiki.github.com/oneclick/rubyinstaller/development-kit[RubyInstaller
DevKit].
==== LaTeX to PNG
Maruku comes with optional support for LaTeX to PNG rendering via blahtex
(Version 0.6) which must be in your $PATH along with @dvips@.
(NOTE: "remi's fork of Maruku":http://github.com/remi/maruku/tree/master does
not assume a fixed location for @dvips@ if you need that fixed)
==== RDiscount
If you prefer to use
http://github.com/rtomayko/rdiscount/tree/master[RDiscount] instead of
http://maruku.rubyforge.org/[Maruku] for markdown, just make sure it's
installed:
----
sudo gem install rdiscount
----
And run Jekyll with the following option:
----
jekyll --rdiscount
----
Or, in your @_config.yml@ file put the following so you don't have to specify the flag:
----
markdown: rdiscount
----
==== Pygments
If you want syntax highlighting via the @{% highlight %}@ tag in your posts,
you'll need to install http://pygments.org/[Pygments].
.On OSX with Homebrew
----
brew install pip && pip install pygments
----
.On OSX with MacPorts
----
sudo port install python25 py25-pygments
----
.Bare OS X Leopard
----
sudo easy_install Pygments
----
.Archlinux
----
sudo pacman -S python-pygments
----
.Archlinux python2 for Pygments
----
$ sudo pacman -S python2-pygments
----
NOTE: python2 pygments version creates a `pygmentize2` executable, while
Jekyll tries to find `pygmentize`. Either create a symlink `# ln -s
/usr/bin/pygmentize2 /usr/bin/pygmentize` or use the python3 version.
.Ubuntu and Debian
----
sudo apt-get install python-pygments
----
.Gentoo
----
$ sudo emerge -av dev-python/pygments
----
=== Creating your First Site
Jekyll comes with a handy generator that will create a barebones skeleton site
to help you get up and running in no time. Simply create an empty directory to
contain your site, navigate to it, and run the generator command:
----
$ mkdir mysite
$ cd mysite
$ jekyll gen
----
Make sure the directory is empty or Jekyll will refuse to run. If everything
was successful, you'll be left with a complete, valid Jekyll site that's ready
to be converted into a static site.
To perform the conversion, make sure you're in the root of your Jekyll site
directory and run:
----
$ jekyll --server
----
If all goes well, you should get a few lines with information about config
file detection, source and destination paths, and a success message.
The `--server` command line option fires up a simple web server that will
serve the static site we just generated so that we can easily preview what it
will look like once we deploy it to a production environment.
Open up your favorite web browser and navigate to:
----
http://localhost:4000
----
Congratulations! You have now successfully created and converted your first
Jekyll site!

View File

@@ -0,0 +1,90 @@
== Chapter 2: Directory Layout
If you followed the Quick Start in the last chapter, you have a Jekyll site on
your local machine. Let's take a closer look at it and see what makes it tick.
The file layout should look something like this:
----
.
|-- _config.yml
|-- _layouts
| |-- default.html
| `-- post.html
|-- _posts
| |-- 2007-10-29-why-every-programmer-should-play-nethack.textile
| `-- 2009-04-26-barcamp-boston-4-roundup.textile
|-- _site
|-- images
| `-- logo.png
`-- index.html
----
Notice that some of the files and directories begin with an underscore. These
have special meaning to Jekyll. The underscore ensures that they will not
interfere with the rest of your site's normal content. It also means that if
any of your normal files start with an underscore, they will cause problems,
so try to avoid this.
=== _config.yml
This file stores configuration data. A majority of these options can be
specified from the command line executable but it's easier to throw them in
here so you don't have to type them out every time. Detailed explanations of
configuration directives can be found in Chapter X.
=== _layouts
Files in this directory represent templates that can be used to wrap converted
pages. Layouts are defined on a page-by-page basis in the YAML front matter.
The liquid tag +{{ content }}+ specifies where the content will be placed
during the conversion process.
=== _posts
If you're using Jekyll as a blog engine, this is where you'll place your blog
posts. A post's filename contains several pieces of data, so you must be very
careful about how these files are named. The filename format is:
+YEAR-MONTH-DATE-SLUG.MARKUP+. The YEAR must be four numbers and the MONTH and
DATE must be two numbers each. The SLUG is what will appear in the URL. The
MARKUP tells Jekyll the format of the post. The date and slug will be used
along with any permalink options you specify (See Chapter X) to construct the
final URL of the post.
=== _site
This is where the generated site will be placed (by default) once Jekyll is
done transforming it. If you're using version control, you'll want to add this
directory to the list of files to be ignored.
=== Normal Files with YAML Front Matter
All files outside of the special underscore directories and that do not
themselves begin with an underscore will be scanned by Jekyll and subjected to
conversion if they contain any YAML front matter.
=== Everything Else
Any files and directories that do not fall into one of the above categories
will be copied to the static site as-is without modification. In this example,
+images/logo.png+ will be copied to the same location in the generated site.
h2. Running Jekyll
Usually this is done through the @jekyll@ executable, which is installed with
the gem. In order to get a server up and running with your Jekyll site, run:
@jekyll --server@
and then browse to http://0.0.0.0:4000. There's plenty of [[configuration
options|Configuration]] available to you as well.
On Debian or Ubuntu, you may need to add @/var/lib/gems/1.8/bin/@ to your path.
h2. Deployment
Since Jekyll simply generates a folder filled with HTML files, it can be
served using practically any available web server out there. Please check the
[[Deployment]] page for more information regarding specific scenarios.

View File

@@ -3,13 +3,6 @@ Feature: Create sites
I want to be able to make a static site
In order to share my awesome ideas with the interwebs
Scenario: Blank site
Given I do not have a "test_blank" directory
When I call jekyll new with test_blank --blank
Then the test_blank/_layouts directory should exist
And the test_blank/_posts directory should exist
And the "test_blank/index.html" file should exist
Scenario: Basic site
Given I have an "index.html" file that contains "Basic Site"
When I run jekyll
@@ -20,7 +13,7 @@ Feature: Create sites
Given I have a _posts directory
And I have the following post:
| title | date | content |
| Hackers | 2009-03-27 | My First Exploit |
| Hackers | 3/27/2009 | My First Exploit |
When I run jekyll
Then the _site directory should exist
And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
@@ -38,23 +31,12 @@ Feature: Create sites
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames | 3/27/2009 | default | The only winning move is not to play. |
And I have a default layout that contains "Post Layout: {{ content }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layout inside a subfolder and a post
Given I have a _layouts directory
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | post/simple | The only winning move is not to play. |
And I have a post/simple layout that contains "Post Layout: {{ content }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layouts, pages, posts and files
Given I have a _layouts directory
And I have a page layout that contains "Page {{ page.title }}: {{ content }}"
@@ -67,13 +49,13 @@ Feature: Create sites
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2009-03-27 | post | content for entry1. |
| entry2 | 2009-04-27 | post | content for entry2. |
| entry1 | 3/27/2009 | post | content for entry1. |
| entry2 | 4/27/2009 | post | content for entry2. |
And I have a category/_posts directory
And I have the following posts in "category":
| title | date | layout | content |
| entry3 | 2009-05-27 | post | content for entry3. |
| entry4 | 2009-06-27 | post | content for entry4. |
| entry3 | 5/27/2009 | post | content for entry3. |
| entry4 | 6/27/2009 | post | content for entry4. |
When I run jekyll
Then the _site directory should exist
And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html"
@@ -107,35 +89,6 @@ Feature: Create sites
And I have an "_includes/about.textile" file that contains "Generated by {% include jekyll.textile %}"
And I have an "_includes/jekyll.textile" file that contains "Jekyll"
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
When I run jekyll
When I debug jekyll
Then the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
Scenario: Basic site with internal post linking
Given I have an "index.html" page that contains "URL: {% post_url 2020-01-31-entry2 %}"
And I have a configuration file with "permalink" set to "pretty"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "URL: /2020/01/31/entry2/" in "_site/index.html"
Scenario: Basic site with whitelisted dotfile
Given I have an ".htaccess" file that contains "SomeDirective"
When I run jekyll
Then the _site directory should exist
And I should see "SomeDirective" in "_site/.htaccess"
Scenario: File was replaced by a directory
Given I have a "test" file that contains "some stuff"
When I run jekyll
Then the _site directory should exist
When I delete the file "test"
Given I have a test directory
And I have a "test/index.html" file that contains "some other stuff"
When I run jekyll
Then the _site/test directory should exist
And I should see "some other stuff" in "_site/test/index.html"

View File

@@ -1,65 +0,0 @@
Feature: Data
In order to use well-formatted data in my blog
As a blog's user
I want to use _data directory in my site
Scenario: autoload *.yaml files in _data directory
Given I have a _data directory
And I have a "_data/products.yaml" file with content:
"""
- name: sugar
price: 5.3
- name: salt
price: 2.5
"""
And I have an "index.html" page that contains "{% for product in site.data.products %}{{product.name}}{% endfor %}"
When I run jekyll
Then the "_site/index.html" file should exist
And I should see "sugar" in "_site/index.html"
And I should see "salt" in "_site/index.html"
Scenario: autoload *.yml files in _data directory
Given I have a _data directory
And I have a "_data/members.yml" file with content:
"""
- name: Jack
age: 28
- name: Leon
age: 34
"""
And I have an "index.html" page that contains "{% for member in site.data.members %}{{member.name}}{% endfor %}"
When I run jekyll
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
Scenario: autoload *.yml files in _data directory with space in file name
Given I have a _data directory
And I have a "_data/team members.yml" file with content:
"""
- name: Jack
age: 28
- name: Leon
age: 34
"""
And I have an "index.html" page that contains "{% for member in site.data.team_members %}{{member.name}}{% endfor %}"
When I run jekyll
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
Scenario: should be backward compatible with site.data in _config.yml
Given I have a "_config.yml" file with content:
"""
data:
- name: Jack
age: 28
- name: Leon
age: 34
"""
And I have an "index.html" page that contains "{% for member in site.data %}{{member.name}}{% endfor %}"
When I run jekyll
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"

View File

@@ -1,25 +0,0 @@
Feature: Draft Posts
As a hacker who likes to blog
I want to be able to preview drafts locally
In order to see if they look alright before publishing
Scenario: Preview a draft
Given I have a configuration file with "permalink" set to "none"
And I have a _drafts directory
And I have the following draft:
| title | date | layout | content |
| Recipe | 2009-03-27 | default | Not baked yet. |
When I run jekyll with drafts
Then the _site directory should exist
And I should see "Not baked yet." in "_site/recipe.html"
Scenario: Don't preview a draft
Given I have a configuration file with "permalink" set to "none"
And I have an "index.html" page that contains "Totally index"
And I have a _drafts directory
And I have the following draft:
| title | date | layout | content |
| Recipe | 2009-03-27 | default | Not baked yet. |
When I run jekyll
Then the _site directory should exist
And the "_site/recipe.html" file should not exist

View File

@@ -8,7 +8,7 @@ Feature: Embed filters
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
| Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ site.time | date_to_xmlschema }}"
When I run jekyll
Then the _site directory should exist
@@ -19,7 +19,7 @@ Feature: Embed filters
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
| Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ page.title | xml_escape }}"
When I run jekyll
Then the _site directory should exist
@@ -30,7 +30,7 @@ Feature: Embed filters
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
| Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ content | xml_escape }}"
When I run jekyll
Then the _site directory should exist
@@ -41,7 +41,7 @@ Feature: Embed filters
And I have a _layouts directory
And I have the following post:
| title | date | layout | tags | content |
| Star Wars | 2009-03-27 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
| Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}"
When I run jekyll
Then the _site directory should exist
@@ -52,7 +52,7 @@ Feature: Embed filters
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
| Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "By {{ '_Obi-wan_' | textilize }}"
When I run jekyll
Then the _site directory should exist

View File

@@ -1,48 +0,0 @@
Feature: Include tags
In order to share their content across several pages
As a hacker who likes to blog
I want to be able to include files in my blog posts
Scenario: Include a file with parameters
Given I have an _includes directory
And I have an "_includes/header.html" file that contains "<header>My awesome blog header: {{include.param}}</header>"
And I have an "_includes/params.html" file that contains "Parameters:<ul>{% for param in include %}<li>{{param[0]}} = {{param[1]}}</li>{% endfor %}</ul>"
And I have an "_includes/ignore.html" file that contains "<footer>My blog footer</footer>"
And I have a _posts directory
And I have the following post:
| title | date | layout | content |
| Include Files | 2013-03-21 | default | {% include header.html param="myparam" %} |
| Ignore params if unused | 2013-03-21 | default | {% include ignore.html date="today" %} |
| List multiple parameters | 2013-03-21 | default | {% include params.html date="today" start="tomorrow" %} |
| Dont keep parameters | 2013-03-21 | default | {% include ignore.html param="test" %}\n{% include header.html %} |
| Allow params with spaces and quotes | 2013-04-07 | default | {% include params.html cool="param with spaces" super="\"quoted\"" single='has "quotes"' escaped='\'single\' quotes' %} |
| Parameter syntax | 2013-04-12 | default | {% include params.html param1_or_2="value" %} |
| Pass a variable | 2013-06-22 | default | {% assign var = 'some text' %}{% include params.html local=var layout=page.layout %} |
When I run jekyll
Then the _site directory should exist
And I should see "<header>My awesome blog header: myparam</header>" in "_site/2013/03/21/include-files.html"
And I should not see "myparam" in "_site/2013/03/21/ignore-params-if-unused.html"
And I should see "<li>date = today</li>" in "_site/2013/03/21/list-multiple-parameters.html"
And I should see "<li>start = tomorrow</li>" in "_site/2013/03/21/list-multiple-parameters.html"
And I should not see "<header>My awesome blog header: myparam</header>" in "_site/2013/03/21/dont-keep-parameters.html"
But I should see "<header>My awesome blog header: </header>" in "_site/2013/03/21/dont-keep-parameters.html"
And I should see "<li>cool = param with spaces</li>" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "<li>super = &#8220;quoted&#8221;</li>" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "<li>single = has &#8220;quotes&#8221;</li>" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "<li>escaped = &#8216;single&#8217; quotes</li>" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "<li>param1_or_2 = value</li>" in "_site/2013/04/12/parameter-syntax.html"
And I should see "<li>local = some text</li>" in "_site/2013/06/22/pass-a-variable.html"
And I should see "<li>layout = default</li>" in "_site/2013/06/22/pass-a-variable.html"
Scenario: Include a file from a variable
Given I have an _includes directory
And I have an "_includes/snippet.html" file that contains "a snippet"
And I have an "_includes/parametrized.html" file that contains "works with {{include.what}}"
And I have a configuration file with:
| key | value |
| include_file1 | snippet.html |
| include_file2 | parametrized.html |
And I have an "index.html" page that contains "{% include {{site.include_file1}} %} that {% include {{site.include_file2}} what='parameters' %}"
When I run jekyll
Then the _site directory should exist
And I should see "a snippet that works with parameters" in "_site/index.html"

View File

@@ -9,7 +9,7 @@ Feature: Markdown
And I have a _posts directory
And I have the following post:
| title | date | content | type |
| Hackers | 2009-03-27 | # My Title | markdown |
| Hackers | 3/27/2009 | # My Title | markdown |
When I run jekyll
Then the _site directory should exist
And I should see "Index" in "_site/index.html"
@@ -22,7 +22,7 @@ Feature: Markdown
And I have a _posts directory
And I have the following post:
| title | date | content | type |
| Hackers | 2009-03-27 | # My Title | markdown |
| Hackers | 3/27/2009 | # My Title | markdown |
When I run jekyll
Then the _site directory should exist
And I should see "Index" in "_site/index.html"

View File

@@ -2,81 +2,26 @@ Feature: Site pagination
In order to paginate my blog
As a blog's user
I want divide the posts in several pages
Scenario Outline: Paginate with N posts per page
Given I have a configuration file with "paginate" set to "<num>"
And I have a _layouts directory
And I have an "index.html" page that contains "{{ paginator.posts.size }}"
And I have a _posts directory
And I have the following posts:
And I have the following post:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames2 | 2009-04-27 | default | The only winning move is not to play2. |
| Wargames3 | 2009-05-27 | default | The only winning move is not to play3. |
| Wargames4 | 2009-06-27 | default | The only winning move is not to play4. |
| Wargames | 3/27/2009 | default | The only winning move is not to play. |
| Wargames2 | 4/27/2009 | default | The only winning move is not to play2. |
| Wargames3 | 5/27/2009 | default | The only winning move is not to play3. |
| Wargames4 | 6/27/2009 | default | The only winning move is not to play4. |
When I run jekyll
Then the _site/page<exist> directory should exist
And the "_site/page<exist>/index.html" file should exist
And I should see "<posts>" in "_site/page<exist>/index.html"
And the "_site/page<not_exist>/index.html" file should not exist
Examples:
| num | exist | posts | not_exist |
| 1 | 4 | 1 | 5 |
| 2 | 2 | 2 | 3 |
| 3 | 2 | 1 | 3 |
Scenario Outline: Setting a custom pagination path
Given I have a configuration file with:
| key | value |
| paginate | 1 |
| paginate_path | /blog/page-:num |
| permalink | /blog/:year/:month/:day/:title |
And I have a blog directory
And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames2 | 2009-04-27 | default | The only winning move is not to play2. |
| Wargames3 | 2009-05-27 | default | The only winning move is not to play3. |
| Wargames4 | 2009-06-27 | default | The only winning move is not to play4. |
When I run jekyll
Then the _site/blog/page-<exist> directory should exist
And the "_site/blog/page-<exist>/index.html" file should exist
And I should see "<posts>" in "_site/blog/page-<exist>/index.html"
And the "_site/blog/page-<not_exist>/index.html" file should not exist
Examples:
| exist | posts | not_exist |
| 2 | 1 | 5 |
| 3 | 1 | 6 |
| 4 | 1 | 7 |
Scenario Outline: Setting a custom pagination path without an index.html in it
Given I have a configuration file with:
| key | value |
| paginate | 1 |
| paginate_path | /blog/page/:num |
| permalink | /blog/:year/:month/:day/:title |
And I have a blog directory
And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}"
And I have an "index.html" page that contains "Don't pick me!"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames2 | 2009-04-27 | default | The only winning move is not to play2. |
| Wargames3 | 2009-05-27 | default | The only winning move is not to play3. |
| Wargames4 | 2009-06-27 | default | The only winning move is not to play4. |
When I run jekyll
Then the _site/blog/page/<exist> directory should exist
And the "_site/blog/page/<exist>/index.html" file should exist
And I should see "<posts>" in "_site/blog/page/<exist>/index.html"
And the "_site/blog/page/<not_exist>/index.html" file should not exist
Examples:
| exist | posts | not_exist |
| 2 | 1 | 5 |
| 3 | 1 | 6 |
| 4 | 1 | 7 |

View File

@@ -7,7 +7,7 @@ Feature: Fancy permalinks
Given I have a _posts directory
And I have the following post:
| title | date | content |
| None Permalink Schema | 2009-03-27 | Totally nothing. |
| None Permalink Schema | 3/27/2009 | Totally nothing. |
And I have a configuration file with "permalink" set to "none"
When I run jekyll
Then the _site directory should exist
@@ -17,7 +17,7 @@ Feature: Fancy permalinks
Given I have a _posts directory
And I have the following post:
| title | date | content |
| Pretty Permalink Schema | 2009-03-27 | Totally wordpress. |
| Pretty Permalink Schema | 3/27/2009 | Totally wordpress. |
And I have a configuration file with "permalink" set to "pretty"
When I run jekyll
Then the _site directory should exist
@@ -38,7 +38,7 @@ Feature: Fancy permalinks
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
| Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title"
When I run jekyll
Then the _site directory should exist
@@ -48,7 +48,7 @@ Feature: Fancy permalinks
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
| Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
And I have a configuration file with "permalink" set to "/:categories/:title.html"
When I run jekyll
Then the _site directory should exist
@@ -58,28 +58,8 @@ Feature: Fancy permalinks
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
| Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html"
When I run jekyll
Then the _site directory should exist
And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
Scenario: Use per-post permalink
Given I have a _posts directory
And I have the following post:
| title | date | permalink | content |
| Some post | 2013-04-14 | /custom/posts/1 | bla bla |
When I run jekyll
Then the _site directory should exist
And the _site/custom/posts/1 directory should exist
And I should see "bla bla" in "_site/custom/posts/1/index.html"
Scenario: Use per-post ending in .html
Given I have a _posts directory
And I have the following post:
| title | date | permalink | content |
| Some post | 2013-04-14 | /custom/posts/some.html | bla bla |
When I run jekyll
Then the _site directory should exist
And the _site/custom/posts directory should exist
And I should see "bla bla" in "_site/custom/posts/some.html"

View File

@@ -8,7 +8,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post title: {{ page.title }}"
When I run jekyll
Then the _site directory should exist
@@ -19,7 +19,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post url: {{ page.url }}"
When I run jekyll
Then the _site directory should exist
@@ -30,18 +30,18 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}"
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post date: {{ page.date }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html"
And I should see "Post date: Fri Mar 27" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.id variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post id: {{ page.id }}"
When I run jekyll
Then the _site directory should exist
@@ -52,7 +52,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post content: {{ content }}"
When I run jekyll
Then the _site directory should exist
@@ -64,7 +64,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post in "movies":
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll
Then the _site directory should exist
@@ -75,7 +75,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | tag | content |
| Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. |
| Star Wars | 5/18/2009 | simple | twist | Luke, I am your father. |
And I have a simple layout that contains "Post tags: {{ page.tags }}"
When I run jekyll
Then the _site directory should exist
@@ -88,20 +88,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post in "scifi/movies":
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in folders with mixed case
Given I have a scifi directory
And I have a scifi/Movies directory
And I have a scifi/Movies/_posts directory
And I have a _layouts directory
And I have the following post in "scifi/Movies":
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll
Then the _site directory should exist
@@ -112,77 +99,29 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in YAML and is mixed-case
Scenario: Use post.categories variable when categories are in YAML
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in YAML
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML with mixed case
Given I have a _posts directory
And I have a _layouts directory
And I have the following posts:
| title | date | layout | categories | content |
| Star Wars | 2009-03-27 | simple | ['scifi', 'Movies'] | Luke, I am your father. |
| Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. |
| title | date | layout | categories | content |
| Star Wars | 3/27/2009 | simple | ['scifi', 'movies'] | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll
Then the _site directory should exist
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2013/03/17/star-trek.html"
Scenario Outline: Use page.path variable
Given I have a <dir>/_posts directory
And I have the following post in "<dir>":
| title | type | date | content |
| my-post | html | 2013-04-12 | Source path: {{ page.path }} |
When I run jekyll
Then the _site directory should exist
And I should see "Source path: <path_prefix>_posts/2013-04-12-my-post.html" in "_site/<dir>/2013/04/12/my-post.html"
Examples:
| dir | path_prefix |
| . | |
| dir | dir/ |
| dir/nested | dir/nested/ |
Scenario: Override page.path variable
Given I have a _posts directory
And I have the following post:
| title | date | path | content |
| override | 2013-04-12 | override-path.html | Custom path: {{ page.path }} |
When I run jekyll
Then the _site directory should exist
And I should see "Custom path: override-path.html" in "_site/2013/04/12/override.html"
Scenario: Disable a post from being published
Given I have a _posts directory
And I have an "index.html" file that contains "Published!"
And I have the following post:
| title | date | layout | published | content |
| Star Wars | 2009-03-27 | simple | false | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | false | Luke, I am your father. |
When I run jekyll
Then the _site directory should exist
And the "_site/2009/03/27/star-wars.html" file should not exist
@@ -193,7 +132,7 @@ Feature: Post data
And I have a _layouts directory
And I have the following post:
| title | date | layout | author | content |
| Star Wars | 2009-03-27 | simple | Darth Vader | Luke, I am your father. |
| Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. |
And I have a simple layout that contains "Post author: {{ page.author }}"
When I run jekyll
Then the _site directory should exist
@@ -204,9 +143,9 @@ Feature: Post data
And I have a _layouts directory
And I have the following posts:
| title | date | layout | author | content |
| Star Wars | 2009-03-27 | ordered | Darth Vader | Luke, I am your father. |
| Some like it hot | 2009-04-27 | ordered | Osgood | Nobody is perfect. |
| Terminator | 2009-05-27 | ordered | Arnold | Sayonara, baby |
| Star Wars | 3/27/2009 | ordered | Darth Vader | Luke, I am your father. |
| Some like it hot | 4/27/2009 | ordered | Osgood | Nobody is perfect. |
| Terminator | 5/27/2009 | ordered | Arnold | Sayonara, baby |
And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}"
When I run jekyll
Then the _site directory should exist

View File

@@ -1,50 +0,0 @@
Feature: Post excerpts
As a hacker who likes to blog
I want to be able to make a static site
In order to share my awesome ideas with the interwebs
But some people can only focus for a few moments
So just give them a taste
Scenario: An excerpt without a layout
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll
Then the _site directory should exist
And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
Scenario: An excerpt from a post with a layout
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have a _layouts directory
And I have a post layout that contains "{{ page.excerpt }}"
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll
Then the _site directory should exist
And the _site/2007 directory should exist
And the _site/2007/12 directory should exist
And the _site/2007/12/31 directory should exist
And the "_site/2007/12/31/entry1.html" file should exist
And I should see exactly "<p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
Scenario: An excerpt from a post with a layout which has context
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have a _layouts directory
And I have a post layout that contains "<html><head></head><body>{{ page.excerpt }}</body></html>"
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll
Then the _site directory should exist
And the _site/2007 directory should exist
And the _site/2007/12 directory should exist
And the _site/2007/12/31 directory should exist
And the "_site/2007/12/31/entry1.html" file should exist
And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
And I should see exactly "<html><head></head><body><p>content for entry1.</p></body></html>" in "_site/2007/12/31/entry1.html"

View File

@@ -3,7 +3,7 @@ Feature: Site configuration
I want to be able to configure jekyll
In order to make setting up a site easier
Scenario: Change source directory
Scenario: Change destination directory
Given I have a blank site in "_sourcedir"
And I have an "_sourcedir/index.html" file that contains "Changing source directory"
And I have a configuration file with "source" set to "_sourcedir"
@@ -18,32 +18,11 @@ Feature: Site configuration
Then the _mysite directory should exist
And I should see "Changing destination directory" in "_mysite/index.html"
Scenario Outline: Similarly named source and destination
Given I have a blank site in "<source>"
And I have an "<source>/index.md" page that contains "markdown"
And I have a configuration file with:
| key | value |
| source | <source> |
| destination | <dest> |
When I run jekyll
Then the <source> directory should exist
And the "<dest>/index.html" file should <file_exist> exist
And I should see "markdown" in "<source>/index.md"
Examples:
| source | dest | file_exist |
| mysite_source | mysite | |
| mysite | mysite_dest | |
| mysite/ | mysite | not |
| mysite | ./mysite | not |
| mysite/source | mysite | not |
| mysite | mysite/dest | |
Scenario: Exclude files inline
Given I have an "Rakefile" file that contains "I want to be excluded"
And I have an "README" file that contains "I want to be excluded"
And I have an "index.html" file that contains "I want to be included"
And I have a configuration file with "exclude" set to "['Rakefile', 'README']"
And I have a configuration file with "exclude" set to "Rakefile", "README"
When I run jekyll
Then I should see "I want to be included" in "_site/index.html"
And the "_site/Rakefile" file should not exist
@@ -76,13 +55,6 @@ Feature: Site configuration
Then the _site directory should exist
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
Scenario: Use Redcarpet for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "redcarpet"
When I run jekyll
Then the _site directory should exist
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
Scenario: Use Maruku for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "maruku"
@@ -109,8 +81,8 @@ Feature: Site configuration
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
| entry1 | 12/31/2007 | post | content for entry1. |
| entry2 | 01/31/2020 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html"
@@ -129,54 +101,14 @@ Feature: Site configuration
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
| entry1 | 12/31/2007 | post | content for entry1. |
| entry2 | 01/31/2020 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
Scenario: Generate proper dates with explicitly set timezone (same as posts' time)
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }}"
And I have a post layout that contains "Post Layout: {{ content }} built at {{ page.date | date_to_xmlschema }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| timezone | America/New_York |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. |
| entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 2" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p> built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p> built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html"
Scenario: Generate proper dates with explicitly set timezone (different than posts' time)
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }}"
And I have a post layout that contains "Post Layout: {{ content }} built at {{ page.date | date_to_xmlschema }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| timezone | Australia/Melbourne |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. |
| entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 2" in "_site/index.html"
And the "_site/2013/04/10/entry1.html" file should exist
And the "_site/2013/04/10/entry2.html" file should exist
And I should see escaped "Post Layout: <p>content for entry1.</p> built at 2013-04-10T13:22:00+10:00" in "_site/2013/04/10/entry1.html"
And I should see escaped "Post Layout: <p>content for entry2.</p> built at 2013-04-10T17:14:00+10:00" in "_site/2013/04/10/entry2.html"
Scenario: Limit the number of posts generated by most recent date
Given I have a _posts directory
And I have a configuration file with:
@@ -184,52 +116,11 @@ Feature: Site configuration
| limit_posts | 2 |
And I have the following posts:
| title | date | content |
| Apples | 2009-03-27 | An article about apples |
| Oranges | 2009-04-01 | An article about oranges |
| Bananas | 2009-04-05 | An article about bananas |
| Apples | 3/27/2009 | An article about apples |
| Oranges | 4/1/2009 | An article about oranges |
| Bananas | 4/5/2009 | An article about bananas |
When I run jekyll
Then the _site directory should exist
And the "_site/2009/04/05/bananas.html" file should exist
And the "_site/2009/04/01/oranges.html" file should exist
And the "_site/2009/03/27/apples.html" file should not exist
Scenario: Copy over normally excluded files when they are explicitly included
Given I have a ".gitignore" file that contains ".DS_Store"
And I have an ".htaccess" file that contains "SomeDirective"
And I have a configuration file with "include" set to:
| value |
| .gitignore |
| .foo |
When I run jekyll
Then the _site directory should exist
And I should see ".DS_Store" in "_site/.gitignore"
And the "_site/.htaccess" file should not exist
Scenario: Using a different layouts directory
Given I have a _theme directory
And I have a page theme that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
And I have a post theme that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| time | 2010-01-01 |
| future | true |
| layouts | _theme |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
Scenario: Add a gem-based plugin
Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with "gems" set to "[jekyll_test_plugin]"
When I run jekyll
Then the _site directory should exist
And I should see "Whatever" in "_site/index.html"
And I should see "this is a test" in "_site/test.txt"

View File

@@ -9,25 +9,6 @@ Feature: Site data
Then the _site directory should exist
And I should see "Contact: email@me.com" in "_site/contact.html"
Scenario Outline: Use page.path variable in a page
Given I have a <dir> directory
And I have a "<path>" page that contains "Source path: {{ page.path }}"
When I run jekyll
Then the _site directory should exist
And I should see "Source path: <path>" in "_site/<path>"
Examples:
| dir | path |
| . | index.html |
| dir | dir/about.html |
| dir/nested | dir/nested/page.html |
Scenario: Override page.path
Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}"
When I run jekyll
Then the _site directory should exist
And I should see "Custom path: custom-override.html" in "_site/override.html"
Scenario: Use site.time variable
Given I have an "index.html" page that contains "{{ site.time }}"
When I run jekyll
@@ -39,9 +20,9 @@ Feature: Site data
And I have an "index.html" page that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}"
And I have the following posts:
| title | date | content |
| First Post | 2009-03-25 | My First Post |
| Second Post | 2009-03-26 | My Second Post |
| Third Post | 2009-03-27 | My Third Post |
| First Post | 3/25/2009 | My First Post |
| Second Post | 3/26/2009 | My Second Post |
| Third Post | 3/27/2009 | My Third Post |
When I run jekyll
Then the _site directory should exist
And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html"
@@ -51,9 +32,9 @@ Feature: Site data
And I have an "index.html" page that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}"
And I have the following posts:
| title | date | content |
| First Post | 2009-03-25 | My First Post |
| Second Post | 2009-03-26 | My Second Post |
| Third Post | 2009-03-27 | My Third Post |
| First Post | 3/25/2009 | My First Post |
| Second Post | 3/26/2009 | My Second Post |
| Third Post | 3/27/2009 | My Third Post |
When I run jekyll
Then the _site directory should exist
And I should see "Third Post Second Post First Post" in "_site/index.html"
@@ -63,8 +44,8 @@ Feature: Site data
And I have an "index.html" page that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}"
And I have the following posts:
| title | date | category | content |
| Awesome Hack | 2009-03-26 | code | puts 'Hello World' |
| Delicious Beer | 2009-03-26 | food | 1) Yuengling |
| Awesome Hack | 3/26/2009 | code | puts 'Hello World' |
| Delicious Beer | 3/26/2009 | food | 1) Yuengling |
When I run jekyll
Then the _site directory should exist
And I should see "Awesome Hack" in "_site/index.html"
@@ -74,7 +55,7 @@ Feature: Site data
And I have an "index.html" page that contains "{% for post in site.tags.beer %} {{ post.content }} {% endfor %}"
And I have the following posts:
| title | date | tag | content |
| Delicious Beer | 2009-03-26 | beer | 1) Yuengling |
| Delicious Beer | 3/26/2009 | beer | 1) Yuengling |
When I run jekyll
Then the _site directory should exist
And I should see "Yuengling" in "_site/index.html"
@@ -84,11 +65,11 @@ Feature: Site data
And I have an "index.html" page that contains "{% for post in site.posts %}{{ post.title }}:{{ post.previous.title}},{{ post.next.title}} {% endfor %}"
And I have the following posts:
| title | date | content |
| first | 2009-02-26 | first |
| A | 2009-03-26 | A |
| B | 2009-03-26 | B |
| C | 2009-03-26 | C |
| last | 2009-04-26 | last |
| first | 2/26/2009 | first |
| A | 3/26/2009 | A |
| B | 3/26/2009 | B |
| C | 3/26/2009 | C |
| last | 4/26/2009 | last |
When I run jekyll
Then the _site directory should exist
And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html"
@@ -99,9 +80,3 @@ Feature: Site data
When I run jekyll
Then the _site directory should exist
And I should see "http://mysite.com" in "_site/index.html"
Scenario: Access Jekyll version via jekyll.version
Given I have an "index.html" page that contains "{{ jekyll.version }}"
When I run jekyll
Then the _site directory should exist
And I should see "\d+\.\d+\.\d+" in "_site/index.html"

View File

@@ -1,17 +1,15 @@
Before do
FileUtils.rm_rf(TEST_DIR)
FileUtils.mkdir(TEST_DIR)
Dir.chdir(TEST_DIR)
end
World(Test::Unit::Assertions)
Given /^I have a blank site in "(.*)"$/ do |path|
FileUtils.mkdir_p(path)
After do
Dir.chdir(TEST_DIR)
FileUtils.rm_rf(TEST_DIR)
end
Given /^I do not have a "(.*)" directory$/ do |path|
File.directory?("#{TEST_DIR}/#{path}")
Given /^I have a blank site in "(.*)"$/ do |path|
FileUtils.mkdir(path)
end
# Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
@@ -23,34 +21,21 @@ Given /^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |
---
#{text}
EOF
f.close
end
end
Given /^I have an? "(.*)" file that contains "(.*)"$/ do |file, text|
File.open(file, 'w') do |f|
f.write(text)
f.close
end
end
Given /^I have an? (.*) (layout|theme) that contains "(.*)"$/ do |name, type, text|
folder = if type == 'layout'
'_layouts'
else
'_theme'
end
destination_file = File.join(folder, name + '.html')
destination_path = File.dirname(destination_file)
unless File.exist?(destination_path)
FileUtils.mkdir_p(destination_path)
end
File.open(destination_file, 'w') do |f|
f.write(text)
end
end
Given /^I have an? "(.*)" file with content:$/ do |file, text|
File.open(file, 'w') do |f|
Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
File.open(File.join('_layouts', layout + '.html'), 'w') do |f|
f.write(text)
f.close
end
end
@@ -58,33 +43,28 @@ Given /^I have an? (.*) directory$/ do |dir|
FileUtils.mkdir_p(dir)
end
Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |status, direction, folder, table|
Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, table|
table.hashes.each do |post|
title = slug(post['title'])
ext = post['type'] || 'textile'
before, after = location(folder, direction)
date = Date.strptime(post['date'], '%m/%d/%Y').strftime('%Y-%m-%d')
title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
if "draft" == status
folder_post = '_drafts'
filename = "#{title}.#{ext}"
elsif "post" == status
parsed_date = Time.xmlschema(post['date']) rescue Time.parse(post['date'])
folder_post = '_posts'
filename = "#{parsed_date.strftime('%Y-%m-%d')}-#{title}.#{ext}"
if direction && direction == "in"
before = folder || '.'
elsif direction && direction == "under"
after = folder || '.'
end
path = File.join(before, folder_post, after, filename)
path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{post['type'] || 'textile'}")
matter_hash = {}
%w(title layout tag tags category categories published author path date permalink).each do |key|
%w(title layout tag tags category categories published author).each do |key|
matter_hash[key] = post[key] if post[key]
end
matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
content = if post['input'] && post['filter']
"{{ #{post['input']} | #{post['filter']} }}"
else
post['content']
content = post['content']
if post['input'] && post['filter']
content = "{{ #{post['input']} | #{post['filter']} }}"
end
File.open(path, 'w') do |f|
@@ -94,6 +74,7 @@ Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |sta
---
#{content}
EOF
f.close
end
end
end
@@ -101,6 +82,7 @@ end
Given /^I have a configuration file with "(.*)" set to "(.*)"$/ do |key, value|
File.open('_config.yml', 'w') do |f|
f.write("#{key}: #{value}\n")
f.close
end
end
@@ -109,6 +91,7 @@ Given /^I have a configuration file with:$/ do |table|
table.hashes.each do |row|
f.write("#{row["key"]}: #{row["value"]}\n")
end
f.close
end
end
@@ -118,6 +101,7 @@ Given /^I have a configuration file with "([^\"]*)" set to:$/ do |key, table|
table.hashes.each do |row|
f.write("- #{row["value"]}\n")
end
f.close
end
end
@@ -126,14 +110,6 @@ When /^I run jekyll$/ do
run_jekyll
end
When /^I run jekyll with drafts$/ do
run_jekyll(:drafts => true)
end
When /^I call jekyll new with test_blank --blank$/ do
call_jekyll_new(:path => "test_blank", :blank => true)
end
When /^I debug jekyll$/ do
run_jekyll(:debug => true)
end
@@ -144,46 +120,26 @@ When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
end
end
When /^I delete the file "(.*)"$/ do |file|
File.delete(file)
end
Then /^the (.*) directory should +exist$/ do |dir|
assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
end
Then /^the (.*) directory should not exist$/ do |dir|
assert !File.directory?(dir), "The directory \"#{dir}\" exists"
Then /^the (.*) directory should exist$/ do |dir|
assert File.directory?(dir)
end
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
assert_match Regexp.new(text), file_contents(file)
assert_match Regexp.new(text), File.open(file).readlines.join
end
Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
assert_equal text, file_contents(file).strip
end
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
assert_no_match Regexp.new(text), file_contents(file)
end
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
assert_match Regexp.new(Regexp.escape(text)), file_contents(file)
end
Then /^the "(.*)" file should +exist$/ do |file|
assert File.file?(file), "The file \"#{file}\" does not exist"
Then /^the "(.*)" file should exist$/ do |file|
assert File.file?(file)
end
Then /^the "(.*)" file should not exist$/ do |file|
assert !File.exists?(file), "The file \"#{file}\" exists"
assert !File.exists?(file)
end
Then /^I should see today's time in "(.*)"$/ do |file|
assert_match Regexp.new(seconds_agnostic_time(Time.now)), file_contents(file)
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.open(file).readlines.join
end
Then /^I should see today's date in "(.*)"$/ do |file|
assert_match Regexp.new(Date.today.to_s), file_contents(file)
assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join
end

View File

@@ -1,75 +1,19 @@
if RUBY_VERSION > '1.9'
require 'coveralls'
Coveralls.wear_merged!
end
require 'fileutils'
require 'rr'
require 'test/unit'
require 'time'
World do
include Test::Unit::Assertions
end
TEST_DIR = File.join('/', 'tmp', 'jekyll')
JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll')
JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll')
def run_jekyll(opts = {})
command = JEKYLL_PATH.clone
command << " build"
command << " --drafts" if opts[:drafts]
command = JEKYLL_PATH
command << " >> /dev/null 2>&1" if opts[:debug].nil?
system command
end
def call_jekyll_new(opts = {})
command = JEKYLL_PATH.clone
command << " new"
command << " #{opts[:path]}" if opts[:path]
command << " --blank" if opts[:blank]
command << " >> /dev/null 2>&1" if opts[:debug].nil?
system command
end
def slug(title)
title.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
end
def location(folder, direction)
if folder
before = folder if direction == "in"
after = folder if direction == "under"
end
[before || '.', after || '.']
end
def file_contents(path)
File.open(path) do |file|
file.readlines.join # avoid differences with \n and \r\n line endings
end
end
def seconds_agnostic_datetime(datetime = Time.now)
pieces = datetime.to_s.split(" ")
if pieces.size == 6 # Ruby 1.8.7
date = pieces[0..2].join(" ")
time = seconds_agnostic_time(pieces[3])
zone = pieces[4..5].join(" ")
else # Ruby 1.9.1 or greater
date, time, zone = pieces
time = seconds_agnostic_time(time)
end
[
Regexp.escape(date),
"#{time}:\\d{2}",
Regexp.escape(zone)
].join("\\ ")
end
def seconds_agnostic_time(time)
if time.is_a? Time
time = time.strftime("%H:%M:%S")
end
hour, minutes, _ = time.split(":")
"#{hour}:#{minutes}"
end
# work around "invalid option: --format" cucumber bug (see #296)
Test::Unit.run = true if RUBY_VERSION < '1.9'
Test::Unit.run = true

View File

@@ -4,9 +4,8 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5'
s.name = 'jekyll'
s.version = '1.3.0'
s.license = 'MIT'
s.date = '2013-11-04'
s.version = '0.10.0'
s.date = '2010-12-16'
s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator."
@@ -19,205 +18,78 @@ Gem::Specification.new do |s|
s.require_paths = %w[lib]
s.executables = ["jekyll"]
s.default_executable = 'jekyll'
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.markdown LICENSE]
s.extra_rdoc_files = %w[README.textile LICENSE]
s.add_runtime_dependency('liquid', "~> 2.5.2")
s.add_runtime_dependency('classifier', "~> 1.3")
s.add_runtime_dependency('listen', "~> 1.3")
s.add_runtime_dependency('maruku', "~> 0.6.0")
s.add_runtime_dependency('pygments.rb', "~> 0.5.0")
s.add_runtime_dependency('commander', "~> 4.1.3")
s.add_runtime_dependency('safe_yaml', "~> 0.9.7")
s.add_runtime_dependency('colorator', "~> 0.1")
s.add_runtime_dependency('redcarpet', "~> 2.3.0")
s.add_runtime_dependency('liquid', ">= 1.9.0")
s.add_runtime_dependency('classifier', ">= 1.3.1")
s.add_runtime_dependency('directory_watcher', ">= 1.1.1")
s.add_runtime_dependency('maruku', ">= 0.5.9")
s.add_runtime_dependency('kramdown', ">= 0.13.2")
s.add_runtime_dependency('albino', ">= 1.3.2")
s.add_development_dependency('rake', "~> 10.1")
s.add_development_dependency('rdoc', "~> 3.11")
s.add_development_dependency('redgreen', "~> 1.2")
s.add_development_dependency('shoulda', "~> 3.3.2")
s.add_development_dependency('rr', "~> 1.1")
s.add_development_dependency('cucumber', "~> 1.3")
s.add_development_dependency('RedCloth', "~> 4.2")
s.add_development_dependency('kramdown', "~> 1.2")
s.add_development_dependency('rdiscount', "~> 1.6")
s.add_development_dependency('launchy', "~> 2.3")
s.add_development_dependency('simplecov', "~> 0.7")
s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
s.add_development_dependency('coveralls', "~> 0.7.0")
s.add_development_dependency('mime-types', "~> 1.5")
s.add_development_dependency('activesupport', '~> 3.2.13')
s.add_development_dependency('jekyll_test_plugin')
s.add_development_dependency('redgreen', ">= 1.2.2")
s.add_development_dependency('shoulda', ">= 2.11.3")
s.add_development_dependency('rr', ">= 1.0.2")
s.add_development_dependency('cucumber', ">= 0.10.0")
s.add_development_dependency('RedCloth', ">= 4.2.1")
s.add_development_dependency('rdiscount', ">= 1.6.5")
# = MANIFEST =
s.files = %w[
CONTRIBUTING.markdown
Gemfile
History.markdown
History.txt
LICENSE
README.markdown
README.textile
Rakefile
bin/jekyll
cucumber.yml
features/create_sites.feature
features/data.feature
features/drafts.feature
features/embed_filters.feature
features/include_tag.feature
features/markdown.feature
features/pagination.feature
features/permalinks.feature
features/post_data.feature
features/post_excerpts.feature
features/site_configuration.feature
features/site_data.feature
features/step_definitions/jekyll_steps.rb
features/support/env.rb
jekyll.gemspec
lib/jekyll.rb
lib/jekyll/cleaner.rb
lib/jekyll/command.rb
lib/jekyll/commands/build.rb
lib/jekyll/commands/doctor.rb
lib/jekyll/commands/new.rb
lib/jekyll/commands/serve.rb
lib/jekyll/configuration.rb
lib/jekyll/albino.rb
lib/jekyll/converter.rb
lib/jekyll/converters/identity.rb
lib/jekyll/converters/markdown.rb
lib/jekyll/converters/markdown/kramdown_parser.rb
lib/jekyll/converters/markdown/maruku_parser.rb
lib/jekyll/converters/markdown/rdiscount_parser.rb
lib/jekyll/converters/markdown/redcarpet_parser.rb
lib/jekyll/converters/textile.rb
lib/jekyll/convertible.rb
lib/jekyll/core_ext.rb
lib/jekyll/deprecator.rb
lib/jekyll/draft.rb
lib/jekyll/errors.rb
lib/jekyll/excerpt.rb
lib/jekyll/filters.rb
lib/jekyll/generator.rb
lib/jekyll/generators/pagination.rb
lib/jekyll/layout.rb
lib/jekyll/mime.types
lib/jekyll/migrators/csv.rb
lib/jekyll/migrators/drupal.rb
lib/jekyll/migrators/marley.rb
lib/jekyll/migrators/mephisto.rb
lib/jekyll/migrators/mt.rb
lib/jekyll/migrators/textpattern.rb
lib/jekyll/migrators/typo.rb
lib/jekyll/migrators/wordpress.com.rb
lib/jekyll/migrators/wordpress.rb
lib/jekyll/page.rb
lib/jekyll/plugin.rb
lib/jekyll/post.rb
lib/jekyll/related_posts.rb
lib/jekyll/site.rb
lib/jekyll/static_file.rb
lib/jekyll/stevenson.rb
lib/jekyll/tags/gist.rb
lib/jekyll/tags/highlight.rb
lib/jekyll/tags/include.rb
lib/jekyll/tags/post_url.rb
lib/jekyll/url.rb
lib/site_template/.gitignore
lib/site_template/_config.yml
lib/site_template/_layouts/default.html
lib/site_template/_layouts/post.html
lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb
lib/site_template/css/main.css
lib/site_template/css/syntax.css
lib/site_template/index.html
script/bootstrap
site/.gitignore
site/CNAME
site/README
site/_config.yml
site/_includes/analytics.html
site/_includes/docs_contents.html
site/_includes/docs_contents_mobile.html
site/_includes/docs_option.html
site/_includes/docs_ul.html
site/_includes/footer.html
site/_includes/header.html
site/_includes/news_contents.html
site/_includes/news_contents_mobile.html
site/_includes/news_item.html
site/_includes/primary-nav-items.html
site/_includes/section_nav.html
site/_includes/top.html
site/_layouts/default.html
site/_layouts/docs.html
site/_layouts/news.html
site/_layouts/news_item.html
site/_posts/2013-05-06-jekyll-1-0-0-released.markdown
site/_posts/2013-05-08-jekyll-1-0-1-released.markdown
site/_posts/2013-05-12-jekyll-1-0-2-released.markdown
site/_posts/2013-06-07-jekyll-1-0-3-released.markdown
site/_posts/2013-07-14-jekyll-1-1-0-released.markdown
site/_posts/2013-07-24-jekyll-1-1-1-released.markdown
site/_posts/2013-07-25-jekyll-1-0-4-released.markdown
site/_posts/2013-07-25-jekyll-1-1-2-released.markdown
site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
site/_posts/2013-09-14-jekyll-1-2-1-released.markdown
site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown
site/_posts/2013-11-04-jekyll-1-3-0-released.markdown
site/css/gridism.css
site/css/normalize.css
site/css/pygments.css
site/css/style.css
site/docs/configuration.md
site/docs/contributing.md
site/docs/datafiles.md
site/docs/deployment-methods.md
site/docs/drafts.md
site/docs/extras.md
site/docs/frontmatter.md
site/docs/github-pages.md
site/docs/heroku.md
site/docs/history.md
site/docs/index.md
site/docs/installation.md
site/docs/migrations.md
site/docs/pages.md
site/docs/pagination.md
site/docs/permalinks.md
site/docs/plugins.md
site/docs/posts.md
site/docs/quickstart.md
site/docs/resources.md
site/docs/sites.md
site/docs/structure.md
site/docs/templates.md
site/docs/troubleshooting.md
site/docs/upgrading.md
site/docs/usage.md
site/docs/variables.md
site/favicon.png
site/feed.xml
site/freenode.txt
site/img/article-footer.png
site/img/footer-arrow.png
site/img/footer-logo.png
site/img/logo-2x.png
site/img/octojekyll.png
site/img/tube.png
site/img/tube1x.png
site/index.html
site/js/modernizr-2.5.3.min.js
site/news/index.html
site/news/releases/index.html
test/fixtures/broken_front_matter1.erb
test/fixtures/broken_front_matter2.erb
test/fixtures/broken_front_matter3.erb
test/fixtures/exploit_front_matter.erb
test/fixtures/front_matter.erb
test/helper.rb
test/source/+/foo.md
test/source/.htaccess
test/source/_data/languages.yml
test/source/_data/members.yaml
test/source/_data/products.yml
test/source/_includes/params.html
test/source/_includes/sig.markdown
test/source/_layouts/default.html
test/source/_layouts/post/simple.html
test/source/_layouts/simple.html
test/source/_plugins/dummy.rb
test/source/_posts/2008-02-02-not-published.textile
test/source/_posts/2008-02-02-published.textile
test/source/_posts/2008-10-18-foo-bar.textile
@@ -241,53 +113,28 @@ Gem::Specification.new do |s|
test/source/_posts/2010-01-09-time-override.textile
test/source/_posts/2010-01-09-timezone-override.textile
test/source/_posts/2010-01-16-override-data.textile
test/source/_posts/2011-04-12-md-extension.md
test/source/_posts/2011-04-12-text-extension.text
test/source/_posts/2013-01-02-post-excerpt.markdown
test/source/_posts/2013-01-12-nil-layout.textile
test/source/_posts/2013-01-12-no-layout.textile
test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep
test/source/_posts/2013-04-11-custom-excerpt.markdown
test/source/_posts/2013-05-10-number-category.textile
test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown
test/source/_posts/2013-08-01-mkdn-extension.mkdn
test/source/_posts/es/2008-11-21-nested.textile
test/source/about.html
test/source/category/_posts/2008-9-23-categories.textile
test/source/contacts.html
test/source/contacts/bar.html
test/source/contacts/index.html
test/source/css/screen.css
test/source/deal.with.dots.html
test/source/foo/_posts/bar/2008-12-12-topical-post.textile
test/source/index.html
test/source/products.yml
test/source/sitemap.xml
test/source/symlink-test/_data
test/source/symlink-test/symlinked-dir
test/source/symlink-test/symlinked-file
test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
test/source/z_category/_posts/2008-9-23-categories.textile
test/suite.rb
test/test_command.rb
test/test_configuration.rb
test/test_convertible.rb
test/test_core_ext.rb
test/test_excerpt.rb
test/test_filters.rb
test/test_generated_site.rb
test/test_kramdown.rb
test/test_new_command.rb
test/test_page.rb
test/test_pager.rb
test/test_post.rb
test/test_rdiscount.rb
test/test_redcarpet.rb
test/test_redcloth.rb
test/test_related_posts.rb
test/test_site.rb
test/test_tags.rb
test/test_url.rb
]
# = MANIFEST =

View File

@@ -18,81 +18,109 @@ require 'rubygems'
# stdlib
require 'fileutils'
require 'time'
require 'safe_yaml'
require 'yaml'
require 'English'
require 'pathname'
# 3rd party
require 'liquid'
require 'maruku'
require 'colorator'
require 'albino'
# internal requires
require 'jekyll/core_ext'
require 'jekyll/stevenson'
require 'jekyll/deprecator'
require 'jekyll/configuration'
require 'jekyll/site'
require 'jekyll/convertible'
require 'jekyll/url'
require 'jekyll/layout'
require 'jekyll/page'
require 'jekyll/post'
require 'jekyll/excerpt'
require 'jekyll/draft'
require 'jekyll/filters'
require 'jekyll/static_file'
require 'jekyll/errors'
require 'jekyll/related_posts'
require 'jekyll/cleaner'
# extensions
require 'jekyll/plugin'
require 'jekyll/converter'
require 'jekyll/generator'
require 'jekyll/command'
require_all 'jekyll/commands'
require_all 'jekyll/converters'
require_all 'jekyll/converters/markdown'
require_all 'jekyll/generators'
require_all 'jekyll/tags'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
VERSION = '1.3.0'
VERSION = '0.10.0'
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.
# Default options. Overriden by values in _config.yml or command-line opts.
# (Strings rather symbols used for compatability with YAML).
DEFAULTS = {
'safe' => false,
'auto' => false,
'server' => false,
'server_port' => 4000,
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'),
'plugins' => File.join(Dir.pwd, '_plugins'),
'future' => true,
'lsi' => false,
'pygments' => false,
'markdown' => 'maruku',
'permalink' => 'date',
'maruku' => {
'use_tex' => false,
'use_divs' => false,
'png_engine' => 'blahtex',
'png_dir' => 'images/latex',
'png_url' => '/images/latex'
},
'rdiscount' => {
'extensions' => []
},
'kramdown' => {
'auto_ids' => true,
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_levels' => '1..6',
'use_coderay' => false,
'coderay' => {
'coderay_wrap' => 'div',
'coderay_line_numbers' => 'inline',
'coderay_line_number_start' => 1,
'coderay_tab_width' => 4,
'coderay_bold_every' => 10,
'coderay_css' => 'style'
}
}
}
# Generate a Jekyll configuration Hash by merging the default options
# with anything in _config.yml, and adding the given options on top.
#
# override - A Hash of config directives that override any options in both
# the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a
# the defaults and the config file. See Jekyll::DEFAULTS for a
# list of option names and their defaults.
#
# Returns the final configuration Hash.
def self.configuration(override)
config = Configuration[Configuration::DEFAULTS]
override = Configuration[override].stringify_keys
config = config.read_config_files(config.config_files(override))
# _config.yml may override default source location, but until
# then, we need to know where to look for _config.yml
source = override['source'] || Jekyll::DEFAULTS['source']
# Get configuration from <source>/_config.yml
config_file = File.join(source, '_config.yml')
begin
config = YAML.load_file(config_file)
raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash)
$stdout.puts "Configuration from #{config_file}"
rescue => err
$stderr.puts "WARNING: Could not read configuration. " +
"Using defaults (and options)."
$stderr.puts "\t" + err.to_s
config = {}
end
# Merge DEFAULTS < _config.yml < override
config = config.deep_merge(override).stringify_keys
set_timezone(config['timezone']) if config['timezone']
config
end
# Static: Set the TZ environment variable to use the timezone specified
#
# timezone - the IANA Time Zone
#
# Returns nothing
def self.set_timezone(timezone)
ENV['TZ'] = timezone
end
def self.logger
@logger ||= Stevenson.new
Jekyll::DEFAULTS.deep_merge(config).deep_merge(override)
end
end

View File

@@ -1,73 +0,0 @@
require 'set'
module Jekyll
class Site
# Handles the cleanup of a site's destination before it is built.
class Cleaner
def initialize(site)
@site = site
end
# Cleans up the site's destination directory
def cleanup!
FileUtils.rm_rf(obsolete_files)
end
private
# Private: The list of files and directories to be deleted during cleanup process
#
# Returns an Array of the file and directory paths
def obsolete_files
(existing_files - new_files - new_dirs + replaced_files).to_a
end
# Private: The list of existing files, apart from those included in keep_files and hidden files.
#
# Returns a Set with the file paths
def existing_files
files = Set.new
Dir.glob(File.join(@site.dest, "**", "*"), File::FNM_DOTMATCH) do |file|
files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex
end
files
end
# Private: The list of files to be created when site is built.
#
# Returns a Set with the file paths
def new_files
files = Set.new
@site.each_site_file { |item| files << item.destination(@site.dest) }
files
end
# Private: The list of directories to be created when site is built.
# These are the parent directories of the files in #new_files.
#
# Returns a Set with the directory paths
def new_dirs
new_files.map { |file| File.dirname(file) }.to_set
end
# Private: The list of existing files that will be replaced by a directory during build
#
# Returns a Set with the file paths
def replaced_files
new_dirs.select { |dir| File.file?(dir) }.to_set
end
# Private: Creates a regular expression from the config's keep_files array
#
# Examples
# ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
#
# Returns the regular expression
def keep_file_regex
or_list = @site.keep_files.join("|")
pattern = "\/(#{or_list.gsub(".", "\.")})"
Regexp.new pattern
end
end
end
end

View File

@@ -1,27 +0,0 @@
module Jekyll
class Command
def self.globs(source, destination)
Dir.chdir(source) do
dirs = Dir['*'].select { |x| File.directory?(x) }
dirs -= [destination, File.expand_path(destination), File.basename(destination)]
dirs = dirs.map { |x| "#{x}/**/*" }
dirs += ['*']
end
end
# Static: Run Site#process and catch errors
#
# site - the Jekyll::Site object
#
# Returns nothing
def self.process_site(site)
site.process
rescue Jekyll::FatalException => e
puts
Jekyll.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
Jekyll.logger.error "", "------------------------------------"
Jekyll.logger.error "", e.message
exit(1)
end
end
end

View File

@@ -1,70 +0,0 @@
module Jekyll
module Commands
class Build < Command
def self.process(options)
site = Jekyll::Site.new(options)
self.build(site, options)
self.watch(site, options) if options['watch']
end
# Private: Build the site from source into destination.
#
# site - A Jekyll::Site instance
# options - A Hash of options passed to the command
#
# Returns nothing.
def self.build(site, options)
source = options['source']
destination = options['destination']
Jekyll.logger.info "Source:", source
Jekyll.logger.info "Destination:", destination
print Jekyll.logger.formatted_topic "Generating..."
self.process_site(site)
puts "done."
end
# Private: Watch for file changes and rebuild the site.
#
# site - A Jekyll::Site instance
# options - A Hash of options passed to the command
#
# Returns nothing.
def self.watch(site, options)
require 'listen'
source = options['source']
destination = options['destination']
begin
dest = Pathname.new(destination).relative_path_from(Pathname.new(source)).to_path
ignored = Regexp.new(Regexp.escape(dest))
rescue ArgumentError
# Destination is outside the source, no need to ignore it.
ignored = nil
end
Jekyll.logger.info "Auto-regeneration:", "enabled"
listener = Listen::Listener.new(source, :ignore => ignored) do |modified, added, removed|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
n = modified.length + added.length + removed.length
print Jekyll.logger.formatted_topic("Regenerating:") + "#{n} files at #{t} "
self.process_site(site)
puts "...done."
end
listener.start
unless options['serving']
trap("INT") do
listener.stop
puts " Halting auto-regeneration."
exit 0
end
loop { sleep 1000 }
end
end
end
end
end

View File

@@ -1,67 +0,0 @@
module Jekyll
module Commands
class Doctor < Command
class << self
def process(options)
site = Jekyll::Site.new(options)
site.read
if healthy?(site)
Jekyll.logger.info "Your test results", "are in. Everything looks fine."
else
abort
end
end
def healthy?(site)
[
!deprecated_relative_permalinks(site),
!conflicting_urls(site)
].all?
end
def deprecated_relative_permalinks(site)
contains_deprecated_pages = false
site.pages.each do |page|
if page.uses_relative_permalinks
Jekyll.logger.warn "Deprecation:", "'#{page.path}' uses relative" +
" permalinks which will be deprecated in" +
" Jekyll v1.2 and beyond."
contains_deprecated_pages = true
end
end
contains_deprecated_pages
end
def conflicting_urls(site)
conflicting_urls = false
urls = {}
urls = collect_urls(urls, site.pages, site.dest)
urls = collect_urls(urls, site.posts, site.dest)
urls.each do |url, paths|
if paths.size > 1
conflicting_urls = true
Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" +
" for the following pages: #{paths.join(", ")}"
end
end
conflicting_urls
end
private
def collect_urls(urls, things, destination)
things.each do |thing|
dest = thing.destination(destination)
if urls[dest]
urls[dest] << thing.path
else
urls[dest] = [thing.path]
end
end
urls
end
end
end
end
end

View File

@@ -1,67 +0,0 @@
require 'erb'
module Jekyll
module Commands
class New < Command
def self.process(args, options = {})
raise ArgumentError.new('You must specify a path.') if args.empty?
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
FileUtils.mkdir_p new_blog_path
if preserve_source_location?(new_blog_path, options)
Jekyll.logger.error "Conflict:", "#{new_blog_path} exists and is not empty."
exit(1)
end
if options[:blank]
create_blank_site new_blog_path
else
create_sample_files new_blog_path
File.open(File.expand_path(self.initialized_post_name, new_blog_path), "w") do |f|
f.write(self.scaffold_post_content)
end
end
puts "New jekyll site installed in #{new_blog_path}."
end
def self.create_blank_site(path)
Dir.chdir(path) do
FileUtils.mkdir(%w(_layouts _posts _drafts))
FileUtils.touch("index.html")
end
end
def self.scaffold_post_content
ERB.new(File.read(File.expand_path(scaffold_path, site_template))).result
end
# Internal: Gets the filename of the sample post to be created
#
# Returns the filename of the sample post, as a String
def self.initialized_post_name
"_posts/#{Time.now.strftime('%Y-%m-%d')}-welcome-to-jekyll.markdown"
end
private
def self.preserve_source_location?(path, options)
!options[:force] && !Dir["#{path}/**/*"].empty?
end
def self.create_sample_files(path)
FileUtils.cp_r site_template + '/.', path
FileUtils.rm File.expand_path(scaffold_path, path)
end
def self.site_template
File.expand_path("../../site_template", File.dirname(__FILE__))
end
def self.scaffold_path
"_posts/0000-00-00-welcome-to-jekyll.markdown.erb"
end
end
end
end

View File

@@ -1,65 +0,0 @@
# -*- encoding: utf-8 -*-
module Jekyll
module Commands
class Serve < Command
def self.process(options)
require 'webrick'
include WEBrick
destination = options['destination']
FileUtils.mkdir_p(destination)
# recreate NondisclosureName under utf-8 circumstance
fh_option = WEBrick::Config::FileHandler
fh_option[:NondisclosureName] = ['.ht*','~*']
s = HTTPServer.new(webrick_options(options))
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination, fh_option)
Jekyll.logger.info "Server address:", "http://#{s.config[:BindAddress]}:#{s.config[:Port]}"
if options['detach'] # detach the server
pid = Process.fork { s.start }
Process.detach(pid)
Jekyll.logger.info "Server detatched with pid '#{pid}'.", "Run `kill -9 #{pid}' to stop the server."
else # create a new server thread, then join it with current terminal
t = Thread.new { s.start }
trap("INT") { s.shutdown }
t.join()
end
end
def self.webrick_options(config)
opts = {
:Port => config['port'],
:BindAddress => config['host'],
:MimeTypes => self.mime_types,
:DoNotReverseLookup => true,
:StartCallback => start_callback(config['detach'])
}
if !config['verbose']
opts.merge!({
:AccessLog => [],
:Logger => Log::new([], Log::WARN)
})
end
opts
end
def self.start_callback(detached)
unless detached
Proc.new { Jekyll.logger.info "Server running...", "press ctrl-c to stop." }
end
end
def self.mime_types
mime_types_file = File.expand_path('../mime.types', File.dirname(__FILE__))
WEBrick::HTTPUtils::load_mime_types(mime_types_file)
end
end
end
end

View File

@@ -1,226 +0,0 @@
# encoding: UTF-8
module Jekyll
class Configuration < Hash
# Default options. Overridden by values in _config.yml.
# Strings rather than symbols are used for compatibility with YAML.
DEFAULTS = {
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'),
'plugins' => '_plugins',
'layouts' => '_layouts',
'data_source' => '_data',
'keep_files' => ['.git','.svn'],
'gems' => [],
'timezone' => nil, # use the local timezone
'encoding' => nil, # use the system encoding
'safe' => false,
'detach' => false, # default to not detaching the server
'show_drafts' => nil,
'limit_posts' => 0,
'lsi' => false,
'future' => true, # remove and make true just default
'pygments' => true,
'relative_permalinks' => true, # backwards-compatibility with < 1.0
# will be set to false once 2.0 hits
'markdown' => 'maruku',
'permalink' => 'date',
'baseurl' => '/',
'include' => ['.htaccess'],
'exclude' => [],
'paginate_path' => '/page:num',
'markdown_ext' => 'markdown,mkd,mkdn,md',
'textile_ext' => 'textile',
'port' => '4000',
'host' => '0.0.0.0',
'excerpt_separator' => "\n\n",
'maruku' => {
'use_tex' => false,
'use_divs' => false,
'png_engine' => 'blahtex',
'png_dir' => 'images/latex',
'png_url' => '/images/latex'
},
'rdiscount' => {
'extensions' => []
},
'redcarpet' => {
'extensions' => []
},
'kramdown' => {
'auto_ids' => true,
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_levels' => '1..6',
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
'use_coderay' => false,
'coderay' => {
'coderay_wrap' => 'div',
'coderay_line_numbers' => 'inline',
'coderay_line_number_start' => 1,
'coderay_tab_width' => 4,
'coderay_bold_every' => 10,
'coderay_css' => 'style'
}
},
'redcloth' => {
'hard_breaks' => true
}
}
# Public: Turn all keys into string
#
# Return a copy of the hash where all its keys are strings
def stringify_keys
reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) }
end
# Public: Directory of the Jekyll source folder
#
# override - the command-line options hash
#
# Returns the path to the Jekyll source directory
def source(override)
override['source'] || self['source'] || DEFAULTS['source']
end
# Public: Generate list of configuration files from the override
#
# override - the command-line options hash
#
# Returns an Array of config files
def config_files(override)
# Get configuration from <source>/_config.yml or <source>/<config_file>
config_files = override.delete('config')
if config_files.to_s.empty?
config_files = File.join(source(override), "_config.yml")
@default_config_file = true
end
config_files = [config_files] unless config_files.is_a? Array
config_files
end
# Public: Read configuration and return merged Hash
#
# file - the path to the YAML file to be read in
#
# Returns this configuration, overridden by the values in the file
def read_config_file(file)
next_config = YAML.safe_load_file(file)
raise ArgumentError.new("Configuration file: (INVALID) #{file}".yellow) if !next_config.is_a?(Hash)
Jekyll.logger.info "Configuration file:", file
next_config
rescue SystemCallError
if @default_config_file
Jekyll.logger.warn "Configuration file:", "none"
{}
else
Jekyll.logger.error "Fatal:", "The configuration file '#{file}' could not be found."
raise LoadError
end
end
# Public: Read in a list of configuration files and merge with this hash
#
# files - the list of configuration file paths
#
# Returns the full configuration, with the defaults overridden by the values in the
# configuration files
def read_config_files(files)
configuration = clone
begin
files.each do |config_file|
new_config = read_config_file(config_file)
configuration = configuration.deep_merge(new_config)
end
rescue ArgumentError => err
Jekyll.logger.warn "WARNING:", "Error reading configuration. " +
"Using defaults (and options)."
$stderr.puts "#{err}"
end
configuration.fix_common_issues.backwards_compatibilize
end
# Public: Split a CSV string into an array containing its values
#
# csv - the string of comma-separated values
#
# Returns an array of the values contained in the CSV
def csv_to_array(csv)
csv.split(",").map(&:strip)
end
# Public: Ensure the proper options are set in the configuration to allow for
# backwards-compatibility with Jekyll pre-1.0
#
# Returns the backwards-compatible configuration
def backwards_compatibilize
config = clone
# Provide backwards-compatibility
if config.has_key?('auto') || config.has_key?('watch')
Jekyll.logger.warn "Deprecation:", "Auto-regeneration can no longer" +
" be set from your configuration file(s). Use the"+
" --watch/-w command-line option instead."
config.delete('auto')
config.delete('watch')
end
if config.has_key? 'server'
Jekyll.logger.warn "Deprecation:", "The 'server' configuration option" +
" is no longer accepted. Use the 'jekyll serve'" +
" subcommand to serve your site with WEBrick."
config.delete('server')
end
if config.has_key? 'server_port'
Jekyll.logger.warn "Deprecation:", "The 'server_port' configuration option" +
" has been renamed to 'port'. Please update your config" +
" file accordingly."
# copy but don't overwrite:
config['port'] = config['server_port'] unless config.has_key?('port')
config.delete('server_port')
end
%w[include exclude].each do |option|
if config.fetch(option, []).is_a?(String)
Jekyll.logger.warn "Deprecation:", "The '#{option}' configuration option" +
" must now be specified as an array, but you specified" +
" a string. For now, we've treated the string you provided" +
" as a list of comma-separated values."
config[option] = csv_to_array(config[option])
end
end
config
end
def fix_common_issues
config = clone
if config.has_key?('paginate') && (!config['paginate'].is_a?(Integer) || config['paginate'] < 1)
Jekyll.logger.warn "Config Warning:", "The `paginate` key must be a" +
" positive integer or nil. It's currently set to '#{config['paginate'].inspect}'."
config['paginate'] = nil
end
config
end
end
end

View File

@@ -1,4 +1,5 @@
module Jekyll
class Converter < Plugin
# Public: Get or set the pygments prefix. When an argument is specified,
# the prefix will be set. If no argument is specified, the current prefix
@@ -45,4 +46,5 @@ module Jekyll
self.class.pygments_suffix
end
end
end
end

View File

@@ -1,21 +1,22 @@
module Jekyll
module Converters
class Identity < Converter
safe true
priority :lowest
class IdentityConverter < Converter
safe true
def matches(ext)
true
end
priority :lowest
def output_ext(ext)
ext
end
def convert(content)
content
end
def matches(ext)
true
end
def output_ext(ext)
ext
end
def convert(content)
content
end
end
end

View File

@@ -1,43 +1,113 @@
module Jekyll
module Converters
class Markdown < Converter
safe true
pygments_prefix "\n"
pygments_suffix "\n"
class MarkdownConverter < Converter
safe true
def setup
return if @setup
@parser = case @config['markdown']
when 'redcarpet'
RedcarpetParser.new @config
when 'kramdown'
KramdownParser.new @config
when 'rdiscount'
RDiscountParser.new @config
when 'maruku'
MarukuParser.new @config
pygments_prefix "\n"
pygments_suffix "\n"
def setup
return if @setup
# Set the Markdown interpreter (and Maruku self.config, if necessary)
case @config['markdown']
when 'kramdown'
begin
require 'kramdown'
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install kramdown'
raise FatalException.new("Missing dependency: kramdown")
end
when 'rdiscount'
begin
require 'rdiscount'
# Load rdiscount extensions
@rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install rdiscount'
raise FatalException.new("Missing dependency: rdiscount")
end
when 'maruku'
begin
require 'maruku'
if @config['maruku']['use_divs']
require 'maruku/ext/div'
STDERR.puts 'Maruku: Using extended syntax for div elements.'
end
if @config['maruku']['use_tex']
require 'maruku/ext/math'
STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
# Switch off MathML output
MaRuKu::Globals[:html_math_output_mathml] = false
MaRuKu::Globals[:html_math_engine] = 'none'
# Turn on math to PNG support with blahtex
# Resulting PNGs stored in `images/latex`
MaRuKu::Globals[:html_math_output_png] = true
MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
end
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install maruku'
raise FatalException.new("Missing dependency: maruku")
end
else
STDERR.puts "Invalid Markdown processor: #{@config['markdown']}"
STDERR.puts " Valid options are [ maruku | rdiscount | kramdown ]"
raise FatalException.new("Invalid Markdown process: #{@config['markdown']}")
end
@setup = true
end
def matches(ext)
ext =~ /(markdown|mkdn?|md)/i
end
def output_ext(ext)
".html"
end
def convert(content)
setup
case @config['markdown']
when 'kramdown'
# Check for use of coderay
if @config['kramdown']['use_coderay']
Kramdown::Document.new(content, {
:auto_ids => @config['kramdown']['auto_ids'],
:footnote_nr => @config['kramdown']['footnote_nr'],
:entity_output => @config['kramdown']['entity_output'],
:toc_levels => @config['kramdown']['toc_levels'],
:coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'],
:coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'],
:coderay_line_number_start => @config['kramdown']['coderay']['coderay_line_number_start'],
:coderay_tab_width => @config['kramdown']['coderay']['coderay_tab_width'],
:coderay_bold_every => @config['kramdown']['coderay']['coderay_bold_every'],
:coderay_css => @config['kramdown']['coderay']['coderay_css']
}).to_html
else
STDERR.puts "Invalid Markdown processor: #{@config['markdown']}"
STDERR.puts " Valid options are [ maruku | rdiscount | kramdown | redcarpet ]"
raise FatalException.new("Invalid Markdown process: #{@config['markdown']}")
end
@setup = true
end
def matches(ext)
rgx = '^\.(' + @config['markdown_ext'].gsub(',','|') +')$'
ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
end
def output_ext(ext)
".html"
end
def convert(content)
setup
@parser.convert(content)
# not using coderay
Kramdown::Document.new(content, {
:auto_ids => @config['kramdown']['auto_ids'],
:footnote_nr => @config['kramdown']['footnote_nr'],
:entity_output => @config['kramdown']['entity_output'],
:toc_levels => @config['kramdown']['toc_levels']
}).to_html
end
when 'rdiscount'
RDiscount.new(content, *@rdiscount_extensions).to_html
when 'maruku'
Maruku.new(content).to_html
end
end
end
end

View File

@@ -1,29 +0,0 @@
module Jekyll
module Converters
class Markdown
class KramdownParser
def initialize(config)
require 'kramdown'
@config = config
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install kramdown'
raise FatalException.new("Missing dependency: kramdown")
end
def convert(content)
# Check for use of coderay
if @config['kramdown']['use_coderay']
%w[wrap line_numbers line_numbers_start tab_width bold_every css default_lang].each do |opt|
key = "coderay_#{opt}"
@config['kramdown'][key] = @config['kramdown']['coderay'][key] unless @config['kramdown'].has_key?(key)
end
end
Kramdown::Document.new(content, @config["kramdown"].symbolize_keys).to_html
end
end
end
end
end

View File

@@ -1,51 +0,0 @@
module Jekyll
module Converters
class Markdown
class MarukuParser
def initialize(config)
require 'maruku'
@config = config
@errors = []
load_divs_library if @config['maruku']['use_divs']
load_blahtext_library if @config['maruku']['use_tex']
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install maruku'
raise FatalException.new("Missing dependency: maruku")
end
def load_divs_library
require 'maruku/ext/div'
STDERR.puts 'Maruku: Using extended syntax for div elements.'
end
def load_blahtext_library
require 'maruku/ext/math'
STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
# Switch off MathML output
MaRuKu::Globals[:html_math_output_mathml] = false
MaRuKu::Globals[:html_math_engine] = 'none'
# Turn on math to PNG support with blahtex
# Resulting PNGs stored in `images/latex`
MaRuKu::Globals[:html_math_output_png] = true
MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
end
def print_errors_and_fail
print @errors.join
raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."
end
def convert(content)
converted = Maruku.new(content, :error_stream => @errors).to_html
print_errors_and_fail unless @errors.empty?
converted
end
end
end
end
end

View File

@@ -1,37 +0,0 @@
module Jekyll
module Converters
class Markdown
class RDiscountParser
def initialize(config)
require 'rdiscount'
@config = config
@rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install rdiscount'
raise FatalException.new("Missing dependency: rdiscount")
end
def convert(content)
rd = RDiscount.new(content, *@rdiscount_extensions)
html = rd.to_html
if @config['rdiscount']['toc_token']
html = replace_generated_toc(rd, html, @config['rdiscount']['toc_token'])
end
html
end
private
def replace_generated_toc(rd, html, toc_token)
if rd.generate_toc && html.include?(toc_token)
utf8_toc = rd.toc_content
utf8_toc.force_encoding('utf-8') if utf8_toc.respond_to?(:force_encoding)
html.gsub(toc_token, utf8_toc)
else
html
end
end
end
end
end
end

View File

@@ -1,70 +0,0 @@
module Jekyll
module Converters
class Markdown
class RedcarpetParser
module CommonMethods
def add_code_tags(code, lang)
code = code.sub(/<pre>/, "<pre><code class=\"#{lang} language-#{lang}\" data-lang=\"#{lang}\">")
code = code.sub(/<\/pre>/,"</code></pre>")
end
end
module WithPygments
include CommonMethods
def block_code(code, lang)
require 'pygments'
lang = lang && lang.split.first || "text"
output = add_code_tags(
Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
lang
)
end
end
module WithoutPygments
require 'cgi'
include CommonMethods
def code_wrap(code)
"<div class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></div>"
end
def block_code(code, lang)
lang = lang && lang.split.first || "text"
output = add_code_tags(code_wrap(code), lang)
end
end
def initialize(config)
require 'redcarpet'
@config = config
@redcarpet_extensions = {}
@config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
@renderer ||= if @config['pygments']
Class.new(Redcarpet::Render::HTML) do
include WithPygments
end
else
Class.new(Redcarpet::Render::HTML) do
include WithoutPygments
end
end
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install redcarpet'
raise FatalException.new("Missing dependency: redcarpet")
end
def convert(content)
@redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
@renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
markdown.render(content)
end
end
end
end
end

View File

@@ -1,50 +1,33 @@
module Jekyll
module Converters
class Textile < Converter
safe true
pygments_prefix '<notextile>'
pygments_suffix '</notextile>'
class TextileConverter < Converter
safe true
def setup
return if @setup
require 'redcloth'
@setup = true
rescue LoadError
STDERR.puts 'You are missing a library required for Textile. Please run:'
STDERR.puts ' $ [sudo] gem install RedCloth'
raise FatalException.new("Missing dependency: RedCloth")
end
pygments_prefix '<notextile>'
pygments_suffix '</notextile>'
def matches(ext)
rgx = '(' + @config['textile_ext'].gsub(',','|') +')'
ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
end
def setup
return if @setup
require 'redcloth'
@setup = true
rescue LoadError
STDERR.puts 'You are missing a library required for Textile. Please run:'
STDERR.puts ' $ [sudo] gem install RedCloth'
raise FatalException.new("Missing dependency: RedCloth")
end
def output_ext(ext)
".html"
end
def matches(ext)
ext =~ /textile/i
end
def convert(content)
setup
def output_ext(ext)
".html"
end
# Shortcut if config doesn't contain RedCloth section
return RedCloth.new(content).to_html if @config['redcloth'].nil?
# List of attributes defined on RedCloth
# (from http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html)
attrs = ['filter_classes', 'filter_html', 'filter_ids', 'filter_styles',
'hard_breaks', 'lite_mode', 'no_span_caps', 'sanitize_html']
r = RedCloth.new(content)
# Set attributes in r if they are NOT nil in the config
attrs.each do |attr|
r.instance_variable_set("@#{attr}".to_sym, @config['redcloth'][attr]) unless @config['redcloth'][attr].nil?
end
r.to_html
end
def convert(content)
setup
RedCloth.new(content).to_html
end
end
end

View File

@@ -1,7 +1,3 @@
# encoding: UTF-8
require 'set'
# Convertible provides methods for converting a pagelike item
# from a certain type of markup into actual content
#
@@ -12,7 +8,6 @@ require 'set'
# self.data=
# self.ext=
# self.output=
# self.name
module Jekyll
module Convertible
# Returns the contents as a String.
@@ -20,31 +15,23 @@ module Jekyll
self.content || ''
end
# Returns merged optin hash for File.read of self.site (if exists)
# and a given param
def merged_file_read_opts(opts)
(self.site ? self.site.file_read_opts : {}).merge(opts)
end
# Read the YAML frontmatter.
#
# base - The String path to the dir containing the file.
# name - The String filename of the file.
# opts - optional parameter to File.read, default at site configs
#
# Returns nothing.
def read_yaml(base, name, opts = {})
begin
self.content = File.read_with_options(File.join(base, name),
merged_file_read_opts(opts))
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
self.data = YAML.safe_load($1)
def read_yaml(base, name)
self.content = File.read(File.join(base, name))
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
begin
self.data = YAML.load($1)
rescue => e
puts "YAML Exception: #{e.message}"
end
rescue SyntaxError => e
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
rescue Exception => e
puts "Error reading file #{File.join(base, name)}: #{e.message}"
end
self.data ||= {}
@@ -55,10 +42,6 @@ module Jekyll
# Returns nothing.
def transform
self.content = converter.convert(self.content)
rescue => e
Jekyll.logger.error "Conversion error:", "There was an error converting" +
" '#{self.path}'."
raise e
end
# Determine the extension depending on content_type.
@@ -77,63 +60,6 @@ module Jekyll
@converter ||= self.site.converters.find { |c| c.matches(self.ext) }
end
# Render Liquid in the content
#
# content - the raw Liquid content to render
# payload - the payload for Liquid
# info - the info for Liquid
#
# Returns the converted content
def render_liquid(content, payload, info, path = nil)
Liquid::Template.parse(content).render!(payload, info)
rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}"
raise e
rescue Exception => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}"
raise e
end
# Convert this Convertible's data to a Hash suitable for use by Liquid.
#
# Returns the Hash representation of this Convertible.
def to_liquid(attrs = nil)
further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map { |attribute|
[attribute, send(attribute)]
}]
data.deep_merge(further_data)
end
# Recursively render layouts
#
# layouts - a list of the layouts
# payload - the payload for Liquid
# info - the info for Liquid
#
# Returns nothing
def render_all_layouts(layouts, payload, info)
# recursively render layouts
layout = layouts[self.data["layout"]]
used = Set.new([layout])
while layout
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
self.output = self.render_liquid(layout.content,
payload,
info,
File.join(self.site.config['layouts'], layout.name))
if layout = layouts[layout.data["layout"]]
if used.include?(layout)
layout = nil # avoid recursive chain
else
used << layout
end
end
end
end
# Add any necessary layouts to this convertible document.
#
# payload - The site payload Hash.
@@ -141,33 +67,35 @@ module Jekyll
#
# Returns nothing.
def do_layout(payload, layouts)
info = { :filters => [Jekyll::Filters], :registers => { :site => self.site, :page => payload['page'] } }
info = { :filters => [Jekyll::Filters], :registers => { :site => self.site } }
# render and transform content (this becomes the final content of the object)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix
self.content = self.render_liquid(self.content,
payload,
info)
begin
self.content = Liquid::Template.parse(self.content).render(payload, info)
rescue => e
puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
end
self.transform
# output keeps track of what will finally be written
self.output = self.content
self.render_all_layouts(layouts, payload, info)
end
# recursively render layouts
layout = layouts[self.data["layout"]]
while layout
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
# Write the generated page file to the destination directory.
#
# dest - The String path to the destination dir.
#
# Returns nothing.
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'wb') do |f|
f.write(self.output)
begin
self.output = Liquid::Template.parse(layout.content).render(payload, info)
rescue => e
puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
end
layout = layouts[layout.data["layout"]]
end
end
end

View File

@@ -24,7 +24,7 @@ class Hash
# and then the plural key, and handling any nil entries.
# +hash+ the hash to read from
# +singular_key+ the singular key
# +plural_key+ the plural key
# +plural_key+ the singular key
#
# Returns an array
def pluralized_array(singular_key, plural_key)
@@ -41,17 +41,6 @@ class Hash
end
array || []
end
def symbolize_keys!
keys.each do |key|
self[(key.to_sym rescue key) || key] = delete(key)
end
self
end
def symbolize_keys
dup.symbolize_keys!
end
end
# Thanks, ActiveSupport!
@@ -61,26 +50,3 @@ class Date
strftime("%Y-%m-%dT%H:%M:%S%Z")
end if RUBY_VERSION < '1.9'
end
module Enumerable
# Returns true if path matches against any glob pattern.
# Look for more detail about glob pattern in method File::fnmatch.
def glob_include?(e)
any? { |exp| File.fnmatch?(exp, e) }
end
end
# Ruby 1.8's File.read don't support option.
# read_with_options ignore optional parameter for 1.8,
# and act as alias for 1.9 or later.
class File
if RUBY_VERSION < '1.9'
def self.read_with_options(path, opts = {})
self.read(path)
end
else
def self.read_with_options(path, opts = {})
self.read(path, opts)
end
end
end

View File

@@ -1,36 +0,0 @@
module Jekyll
class Deprecator
def self.process(args)
no_subcommand(args)
arg_is_present? args, "--server", "The --server command has been replaced by the \
'serve' subcommand."
arg_is_present? args, "--no-server", "To build Jekyll without launching a server, \
use the 'build' subcommand."
arg_is_present? args, "--auto", "The switch '--auto' has been replaced with '--watch'."
arg_is_present? args, "--no-auto", "To disable auto-replication, simply leave off \
the '--watch' switch."
arg_is_present? args, "--pygments", "The 'pygments' setting can only be set in \
your config files."
arg_is_present? args, "--paginate", "The 'paginate' setting can only be set in your \
config files."
arg_is_present? args, "--url", "The 'url' setting can only be set in your config files."
end
def self.no_subcommand(args)
if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
Jekyll.logger.error "Deprecation:", "Jekyll now uses subcommands instead of just \
switches. Run `jekyll help' to find out more."
end
end
def self.arg_is_present?(args, deprecated_argument, message)
if args.include?(deprecated_argument)
deprecation_message(message)
end
end
def self.deprecation_message(message)
Jekyll.logger.error "Deprecation:", message
end
end
end

View File

@@ -1,35 +0,0 @@
module Jekyll
class Draft < Post
# Valid post name regex (no date)
MATCHER = /^(.*)(\.[^.]+)$/
# Draft name validator. Draft filenames must be like:
# my-awesome-post.textile
#
# Returns true if valid, false if not.
def self.valid?(name)
name =~ MATCHER
end
# Get the full path to the directory containing the draft files
def containing_dir(source, dir)
File.join(source, dir, '_drafts')
end
# Extract information from the post filename.
#
# name - The String filename of the post file.
#
# Returns nothing.
def process(name)
m, slug, ext = *name.match(MATCHER)
self.date = File.mtime(File.join(@base, name))
self.slug = slug
self.ext = ext
end
end
end

View File

@@ -1,4 +1,6 @@
module Jekyll
class FatalException < StandardError
end
end
end

View File

@@ -1,113 +0,0 @@
module Jekyll
class Excerpt
include Convertible
attr_accessor :post
attr_accessor :content, :output, :ext
# Initialize this Post instance.
#
# site - The Site.
# base - The String path to the dir containing the post file.
# name - The String filename of the post file.
#
# Returns the new Post.
def initialize(post)
self.post = post
self.content = extract_excerpt(post.content)
end
%w[site name ext].each do |meth|
define_method(meth) do
post.send(meth)
end
end
def to_liquid
post.to_liquid(Post::EXCERPT_ATTRIBUTES_FOR_LIQUID)
end
# Fetch YAML front-matter data from related post, without layout key
#
# Returns Hash of post data
def data
@data ||= post.data.dup
@data.delete("layout")
@data
end
# 'Path' of the excerpt.
#
# Returns the path for the post this excerpt belongs to with #excerpt appended
def path
File.join(post.path, "#excerpt")
end
# Check if excerpt includes a string
#
# Returns true if the string passed in
def include?(something)
(self.output && self.output.include?(something)) || self.content.include?(something)
end
# The UID for this post (useful in feeds).
# e.g. /2008/11/05/my-awesome-post
#
# Returns the String UID.
def id
File.join(post.dir, post.slug, "#excerpt")
end
def to_s
self.output || self.content
end
# Returns the shorthand String identifier of this Post.
def inspect
"<Excerpt: #{self.id}>"
end
protected
# Internal: Extract excerpt from the content
#
# By default excerpt is your first paragraph of a post: everything before
# the first two new lines:
#
# ---
# title: Example
# ---
#
# First paragraph with [link][1].
#
# Second paragraph.
#
# [1]: http://example.com/
#
# This is fairly good option for Markdown and Textile files. But might cause
# problems for HTML posts (which is quite unusual for Jekyll). If default
# excerpt delimiter is not good for you, you might want to set your own via
# configuration option `excerpt_separator`. For example, following is a good
# alternative for HTML posts:
#
# # file: _config.yml
# excerpt_separator: "<!-- more -->"
#
# Notice that all markdown-style link references will be appended to the
# excerpt. So the example post above will have this excerpt source:
#
# First paragraph with [link][1].
#
# [1]: http://example.com/
#
# Excerpts are rendered same time as content is rendered.
#
# Returns excerpt String
def extract_excerpt(post_content)
separator = site.config['excerpt_separator']
head, _, tail = post_content.partition(separator)
"" << head << "\n\n" << tail.scan(/^\[[^\]]+\]:.+$/).join("\n")
end
end
end

View File

@@ -1,140 +1,40 @@
require 'uri'
require 'json'
module Jekyll
module Filters
# Convert a Textile string into HTML output.
#
# input - The Textile String to convert.
#
# Returns the HTML formatted String.
def textilize(input)
site = @context.registers[:site]
converter = site.getConverterImpl(Jekyll::Converters::Textile)
converter.convert(input)
TextileConverter.new.convert(input)
end
# Convert a Markdown string into HTML output.
#
# input - The Markdown String to convert.
#
# Returns the HTML formatted String.
def markdownify(input)
site = @context.registers[:site]
converter = site.getConverterImpl(Jekyll::Converters::Markdown)
converter.convert(input)
end
# Format a date in short format e.g. "27 Jan 2011".
#
# date - the Time to format.
#
# Returns the formatting String.
def date_to_string(date)
time(date).strftime("%d %b %Y")
date.strftime("%d %b %Y")
end
# Format a date in long format e.g. "27 January 2011".
#
# date - The Time to format.
#
# Returns the formatted String.
def date_to_long_string(date)
time(date).strftime("%d %B %Y")
date.strftime("%d %B %Y")
end
# Format a date for use in XML.
#
# date - The Time to format.
#
# Examples
#
# date_to_xmlschema(Time.now)
# # => "2011-04-24T20:34:46+08:00"
#
# Returns the formatted String.
def date_to_xmlschema(date)
time(date).xmlschema
date.xmlschema
end
# Format a date according to RFC-822
#
# date - The Time to format.
#
# Examples
#
# date_to_rfc822(Time.now)
# # => "Sun, 24 Apr 2011 12:34:46 +0000"
#
# Returns the formatted String.
def date_to_rfc822(date)
time(date).rfc822
end
# XML escape a string for use. Replaces any special characters with
# appropriate HTML entity replacements.
#
# input - The String to escape.
#
# Examples
#
# xml_escape('foo "bar" <baz>')
# # => "foo &quot;bar&quot; &lt;baz&gt;"
#
# Returns the escaped String.
def xml_escape(input)
CGI.escapeHTML(input)
end
# CGI escape a string for use in a URL. Replaces any special characters
# with appropriate %XX replacements.
#
# input - The String to escape.
#
# Examples
#
# cgi_escape('foo,bar;baz?')
# # => "foo%2Cbar%3Bbaz%3F"
#
# Returns the escaped String.
def cgi_escape(input)
CGI::escape(input)
end
# URI escape a string.
#
# input - The String to escape.
#
# Examples
#
# uri_escape('foo, bar \\baz?')
# # => "foo,%20bar%20%5Cbaz?"
#
# Returns the escaped String.
def uri_escape(input)
URI.escape(input)
end
# Count the number of words in the input string.
#
# input - The String on which to operate.
#
# Returns the Integer word count.
def number_of_words(input)
input.split.length
end
# Join an array of things into a string by separating with commes and the
# word "and" for the last one.
#
# array - The Array of Strings to join.
#
# Examples
#
# array_to_sentence_string(["apples", "oranges", "grapes"])
# # => "apples, oranges, and grapes"
#
# Returns the formatted String.
def array_to_sentence_string(array)
connector = "and"
case array.length
@@ -149,26 +49,5 @@ module Jekyll
end
end
# Convert the input into json string
#
# input - The Array or Hash to be converted
#
# Returns the converted json string
def jsonify(input)
input.to_json
end
private
def time(input)
case input
when Time
input
when String
Time.parse(input)
else
Jekyll.logger.error "Invalid Date:", "'#{input}' is not a valid datetime."
exit(1)
end
end
end
end

View File

@@ -1,4 +1,7 @@
module Jekyll
class Generator < Plugin
end
end
end

View File

@@ -1,182 +1,60 @@
module Jekyll
module Generators
class Pagination < Generator
# This generator is safe from arbitrary code execution.
safe true
# Generate paginated pages if necessary.
#
# site - The Site.
#
# Returns nothing.
def generate(site)
if Pager.pagination_enabled?(site)
if template = template_page(site)
paginate(site, template)
else
Jekyll.logger.warn "Pagination:", "Pagination is enabled, but I couldn't find" +
"an index.html page to use as the pagination template. Skipping pagination."
end
end
end
class Pagination < Generator
safe true
# Paginates the blog's posts. Renders the index.html file into paginated
# directories, e.g.: page2/index.html, page3/index.html, etc and adds more
# site-wide data.
#
# site - The Site.
# page - The index.html Page that requires pagination.
#
# {"paginator" => { "page" => <Number>,
# "per_page" => <Number>,
# "posts" => [<Post>],
# "total_posts" => <Number>,
# "total_pages" => <Number>,
# "previous_page" => <Number>,
# "next_page" => <Number> }}
def paginate(site, page)
all_posts = site.site_payload['site']['posts']
pages = Pager.calculate_pages(all_posts, site.config['paginate'].to_i)
(1..pages).each do |num_page|
pager = Pager.new(site, num_page, all_posts, pages)
if num_page > 1
newpage = Page.new(site, site.source, page.dir, page.name)
newpage.pager = pager
newpage.dir = Pager.paginate_path(site, num_page)
site.pages << newpage
else
page.pager = pager
end
end
end
# Static: Fetch the URL of the template page. Used to determine the
# path to the first pager in the series.
#
# site - the Jekyll::Site object
#
# Returns the url of the template page
def self.first_page_url(site)
if page = Pagination.new.template_page(site)
page.url
else
nil
end
end
# Public: Find the Jekyll::Page which will act as the pager template
#
# site - the Jekyll::Site object
#
# Returns the Jekyll::Page which will act as the pager template
def template_page(site)
site.pages.dup.select do |page|
Pager.pagination_candidate?(site.config, page)
end.sort do |one, two|
two.path.size <=> one.path.size
end.first
def generate(site)
site.pages.dup.each do |page|
paginate(site, page) if Pager.pagination_enabled?(site.config, page.name)
end
end
# Paginates the blog's posts. Renders the index.html file into paginated
# directories, ie: page2/index.html, page3/index.html, etc and adds more
# site-wide data.
# +page+ is the index.html Page that requires pagination
#
# {"paginator" => { "page" => <Number>,
# "per_page" => <Number>,
# "posts" => [<Post>],
# "total_posts" => <Number>,
# "total_pages" => <Number>,
# "previous_page" => <Number>,
# "next_page" => <Number> }}
def paginate(site, page)
all_posts = site.site_payload['site']['posts']
pages = Pager.calculate_pages(all_posts, site.config['paginate'].to_i)
(1..pages).each do |num_page|
pager = Pager.new(site.config, num_page, all_posts, pages)
if num_page > 1
newpage = Page.new(site, site.source, page.dir, page.name)
newpage.pager = pager
newpage.dir = File.join(page.dir, "page#{num_page}")
site.pages << newpage
else
page.pager = pager
end
end
end
end
class Pager
attr_reader :page, :per_page, :posts, :total_posts, :total_pages,
:previous_page, :previous_page_path, :next_page, :next_page_path
attr_reader :page, :per_page, :posts, :total_posts, :total_pages, :previous_page, :next_page
# Calculate the number of pages.
#
# all_posts - The Array of all Posts.
# per_page - The Integer of entries per page.
#
# Returns the Integer number of pages.
def self.calculate_pages(all_posts, per_page)
(all_posts.size.to_f / per_page.to_i).ceil
num_pages = all_posts.size / per_page.to_i
num_pages = num_pages + 1 if all_posts.size % per_page.to_i != 0
num_pages
end
# Determine if pagination is enabled the site.
#
# site - the Jekyll::Site object
#
# Returns true if pagination is enabled, false otherwise.
def self.pagination_enabled?(site)
!site.config['paginate'].nil? &&
site.pages.size > 0
def self.pagination_enabled?(config, file)
file == 'index.html' && !config['paginate'].nil?
end
# Static: Determine if a page is a possible candidate to be a template page.
# Page's name must be `index.html` and exist in any of the directories
# between the site source and `paginate_path`.
#
# config - the site configuration hash
# page - the Jekyll::Page about which we're inquiring
#
# Returns true if the
def self.pagination_candidate?(config, page)
page_dir = File.dirname(File.expand_path(remove_leading_slash(page.path), config['source']))
paginate_path = remove_leading_slash(config['paginate_path'])
paginate_path = File.expand_path(paginate_path, config['source'])
page.name == 'index.html' &&
in_hierarchy(config['source'], page_dir, File.dirname(paginate_path))
end
# Determine if the subdirectories of the two paths are the same relative to source
#
# source - the site source
# page_dir - the directory of the Jekyll::Page
# paginate_path - the absolute paginate path (from root of FS)
#
# Returns whether the subdirectories are the same relative to source
def self.in_hierarchy(source, page_dir, paginate_path)
return false if paginate_path == File.dirname(paginate_path)
return false if paginate_path == Pathname.new(source).parent
page_dir == paginate_path ||
in_hierarchy(source, page_dir, File.dirname(paginate_path))
end
# Static: Return the pagination path of the page
#
# site - the Jekyll::Site object
# num_page - the pagination page number
#
# Returns the pagination path as a string
def self.paginate_path(site, num_page)
return nil if num_page.nil?
return Generators::Pagination.first_page_url(site) if num_page <= 1
format = site.config['paginate_path']
format = format.sub(':num', num_page.to_s)
ensure_leading_slash(format)
end
# Static: Return a String version of the input which has a leading slash.
# If the input already has a forward slash in position zero, it will be
# returned unchanged.
#
# path - a String path
#
# Returns the path with a leading slash
def self.ensure_leading_slash(path)
path[0..0] == "/" ? path : "/#{path}"
end
# Static: Return a String version of the input without a leading slash.
#
# path - a String path
#
# Returns the input without the leading slash
def self.remove_leading_slash(path)
ensure_leading_slash(path)[1..-1]
end
# Initialize a new Pager.
#
# site - the Jekyll::Site object
# page - The Integer page number.
# all_posts - The Array of all the site's Posts.
# num_pages - The Integer number of pages or nil if you'd like the number
# of pages calculated.
def initialize(site, page, all_posts, num_pages = nil)
def initialize(config, page, all_posts, num_pages = nil)
@page = page
@per_page = site.config['paginate'].to_i
@per_page = config['paginate'].to_i
@total_pages = num_pages || Pager.calculate_pages(all_posts, @per_page)
if @page > @total_pages
@@ -189,14 +67,9 @@ module Jekyll
@total_posts = all_posts.size
@posts = all_posts[init..offset]
@previous_page = @page != 1 ? @page - 1 : nil
@previous_page_path = Pager.paginate_path(site, @previous_page)
@next_page = @page != @total_pages ? @page + 1 : nil
@next_page_path = Pager.paginate_path(site, @next_page)
end
# Convert this Pager's data to a Hash suitable for use by Liquid.
#
# Returns the Hash representation of this Pager.
def to_liquid
{
'page' => page,
@@ -205,10 +78,10 @@ module Jekyll
'total_posts' => total_posts,
'total_pages' => total_pages,
'previous_page' => previous_page,
'previous_page_path' => previous_page_path,
'next_page' => next_page,
'next_page_path' => next_page_path
'next_page' => next_page
}
end
end
end

View File

@@ -1,27 +1,18 @@
module Jekyll
class Layout
include Convertible
# Gets the Site object.
attr_reader :site
# Gets the name of this layout.
attr_reader :name
# Gets/Sets the extension of this layout.
attr_accessor :site
attr_accessor :ext
# Gets/Sets the Hash that holds the metadata for this layout.
attr_accessor :data
# Gets/Sets the content of this layout.
attr_accessor :content
attr_accessor :data, :content
# Initialize a new Layout.
# +site+ is the Site
# +base+ is the String path to the <source>
# +name+ is the String filename of the post file
#
# site - The Site.
# base - The String path to the source.
# name - The String filename of the post file.
# Returns <Page>
def initialize(site, base, name)
@site = site
@base = base
@@ -33,13 +24,13 @@ module Jekyll
self.read_yaml(base, name)
end
# Extract information from the layout filename.
# Extract information from the layout filename
# +name+ is the String filename of the layout file
#
# name - The String filename of the layout file.
#
# Returns nothing.
# Returns nothing
def process(name)
self.ext = File.extname(name)
end
end
end
end

View File

@@ -0,0 +1,26 @@
module Jekyll
module CSV
#Reads a csv with title, permalink, body, published_at, and filter.
#It creates a post file for each row in the csv
def self.process(file = "posts.csv")
FileUtils.mkdir_p "_posts"
posts = 0
FasterCSV.foreach(file) do |row|
next if row[0] == "title"
posts += 1
name = row[3].split(" ")[0]+"-"+row[1]+(row[4] =~ /markdown/ ? ".markdown" : ".textile")
File.open("_posts/#{name}", "w") do |f|
f.puts <<-HEADER
---
layout: post
title: #{row[0]}
---
HEADER
f.puts row[2]
end
end
"Created #{posts} posts!"
end
end
end

View File

@@ -0,0 +1,86 @@
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
module Jekyll
module Drupal
# Reads a MySQL database via Sequel and creates a post file for each
# post in wp_posts that has post_status = 'publish'.
# This restriction is made because 'draft' posts are not guaranteed to
# have valid dates.
QUERY = "SELECT node.nid, node.title, node_revisions.body, node.created, node.status FROM node, node_revisions WHERE (node.type = 'blog' OR node.type = 'story') AND node.vid = node_revisions.vid"
def self.process(dbname, user, pass, host = 'localhost')
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
FileUtils.mkdir_p "_posts"
FileUtils.mkdir_p "_drafts"
# Create the refresh layout
# Change the refresh url if you customized your permalink config
File.open("_layouts/refresh.html", "w") do |f|
f.puts <<EOF
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;url={{ page.refresh_to_post_id }}.html" />
</head>
</html>
EOF
end
db[QUERY].each do |post|
# Get required fields and construct Jekyll compatible name
node_id = post[:nid]
title = post[:title]
content = post[:body]
created = post[:created]
time = Time.at(created)
is_published = post[:status] == 1
dir = is_published ? "_posts" : "_drafts"
slug = title.strip.downcase.gsub(/(&|&amp;)/, ' and ').gsub(/[\s\.\/\\]/, '-').gsub(/[^\w-]/, '').gsub(/[-_]{2,}/, '-').gsub(/^[-_]/, '').gsub(/[-_]$/, '')
name = time.strftime("%Y-%m-%d-") + slug + '.md'
# Get the relevant fields as a hash, delete empty fields and convert
# to YAML for the header
data = {
'layout' => 'post',
'title' => title.to_s,
'created' => created,
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
# Write out the data and content to file
File.open("#{dir}/#{name}", "w") do |f|
f.puts data
f.puts "---"
f.puts content
end
# Make a file to redirect from the old Drupal URL
if is_published
FileUtils.mkdir_p "node/#{node_id}"
File.open("node/#{node_id}/index.md", "w") do |f|
f.puts "---"
f.puts "layout: refresh"
f.puts "refresh_to_post_id: /#{time.strftime("%Y/%m/%d/") + slug}"
f.puts "---"
end
end
end
# TODO: Make dirs & files for nodes of type 'page'
# Make refresh pages for these as well
# TODO: Make refresh dirs & files according to entries in url_alias table
end
end
end

View File

@@ -0,0 +1,53 @@
require 'yaml'
require 'fileutils'
module Jekyll
module Marley
def self.regexp
{ :id => /^\d{0,4}-{0,1}(.*)$/,
:title => /^#\s*(.*)\s+$/,
:title_with_date => /^#\s*(.*)\s+\(([0-9\/]+)\)$/,
:published_on => /.*\s+\(([0-9\/]+)\)$/,
:perex => /^([^\#\n]+\n)$/,
:meta => /^\{\{\n(.*)\}\}\n$/mi # Multiline Regexp
}
end
def self.process(marley_data_dir)
raise ArgumentError, "marley dir #{marley_data_dir} not found" unless File.directory?(marley_data_dir)
FileUtils.mkdir_p "_posts"
posts = 0
Dir["#{marley_data_dir}/**/*.txt"].each do |f|
next unless File.exists?(f)
#copied over from marley's app/lib/post.rb
file_content = File.read(f)
meta_content = file_content.slice!( self.regexp[:meta] )
body = file_content.sub( self.regexp[:title], '').sub( self.regexp[:perex], '').strip
title = file_content.scan( self.regexp[:title] ).first.to_s.strip
prerex = file_content.scan( self.regexp[:perex] ).first.to_s.strip
published_on = DateTime.parse( post[:published_on] ) rescue File.mtime( File.dirname(f) )
meta = ( meta_content ) ? YAML::load( meta_content.scan( self.regexp[:meta]).to_s ) : {}
meta['title'] = title
meta['layout'] = 'post'
formatted_date = published_on.strftime('%Y-%m-%d')
post_name = File.dirname(f).split(%r{/}).last.gsub(/\A\d+-/, '')
name = "#{formatted_date}-#{post_name}"
File.open("_posts/#{name}.markdown", "w") do |f|
f.puts meta.to_yaml
f.puts "---\n"
f.puts "\n#{prerex}\n\n" if prerex
f.puts body
end
posts += 1
end
"Created #{posts} posts!"
end
end
end

View File

@@ -0,0 +1,79 @@
# Quickly hacked together my Michael Ivey
# Based on mt.rb by Nick Gerakines, open source and publically
# available under the MIT license. Use this module at your own risk.
require 'rubygems'
require 'sequel'
require 'fastercsv'
require 'fileutils'
require File.join(File.dirname(__FILE__),"csv.rb")
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
module Jekyll
module Mephisto
#Accepts a hash with database config variables, exports mephisto posts into a csv
#export PGPASSWORD if you must
def self.postgres(c)
sql = <<-SQL
BEGIN;
CREATE TEMP TABLE jekyll AS
SELECT title, permalink, body, published_at, filter FROM contents
WHERE user_id = 1 AND type = 'Article' ORDER BY published_at;
COPY jekyll TO STDOUT WITH CSV HEADER;
ROLLBACK;
SQL
command = %Q(psql -h #{c[:host] || "localhost"} -c "#{sql.strip}" #{c[:database]} #{c[:username]} -o #{c[:filename] || "posts.csv"})
puts command
`#{command}`
CSV.process
end
# This query will pull blog posts from all entries across all blogs. If
# you've got unpublished, deleted or otherwise hidden posts please sift
# through the created posts to make sure nothing is accidently published.
QUERY = "SELECT id, permalink, body, published_at, title FROM contents WHERE user_id = 1 AND type = 'Article' AND published_at IS NOT NULL ORDER BY published_at"
def self.process(dbname, user, pass, host = 'localhost')
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
FileUtils.mkdir_p "_posts"
db[QUERY].each do |post|
title = post[:title]
slug = post[:permalink]
date = post[:published_at]
content = post[:body]
# more_content = ''
# Be sure to include the body and extended body.
# if more_content != nil
# content = content + " \n" + more_content
# end
# Ideally, this script would determine the post format (markdown, html
# , etc) and create files with proper extensions. At this point it
# just assumes that markdown will be acceptable.
name = [date.year, date.month, date.day, slug].join('-') + ".markdown"
data = {
'layout' => 'post',
'title' => title.to_s,
'mt_id' => post[:entry_id],
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
File.open("_posts/#{name}", "w") do |f|
f.puts data
f.puts "---"
f.puts content
end
end
end
end
end

View File

@@ -0,0 +1,77 @@
# Created by Nick Gerakines, open source and publically available under the
# MIT license. Use this module at your own risk.
# I'm an Erlang/Perl/C++ guy so please forgive my dirty ruby.
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
module Jekyll
module MT
# This query will pull blog posts from all entries across all blogs. If
# you've got unpublished, deleted or otherwise hidden posts please sift
# through the created posts to make sure nothing is accidently published.
QUERY = "SELECT entry_id, entry_basename, entry_text, entry_text_more, entry_authored_on, entry_title, entry_convert_breaks FROM mt_entry"
def self.process(dbname, user, pass, host = 'localhost')
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
FileUtils.mkdir_p "_posts"
db[QUERY].each do |post|
title = post[:entry_title]
slug = post[:entry_basename].gsub(/_/, '-')
date = post[:entry_authored_on]
content = post[:entry_text]
more_content = post[:entry_text_more]
entry_convert_breaks = post[:entry_convert_breaks]
# Be sure to include the body and extended body.
if more_content != nil
content = content + " \n" + more_content
end
# Ideally, this script would determine the post format (markdown, html
# , etc) and create files with proper extensions. At this point it
# just assumes that markdown will be acceptable.
name = [date.year, date.month, date.day, slug].join('-') + '.' + self.suffix(entry_convert_breaks)
data = {
'layout' => 'post',
'title' => title.to_s,
'mt_id' => post[:entry_id],
'date' => date
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
File.open("_posts/#{name}", "w") do |f|
f.puts data
f.puts "---"
f.puts content
end
end
end
def self.suffix(entry_type)
if entry_type.nil? || entry_type.include?("markdown")
# The markdown plugin I have saves this as "markdown_with_smarty_pants", so I just look for "markdown".
"markdown"
elsif entry_type.include?("textile")
# This is saved as "textile_2" on my installation of MT 5.1.
"textile"
elsif entry_type == "0" || entry_type.include?("richtext")
# richtext looks to me like it's saved as HTML, so I include it here.
"html"
else
# Other values might need custom work.
entry_type
end
end
end
end

View File

@@ -0,0 +1,73 @@
require 'rubygems'
require 'jekyll'
require 'fileutils'
require 'net/http'
require 'uri'
require "json"
# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, blog)'
module Jekyll
module Posterous
def self.fetch(uri_str, limit = 10)
# You should choose better exception.
raise ArgumentError, 'Stuck in a redirect loop. Please double check your email and password' if limit == 0
response = nil
Net::HTTP.start('posterous.com') {|http|
req = Net::HTTP::Get.new(uri_str)
req.basic_auth @email, @pass
response = http.request(req)
}
case response
when Net::HTTPSuccess then response
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
else response.error!
end
end
def self.process(email, pass, blog = 'primary')
@email, @pass = email, pass
@api_token = JSON.parse(self.fetch("/api/2/auth/token").body)['api_token']
FileUtils.mkdir_p "_posts"
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body)
page = 1
while posts.any?
posts.each do |post|
title = post["title"]
slug = title.gsub(/[^[:alnum:]]+/, '-').downcase
date = Date.parse(post["display_date"])
content = post["body_html"]
published = !post["is_private"]
name = "%02d-%02d-%02d-%s.html" % [date.year, date.month, date.day, slug]
# Get the relevant fields as a hash, delete empty fields and convert
# to YAML for the header
data = {
'layout' => 'post',
'title' => title.to_s,
'published' => published
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
# Write out the data and content to file
File.open("_posts/#{name}", "w") do |f|
f.puts data
f.puts "---"
f.puts content
end
end
page += 1
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}&page=#{page}").body)
end
end
end
end

View File

@@ -0,0 +1,50 @@
require 'rubygems'
require 'sequel'
require 'fileutils'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
module Jekyll
module TextPattern
# Reads a MySQL database via Sequel and creates a post file for each post.
# The only posts selected are those with a status of 4 or 5, which means "live"
# and "sticky" respectively.
# Other statuses is 1 => draft, 2 => hidden and 3 => pending
QUERY = "select Title, url_title, Posted, Body, Keywords from textpattern where Status = '4' or Status = '5'"
def self.process(dbname, user, pass, host = 'localhost')
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
FileUtils.mkdir_p "_posts"
db[QUERY].each do |post|
# Get required fields and construct Jekyll compatible name
title = post[:Title]
slug = post[:url_title]
date = post[:Posted]
content = post[:Body]
name = [date.strftime("%Y-%m-%d"), slug].join('-') + ".textile"
# Get the relevant fields as a hash, delete empty fields and convert
# to YAML for the header
data = {
'layout' => 'post',
'title' => title.to_s,
'tags' => post[:Keywords].split(',')
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
# Write out the data and content to file
File.open("_posts/#{name}", "w") do |f|
f.puts data
f.puts "---"
f.puts content
end
end
end
end
end

View File

@@ -0,0 +1,49 @@
# Author: Toby DiPasquale <toby@cbcg.net>
require 'fileutils'
require 'rubygems'
require 'sequel'
module Jekyll
module Typo
# this SQL *should* work for both MySQL and PostgreSQL, but I haven't
# tested PostgreSQL yet (as of 2008-12-16)
SQL = <<-EOS
SELECT c.id id,
c.title title,
c.permalink slug,
c.body body,
c.published_at date,
c.state state,
COALESCE(tf.name, 'html') filter
FROM contents c
LEFT OUTER JOIN text_filters tf
ON c.text_filter_id = tf.id
EOS
def self.process dbname, user, pass, host='localhost'
FileUtils.mkdir_p '_posts'
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
db[SQL].each do |post|
next unless post[:state] =~ /Published/
name = [ sprintf("%.04d", post[:date].year),
sprintf("%.02d", post[:date].month),
sprintf("%.02d", post[:date].day),
post[:slug].strip ].join('-')
# Can have more than one text filter in this field, but we just want
# the first one for this
name += '.' + post[:filter].split(' ')[0]
File.open("_posts/#{name}", 'w') do |f|
f.puts({ 'layout' => 'post',
'title' => post[:title].to_s,
'typo_id' => post[:id]
}.delete_if { |k, v| v.nil? || v == '' }.to_yaml)
f.puts '---'
f.puts post[:body].delete("\r")
end
end
end
end # module Typo
end # module Jekyll

View File

@@ -0,0 +1,56 @@
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
module Jekyll
module WordPress
def self.process(dbname, user, pass, host = 'localhost', table_prefix = 'wp_')
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
FileUtils.mkdir_p "_posts"
# Reads a MySQL database via Sequel and creates a post file for each
# post in wp_posts that has post_status = 'publish'.
# This restriction is made because 'draft' posts are not guaranteed to
# have valid dates.
query = "select post_title, post_name, post_date, post_content, post_excerpt, ID, guid from #{table_prefix}posts where post_status = 'publish' and post_type = 'post'"
db[query].each do |post|
# Get required fields and construct Jekyll compatible name
title = post[:post_title]
slug = post[:post_name]
date = post[:post_date]
content = post[:post_content]
name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, date.day,
slug]
# Get the relevant fields as a hash, delete empty fields and convert
# to YAML for the header
data = {
'layout' => 'post',
'title' => title.to_s,
'excerpt' => post[:post_excerpt].to_s,
'wordpress_id' => post[:ID],
'wordpress_url' => post[:guid],
'date' => date
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
# Write out the data and content to file
File.open("_posts/#{name}", "w") do |f|
f.puts data
f.puts "---"
f.puts content
end
end
end
end
end

View File

@@ -0,0 +1,45 @@
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'yaml'
module Jekyll
# This importer takes a wordpress.xml file,
# which can be exported from your
# wordpress.com blog (/wp-admin/export.php)
module WordpressDotCom
def self.process(filename = "wordpress.xml")
FileUtils.mkdir_p "_posts"
posts = 0
doc = Hpricot::XML(File.read(filename))
(doc/:channel/:item).each do |item|
title = item.at(:title).inner_text.strip
permalink_title = item.at('wp:post_name').inner_text
date = Time.parse(item.at(:pubDate).inner_text)
tags = (item/:category).map{|c| c.inner_text}.reject{|c| c == 'Uncategorized'}.uniq
name = "#{date.strftime('%Y-%m-%d')}-#{permalink_title}.html"
header = {
'layout' => 'post',
'title' => title,
'tags' => tags
}
File.open("_posts/#{name}", "w") do |f|
f.puts header.to_yaml
f.puts '---'
f.puts item.at('content:encoded').inner_text
end
posts += 1
end
puts "Imported #{posts} posts"
end
end
end

View File

@@ -1,85 +0,0 @@
# These are the same MIME types that GitHub Pages uses as of 17 Mar 2013.
text/html html htm shtml
text/css css
text/xml xml rss xsl
image/gif gif
image/jpeg jpeg jpg
application/x-javascript js
application/atom+xml atom
text/mathml mml
text/plain txt
text/vnd.sun.j2me.app-descriptor jad
text/vnd.wap.wml wml
text/x-component htc
text/cache-manifest manifest appcache
text/coffeescript coffee
text/plain pde
text/plain md markdown
image/png png
image/svg+xml svg
image/tiff tif tiff
image/vnd.wap.wbmp wbmp
image/x-icon ico
image/x-jng jng
image/x-ms-bmp bmp
application/json json
application/java-archive jar ear
application/mac-binhex40 hqx
application/msword doc
application/pdf pdf
application/postscript ps eps ai
application/rdf+xml rdf
application/rtf rtf
text/vcard vcf vcard
application/vnd.apple.pkpass pkpass
application/vnd.ms-excel xls
application/vnd.ms-powerpoint ppt
application/vnd.wap.wmlc wmlc
application/xhtml+xml xhtml
application/x-chrome-extension crx
application/x-cocoa cco
application/x-font-ttf ttf
application/x-java-archive-diff jardiff
application/x-java-jnlp-file jnlp
application/x-makeself run
application/x-ns-proxy-autoconfig pac
application/x-perl pl pm
application/x-pilot prc pdb
application/x-rar-compressed rar
application/x-redhat-package-manager rpm
application/x-sea sea
application/x-shockwave-flash swf
application/x-stuffit sit
application/x-tcl tcl tk
application/x-web-app-manifest+json webapp
application/x-x509-ca-cert der pem crt
application/x-xpinstall xpi
application/x-zip war
application/zip zip
application/octet-stream bin exe dll
application/octet-stream deb
application/octet-stream dmg
application/octet-stream eot
application/octet-stream iso img
application/octet-stream msi msp msm
audio/midi mid midi kar
audio/mpeg mp3
audio/x-realaudio ra
audio/ogg ogg
video/3gpp 3gpp 3gp
video/mpeg mpeg mpg
video/quicktime mov
video/x-flv flv
video/x-mng mng
video/x-ms-asf asx asf
video/x-ms-wmv wmv
video/x-msvideo avi
video/ogg ogv
video/webm webm

View File

@@ -1,25 +1,19 @@
module Jekyll
class Page
include Convertible
attr_writer :dir
attr_accessor :site, :pager
attr_accessor :name, :ext, :basename
attr_accessor :name, :ext, :basename, :dir
attr_accessor :data, :content, :output
# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w[
url
content
path
]
# Initialize a new Page.
# +site+ is the Site
# +base+ is the String path to the <source>
# +dir+ is the String path between <source> and the file
# +name+ is the String filename of the file
#
# site - The Site object.
# base - The String path to the source.
# dir - The String path between the source and the file.
# name - The String filename of the file.
# Returns <Page>
def initialize(site, base, dir, name)
@site = site
@base = base
@@ -32,80 +26,68 @@ module Jekyll
# The generated directory into which the page will be placed
# upon generation. This is derived from the permalink or, if
# permalink is absent, we be '/'
# permalink is absent, set to '/'
#
# Returns the String destination directory.
# Returns <String>
def dir
url[-1, 1] == '/' ? url : File.dirname(url)
end
# The full path and filename of the post. Defined in the YAML of the post
# body.
# The full path and filename of the post.
# Defined in the YAML of the post body
# (Optional)
#
# Returns the String permalink or nil if none has been set.
# Returns <String>
def permalink
return nil if self.data.nil? || self.data['permalink'].nil?
if site.config['relative_permalinks']
File.join(@dir, self.data['permalink'])
else
self.data['permalink']
end
self.data && self.data['permalink']
end
# The template of the permalink.
#
# Returns the template String.
def template
if self.site.permalink_style == :pretty
if index? && html?
"/:path/"
elsif html?
"/:path/:basename/"
else
"/:path/:basename:output_ext"
end
if self.site.permalink_style == :pretty && !index? && html?
"/:basename/"
else
"/:path/:basename:output_ext"
"/:basename:output_ext"
end
end
# The generated relative url of this page. e.g. /about.html.
# The generated relative url of this page
# e.g. /about.html
#
# Returns the String url.
# Returns <String>
def url
@url ||= URL.new({
:template => template,
:placeholders => url_placeholders,
:permalink => permalink
}).to_s
return @url if @url
url = if permalink
permalink
else
{
"basename" => self.basename,
"output_ext" => self.output_ext,
}.inject(template) { |result, token|
result.gsub(/:#{token.first}/, token.last)
}.gsub(/\/\//, "/")
end
# sanitize url
@url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
@url += "/" if url =~ /\/$/
@url
end
# Returns a hash of URL placeholder names (as symbols) mapping to the
# desired placeholder replacements. For details see "url.rb"
def url_placeholders
{
:path => @dir,
:basename => self.basename,
:output_ext => self.output_ext
}
end
# Extract information from the page filename.
# Extract information from the page filename
# +name+ is the String filename of the page file
#
# name - The String filename of the page file.
#
# Returns nothing.
# Returns nothing
def process(name)
self.ext = File.extname(name)
self.basename = name[0 .. -self.ext.length-1]
end
# Add any necessary layouts to this post
# +layouts+ is a Hash of {"name" => "layout"}
# +site_payload+ is the site payload hash
#
# layouts - The Hash of {"name" => "layout"}.
# site_payload - The site payload Hash.
#
# Returns nothing.
# Returns nothing
def render(layouts, site_payload)
payload = {
"page" => self.to_liquid,
@@ -115,46 +97,47 @@ module Jekyll
do_layout(payload, layouts)
end
# The path to the source file
#
# Returns the path to the source file
def path
self.data.fetch('path', self.relative_path.sub(/\A\//, ''))
def to_liquid
self.data.deep_merge({
"url" => File.join(@dir, self.url),
"content" => self.content })
end
# The path to the page source file, relative to the site source
def relative_path
File.join(@dir, @name)
end
# Obtain destination path.
# +dest+ is the String path to the destination dir
#
# dest - The String path to the destination dir.
#
# Returns the destination file path String.
# Returns destination file path.
def destination(dest)
path = File.join(dest, self.url)
# The url needs to be unescaped in order to preserve the correct filename
path = File.join(dest, @dir, CGI.unescape(self.url))
path = File.join(path, "index.html") if self.url =~ /\/$/
path
end
# Returns the object as a debug String.
# Write the generated page file to the destination directory.
# +dest+ is the String path to the destination dir
#
# Returns nothing
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') do |f|
f.write(self.output)
end
end
def inspect
"#<Jekyll:Page @name=#{self.name.inspect}>"
end
# Returns the Boolean of whether this Page is HTML or not.
def html?
output_ext == '.html'
end
# Returns the Boolean of whether this Page is an index file or not.
def index?
basename == 'index'
end
def uses_relative_permalinks
permalink && @dir != "" && site.config['relative_permalinks']
end
end
end

View File

@@ -1,4 +1,5 @@
module Jekyll
class Plugin
PRIORITIES = { :lowest => -100,
:low => -10,
@@ -33,7 +34,6 @@ module Jekyll
#
# Returns the Symbol priority.
def self.priority(priority = nil)
@priority ||= nil
if priority && PRIORITIES.has_key?(priority)
@priority = priority
end
@@ -72,4 +72,5 @@ module Jekyll
# no-op for default
end
end
end

View File

@@ -1,144 +1,64 @@
module Jekyll
class Post
include Comparable
include Convertible
# Valid post name regex.
class << self
attr_accessor :lsi
end
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/
EXCERPT_ATTRIBUTES_FOR_LIQUID = %w[
title
url
date
id
categories
next
previous
tags
path
]
# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = EXCERPT_ATTRIBUTES_FOR_LIQUID + %w[
content
excerpt
]
# Post name validator. Post filenames must be like:
# 2008-11-05-my-awesome-post.textile
# 2008-11-05-my-awesome-post.textile
#
# Returns true if valid, false if not.
# Returns <Bool>
def self.valid?(name)
name =~ MATCHER
end
attr_accessor :site
attr_accessor :data, :extracted_excerpt, :content, :output, :ext
attr_accessor :data, :content, :output, :ext
attr_accessor :date, :slug, :published, :tags, :categories
attr_reader :name
# Initialize this Post instance.
# +site+ is the Site
# +base+ is the String path to the dir containing the post file
# +name+ is the String filename of the post file
# +categories+ is an Array of Strings for the categories for this post
#
# site - The Site.
# base - The String path to the dir containing the post file.
# name - The String filename of the post file.
#
# Returns the new Post.
# Returns <Post>
def initialize(site, source, dir, name)
@site = site
@dir = dir
@base = self.containing_dir(source, dir)
@base = File.join(source, dir, '_posts')
@name = name
self.categories = dir.downcase.split('/').reject { |x| x.empty? }
self.categories = dir.split('/').reject { |x| x.empty? }
self.process(name)
self.read_yaml(@base, name)
#If we've added a date and time to the yaml, use that instead of the filename date
#Means we'll sort correctly.
if self.data.has_key?('date')
# ensure Time via to_s and reparse
self.date = Time.parse(self.data["date"].to_s)
end
self.published = self.published?
self.populate_categories
self.populate_tags
end
def published?
if self.data.has_key?('published') && self.data['published'] == false
false
self.published = false
else
true
self.published = true
end
end
def populate_categories
self.tags = self.data.pluralized_array("tag", "tags")
if self.categories.empty?
self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s.downcase}
self.categories = self.data.pluralized_array('category', 'categories')
end
self.categories.flatten!
end
def populate_tags
self.tags = self.data.pluralized_array("tag", "tags").flatten
end
# Get the full path to the directory containing the post files
def containing_dir(source, dir)
return File.join(source, dir, '_posts')
end
# Read the YAML frontmatter.
#
# base - The String path to the dir containing the file.
# name - The String filename of the file.
#
# Returns nothing.
def read_yaml(base, name)
super(base, name)
self.extracted_excerpt = self.extract_excerpt
end
# The post excerpt. This is either a custom excerpt
# set in YAML front matter or the result of extract_excerpt.
#
# Returns excerpt string.
def excerpt
self.data.fetch('excerpt', self.extracted_excerpt.to_s)
end
# Public: the Post title, from the YAML Front-Matter or from the slug
#
# Returns the post title
def title
self.data.fetch("title", self.titleized_slug)
end
# Turns the post slug into a suitable title
def titleized_slug
self.slug.split('-').select {|w| w.capitalize! || w }.join(' ')
end
# Public: the path to the post relative to the site source,
# from the YAML Front-Matter or from a combination of
# the directory it's in, "_posts", and the name of the
# post file
#
# Returns the path to the file relative to the site source
def path
self.data.fetch('path', self.relative_path.sub(/\A\//, ''))
end
# The path to the post source file, relative to the site source
def relative_path
File.join(@dir, '_posts', @name)
end
# Compares Post objects. First compares the Post date. If the dates are
# equal, it compares the Post slugs.
#
# other - The other Post we are comparing to.
# Spaceship is based on Post#date, slug
#
# Returns -1, 0, 1
def <=>(other)
@@ -149,11 +69,10 @@ module Jekyll
return cmp
end
# Extract information from the post filename.
# Extract information from the post filename
# +name+ is the String filename of the post file
#
# name - The String filename of the post file.
#
# Returns nothing.
# Returns nothing
def process(name)
m, cats, date, slug, ext = *name.match(MATCHER)
self.date = Time.parse(date)
@@ -166,17 +85,18 @@ module Jekyll
# The generated directory into which the post will be placed
# upon generation. This is derived from the permalink or, if
# permalink is absent, set to the default date
# e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing.
# e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing
#
# Returns the String directory.
# Returns <String>
def dir
File.dirname(url)
end
# The full path and filename of the post. Defined in the YAML of the post
# body (optional).
# The full path and filename of the post.
# Defined in the YAML of the post body
# (Optional)
#
# Returns the String permalink.
# Returns <String>
def permalink
self.data && self.data['permalink']
end
@@ -189,89 +109,125 @@ module Jekyll
"/:categories/:title.html"
when :date
"/:categories/:year/:month/:day/:title.html"
when :ordinal
"/:categories/:year/:y_day/:title.html"
else
self.site.permalink_style.to_s
end
end
# The generated relative url of this post.
# The generated relative url of this post
# e.g. /2008/11/05/my-awesome-post.html
#
# Returns the String url.
# Returns <String>
def url
@url ||= URL.new({
:template => template,
:placeholders => url_placeholders,
:permalink => permalink
}).to_s
return @url if @url
url = if permalink
permalink
else
{
"year" => date.strftime("%Y"),
"month" => date.strftime("%m"),
"day" => date.strftime("%d"),
"title" => CGI.escape(slug),
"i_day" => date.strftime("%d").to_i.to_s,
"i_month" => date.strftime("%m").to_i.to_s,
"categories" => categories.join('/'),
"output_ext" => self.output_ext
}.inject(template) { |result, token|
result.gsub(/:#{Regexp.escape token.first}/, token.last)
}.gsub(/\/\//, "/")
end
# sanitize url
@url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
@url += "/" if url =~ /\/$/
@url
end
# Returns a hash of URL placeholder names (as symbols) mapping to the
# desired placeholder replacements. For details see "url.rb"
def url_placeholders
{
:year => date.strftime("%Y"),
:month => date.strftime("%m"),
:day => date.strftime("%d"),
:title => CGI.escape(slug),
:i_day => date.strftime("%d").to_i.to_s,
:i_month => date.strftime("%m").to_i.to_s,
:categories => (categories || []).map { |c| URI.escape(c.to_s) }.join('/'),
:short_month => date.strftime("%b"),
:y_day => date.strftime("%j"),
:output_ext => self.output_ext
}
end
# The UID for this post (useful in feeds).
# The UID for this post (useful in feeds)
# e.g. /2008/11/05/my-awesome-post
#
# Returns the String UID.
# Returns <String>
def id
File.join(self.dir, self.slug)
end
# Calculate related posts.
#
# Returns an Array of related Posts.
# Returns [<Post>]
def related_posts(posts)
Jekyll::RelatedPosts.new(self).build
return [] unless posts.size > 1
if self.site.lsi
self.class.lsi ||= begin
puts "Running the classifier... this could take a while."
lsi = Classifier::LSI.new
posts.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) }
puts ""
lsi
end
related = self.class.lsi.find_related(self.content, 11)
related - [self]
else
(posts - [self])[0..9]
end
end
# Add any necessary layouts to this post.
# Add any necessary layouts to this post
# +layouts+ is a Hash of {"name" => "layout"}
# +site_payload+ is the site payload hash
#
# layouts - A Hash of {"name" => "layout"}.
# site_payload - The site payload hash.
#
# Returns nothing.
# Returns nothing
def render(layouts, site_payload)
# construct payload
payload = {
"site" => { "related_posts" => related_posts(site_payload["site"]["posts"]) },
"page" => self.to_liquid(EXCERPT_ATTRIBUTES_FOR_LIQUID)
"page" => self.to_liquid
}.deep_merge(site_payload)
if generate_excerpt?
self.extracted_excerpt.do_layout(payload, {})
end
do_layout(payload.merge({"page" => self.to_liquid}), layouts)
do_layout(payload, layouts)
end
# Obtain destination path.
# +dest+ is the String path to the destination dir
#
# dest - The String path to the destination dir.
#
# Returns destination file path String.
# Returns destination file path.
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
path = File.join(dest, CGI.unescape(self.url))
path = File.join(path, "index.html") if path[/\.html$/].nil?
path = File.join(path, "index.html") if template[/\.html$/].nil?
path
end
# Returns the shorthand String identifier of this Post.
# Write the generated post file to the destination directory.
# +dest+ is the String path to the destination dir
#
# Returns nothing
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') do |f|
f.write(self.output)
end
end
# Convert this post into a Hash for use in Liquid templates.
#
# Returns <Hash>
def to_liquid
self.data.deep_merge({
"title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '),
"url" => self.url,
"date" => self.date,
"id" => self.id,
"categories" => self.categories,
"next" => self.next,
"previous" => self.previous,
"tags" => self.tags,
"content" => self.content })
end
def inspect
"<Post: #{self.id}>"
end
@@ -294,19 +250,6 @@ module Jekyll
nil
end
end
protected
def extract_excerpt
if generate_excerpt?
Jekyll::Excerpt.new(self)
else
""
end
end
def generate_excerpt?
!(site.config['excerpt_separator'].to_s.empty?)
end
end
end

View File

@@ -1,59 +0,0 @@
module Jekyll
class RelatedPosts
class << self
attr_accessor :lsi
end
attr_reader :post, :site
def initialize(post)
@post = post
@site = post.site
require 'classifier' if site.lsi
end
def build
return [] unless self.site.posts.size > 1
if self.site.lsi
build_index
lsi_related_posts
else
most_recent_posts
end
end
def build_index
self.class.lsi ||= begin
lsi = Classifier::LSI.new(:auto_rebuild => false)
display("Populating LSI...")
self.site.posts.each do |x|
lsi.add_item(x)
end
display("Rebuilding index...")
lsi.build_index
display("")
lsi
end
end
def lsi_related_posts
self.class.lsi.find_related(post.content, 11) - [self.post]
end
def most_recent_posts
recent_posts = self.site.posts.reverse - [self.post]
recent_posts.first(10)
end
def display(output)
$stdout.print("\n")
$stdout.print(Jekyll.logger.formatted_topic(output))
$stdout.flush
end
end
end

View File

@@ -1,49 +1,36 @@
require 'set'
module Jekyll
class Site
attr_accessor :config, :layouts, :posts, :pages, :static_files,
:categories, :exclude, :include, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts,
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts, :gems
:categories, :exclude, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts
attr_accessor :converters, :generators
# Public: Initialize a new Site.
# Initialize the site
# +config+ is a Hash containing site configurations details
#
# config - A Hash containing site configuration details.
# Returns <Site>
def initialize(config)
self.config = config.clone
%w[safe lsi pygments baseurl exclude include future show_drafts limit_posts keep_files gems].each do |opt|
self.send("#{opt}=", config[opt])
end
self.safe = config['safe']
self.source = File.expand_path(config['source'])
self.dest = File.expand_path(config['destination'])
self.plugins = plugins_path
self.plugins = File.expand_path(config['plugins'])
self.lsi = config['lsi']
self.pygments = config['pygments']
self.permalink_style = config['permalink'].to_sym
self.file_read_opts = {}
self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
self.exclude = config['exclude'] || []
self.future = config['future']
self.limit_posts = config['limit_posts'] || nil
self.reset
self.setup
end
# Public: Read, process, and write this Site to output.
#
# Returns nothing.
def process
self.reset
self.read
self.generate
self.render
self.cleanup
self.write
end
# Reset Site details.
#
# Returns nothing
def reset
self.time = if self.config['time']
Time.parse(self.config['time'].to_s)
@@ -56,76 +43,62 @@ module Jekyll
self.static_files = []
self.categories = Hash.new { |hash, key| hash[key] = [] }
self.tags = Hash.new { |hash, key| hash[key] = [] }
self.data = {}
if self.limit_posts < 0
raise ArgumentError, "limit_posts must be a non-negative number"
end
raise ArgumentError, "Limit posts must be nil or >= 1" if !self.limit_posts.nil? && self.limit_posts < 1
end
# Load necessary libraries, plugins, converters, and generators.
#
# Returns nothing.
def setup
ensure_not_in_dest
require 'classifier' if self.lsi
# If safe mode is off, load in any Ruby files under the plugins
# If safe mode is off, load in any ruby files under the plugins
# directory.
unless self.safe
self.plugins.each do |plugins|
Dir[File.join(plugins, "**/*.rb")].each do |f|
require f
end
end
self.gems.each do |gem|
require gem
Dir[File.join(self.plugins, "**/*.rb")].each do |f|
require f
end
end
self.converters = instantiate_subclasses(Jekyll::Converter)
self.generators = instantiate_subclasses(Jekyll::Generator)
end
self.converters = Jekyll::Converter.subclasses.select do |c|
!self.safe || c.safe
end.map do |c|
c.new(self.config)
end
# Check that the destination dir isn't the source dir or a directory
# parent to the source dir.
def ensure_not_in_dest
dest = Pathname.new(self.dest)
Pathname.new(self.source).ascend do |path|
if path == dest
raise FatalException.new "Destination directory cannot be or contain the Source directory."
end
self.generators = Jekyll::Generator.subclasses.select do |c|
!self.safe || c.safe
end.map do |c|
c.new(self.config)
end
end
# Internal: Setup the plugin search path
# Do the actual work of processing the site and generating the
# real deal. 5 phases; reset, read, generate, render, write. This allows
# rendering to have full site payload available.
#
# Returns an Array of plugin search paths
def plugins_path
if (config['plugins'] == Jekyll::Configuration::DEFAULTS['plugins'])
[File.join(self.source, config['plugins'])]
else
Array(config['plugins']).map { |d| File.expand_path(d) }
end
# Returns nothing
def process
self.reset
self.read
self.generate
self.render
self.cleanup
self.write
end
# Read Site data from disk and load it into internal data structures.
#
# Returns nothing.
def read
self.read_layouts
self.read_layouts # existing implementation did this at top level only so preserved that
self.read_directories
self.read_data(config['data_source'])
end
# Read all the files in <source>/<layouts> and create a new Layout object
# with each one.
# Read all the files in <source>/<dir>/_layouts and create a new Layout
# object with each one.
#
# Returns nothing.
def read_layouts
base = File.join(self.source, self.config['layouts'])
# Returns nothing
def read_layouts(dir = '')
base = File.join(self.source, dir, "_layouts")
return unless File.exists?(base)
entries = []
Dir.chdir(base) { entries = filter_entries(Dir['**/*.*']) }
Dir.chdir(base) { entries = filter_entries(Dir['*.*']) }
entries.each do |f|
name = f.split(".")[0..-2].join(".")
@@ -133,43 +106,14 @@ module Jekyll
end
end
# Recursively traverse directories to find posts, pages and static files
# that will become part of the site according to the rules in
# filter_entries.
#
# dir - The String relative path of the directory to read. Default: ''.
#
# Returns nothing.
def read_directories(dir = '')
base = File.join(self.source, dir)
entries = Dir.chdir(base) { filter_entries(Dir.entries('.')) }
self.read_posts(dir)
self.read_drafts(dir) if self.show_drafts
self.posts.sort!
limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set
entries.each do |f|
f_abs = File.join(base, f)
if File.directory?(f_abs)
f_rel = File.join(dir, f)
read_directories(f_rel) unless self.dest.sub(/\/$/, '') == f_abs
elsif has_yaml_header?(f_abs)
pages << Page.new(self, self.source, dir, f)
else
static_files << StaticFile.new(self, self.source, dir, f)
end
end
end
# Read all the files in <source>/<dir>/_posts and create a new Post
# object with each one.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
# Returns nothing
def read_posts(dir)
entries = get_entries(dir, '_posts')
base = File.join(self.source, dir, '_posts')
return unless File.exists?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
# first pass processes, but does not yet render post content
entries.each do |f|
@@ -177,260 +121,160 @@ module Jekyll
post = Post.new(self, self.source, dir, f)
if post.published && (self.future || post.date <= self.time)
aggregate_post_info(post)
self.posts << post
post.categories.each { |c| self.categories[c] << post }
post.tags.each { |c| self.tags[c] << post }
end
end
end
self.posts.sort!
# limit the posts if :limit_posts option is set
self.posts = self.posts[-limit_posts, limit_posts] if limit_posts
end
# Read all the files in <source>/<dir>/_drafts and create a new Post
# object with each one.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
def read_drafts(dir)
entries = get_entries(dir, '_drafts')
# first pass processes, but does not yet render draft content
entries.each do |f|
if Draft.valid?(f)
draft = Draft.new(self, self.source, dir, f)
aggregate_post_info(draft)
end
end
end
# Read and parse all yaml files under <source>/<dir>
#
# Returns nothing
def read_data(dir)
base = File.join(self.source, dir)
return unless File.directory?(base) && (!self.safe || !File.symlink?(base))
entries = Dir.chdir(base) { Dir['*.{yaml,yml}'] }
entries.delete_if { |e| File.directory?(File.join(base, e)) }
entries.each do |entry|
path = File.join(self.source, dir, entry)
next if File.symlink?(path) && self.safe
key = sanitize_filename(File.basename(entry, '.*'))
self.data[key] = YAML.safe_load_file(path)
end
end
# Run each of the Generators.
#
# Returns nothing.
def generate
self.generators.each do |generator|
generator.generate(self)
end
end
# Render the site to the destination.
#
# Returns nothing.
def render
relative_permalinks_deprecation_method
payload = site_payload
[self.posts, self.pages].flatten.each do |page_or_post|
page_or_post.render(self.layouts, payload)
self.posts.each do |post|
post.render(self.layouts, site_payload)
end
self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a } }
self.tags.values.map { |ps| ps.sort! { |a, b| b <=> a } }
self.pages.each do |page|
page.render(self.layouts, site_payload)
end
self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a} }
self.tags.values.map { |ps| ps.sort! { |a, b| b <=> a} }
rescue Errno::ENOENT => e
# ignore missing layout dir
end
# Remove orphaned files and empty directories in destination.
# Remove orphaned files and empty directories in destination
#
# Returns nothing.
# Returns nothing
def cleanup
site_cleaner.cleanup!
# all files and directories in destination, including hidden ones
dest_files = Set.new
Dir.glob(File.join(self.dest, "**", "*"), File::FNM_DOTMATCH) do |file|
dest_files << file unless file =~ /\/\.{1,2}$/
end
# files to be written
files = Set.new
self.posts.each do |post|
files << post.destination(self.dest)
end
self.pages.each do |page|
files << page.destination(self.dest)
end
self.static_files.each do |sf|
files << sf.destination(self.dest)
end
# adding files' parent directories
dirs = Set.new
files.each { |file| dirs << File.dirname(file) }
files.merge(dirs)
obsolete_files = dest_files - files
FileUtils.rm_rf(obsolete_files.to_a)
end
# Write static files, pages, and posts.
# Write static files, pages and posts
#
# Returns nothing.
# Returns nothing
def write
each_site_file { |item| item.write(self.dest) }
self.posts.each do |post|
post.write(self.dest)
end
self.pages.each do |page|
page.write(self.dest)
end
self.static_files.each do |sf|
sf.write(self.dest)
end
end
# Construct a Hash of Posts indexed by the specified Post attribute.
# Reads the directories and finds posts, pages and static files that will
# become part of the valid site according to the rules in +filter_entries+.
# The +dir+ String is a relative path used to call this method
# recursively as it descends through directories
#
# post_attr - The String name of the Post attribute.
# Returns nothing
def read_directories(dir = '')
base = File.join(self.source, dir)
entries = Dir.chdir(base){ filter_entries(Dir['*']) }
self.read_posts(dir)
entries.each do |f|
f_abs = File.join(base, f)
f_rel = File.join(dir, f)
if File.directory?(f_abs)
next if self.dest.sub(/\/$/, '') == f_abs
read_directories(f_rel)
elsif !File.symlink?(f_abs)
first3 = File.open(f_abs) { |fd| fd.read(3) }
if first3 == "---"
# file appears to have a YAML header so process it as a page
pages << Page.new(self, self.source, dir, f)
else
# otherwise treat it as a static file
static_files << StaticFile.new(self, self.source, dir, f)
end
end
end
end
# Constructs a hash map of Posts indexed by the specified Post attribute
#
# Examples
#
# post_attr_hash('categories')
# # => { 'tech' => [<Post A>, <Post B>],
# # 'ruby' => [<Post B>] }
#
# Returns the Hash: { attr => posts } where
# attr - One of the values for the requested attribute.
# posts - The Array of Posts with the given attr value.
# Returns {post_attr => [<Post>]}
def post_attr_hash(post_attr)
# Build a hash map based on the specified post attribute ( post attr =>
# array of posts ) then sort each array in reverse order.
hash = Hash.new { |hsh, key| hsh[key] = Array.new }
# Build a hash map based on the specified post attribute ( post attr => array of posts )
# then sort each array in reverse order
hash = Hash.new { |hash, key| hash[key] = Array.new }
self.posts.each { |p| p.send(post_attr.to_sym).each { |t| hash[t] << p } }
hash.values.map { |sortme| sortme.sort! { |a, b| b <=> a } }
hash
hash.values.map { |sortme| sortme.sort! { |a, b| b <=> a} }
return hash
end
# Prepare site data for site payload. The method maintains backward compatibility
# if the key 'data' is already used in _config.yml.
# The Hash payload containing site-wide data
#
# Returns the Hash to be hooked to site.data.
def site_data
self.config['data'] || self.data
end
# The Hash payload containing site-wide data.
#
# Returns the Hash: { "site" => data } where data is a Hash with keys:
# "time" - The Time as specified in the configuration or the
# current time if none was specified.
# "posts" - The Array of Posts, sorted chronologically by post date
# and then title.
# "pages" - The Array of all Pages.
# "html_pages" - The Array of HTML Pages.
# "categories" - The Hash of category values and Posts.
# See Site#post_attr_hash for type info.
# "tags" - The Hash of tag values and Posts.
# See Site#post_attr_hash for type info.
# Returns {"site" => {"time" => <Time>,
# "posts" => [<Post>],
# "pages" => [<Page>],
# "categories" => [<Post>]}
def site_payload
{"jekyll" => { "version" => Jekyll::VERSION },
"site" => self.config.merge({
{"site" => self.config.merge({
"time" => self.time,
"posts" => self.posts.sort { |a, b| b <=> a },
"posts" => self.posts.sort { |a,b| b <=> a },
"pages" => self.pages,
"html_pages" => self.pages.reject { |page| !page.html? },
"categories" => post_attr_hash('categories'),
"tags" => post_attr_hash('tags'),
"data" => site_data})}
"tags" => post_attr_hash('tags')})}
end
# Filter out any files/directories that are hidden or backup files (start
# with "." or "#" or end with "~"), or contain site content (start with "_"),
# or are excluded in the site configuration, unless they are web server
# files such as '.htaccess'.
#
# entries - The Array of String file/directory entries to filter.
#
# Returns the Array of filtered entries.
# files such as '.htaccess'
def filter_entries(entries)
entries.reject do |e|
unless self.include.glob_include?(e)
entries = entries.reject do |e|
unless ['.htaccess'].include?(e)
['.', '_', '#'].include?(e[0..0]) ||
e[-1..-1] == '~' ||
self.exclude.glob_include?(e) ||
(File.symlink?(e) && self.safe)
self.exclude.include?(e) ||
File.symlink?(e)
end
end
end
# Get the implementation class for the given Converter.
#
# klass - The Class of the Converter to fetch.
#
# Returns the Converter instance implementing the given Converter.
def getConverterImpl(klass)
matches = self.converters.select { |c| c.class == klass }
if impl = matches.first
impl
else
raise "Converter implementation not found for #{klass}"
end
end
# Create array of instances of the subclasses of the class or module
# passed in as argument.
#
# klass - class or module containing the subclasses which should be
# instantiated
#
# Returns array of instances of subclasses of parameter
def instantiate_subclasses(klass)
klass.subclasses.select do |c|
!self.safe || c.safe
end.sort.map do |c|
c.new(self.config)
end
end
# Read the entries from a particular directory for processing
#
# dir - The String relative path of the directory to read
# subfolder - The String directory to read
#
# Returns the list of entries to process
def get_entries(dir, subfolder)
base = File.join(self.source, dir, subfolder)
return [] unless File.exists?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
entries.delete_if { |e| File.directory?(File.join(base, e)) }
end
# Aggregate post information
#
# post - The Post object to aggregate information for
#
# Returns nothing
def aggregate_post_info(post)
self.posts << post
post.categories.each { |c| self.categories[c] << post }
post.tags.each { |c| self.tags[c] << post }
end
def relative_permalinks_deprecation_method
if config['relative_permalinks'] && has_relative_page?
$stderr.puts # Places newline after "Generating..."
Jekyll.logger.warn "Deprecation:", "Starting in 2.0, permalinks for pages" +
" in subfolders must be relative to the" +
" site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+
" for more info."
$stderr.print Jekyll.logger.formatted_topic("") + "..." # for "done."
end
end
def each_site_file
%w(posts pages static_files).each do |type|
self.send(type).each do |item|
yield item
end
end
end
private
def has_relative_page?
self.pages.any? { |page| page.uses_relative_permalinks }
end
def has_yaml_header?(file)
"---" == File.open(file) { |fd| fd.read(3) }
end
def limit_posts!
limit = self.posts.length < limit_posts ? self.posts.length : limit_posts
self.posts = self.posts[-limit, limit]
end
def site_cleaner
@site_cleaner ||= Cleaner.new(self)
end
def sanitize_filename(name)
name = name.gsub(/[^\w\s_-]+/, '')
name = name.gsub(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
name = name.gsub(/\s+/, '_')
end
end
end

View File

@@ -1,14 +1,15 @@
module Jekyll
class StaticFile
# The cache of last modification times [path] -> mtime.
@@mtimes = Hash.new
@@mtimes = Hash.new # the cache of last modification times [path] -> mtime
# Initialize a new StaticFile.
# +site+ is the Site
# +base+ is the String path to the <source>
# +dir+ is the String path between <source> and the file
# +name+ is the String filename of the file
#
# site - The Site.
# base - The String path to the <source>.
# dir - The String path between <source> and the file.
# name - The String filename of the file.
# Returns <StaticFile>
def initialize(site, base, dir, name)
@site = site
@base = base
@@ -16,21 +17,24 @@ module Jekyll
@name = name
end
# Obtains source file path.
#
# Returns source file path.
def path
File.join(@base, @dir, @name)
end
# Obtain destination path.
#
# dest - The String path to the destination dir.
# +dest+ is the String path to the destination dir
#
# Returns destination file path.
def destination(dest)
File.join(dest, @dir, @name)
end
# Returns last modification time for this file.
# Obtain mtime of the source path.
#
# Returns last modifiaction time for this file.
def mtime
File.stat(path).mtime.to_i
end
@@ -43,14 +47,13 @@ module Jekyll
end
# Write the static file to the destination directory (if modified).
#
# dest - The String path to the destination dir.
# +dest+ is the String path to the destination dir
#
# Returns false if the file was not modified since last time (no-op).
def write(dest)
dest_path = destination(dest)
return false if File.exist?(dest_path) and !modified?
return false if File.exist? dest_path and !modified?
@@mtimes[path] = mtime
FileUtils.mkdir_p(File.dirname(dest_path))
@@ -64,7 +67,9 @@ module Jekyll
# Returns nothing.
def self.reset_cache
@@mtimes = Hash.new
nil
end
end
end

View File

@@ -1,89 +0,0 @@
module Jekyll
class Stevenson
attr_accessor :log_level
DEBUG = 0
INFO = 1
WARN = 2
ERROR = 3
# Public: Create a new instance of Stevenson, Jekyll's logger
#
# level - (optional, integer) the log level
#
# Returns nothing
def initialize(level = INFO)
@log_level = level
end
# Public: Print a jekyll debug message to stdout
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def debug(topic, message = nil)
$stdout.puts(message(topic, message)) if log_level <= DEBUG
end
# Public: Print a jekyll message to stdout
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def info(topic, message = nil)
$stdout.puts(message(topic, message)) if log_level <= INFO
end
# Public: Print a jekyll message to stderr
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def warn(topic, message = nil)
$stderr.puts(message(topic, message).yellow) if log_level <= WARN
end
# Public: Print a jekyll error message to stderr
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def error(topic, message = nil)
$stderr.puts(message(topic, message).red) if log_level <= ERROR
end
# Public: Print a Jekyll error message to stderr and immediately abort the process
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail (can be omitted)
#
# Returns nothing
def abort_with(topic, message = nil)
error(topic, message)
abort
end
# Public: Build a Jekyll topic method
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns the formatted message
def message(topic, message)
formatted_topic(topic) + message.to_s.gsub(/\s+/, ' ')
end
# Public: Format the topic
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
#
# Returns the formatted topic statement
def formatted_topic(topic)
"#{topic} ".rjust(20)
end
end
end

View File

@@ -1,48 +0,0 @@
# Gist Liquid Tag
#
# Example:
# {% gist 1234567 %}
# {% gist 1234567 file.rb %}
module Jekyll
class GistTag < Liquid::Tag
def render(context)
if tag_contents = determine_arguments(@markup.strip)
gist_id, filename = tag_contents[0], tag_contents[1]
gist_script_tag(gist_id, filename)
else
raise ArgumentError.new <<-eos
Syntax error in tag 'gist' while parsing the following markup:
#{@markup}
Valid syntax:
for public gists: {% gist 1234567 %}
for private gists: {% gist user/1234567 %}
eos
end
end
private
def determine_arguments(input)
matched = if input.include?("/")
input.match(/\A([a-zA-Z0-9\/\-_]+) ?(\S*)\Z/)
else
input.match(/\A(\d+) ?(\S*)\Z/)
end
[matched[1].strip, matched[2].strip] if matched && matched.length >= 3
end
def gist_script_tag(gist_id, filename = nil)
if filename.empty?
"<script src=\"https://gist.github.com/#{gist_id}.js\"> </script>"
else
"<script src=\"https://gist.github.com/#{gist_id}.js?file=#{filename}\"> </script>"
end
end
end
end
Liquid::Template.register_tag('gist', Jekyll::GistTag)

View File

@@ -1,85 +1,73 @@
module Jekyll
module Tags
class HighlightBlock < Liquid::Block
include Liquid::StandardFilters
# The regular expression syntax checker. Start with the language specifier.
# Follow that by zero or more space separated options that take one of two
# forms:
#
# 1. name
# 2. name=value
SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=\w+)?)*)$/
class HighlightBlock < Liquid::Block
include Liquid::StandardFilters
def initialize(tag_name, markup, tokens)
super
if markup.strip =~ SYNTAX
@lang = $1.downcase
@options = {}
if defined?($2) && $2 != ''
$2.split.each do |opt|
key, value = opt.split('=')
if value.nil?
if key == 'linenos'
value = 'inline'
else
value = true
end
# we need a language, but the linenos argument is optional.
SYNTAX = /(\w+)\s?([\w\s=]+)*/
def initialize(tag_name, markup, tokens)
super
if markup =~ SYNTAX
@lang = $1
if defined? $2
tmp_options = {}
$2.split.each do |opt|
key, value = opt.split('=')
if value.nil?
if key == 'linenos'
value = 'inline'
else
value = true
end
@options[key] = value
end
tmp_options[key] = value
end
tmp_options = tmp_options.to_a.collect { |opt| opt.join('=') }
# additional options to pass to Albino.
@options = { 'O' => tmp_options.join(',') }
else
raise SyntaxError.new <<-eos
Syntax Error in tag 'highlight' while parsing the following markup:
#{markup}
Valid syntax: highlight <lang> [linenos]
eos
@options = {}
end
else
raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
end
def render(context)
if context.registers[:site].pygments
render_pygments(context, super)
else
render_codehighlighter(context, super)
end
end
def render_pygments(context, code)
require 'pygments'
@options[:encoding] = 'utf-8'
output = add_code_tags(
Pygments.highlight(code, :lexer => @lang, :options => @options),
@lang
)
output = context["pygments_prefix"] + output if context["pygments_prefix"]
output = output + context["pygments_suffix"] if context["pygments_suffix"]
output
end
def render_codehighlighter(context, code)
#The div is required because RDiscount blows ass
<<-HTML
<div>
<pre><code class='#{@lang}'>#{h(code).strip}</code></pre>
</div>
HTML
end
def add_code_tags(code, lang)
# Add nested <code> tags to code blocks
code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
code = code.sub(/<\/pre>/,"</code></pre>")
end
end
def render(context)
if context.registers[:site].pygments
render_pygments(context, super.join)
else
render_codehighlighter(context, super.join)
end
end
def render_pygments(context, code)
output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang)
output = context["pygments_prefix"] + output if context["pygments_prefix"]
output = output + context["pygments_suffix"] if context["pygments_suffix"]
output
end
def render_codehighlighter(context, code)
#The div is required because RDiscount blows ass
<<-HTML
<div>
<pre>
<code class='#{@lang}'>#{h(code).strip}</code>
</pre>
</div>
HTML
end
def add_code_tags(code, lang)
# Add nested <code> tags to code blocks
code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
code = code.sub(/<\/pre>/,"</code></pre>")
end
end
end
Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)
Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock)

View File

@@ -1,135 +1,37 @@
module Jekyll
module Tags
class IncludeTagError < StandardError
attr_accessor :path
def initialize(msg, path)
super(msg)
@path = path
end
class IncludeTag < Liquid::Tag
def initialize(tag_name, file, tokens)
super
@file = file.strip
end
class IncludeTag < Liquid::Tag
def render(context)
includes_dir = File.join(context.registers[:site].source, '_includes')
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
INCLUDES_DIR = '_includes'
def initialize(tag_name, markup, tokens)
super
@file, @params = markup.strip.split(' ', 2);
validate_params if @params
if File.symlink?(includes_dir)
return "Includes directory '#{includes_dir}' cannot be a symlink"
end
def parse_params(context)
params = {}
markup = @params
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
return "Include file '#{@file}' contains invalid characters or sequences"
end
while match = VALID_SYNTAX.match(markup) do
markup = markup[match.end(0)..-1]
value = if match[2]
match[2].gsub(/\\"/, '"')
elsif match[3]
match[3].gsub(/\\'/, "'")
elsif match[4]
context[match[4]]
Dir.chdir(includes_dir) do
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
if choices.include?(@file)
source = File.read(@file)
partial = Liquid::Template.parse(source)
context.stack do
partial.render(context)
end
params[match[1]] = value
else
"Included file '#{@file}' not found in _includes directory"
end
params
end
def validate_file_name
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
raise ArgumentError.new <<-eos
Invalid syntax for include tag. File contains invalid characters or sequences:
#{@file}
Valid syntax:
#{SYNTAX_EXAMPLE}
eos
end
end
def validate_params
full_valid_syntax = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
unless @params =~ full_valid_syntax
raise ArgumentError.new <<-eos
Invalid syntax for include tag:
#{@params}
Valid syntax:
#{SYNTAX_EXAMPLE}
eos
end
end
# Grab file read opts in the context
def file_read_opts(context)
context.registers[:site].file_read_opts
end
def retrieve_variable(context)
if /\{\{([\w\-\.]+)\}\}/ =~ @file
raise ArgumentError.new("No variable #{$1} was found in include tag") if context[$1].nil?
@file = context[$1]
end
end
def render(context)
dir = File.join(context.registers[:site].source, INCLUDES_DIR)
validate_dir(dir, context.registers[:site].safe)
retrieve_variable(context)
validate_file_name
file = File.join(dir, @file)
validate_file(file, context.registers[:site].safe)
partial = Liquid::Template.parse(source(file, context))
context.stack do
context['include'] = parse_params(context) if @params
partial.render!(context)
end
rescue => e
raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file)
end
def validate_dir(dir, safe)
if File.symlink?(dir) && safe
raise IOError.new "Includes directory '#{dir}' cannot be a symlink"
end
end
def validate_file(file, safe)
if !File.exists?(file)
raise IOError.new "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
elsif File.symlink?(file) && safe
raise IOError.new "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
def blank?
false
end
# This method allows to modify the file content by inheriting from the class.
def source(file, context)
File.read_with_options(file, file_read_opts(context))
end
end
end
end
Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)
Liquid::Template.register_tag('include', Jekyll::IncludeTag)

View File

@@ -1,63 +0,0 @@
module Jekyll
module Tags
class PostComparer
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
attr_accessor :date, :slug
def initialize(name)
all, path, date, slug = *name.sub(/^\//, "").match(MATCHER)
@slug = path ? path + slug : slug
@date = Time.parse(date)
end
def ==(other)
slug == post_slug(other) &&
date.year == other.date.year &&
date.month == other.date.month &&
date.day == other.date.day
end
private
# Construct the directory-aware post slug for a Jekyll::Post
#
# other - the Jekyll::Post
#
# Returns the post slug with the subdirectory (relative to _posts)
def post_slug(other)
path = other.name.split("/")[0...-1].join("/")
if path.nil? || path == ""
other.slug
else
path + '/' + other.slug
end
end
end
class PostUrl < Liquid::Tag
def initialize(tag_name, post, tokens)
super
@orig_post = post.strip
@post = PostComparer.new(@orig_post)
end
def render(context)
site = context.registers[:site]
site.posts.each do |p|
if @post == p
return p.url
end
end
raise ArgumentError.new <<-eos
Could not find post "#{@orig_post}" in tag 'post_url'.
Make sure the post exists and the name is correct.
eos
end
end
end
end
Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)

View File

@@ -1,67 +0,0 @@
# Public: Methods that generate a URL for a resource such as a Post or a Page.
#
# Examples
#
# URL.new({
# :template => /:categories/:title.html",
# :placeholders => {:categories => "ruby", :title => "something"}
# }).to_s
#
module Jekyll
class URL
# options - One of :permalink or :template must be supplied.
# :template - The String used as template for URL generation,
# for example "/:path/:basename:output_ext", where
# a placeholder is prefixed with a colon.
# :placeholders - A hash containing the placeholders which will be
# replaced when used inside the template. E.g.
# { "year" => Time.now.strftime("%Y") } would replace
# the placeholder ":year" with the current year.
# :permalink - If supplied, no URL will be generated from the
# template. Instead, the given permalink will be
# used as URL.
def initialize(options)
@template = options[:template]
@placeholders = options[:placeholders] || {}
@permalink = options[:permalink]
if (@template || @permalink).nil?
raise ArgumentError, "One of :template or :permalink must be supplied."
end
end
# The generated relative URL of the resource
#
# Returns the String URL
def to_s
sanitize_url(@permalink || generate_url)
end
# Internal: Generate the URL by replacing all placeholders with their
# respective values
#
# Returns the _unsanitizied_ String URL
def generate_url
@placeholders.inject(@template) do |result, token|
result.gsub(/:#{token.first}/, token.last)
end
end
# Returns a sanitized String URL
def sanitize_url(in_url)
# Remove all double slashes
url = in_url.gsub(/\/\//, "/")
# Remove every URL segment that consists solely of dots
url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
# Append a trailing slash to the URL if the unsanitized URL had one
url += "/" if in_url =~ /\/$/
# Always add a leading slash
url.gsub!(/\A([^\/])/, '/\1')
url
end
end
end

View File

@@ -1 +0,0 @@
_site

View File

@@ -1,3 +0,0 @@
name: Your New Jekyll Site
markdown: redcarpet
pygments: true

View File

@@ -1,44 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ page.title }}</title>
<meta name="viewport" content="width=device-width">
<!-- syntax highlighting CSS -->
<link rel="stylesheet" href="/css/syntax.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="/css/main.css">
</head>
<body>
<div class="site">
<div class="header">
<h1 class="title"><a href="/">{{ site.name }}</a></h1>
<a class="extra" href="/">home</a>
</div>
{{ content }}
<div class="footer">
<div class="contact">
<p>
Your Name<br />
What You Are<br />
you@example.com
</p>
</div>
<div class="contact">
<p>
<a href="https://github.com/yourusername">github.com/yourusername</a><br />
<a href="https://twitter.com/yourusername">twitter.com/yourusername</a><br />
</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,9 +0,0 @@
---
layout: default
---
<h2>{{ page.title }}</h2>
<p class="meta">{{ page.date | date_to_string }}</p>
<div class="post">
{{ content }}
</div>

View File

@@ -1,24 +0,0 @@
---
layout: post
title: "Welcome to Jekyll!"
date: <%= Time.now.strftime('%Y-%m-%d %H:%M:%S') %>
categories: jekyll update
---
You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!
To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.
Jekyll also offers powerful support for code snippets:
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].
[jekyll-gh]: https://github.com/mojombo/jekyll
[jekyll]: http://jekyllrb.com

View File

@@ -1,160 +0,0 @@
/*****************************************************************************/
/*
/* Common
/*
/*****************************************************************************/
/* Global Reset */
* {
margin: 0;
padding: 0;
}
html, body { height: 100%; }
body {
background-color: #FFF;
font: 13.34px Helvetica, Arial, sans-serif;
font-size: small;
text-align: center;
}
h1, h2, h3, h4, h5, h6 {
font-size: 100%; }
h1 { margin-bottom: 1em; }
p { margin: 1em 0; }
a { color: #00a; }
a:hover { color: #000; }
a:visited { color: #a0a; }
/*****************************************************************************/
/*
/* Home
/*
/*****************************************************************************/
.posts {
list-style-type: none;
margin-bottom: 2em;
}
.posts li {
line-height: 1.75em;
}
.posts span {
color: #aaa;
font-family: Monaco, "Courier New", monospace;
font-size: 80%;
}
/*****************************************************************************/
/*
/* Site
/*
/*****************************************************************************/
.site {
font-size: 115%;
text-align: justify;
width: 42em;
margin: 3em auto 2em;
line-height: 1.5em;
}
.header a {
font-weight: bold;
text-decoration: none;
}
.title {
display: inline-block;
margin-bottom: 2em;
}
.title a {
color: #a00;
}
.title a:hover {
color: #000;
}
.header a.extra {
color: #aaa;
margin-left: 1em;
}
.header a.extra:hover {
color: #000;
}
.meta {
color: #aaa;
}
.footer {
font-size: 80%;
color: #666;
border-top: 4px solid #eee;
margin-top: 2em;
overflow: hidden;
}
.footer .contact {
float: left;
margin-right: 3em;
}
.footer .contact a {
color: #8085C1;
}
.footer .rss {
margin-top: 1.1em;
margin-right: -.2em;
float: right;
}
.footer .rss img {
border: 0;
}
/*****************************************************************************/
/*
/* Posts
/*
/*****************************************************************************/
/* standard */
.post pre {
border: 1px solid #ddd;
background-color: #eef;
padding: 0 .4em;
}
.post ul, .post ol {
margin-left: 1.35em;
}
.post code {
border: 1px solid #ddd;
background-color: #eef;
padding: 0 .2em;
}
.post pre code {
border: none;
}
/* terminal */
.post pre.terminal {
border: 1px solid #000;
background-color: #333;
color: #FFF;
}
.post pre.terminal code {
background-color: #333;
}

View File

@@ -1,60 +0,0 @@
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

View File

@@ -1,13 +0,0 @@
---
layout: default
title: Your New Jekyll Site
---
<div id="home">
<h1>Blog Posts</h1>
<ul class="posts">
{% for post in site.posts %}
<li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>

View File

@@ -1,2 +0,0 @@
#!/bin/sh
bundle install

4
site/.gitignore vendored
View File

@@ -1,4 +0,0 @@
_site/
*.swp
pkg/
test/

View File

@@ -1 +0,0 @@
jekyllrb.com

View File

@@ -1 +0,0 @@
Jekyll's awesome website.

View File

@@ -1,6 +0,0 @@
pygments: true
relative_permalinks: false
gauges_id: 503c5af6613f5d0f19000027
permalink: /news/:year/:month/:day/:title/
excerpt_separator: noifniof3nioaniof3nioafafinoafnoif
repository: https://github.com/mojombo/jekyll

View File

@@ -1,32 +0,0 @@
{% if site.gauges_id %}
<!-- Gauges (http://gaug.es/) -->
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '{{ site.gauges_id }}');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
{% endif %}
{% if site.google_analytics_id %}
<!-- Google Analytics (http://google.com/analytics) -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.google_analytics_id }}']);
_gaq.push(['_setDomainName', '{{ site.url }}']); // Multiple sub-domains
_gaq.push(['_setAllowLinker', true]); // Multiple TLDs
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endif %}

View File

@@ -1,16 +0,0 @@
<div class="unit one-fifth hide-on-mobiles">
<aside>
<h4>Getting Started</h4>
{% include docs_ul.html items='home quickstart installation usage structure configuration' %}
<h4>Your Content</h4>
{% include docs_ul.html items='frontmatter posts drafts pages variables datafiles migrations' %}
<h4>Customization</h4>
{% include docs_ul.html items='templates permalinks pagination plugins extras' %}
<h4>Deployment</h4>
{% include docs_ul.html items='github-pages deployment-methods' %}
<h4>Miscellaneous</h4>
{% include docs_ul.html items='troubleshooting sites resources upgrading' %}
<h4>Meta</h4>
{% include docs_ul.html items='contributing history' %}
</aside>
</div>

View File

@@ -1,23 +0,0 @@
<div class="docs-nav-mobile unit whole show-on-mobiles">
<select onchange="if (this.value) window.location.href=this.value">
<option value="">Navigate the docs…</option>
<optgroup label="Getting started">
{% include docs_option.html items='home quickstart installation usage structure configuration' %}
</optgroup>
<optgroup label="Your Content">
{% include docs_option.html items='frontmatter posts drafts pages variables datafiles migrations' %}
</optgroup>
<optgroup label="Customization">
{% include docs_option.html items='templates permalinks pagination plugins extras' %}
</optgroup>
<optgroup label="Deployment">
{% include docs_option.html items='github-pages deployment-methods' %}
</optgroup>
<optgroup label="Miscellaneous">
{% include docs_option.html items='troubleshooting sites resources upgrading' %}
</optgroup>
<optgroup label="Meta">
{% include docs_option.html items='contributing history' %}
</optgroup>
</select>
</div>

View File

@@ -1,11 +0,0 @@
{% assign items = include.items | split: ' ' %}
{% for item in items %}
{% assign item_url = item | prepend:'/docs/' | append:'/' %}
{% for p in site.pages %}
{% if p.url == item_url %}
<option value="{{ site.url }}{{ p.url }}">{{ p.title }}</option>
{% endif %}
{% endfor %}
{% endfor %}

View File

@@ -1,20 +0,0 @@
{% assign items = include.items | split: ' ' %}
<ul>
{% for item in items %}
{% assign item_url = item | prepend:'/docs/' | append:'/' %}
{% if item_url == page.url %}
{% assign c = 'current' %}
{% else %}
{% assign c = '' %}
{% endif %}
{% for p in site.pages %}
{% if p.url == item_url %}
<li class="{{ c }}"><a href="{{ site.url }}{{ p.url }}">{{ p.title }}</a></li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>

Some files were not shown because too many files have changed in this diff Show More