kitabu 0.4.7 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +62 -0
- data/README.rdoc +187 -0
- data/Rakefile +4 -36
- data/bin/kitabu +2 -5
- data/examples/RailsGuides/config/helper.rb +29 -0
- data/examples/RailsGuides/config/kitabu.yml +48 -0
- data/examples/RailsGuides/images/challenge.png +0 -0
- data/examples/RailsGuides/images/posts_index.png +0 -0
- data/examples/RailsGuides/images/rails_welcome.png +0 -0
- data/examples/RailsGuides/output/RailsGuides.epub +0 -0
- data/examples/RailsGuides/output/RailsGuides.html +1556 -0
- data/examples/RailsGuides/output/RailsGuides.pdf +4930 -7
- data/examples/RailsGuides/templates/cover.erb +16 -0
- data/examples/RailsGuides/templates/layout.css +352 -0
- data/examples/RailsGuides/templates/layout.erb +43 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css/idle.css → examples/RailsGuides/templates/syntax.css} +0 -0
- data/examples/RailsGuides/templates/user.css +19 -0
- data/examples/RailsGuides/text/01_Guide_Assumptions.mkdn +13 -0
- data/examples/RailsGuides/text/02_What_is_Rails.mkdn +106 -0
- data/examples/RailsGuides/text/03_Creating_a_new_Rails_project.mkdn +200 -0
- data/examples/RailsGuides/text/04_Hello_Rails.mkdn +62 -0
- data/examples/RailsGuides/text/05_Getting_Up_and_Running_Quickly_with_Scaffolding.mkdn +4 -0
- data/examples/RailsGuides/text/06_Creating_a_resource.mkdn +503 -0
- data/examples/RailsGuides/text/07_Adding_a_second_model.mkdn +232 -0
- data/examples/RailsGuides/text/08_Refactoring.mkdn +123 -0
- data/examples/RailsGuides/text/09_Deleting_comments.mkdn +57 -0
- data/examples/RailsGuides/text/09_Security.mkdn +56 -0
- data/examples/RailsGuides/text/10_Building_a_multi_model_form.mkdn +130 -0
- data/examples/RailsGuides/text/11_View_helpers.mkdn +50 -0
- data/examples/RailsGuides/text/12_Whats_next.mkdn +14 -0
- data/examples/RailsGuides/text/13_Configuration_gotchas.mkdn +10 -0
- data/kitabu.gemspec +28 -491
- data/lib/kitabu.rb +54 -46
- data/lib/kitabu/cli.rb +88 -0
- data/lib/kitabu/errors.rb +3 -0
- data/lib/kitabu/exporter.rb +81 -0
- data/lib/kitabu/extensions/redcloth.rb +65 -0
- data/lib/kitabu/extensions/string.rb +11 -0
- data/lib/kitabu/generator.rb +74 -0
- data/lib/kitabu/parser.rb +34 -0
- data/lib/kitabu/parser/epub.rb +131 -0
- data/lib/kitabu/parser/html.rb +174 -0
- data/lib/kitabu/parser/mobi.rb +17 -0
- data/lib/kitabu/parser/pdf.rb +41 -0
- data/lib/kitabu/parser/txt.rb +22 -0
- data/lib/kitabu/stream.rb +27 -0
- data/lib/kitabu/syntax.rb +109 -107
- data/lib/kitabu/toc.rb +62 -33
- data/lib/kitabu/version.rb +8 -0
- data/spec/kitabu/cli/export_spec.rb +17 -0
- data/spec/kitabu/cli/new_spec.rb +21 -0
- data/spec/kitabu/cli/permalinks_spec.rb +12 -0
- data/spec/kitabu/cli/version_spec.rb +12 -0
- data/spec/kitabu/extensions/redcloth_spec.rb +52 -0
- data/spec/kitabu/extensions/string_spec.rb +21 -0
- data/spec/kitabu/generator_spec.rb +10 -0
- data/spec/kitabu/parser/epub_spec.rb +10 -0
- data/spec/kitabu/parser/html_spec.rb +75 -0
- data/spec/kitabu/parser/pdf_spec.rb +14 -0
- data/spec/kitabu/syntax_spec.rb +80 -76
- data/spec/kitabu/toc_spec.rb +42 -68
- data/spec/kitabu_spec.rb +4 -0
- data/spec/spec_helper.rb +20 -24
- data/spec/support/exit_with_code.rb +26 -0
- data/spec/support/have_tag.rb +115 -0
- data/spec/support/helper.rb +18 -0
- data/spec/support/mybook/.gitignore +1 -0
- data/spec/support/mybook/code/.gitkeep +0 -0
- data/spec/support/mybook/code/code.rb +13 -0
- data/spec/support/mybook/config/helper.rb +29 -0
- data/spec/support/mybook/config/kitabu.yml +59 -0
- data/spec/support/mybook/images/.gitkeep +0 -0
- data/spec/support/mybook/images/logo.gif +0 -0
- data/spec/support/mybook/output/.gitkeep +0 -0
- data/spec/support/mybook/templates/cover.erb +16 -0
- data/spec/support/mybook/templates/epub.css +1 -0
- data/spec/support/mybook/templates/epub.erb +15 -0
- data/spec/support/mybook/templates/layout.css +137 -0
- data/{templates/layouts/boom/layout.html → spec/support/mybook/templates/layout.erb} +26 -17
- data/{templates/themes/mac_classic.css → spec/support/mybook/templates/syntax.css} +63 -0
- data/spec/support/mybook/templates/user.css +1 -0
- data/spec/support/mybook/text/.gitkeep +0 -0
- data/spec/support/mybook/text/01_Markdown_Chapter.markdown +8 -0
- data/spec/support/mybook/text/02_Textile_Chapter.textile +3 -0
- data/spec/support/mybook/text/03_HTML_Chapter.html +3 -0
- data/spec/support/mybook/text/04_With_Directory/Some_Chapter.mkdn +3 -0
- data/spec/support/mybook/text/CHANGELOG.textile +6 -0
- data/spec/support/mybook/text/TOC.textile +0 -0
- data/spec/support/mybook/text/_00_Introduction.markdown +3 -0
- data/spec/support/shared.rb +16 -0
- data/templates/config.erb +48 -0
- data/templates/cover.erb +16 -0
- data/templates/ebook.png +0 -0
- data/templates/epub.css +0 -0
- data/templates/epub.erb +15 -0
- data/templates/helper.rb +29 -0
- data/templates/layout.css +353 -0
- data/templates/layout.erb +44 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/active4d.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/all_hallows_eve.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/amy.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/blackboard.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/brilliance_black.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/brilliance_dull.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/cobalt.css +0 -0
- data/{lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css → templates/styles}/dawn.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/eiffel.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/espresso_libre.css +0 -0
- data/{lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css → templates/styles}/idle.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/iplastic.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/lazy.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/mac_classic.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/magicwb_amiga.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/pastels_on_dark.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/slush_poppies.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/spacecadet.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/sunburst.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/twilight.css +0 -0
- data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/zenburnesque.css +0 -0
- data/templates/user.css +1 -1
- metadata +395 -501
- data/README.markdown +0 -60
- data/VERSION +0 -1
- data/lib/kitabu/base.rb +0 -271
- data/lib/kitabu/blackcloth.rb +0 -184
- data/lib/kitabu/command.rb +0 -94
- data/lib/kitabu/redcloth.rb +0 -964
- data/lib/kitabu/tasks.rb +0 -113
- data/lib/kitabu/templates.rb +0 -54
- data/lib/kitabu/vendor/colorize/colorize.rb +0 -81
- data/lib/kitabu/vendor/ruby1.8/plist/plist.rb +0 -22
- data/lib/kitabu/vendor/ruby1.8/plist/plist/generator.rb +0 -224
- data/lib/kitabu/vendor/ruby1.8/plist/plist/parser.rb +0 -224
- data/lib/kitabu/vendor/ruby1.8/textpow/textpow.rb +0 -10
- data/lib/kitabu/vendor/ruby1.8/textpow/textpow/debug_processor.rb +0 -36
- data/lib/kitabu/vendor/ruby1.8/textpow/textpow/score_manager.rb +0 -65
- data/lib/kitabu/vendor/ruby1.8/textpow/textpow/syntax.rb +0 -284
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/active4d.render +0 -140
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/all_hallows_eve.render +0 -104
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/amy.render +0 -179
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/blackboard.render +0 -119
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/brilliance_black.render +0 -560
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/brilliance_dull.render +0 -569
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/cobalt.render +0 -170
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/dawn.render +0 -134
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/eiffel.render +0 -140
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/espresso_libre.render +0 -131
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css/dawn.css +0 -121
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/idle.render +0 -101
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/iplastic.render +0 -107
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/lazy.render +0 -104
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/mac_classic.render +0 -143
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/magicwb_amiga.render +0 -125
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/pastels_on_dark.render +0 -212
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/slush_poppies.render +0 -131
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/spacecadet.render +0 -89
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/sunburst.render +0 -194
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/twilight.render +0 -161
- data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/zenburnesque.render +0 -134
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/actionscript.syntax +0 -97
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d.syntax +0 -276
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d_html.syntax +0 -311
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d_ini.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d_library.syntax +0 -21
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ada.syntax +0 -33
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/antlr.syntax +0 -151
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/apache.syntax +0 -191
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/applescript.syntax +0 -384
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/asp.syntax +0 -70
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/asp_vb.net.syntax +0 -129
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/bibtex.syntax +0 -151
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_html.syntax +0 -41
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_markdown.syntax +0 -42
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_text.syntax +0 -27
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_textile.syntax +0 -27
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/buggy/nemerle.syntax +0 -74
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/build.syntax +0 -53
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/bulletin_board.syntax +0 -287
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/c++.syntax +0 -109
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/c.syntax +0 -326
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/cake.syntax +0 -55
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/camlp4.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/cm.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/coldfusion.syntax +0 -119
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/context_free.syntax +0 -176
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/cs.syntax +0 -59
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/css.syntax +0 -195
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/css_experimental.syntax +0 -1925
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/csv.syntax +0 -68
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/d.syntax +0 -142
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/diff.syntax +0 -81
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/dokuwiki.syntax +0 -204
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/dot.syntax +0 -47
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/doxygen.syntax +0 -43
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/dylan.syntax +0 -62
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/eiffel.syntax +0 -78
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/erlang.syntax +0 -922
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/f-script.syntax +0 -80
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/fortran.syntax +0 -141
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/fxscript.syntax +0 -142
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/greasemonkey.syntax +0 -34
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/gri.syntax +0 -83
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/groovy.syntax +0 -191
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/gtd.syntax +0 -22
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/gtdalt.syntax +0 -143
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/haml.syntax +0 -88
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/haskell.syntax +0 -88
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html-asp.syntax +0 -27
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html.syntax +0 -362
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_django.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_for_asp.net.syntax +0 -424
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_mason.syntax +0 -119
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_rails.syntax +0 -40
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_tcl.syntax +0 -26
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/icalendar.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/inform.syntax +0 -48
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ini.syntax +0 -55
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/installer_distribution_script.syntax +0 -77
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/io.syntax +0 -81
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/java.syntax +0 -211
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/javaproperties.syntax +0 -20
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/javascript.syntax +0 -256
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/javascript_+_prototype.syntax +0 -72
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/javascript_+_prototype_bracketed.syntax +0 -140
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/jquery_javascript.syntax +0 -114
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/json.syntax +0 -136
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/languagedefinition.syntax +0 -708
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex.syntax +0 -566
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex_beamer.syntax +0 -41
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex_log.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex_memoir.syntax +0 -64
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/lexflex.syntax +0 -219
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/lighttpd.syntax +0 -54
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/lilypond.syntax +0 -492
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/lisp.syntax +0 -61
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/literate_haskell.syntax +0 -24
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/logo.syntax +0 -29
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/logtalk.syntax +0 -152
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/lua.syntax +0 -86
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/m.syntax +0 -142
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/macports_portfile.syntax +0 -163
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/mail.syntax +0 -118
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/makefile.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/man.syntax +0 -17
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/markdown.syntax +0 -543
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/mediawiki.syntax +0 -567
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/mel.syntax +0 -92
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/mips.syntax +0 -66
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/mod_perl.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/modula-3.syntax +0 -47
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/moinmoin.syntax +0 -189
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/mootools.syntax +0 -572
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/movable_type.syntax +0 -162
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/multimarkdown.syntax +0 -39
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/objective-c++.syntax +0 -18
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/objective-c.syntax +0 -233
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ocaml.syntax +0 -764
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ocamllex.syntax +0 -167
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ocamlyacc.syntax +0 -184
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/old/YAML.yaml +0 -160
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/old/txt2tags.yaml +0 -139
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/opengl.syntax +0 -14
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/pascal.syntax +0 -77
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/perl.syntax +0 -1115
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/php.syntax +0 -1253
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/plain_text.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/pmwiki.syntax +0 -113
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/postscript.syntax +0 -114
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/processing.syntax +0 -106
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/prolog.syntax +0 -40
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/property_list.syntax +0 -635
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/python.syntax +0 -868
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/python_django.syntax +0 -21
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/qmake_project.syntax +0 -114
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/qt_c++.syntax +0 -26
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/quake3_config.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/r.syntax +0 -81
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/r_console.syntax +0 -16
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ragel.syntax +0 -201
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/rd_r_documentation.syntax +0 -91
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/regexp.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/regular_expressions_oniguruma.syntax +0 -107
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/regular_expressions_python.syntax +0 -109
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/release_notes.syntax +0 -46
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/remind.syntax +0 -253
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/restructuredtext.syntax +0 -250
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/rez.syntax +0 -80
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ruby.syntax +0 -1035
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ruby_experimental.syntax +0 -145
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ruby_on_rails.syntax +0 -88
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/s5.syntax +0 -69
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/scheme.syntax +0 -347
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/scilab.syntax +0 -41
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/setext.syntax +0 -147
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/shell-unix-generic.syntax +0 -384
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/slate.syntax +0 -149
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/smarty.syntax +0 -63
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/sql.syntax +0 -237
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/sql_rails.syntax +0 -18
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/ssh-config.syntax +0 -33
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/standard_ml.syntax +0 -121
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/strings_file.syntax +0 -39
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/subversion_commit_message.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/sweave.syntax +0 -84
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/swig.syntax +0 -57
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/tcl.syntax +0 -152
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/template_toolkit.syntax +0 -121
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/tex.syntax +0 -86
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/tex_math.syntax +0 -49
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/textile.syntax +0 -215
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/tsv.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/twiki.syntax +0 -241
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/txt2tags.syntax +0 -79
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/vectorscript.syntax +0 -57
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/xhtml_1.0.syntax +0 -4027
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/xml.syntax +0 -180
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/xml_strict.syntax +0 -92
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/xsl.syntax +0 -60
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/yaml.syntax +0 -160
- data/lib/kitabu/vendor/ruby1.8/uv/syntax/yui_javascript.syntax +0 -176
- data/lib/kitabu/vendor/ruby1.8/uv/uv.rb +0 -88
- data/lib/kitabu/vendor/ruby1.8/uv/uv/render_processor.rb +0 -131
- data/lib/kitabu/vendor/ruby1.8/uv/uv/utility.rb +0 -67
- data/lib/kitabu/vendor/ruby1.9/plist/plist.rb +0 -23
- data/lib/kitabu/vendor/ruby1.9/plist/plist/generator.rb +0 -228
- data/lib/kitabu/vendor/ruby1.9/plist/plist/parser.rb +0 -225
- data/lib/kitabu/vendor/ruby1.9/textpow/textpow.rb +0 -10
- data/lib/kitabu/vendor/ruby1.9/textpow/textpow/debug_processor.rb +0 -37
- data/lib/kitabu/vendor/ruby1.9/textpow/textpow/score_manager.rb +0 -66
- data/lib/kitabu/vendor/ruby1.9/textpow/textpow/syntax.rb +0 -286
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/active4d.render +0 -140
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/all_hallows_eve.render +0 -104
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/amy.render +0 -179
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/blackboard.render +0 -119
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/brilliance_black.render +0 -560
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/brilliance_dull.render +0 -569
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/cobalt.render +0 -170
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/dawn.render +0 -134
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/eiffel.render +0 -140
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/espresso_libre.render +0 -131
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/active4d.css +0 -114
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/all_hallows_eve.css +0 -72
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/amy.css +0 -147
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/blackboard.css +0 -88
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/brilliance_black.css +0 -605
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/brilliance_dull.css +0 -599
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/cobalt.css +0 -149
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/eiffel.css +0 -121
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/espresso_libre.css +0 -109
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/iplastic.css +0 -80
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/lazy.css +0 -73
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/mac_classic.css +0 -123
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/magicwb_amiga.css +0 -104
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/pastels_on_dark.css +0 -188
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/slush_poppies.css +0 -85
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/spacecadet.css +0 -51
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/sunburst.css +0 -180
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/twilight.css +0 -137
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/zenburnesque.css +0 -91
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/idle.render +0 -101
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/iplastic.render +0 -107
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/lazy.render +0 -104
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/mac_classic.render +0 -143
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/magicwb_amiga.render +0 -125
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/pastels_on_dark.render +0 -212
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/slush_poppies.render +0 -131
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/spacecadet.render +0 -89
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/sunburst.render +0 -194
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/twilight.render +0 -161
- data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/zenburnesque.render +0 -134
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/actionscript.syntax +0 -97
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d.syntax +0 -276
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d_html.syntax +0 -311
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d_ini.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d_library.syntax +0 -21
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ada.syntax +0 -33
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/antlr.syntax +0 -151
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/apache.syntax +0 -191
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/applescript.syntax +0 -384
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/asp.syntax +0 -70
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/asp_vb.net.syntax +0 -129
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/bibtex.syntax +0 -151
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_html.syntax +0 -41
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_markdown.syntax +0 -42
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_text.syntax +0 -27
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_textile.syntax +0 -27
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/build.syntax +0 -53
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/bulletin_board.syntax +0 -287
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/cake.syntax +0 -55
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/camlp4.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/cm.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/coldfusion.syntax +0 -119
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/context_free.syntax +0 -176
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/cs.syntax +0 -59
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/css.syntax +0 -195
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/css_experimental.syntax +0 -1925
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/csv.syntax +0 -68
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/d.syntax +0 -142
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/diff.syntax +0 -81
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/dokuwiki.syntax +0 -204
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/dot.syntax +0 -47
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/doxygen.syntax +0 -43
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/dylan.syntax +0 -62
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/eiffel.syntax +0 -78
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/erlang.syntax +0 -922
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/f-script.syntax +0 -80
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/fortran.syntax +0 -141
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/fxscript.syntax +0 -142
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/greasemonkey.syntax +0 -34
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/gri.syntax +0 -83
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/groovy.syntax +0 -191
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/gtd.syntax +0 -22
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/gtdalt.syntax +0 -143
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/haml.syntax +0 -88
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/haskell.syntax +0 -88
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html-asp.syntax +0 -27
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html.syntax +0 -362
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_django.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_for_asp.net.syntax +0 -424
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_mason.syntax +0 -119
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_rails.syntax +0 -40
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_tcl.syntax +0 -26
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/icalendar.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/inform.syntax +0 -48
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ini.syntax +0 -55
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/installer_distribution_script.syntax +0 -77
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/io.syntax +0 -81
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/java.syntax +0 -211
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/javaproperties.syntax +0 -20
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/javascript.syntax +0 -256
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/javascript_+_prototype.syntax +0 -72
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/javascript_+_prototype_bracketed.syntax +0 -140
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/jquery_javascript.syntax +0 -114
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/json.syntax +0 -136
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/languagedefinition.syntax +0 -708
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex.syntax +0 -566
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex_beamer.syntax +0 -41
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex_log.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex_memoir.syntax +0 -64
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/lexflex.syntax +0 -219
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/lighttpd.syntax +0 -54
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/lilypond.syntax +0 -492
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/lisp.syntax +0 -61
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/literate_haskell.syntax +0 -24
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/logo.syntax +0 -29
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/logtalk.syntax +0 -152
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/lua.syntax +0 -86
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/m.syntax +0 -142
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/macports_portfile.syntax +0 -163
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/makefile.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/man.syntax +0 -17
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/mediawiki.syntax +0 -567
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/mips.syntax +0 -66
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/mod_perl.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/modula-3.syntax +0 -47
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/moinmoin.syntax +0 -189
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/mootools.syntax +0 -572
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/movable_type.syntax +0 -162
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/multimarkdown.syntax +0 -39
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/objective-c++.syntax +0 -18
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/objective-c.syntax +0 -233
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ocaml.syntax +0 -764
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ocamllex.syntax +0 -167
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ocamlyacc.syntax +0 -184
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/opengl.syntax +0 -14
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/pascal.syntax +0 -77
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/perl.syntax +0 -1115
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/plain_text.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/postscript.syntax +0 -114
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/processing.syntax +0 -106
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/prolog.syntax +0 -40
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/property_list.syntax +0 -635
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/python.syntax +0 -868
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/python_django.syntax +0 -21
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/qmake_project.syntax +0 -114
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/qt_c++.syntax +0 -26
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/quake3_config.syntax +0 -32
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/r.syntax +0 -81
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/r_console.syntax +0 -16
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ragel.syntax +0 -201
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/rd_r_documentation.syntax +0 -91
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/regexp.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/release_notes.syntax +0 -46
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/remind.syntax +0 -253
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/restructuredtext.syntax +0 -250
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/rez.syntax +0 -80
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ruby.syntax +0 -1035
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ruby_experimental.syntax +0 -145
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ruby_on_rails.syntax +0 -88
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/s5.syntax +0 -69
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/scheme.syntax +0 -347
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/scilab.syntax +0 -41
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/setext.syntax +0 -147
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/shell-unix-generic.syntax +0 -384
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/slate.syntax +0 -149
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/sql.syntax +0 -237
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/sql_rails.syntax +0 -18
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/ssh-config.syntax +0 -33
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/standard_ml.syntax +0 -121
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/strings_file.syntax +0 -39
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/subversion_commit_message.syntax +0 -36
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/sweave.syntax +0 -84
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/swig.syntax +0 -57
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/tcl.syntax +0 -152
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/template_toolkit.syntax +0 -121
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/tex.syntax +0 -86
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/tex_math.syntax +0 -49
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/textile.syntax +0 -215
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/tsv.syntax +0 -50
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/twiki.syntax +0 -241
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/txt2tags.syntax +0 -79
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/vectorscript.syntax +0 -57
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/xhtml_1.0.syntax +0 -4027
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/xml.syntax +0 -180
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/xml_strict.syntax +0 -92
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/xsl.syntax +0 -60
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/yaml.syntax +0 -160
- data/lib/kitabu/vendor/ruby1.9/uv/syntax/yui_javascript.syntax +0 -176
- data/lib/kitabu/vendor/ruby1.9/uv/uv.rb +0 -89
- data/lib/kitabu/vendor/ruby1.9/uv/uv/render_processor.rb +0 -132
- data/lib/kitabu/vendor/ruby1.9/uv/uv/utility.rb +0 -68
- data/spec/exit_matcher.rb +0 -45
- data/spec/fixtures/rails-guides/code/sample.rb +0 -7
- data/spec/kitabu/base_spec.rb +0 -159
- data/spec/kitabu/blackcloth_spec.rb +0 -41
- data/spec/kitabu/bug_fix_spec.rb +0 -25
- data/spec/kitabu/command_spec.rb +0 -82
- data/templates/Rakefile +0 -3
- data/templates/config.yml +0 -9
- data/templates/layouts/boom/layout.css +0 -469
- data/templates/syntax.css +0 -1065
- data/templates/themes/active4d.css +0 -114
- data/templates/themes/blackboard.css +0 -88
- data/templates/themes/dawn.css +0 -121
- data/templates/themes/eiffel.css +0 -121
- data/templates/themes/idle.css +0 -62
- data/templates/themes/iplastic.css +0 -80
- data/templates/themes/lazy.css +0 -73
- data/templates/themes/slush_poppies.css +0 -85
- data/templates/themes/sunburst.css +0 -180
@@ -0,0 +1,131 @@
|
|
1
|
+
module Kitabu
|
2
|
+
module Parser
|
3
|
+
class Epub < Html
|
4
|
+
|
5
|
+
module Toc
|
6
|
+
HEAD = <<-HEAD
|
7
|
+
<?xml version='1.0' encoding='utf-8' ?>
|
8
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
9
|
+
<html xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
10
|
+
<head>
|
11
|
+
<meta content='application/xhtml+xml; charset=utf-8' http-equiv='Content-Type' />
|
12
|
+
<title>Table of Contents</title>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div id='toc'>
|
16
|
+
<ul>
|
17
|
+
HEAD
|
18
|
+
|
19
|
+
TAIL = <<-TAIL
|
20
|
+
</ul>
|
21
|
+
</div>
|
22
|
+
</body>
|
23
|
+
</html>
|
24
|
+
TAIL
|
25
|
+
|
26
|
+
def generate_html(nav)
|
27
|
+
HEAD +
|
28
|
+
nav.map { |element|
|
29
|
+
"<li><a href='#{element[:content]}'>#{element[:label]}</a></li>"
|
30
|
+
}.join +
|
31
|
+
TAIL
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate_file(*args)
|
35
|
+
filename = "tmp/toc.html"
|
36
|
+
File.open(filename, 'w') { |file| file.write generate_html(*args) }
|
37
|
+
filename
|
38
|
+
end
|
39
|
+
module_function :generate_file, :generate_html
|
40
|
+
end
|
41
|
+
|
42
|
+
attr_accessor :epub
|
43
|
+
|
44
|
+
def initialize(*args)
|
45
|
+
super
|
46
|
+
FileUtils.mkdir_p('tmp')
|
47
|
+
@epub = EeePub::Maker.new
|
48
|
+
end
|
49
|
+
|
50
|
+
def parse
|
51
|
+
epub.title config[:title]
|
52
|
+
epub.language config[:language]
|
53
|
+
epub.creator config[:authors].to_sentence
|
54
|
+
epub.publisher config[:publisher]
|
55
|
+
epub.date config[:published_at]
|
56
|
+
epub.uid config[:uid]
|
57
|
+
epub.identifier config[:identifier][:id], :scheme => config[:identifier][:type]
|
58
|
+
epub.cover_page cover_image
|
59
|
+
|
60
|
+
assets = collect_assets
|
61
|
+
sections = collect_sections
|
62
|
+
filenames = collect_filenames(sections)
|
63
|
+
|
64
|
+
epub.files filenames + assets
|
65
|
+
epub.nav collect_nav(sections, filenames)
|
66
|
+
|
67
|
+
epub.toc_page Toc.generate_file collect_nav(sections, filenames)
|
68
|
+
|
69
|
+
epub.save(epub_path)
|
70
|
+
true
|
71
|
+
rescue Exception
|
72
|
+
p $!, $@
|
73
|
+
false
|
74
|
+
end
|
75
|
+
|
76
|
+
def collect_assets
|
77
|
+
[cover_image, File.join(root_dir, "templates", "epub", "style.css")].compact
|
78
|
+
end
|
79
|
+
|
80
|
+
def cover_image
|
81
|
+
path = root_dir.join('images/cover-epub.jpg')
|
82
|
+
return path if File.exist?(path)
|
83
|
+
end
|
84
|
+
|
85
|
+
def chapter(entry)
|
86
|
+
files = chapter_files(entry)
|
87
|
+
content = replace_paths(render_chapter(files, true))
|
88
|
+
html = Nokogiri(content)
|
89
|
+
title = html.css("h2").first.text
|
90
|
+
|
91
|
+
[
|
92
|
+
title,
|
93
|
+
render_template(
|
94
|
+
root_dir.join("templates/epub/page.erb"),
|
95
|
+
{:chapter_title => title, :content => content, :language => config[:language]}
|
96
|
+
)
|
97
|
+
]
|
98
|
+
end
|
99
|
+
|
100
|
+
def collect_sections
|
101
|
+
entries.map { |entry| chapter(entry) }
|
102
|
+
end
|
103
|
+
|
104
|
+
def collect_filenames(sections)
|
105
|
+
index = 0
|
106
|
+
|
107
|
+
sections.map do |section|
|
108
|
+
index += 1
|
109
|
+
|
110
|
+
filename = "tmp/section_#{index}.html"
|
111
|
+
File.open(filename, 'w') { |file| file.write section[1] }
|
112
|
+
filename
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def collect_nav(sections, filenames)
|
117
|
+
[sections, filenames].transpose.map do |section, filename|
|
118
|
+
{:label => section[0], :content => File.basename(filename)}
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def replace_paths(text)
|
123
|
+
text.gsub(%r[src="(.*?)"]) {|m| %[src="#{File.basename($1)}"]}
|
124
|
+
end
|
125
|
+
|
126
|
+
def epub_path
|
127
|
+
root_dir.join("output/#{name}.epub")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
module Kitabu
|
2
|
+
module Parser
|
3
|
+
class Html < Base
|
4
|
+
# Supported Markdown libraries
|
5
|
+
#
|
6
|
+
MARKDOWN_LIBRARIES = %w[Maruku BlueCloth PEGMarkdown Redcarpet RDiscount]
|
7
|
+
|
8
|
+
# List of directories that should be skipped.
|
9
|
+
#
|
10
|
+
IGNORE_DIR = %w[. .. .svn]
|
11
|
+
|
12
|
+
# Files that should be skipped.
|
13
|
+
#
|
14
|
+
IGNORE_FILES = /^(CHANGELOG|TOC)\..*?$/
|
15
|
+
|
16
|
+
# List of recognized extensions.
|
17
|
+
#
|
18
|
+
EXTENSIONS = %w[md mkdn markdown textile html]
|
19
|
+
|
20
|
+
# Parse all files and save the parsed content
|
21
|
+
# to <tt>output/book_name.html</tt>.
|
22
|
+
#
|
23
|
+
def parse
|
24
|
+
File.open(root_dir.join("output/#{name}.html"), "w+") do |file|
|
25
|
+
file << parse_layout(content)
|
26
|
+
end
|
27
|
+
true
|
28
|
+
rescue Exception
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
# Return all chapters wrapped in a <tt>div.chapter</tt> tag.
|
33
|
+
#
|
34
|
+
def content
|
35
|
+
String.new.tap do |chapters|
|
36
|
+
entries.each do |entry|
|
37
|
+
files = chapter_files(entry)
|
38
|
+
|
39
|
+
# no markup files, so skip to the next one!
|
40
|
+
next if files.empty?
|
41
|
+
|
42
|
+
chapters << %[<div class="chapter">#{render_chapter(files)}</div>]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Return the configuration file.
|
48
|
+
#
|
49
|
+
def config
|
50
|
+
Kitabu.config(root_dir)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Return a list of all recognized files.
|
54
|
+
#
|
55
|
+
def entries
|
56
|
+
Dir.entries(source).sort.inject([]) do |buffer, entry|
|
57
|
+
buffer << source.join(entry) if valid_entry?(entry)
|
58
|
+
buffer
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
def chapter_files(entry)
|
64
|
+
# Chapters can be files outside a directory.
|
65
|
+
if File.file?(entry)
|
66
|
+
[entry]
|
67
|
+
else
|
68
|
+
Dir.glob("#{entry}/**/*.{#{EXTENSIONS.join(",")}}").sort
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check if path is a valid entry.
|
73
|
+
# Files/directories that start with a dot or underscore will be skipped.
|
74
|
+
#
|
75
|
+
def valid_entry?(entry)
|
76
|
+
entry !~ /^(\.|_)/ && (valid_directory?(entry) || valid_file?(entry))
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check if path is a valid directory.
|
80
|
+
#
|
81
|
+
def valid_directory?(entry)
|
82
|
+
File.directory?(source.join(entry)) && !IGNORE_DIR.include?(File.basename(entry))
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check if path is a valid file.
|
86
|
+
#
|
87
|
+
def valid_file?(entry)
|
88
|
+
ext = File.extname(entry).gsub(/\./, "").downcase
|
89
|
+
File.file?(source.join(entry)) && EXTENSIONS.include?(ext) && entry !~ IGNORE_FILES
|
90
|
+
end
|
91
|
+
|
92
|
+
# Render +file+ considering its extension.
|
93
|
+
#
|
94
|
+
def render_file(file, plain_syntax = false)
|
95
|
+
file_format = format(file)
|
96
|
+
|
97
|
+
content = Kitabu::Syntax.render(root_dir, file_format, File.read(file), plain_syntax)
|
98
|
+
|
99
|
+
case file_format
|
100
|
+
when :markdown
|
101
|
+
markdown.new(content).to_html
|
102
|
+
when :textile
|
103
|
+
RedCloth.convert(content)
|
104
|
+
else
|
105
|
+
content
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def format(file)
|
110
|
+
case File.extname(file).downcase
|
111
|
+
when ".markdown", ".mkdn", ".md"
|
112
|
+
:markdown
|
113
|
+
when ".textile"
|
114
|
+
:textile
|
115
|
+
else
|
116
|
+
:html
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Parse layout file, making available all configuration entries.
|
121
|
+
#
|
122
|
+
def parse_layout(html)
|
123
|
+
toc = Toc.generate(html)
|
124
|
+
locals = config.merge({
|
125
|
+
:content => toc.content,
|
126
|
+
:toc => toc.to_html,
|
127
|
+
:changelog => render_changelog
|
128
|
+
})
|
129
|
+
render_template(root_dir.join("templates/html/layout.erb"), locals)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Render changelog file.
|
133
|
+
# This file can be used to inform any book change.
|
134
|
+
#
|
135
|
+
def render_changelog
|
136
|
+
changelog = Dir[root_dir.join("text/CHANGELOG.*")].first
|
137
|
+
return render_file(changelog) if changelog
|
138
|
+
nil
|
139
|
+
end
|
140
|
+
|
141
|
+
# Render a eRb template using +locals+ as data seed.
|
142
|
+
#
|
143
|
+
def render_template(file, locals = {})
|
144
|
+
ERB.new(File.read(file)).result OpenStruct.new(locals).instance_eval{ binding }
|
145
|
+
end
|
146
|
+
|
147
|
+
# Render all +files+ from a given chapter.
|
148
|
+
#
|
149
|
+
def render_chapter(files, plain_syntax = false)
|
150
|
+
String.new.tap do |chapter|
|
151
|
+
files.each do |file|
|
152
|
+
chapter << render_file(file, plain_syntax) << "\n\n"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# Retrieve preferred Markdown processor.
|
158
|
+
# You'll need one of the following libraries:
|
159
|
+
#
|
160
|
+
# # RDiscount: https://rubygems.org/gems/rdiscount
|
161
|
+
# # Maruku: https://rubygems.org/gems/maruku
|
162
|
+
# # PEGMarkdown: https://rubygems.org/gems/rpeg-markdown
|
163
|
+
# # BlueCloth: https://rubygems.org/gems/bluecloth
|
164
|
+
# # Redcarpet: https://rubygems.org/gems/redcarpet
|
165
|
+
#
|
166
|
+
# Note: RDiscount will always be installed as Kitabu's dependency but only used when no
|
167
|
+
# alternative library is available.
|
168
|
+
#
|
169
|
+
def markdown
|
170
|
+
@markdown ||= Object.const_get(MARKDOWN_LIBRARIES.find {|lib| Object.const_defined?(lib)})
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Kitabu
|
2
|
+
module Parser
|
3
|
+
class Mobi < Base
|
4
|
+
def parse
|
5
|
+
command = ["kindlegen", epub_file.to_s,]
|
6
|
+
puts command
|
7
|
+
|
8
|
+
Process.wait Process.spawn(*command)
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
def epub_file
|
13
|
+
root_dir.join("output/#{name}.epub")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Kitabu
|
2
|
+
module Parser
|
3
|
+
class Pdf < Base
|
4
|
+
def parse
|
5
|
+
content = File.read(html_file)
|
6
|
+
prince_friendly_footnotes = transform_footnotes(content)
|
7
|
+
|
8
|
+
transformed_html_file = File.new('output/prince_friendly_footnote_file.html', 'w')
|
9
|
+
transformed_html_file.write prince_friendly_footnotes
|
10
|
+
|
11
|
+
command = ["prince", transformed_html_file.path, "-o", pdf_file.to_s]
|
12
|
+
Process.wait Process.spawn(*command)
|
13
|
+
|
14
|
+
transformed_html_file.close
|
15
|
+
File.unlink(transformed_html_file)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def transform_footnotes(content)
|
20
|
+
doc = Nokogiri::HTML(content)
|
21
|
+
doc.css('a').each do |node|
|
22
|
+
prince_friendly_footnote = <<-FN
|
23
|
+
#{node.text}<span class='fn'><a href='#{node['href']}'>#{node['href']}</a></span>
|
24
|
+
FN
|
25
|
+
|
26
|
+
node.replace(prince_friendly_footnote)
|
27
|
+
end
|
28
|
+
|
29
|
+
doc.to_xhtml
|
30
|
+
end
|
31
|
+
|
32
|
+
def html_file
|
33
|
+
root_dir.join("output/#{name}.html")
|
34
|
+
end
|
35
|
+
|
36
|
+
def pdf_file
|
37
|
+
root_dir.join("output/#{name}.pdf")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Kitabu
|
2
|
+
module Parser
|
3
|
+
class Txt < Base
|
4
|
+
def parse
|
5
|
+
command = ["html2text", "-style", "pretty", "-o", txt_file.to_s, html_file.to_s]
|
6
|
+
puts command.join(' ')
|
7
|
+
|
8
|
+
Process.wait Process.spawn(*command)
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
def html_file
|
13
|
+
root_dir.join("output/#{name}.html")
|
14
|
+
end
|
15
|
+
|
16
|
+
def txt_file
|
17
|
+
root_dir.join("output/#{name}.txt")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Kitabu
|
2
|
+
class Stream
|
3
|
+
attr_accessor :listener, :content
|
4
|
+
attr_reader :html
|
5
|
+
|
6
|
+
def initialize(content, listener)
|
7
|
+
@content = content
|
8
|
+
@listener = listener
|
9
|
+
@html = Nokogiri::HTML.parse(content)
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse
|
13
|
+
traverse(html)
|
14
|
+
end
|
15
|
+
|
16
|
+
def traverse(node)
|
17
|
+
node.children.each do |child|
|
18
|
+
emit(child)
|
19
|
+
traverse(child)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def emit(node)
|
24
|
+
listener.send(:tag, node) if node.name =~ /h[2-6]/
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/kitabu/syntax.rb
CHANGED
@@ -1,126 +1,128 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
module Kitabu
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
if options[:from_line] && options[:to_line]
|
19
|
-
# Check if there's a line range and if so, set the code to
|
20
|
-
# the chosen lines
|
21
|
-
from_line = options[:from_line].to_i - 1
|
22
|
-
to_line = options[:to_line].to_i
|
23
|
-
offset = to_line - from_line
|
24
|
-
code = file.readlines.slice(from_line, offset).join
|
25
|
-
elsif block_name = options[:block_name]
|
26
|
-
# Check if there's a block name and retrieve it
|
27
|
-
re = %r(# ?begin: ?\b#{block_name}\b ?(?:[^\r\n]+)?\r?\n(.*?)\r?\n([^\r\n]+)?# ?end: \b#{block_name}\b)sim
|
28
|
-
file.read.gsub(re) { |block| code = $1 }
|
29
|
-
else
|
30
|
-
# As last resource, just read the whole file
|
31
|
-
code = file.read
|
32
|
-
code = code.gsub(/</, '<').gsub(/>/, '>').gsub(/&/, '&')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# no code? set to default
|
37
|
-
code ||= options[:code]
|
38
|
-
|
39
|
-
# normalize indentation
|
40
|
-
line = StringIO.new(code).readlines[0]
|
41
|
-
|
42
|
-
if line =~ /^(\t+)/
|
43
|
-
char = "\t"
|
44
|
-
size = $1.length
|
45
|
-
elsif line =~ /^( +)/
|
46
|
-
char = " "
|
47
|
-
size = $1.length
|
2
|
+
class Syntax
|
3
|
+
attr_reader :io
|
4
|
+
attr_reader :lines
|
5
|
+
attr_reader :root_dir
|
6
|
+
attr_reader :format
|
7
|
+
|
8
|
+
# Render syntax blocks from specified source code.
|
9
|
+
#
|
10
|
+
# dir = Pathname.new(File.dirname(__FILE__))
|
11
|
+
# text = File.read(dir.join("text/some_file.textile"))
|
12
|
+
# Kitabu::Syntax.render(dir, :textile, text)
|
13
|
+
#
|
14
|
+
def self.render(root_dir, format, source_code, raw = false)
|
15
|
+
source_code.gsub(/@@@(.*?)@@@/m) do |match|
|
16
|
+
new(root_dir, format, $1, raw).process
|
48
17
|
end
|
18
|
+
end
|
49
19
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
20
|
+
# Process each syntax block individually.
|
21
|
+
#
|
22
|
+
def initialize(root_dir, format, code, raw = false)
|
23
|
+
@format = format
|
24
|
+
@root_dir = root_dir
|
25
|
+
@io = StringIO.new(code)
|
26
|
+
@lines = io.readlines.collect(&:chomp)
|
27
|
+
@language = 'text' if raw
|
55
28
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
# get default syntax if no syntax has been set yet
|
63
|
-
syntax = Kitabu::Base.default_syntax if syntax.to_s =~ /^\s*$/ || !Kitabu::Base.syntax?(syntax)
|
64
|
-
|
65
|
-
# replace ampersand for textile; this is added
|
66
|
-
# by RedCloth
|
67
|
-
code.gsub!(/x%x%/sm, "&") if processor == :textile
|
68
|
-
|
69
|
-
# do replace PRE tags using the syntax and added classes
|
70
|
-
silence_warnings do
|
71
|
-
code = Uv.parse(code, "xhtml", syntax, false, theme)
|
72
|
-
end
|
73
|
-
code.gsub!(/<pre class="(.*?)"/sim, %(<pre class="\\1 #{syntax}"))
|
74
|
-
code.gsub!(/<pre>/sim, %(<pre class="#{syntax} #{theme}"))
|
75
|
-
|
76
|
-
code
|
29
|
+
|
30
|
+
# Return unprocessed line codes.
|
31
|
+
#
|
32
|
+
def raw
|
33
|
+
lines[1..-1].join("\n")
|
77
34
|
end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
35
|
+
|
36
|
+
# Return meta data from syntax annotation.
|
37
|
+
#
|
38
|
+
def meta
|
39
|
+
@meta ||= begin
|
40
|
+
line = lines.first.squish
|
41
|
+
_, language, file, modifier, reference = *line.match(/^([^ ]+)(?: ([^:#]+)(?:(:|#)(.*?))?)?$/)
|
42
|
+
|
43
|
+
if modifier == "#"
|
44
|
+
type = :block
|
45
|
+
elsif modifier == ":"
|
46
|
+
type = :range
|
47
|
+
elsif file
|
48
|
+
type = :file
|
49
|
+
else
|
50
|
+
type = :inline
|
87
51
|
end
|
88
|
-
else
|
89
|
-
# markdown
|
90
|
-
content = content.gsub /<pre><code>(.*?)<\/code><\/pre>/m do |block|
|
91
|
-
code = $1.gsub(/</, '<').gsub(/>/, '>').gsub(/&/, '&')
|
92
|
-
code_lines = StringIO.new(code).readlines
|
93
|
-
syntax_settings = code_lines.first
|
94
52
|
|
95
|
-
|
53
|
+
{
|
54
|
+
:language => language,
|
55
|
+
:file => file,
|
56
|
+
:type => type,
|
57
|
+
:reference => reference
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
96
61
|
|
97
|
-
|
98
|
-
|
62
|
+
# Process syntax block, returning a +pre+ HTML tag.
|
63
|
+
#
|
64
|
+
def process
|
65
|
+
code = raw.to_s.strip_heredoc
|
66
|
+
code = process_file.gsub(/\n^.*?@(begin|end):.*?$/, "") if meta[:file]
|
99
67
|
|
100
|
-
|
101
|
-
m, syntax = *syntax_settings.match(/syntax\(([^ #]+).*?\)./)
|
68
|
+
code = Pygments.highlight(code, :lexer => language)
|
102
69
|
|
103
|
-
|
104
|
-
|
70
|
+
# escape for textile
|
71
|
+
code = %[<notextile>#{code}</notextile>] if format == :textile
|
72
|
+
code
|
73
|
+
end
|
105
74
|
|
106
|
-
|
107
|
-
|
75
|
+
private
|
76
|
+
# Process line range as in <tt>@@@ ruby some_file.rb:15,20 @@@</tt>.
|
77
|
+
#
|
78
|
+
def process_range(code)
|
79
|
+
starts, ends = meta[:reference].split(",").collect(&:to_i)
|
80
|
+
code = StringIO.new(code).readlines[starts-1..ends-1].join("\n").strip_heredoc.chomp
|
81
|
+
end
|
108
82
|
|
109
|
-
|
110
|
-
|
83
|
+
# Process block name as in <tt>@@@ ruby some_file.rb#some_block @@@</tt>.
|
84
|
+
#
|
85
|
+
def process_block(code)
|
86
|
+
code.gsub!(/\r\n/, "\n")
|
87
|
+
re = %r[@begin: *\b(#{meta[:reference]})\b *[^\n]*\n(.*?)\n[^\n]*@end: \1]im
|
111
88
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
})
|
119
|
-
end
|
89
|
+
if code.match(re)
|
90
|
+
$2.strip_heredoc
|
91
|
+
else
|
92
|
+
"[missing '#{meta[:reference]}' block name]"
|
93
|
+
end
|
94
|
+
end
|
120
95
|
|
121
|
-
|
96
|
+
# Process file and its relatives.
|
97
|
+
#
|
98
|
+
def process_file
|
99
|
+
file_path = root_dir.join("code/#{meta[:file]}")
|
100
|
+
|
101
|
+
if File.exist?(file_path)
|
102
|
+
code = File.read(file_path)
|
103
|
+
|
104
|
+
if meta[:type] == :range
|
105
|
+
process_range(code)
|
106
|
+
elsif meta[:type] == :block
|
107
|
+
process_block(code)
|
108
|
+
else
|
109
|
+
code
|
122
110
|
end
|
111
|
+
else
|
112
|
+
"[missing 'code/#{meta[:file]}' file]"
|
123
113
|
end
|
124
114
|
end
|
115
|
+
|
116
|
+
# Return e-book's configuration.
|
117
|
+
#
|
118
|
+
def config
|
119
|
+
Kitabu.config(root_dir)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Return the language used for this syntax block. Overrideable
|
123
|
+
# for epub generation.
|
124
|
+
def language
|
125
|
+
@language || meta[:language]
|
126
|
+
end
|
125
127
|
end
|
126
128
|
end
|