Skip to content
Browse files

Upgraded to Rails 2.2 & RedCloth 4.1

  • Loading branch information...
1 parent 819aafc commit 81c21cc86d901bc73cc0ed8c99265a1473bfd4b7 faithfulgeek committed Jan 31, 2009
Showing with 33 additions and 18,511 deletions.
  1. +28 −28 app/controllers/posts_controller.rb
  2. +1 −1 config/deploy.rb
  3. +3 −7 config/environment.rb
  4. +1 −2 config/environments/development.rb
  5. +0 −1 config/environments/staging.rb
  6. +0 −1 script/spin
  7. +0 −3 vendor/RedCloth-3.0.4/bin/redcloth
  8. +0 −160 vendor/RedCloth-3.0.4/doc/CHANGELOG
  9. +0 −25 vendor/RedCloth-3.0.4/doc/COPYING
  10. +0 −106 vendor/RedCloth-3.0.4/doc/README
  11. +0 −216 vendor/RedCloth-3.0.4/doc/REFERENCE
  12. +0 −359 vendor/RedCloth-3.0.4/doc/make.rb
  13. +0 −1,130 vendor/RedCloth-3.0.4/lib/redcloth.rb
  14. +0 −28 vendor/RedCloth-3.0.4/run-tests.rb
  15. +0 −1,376 vendor/RedCloth-3.0.4/setup.rb
  16. +0 −105 vendor/RedCloth-3.0.4/tests/code.yml
  17. +0 −26 vendor/RedCloth-3.0.4/tests/hard_breaks.yml
  18. +0 −171 vendor/RedCloth-3.0.4/tests/images.yml
  19. +0 −39 vendor/RedCloth-3.0.4/tests/instiki.yml
  20. +0 −155 vendor/RedCloth-3.0.4/tests/links.yml
  21. +0 −77 vendor/RedCloth-3.0.4/tests/lists.yml
  22. +0 −218 vendor/RedCloth-3.0.4/tests/markdown.yml
  23. +0 −64 vendor/RedCloth-3.0.4/tests/poignant.yml
  24. +0 −198 vendor/RedCloth-3.0.4/tests/table.yml
  25. +0 −406 vendor/RedCloth-3.0.4/tests/textism.yml
  26. +0 −336 vendor/rails/actionmailer/CHANGELOG
  27. +0 −21 vendor/rails/actionmailer/MIT-LICENSE
  28. +0 −149 vendor/rails/actionmailer/README
  29. +0 −97 vendor/rails/actionmailer/Rakefile
  30. +0 −30 vendor/rails/actionmailer/install.rb
  31. +0 −52 vendor/rails/actionmailer/lib/action_mailer.rb
  32. +0 −30 vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
  33. +0 −646 vendor/rails/actionmailer/lib/action_mailer/base.rb
  34. +0 −111 vendor/rails/actionmailer/lib/action_mailer/helpers.rb
  35. +0 −19 vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
  36. +0 −110 vendor/rails/actionmailer/lib/action_mailer/part.rb
  37. +0 −51 vendor/rails/actionmailer/lib/action_mailer/part_container.rb
  38. +0 −61 vendor/rails/actionmailer/lib/action_mailer/quoting.rb
  39. +0 −64 vendor/rails/actionmailer/lib/action_mailer/test_case.rb
  40. +0 −67 vendor/rails/actionmailer/lib/action_mailer/test_helper.rb
  41. +0 −8 vendor/rails/actionmailer/lib/action_mailer/utils.rb
  42. +0 −14 vendor/rails/actionmailer/lib/action_mailer/vendor.rb
  43. +0 −1,466 vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
  44. +0 −5 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail.rb
  45. +0 −426 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/address.rb
  46. +0 −46 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb
  47. +0 −46 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/base64.rb
  48. +0 −41 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/compat.rb
  49. +0 −67 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/config.rb
  50. +0 −63 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/core_extensions.rb
  51. +0 −581 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/encode.rb
  52. +0 −960 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/header.rb
  53. +0 −9 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/index.rb
  54. +0 −1,130 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/interface.rb
  55. +0 −3 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/loader.rb
  56. +0 −578 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/mail.rb
  57. +0 −495 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/mailbox.rb
  58. +0 −6 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/main.rb
  59. +0 −3 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/mbox.rb
  60. +0 −248 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb
  61. +0 −132 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/obsolete.rb
  62. +0 −1,476 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb
  63. +0 −379 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/port.rb
  64. +0 −118 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb
  65. +0 −58 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/require_arch.rb
  66. +0 −49 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner.rb
  67. +0 −261 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner_r.rb
  68. +0 −280 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/stringio.rb
  69. +0 −337 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/utils.rb
  70. +0 −39 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/version.rb
  71. +0 −9 vendor/rails/actionmailer/lib/action_mailer/version.rb
  72. +0 −1 vendor/rails/actionmailer/lib/actionmailer.rb
  73. +0 −49 vendor/rails/actionmailer/test/abstract_unit.rb
  74. +0 −51 vendor/rails/actionmailer/test/delivery_method_test.rb
  75. +0 −1 vendor/rails/actionmailer/test/fixtures/first_mailer/share.erb
  76. +0 −1 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.erb
  77. +0 −1 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.erb
  78. +0 −1 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.erb
  79. +0 −5 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.erb
  80. +0 −5 vendor/rails/actionmailer/test/fixtures/helpers/example_helper.rb
  81. +0 −1 ...nmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb
  82. +0 −14 vendor/rails/actionmailer/test/fixtures/raw_email
  83. +0 −20 vendor/rails/actionmailer/test/fixtures/raw_email10
  84. +0 −32 vendor/rails/actionmailer/test/fixtures/raw_email12
  85. +0 −29 vendor/rails/actionmailer/test/fixtures/raw_email13
  86. +0 −114 vendor/rails/actionmailer/test/fixtures/raw_email2
  87. +0 −70 vendor/rails/actionmailer/test/fixtures/raw_email3
  88. +0 −59 vendor/rails/actionmailer/test/fixtures/raw_email4
  89. +0 −19 vendor/rails/actionmailer/test/fixtures/raw_email5
  90. +0 −20 vendor/rails/actionmailer/test/fixtures/raw_email6
  91. +0 −66 vendor/rails/actionmailer/test/fixtures/raw_email7
  92. +0 −47 vendor/rails/actionmailer/test/fixtures/raw_email8
  93. +0 −28 vendor/rails/actionmailer/test/fixtures/raw_email9
  94. +0 −14 vendor/rails/actionmailer/test/fixtures/raw_email_quoted_with_0d0a
  95. +0 −104 vendor/rails/actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type
  96. +0 −100 vendor/rails/actionmailer/test/fixtures/raw_email_with_nested_attachment
  97. +0 −14 vendor/rails/actionmailer/test/fixtures/raw_email_with_partially_quoted_subject
  98. +0 −1 vendor/rails/actionmailer/test/fixtures/second_mailer/share.erb
  99. +0 −3 vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb
  100. +0 −1 vendor/rails/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb
  101. +0 −6 vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml
  102. +0 −6 vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml
  103. +0 −1 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb
  104. +0 −1 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak
  105. +0 −10 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb
  106. +0 −2 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb
  107. +0 −1 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb
  108. +0 −1 vendor/rails/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb
  109. +0 −2 vendor/rails/actionmailer/test/fixtures/test_mailer/rxml_template.builder
  110. +0 −2 vendor/rails/actionmailer/test/fixtures/test_mailer/rxml_template.rxml
  111. +0 −3 vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb
  112. +0 −5 vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb
  113. +0 −95 vendor/rails/actionmailer/test/mail_helper_test.rb
  114. +0 −122 vendor/rails/actionmailer/test/mail_render_test.rb
  115. +0 −979 vendor/rails/actionmailer/test/mail_service_test.rb
  116. +0 −98 vendor/rails/actionmailer/test/quoting_test.rb
  117. +0 −129 vendor/rails/actionmailer/test/test_helper_test.rb
  118. +0 −22 vendor/rails/actionmailer/test/tmail_test.rb
  119. +0 −76 vendor/rails/actionmailer/test/url_test.rb
Sorry, we could not display the entire diff because too many files (1,278) changed.
View
56 app/controllers/posts_controller.rb
@@ -1,15 +1,15 @@
class PostsController < ResourceController::Base
- alias r_c_generated_object object
+ alias r_c_generated_object object
new_action.wants.html do
render_for_admin :html => @posts
end
-
- index.wants.atom
+
+ index.wants.atom
index.wants.html do
@sticky = Post.sticky
-
+
for_user_by_type do |type|
case type
when :anonymous
@@ -25,16 +25,16 @@ class PostsController < ResourceController::Base
end
end
- create.before { @post.author = @current_user }
- create.after { logger.info "MY OBJECT: #{@post} AND IT'S ATTRIBUTES: #{@post.attributes}" }
+ create.before { @post.author = @current_user }
+ create.after { logger.info "MY OBJECT: #{@post} AND IT'S ATTRIBUTES: #{@post.attributes}" }
- show.wants.html do
- if params[:day] and params[:month] and params[:year]
- ex = "#{params[:month]}/#{params[:day]}/#{params[:year]}"
- elsif params[:year]
- ex = "Year: #{params[:year]}"
- end
- end
+ show.wants.html do
+ if params[:day] and params[:month] and params[:year]
+ ex = "#{params[:month]}/#{params[:day]}/#{params[:year]}"
+ elsif params[:year]
+ ex = "Year: #{params[:year]}"
+ end
+ end
show.wants.xml { render :xml => @post }
new_action.wants.xml { render :xml => @post }
@@ -46,30 +46,30 @@ class PostsController < ResourceController::Base
protected
def object
- if params[:id]
- my_object = Post.find params[:id]
- elsif params[:action] != 'create'
- my_object = Post.new
- else
- my_object = r_c_generated_object
- end
- my_object
+ if params[:id]
+ my_object = Post.find params[:id]
+ elsif params[:action] != 'create'
+ my_object = Post.new
+ else
+ my_object = r_c_generated_object
+ end
+ my_object
end
def load_collection
- if params[:tag]
- @posts = Post.find_tagged_with params[:tag]
- elsif @current_user
- @posts = Post.posts_per_date
- else
+ if params[:tag]
+ @posts = Post.find_tagged_with params[:tag]
+ elsif @current_user
+ @posts = Post.posts_per_date
+ else
for_user_by_type do |type|
if type == :admin
- @posts = Post.posts_per_date
+ @posts = Post.posts_per_date
else
@posts = Post.not_sticky.all :limit => 10, :order => "created_at desc"
end
end
- end
+ end
end
end
View
2 config/deploy.rb
@@ -3,7 +3,7 @@
set :scm, :git
set :git_enable_submodules, 1
set :spinner_user, nil
-set :runner, 'deployer'
+set :runner, 'joe'
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
View
10 config/environment.rb
@@ -1,11 +1,13 @@
+require 'rubygems'
+
# Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.2.0' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -62,13 +64,7 @@
require "#{File.expand_path(RAILS_ROOT)}/lib/string"
require "#{File.expand_path(RAILS_ROOT)}/lib/ActionView/base"
-require "#{File.expand_path(RAILS_ROOT)}/vendor/RedCloth-3.0.4/lib/redcloth"
# Add custom date formats
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:short_date_only] = "%D"
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:long_ordinal_12hour] = "%B %d, %Y %I:%M%p"
-
-# RedCloth HTML WhiteList customizations
-['blockquote', 'table', 'tr', 'td'].each do |tag|
- RedCloth::BASIC_TAGS.delete tag
-end
View
3 config/environments/development.rb
@@ -12,7 +12,6 @@
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
-config.action_view.cache_template_extensions = false
# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
+config.action_mailer.raise_delivery_errors = false
View
1 config/environments/staging.rb
@@ -12,7 +12,6 @@
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
-config.action_view.cache_template_extensions = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
View
1 script/spin
@@ -1,4 +1,3 @@
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
-`chmod 775 #{RAILS_ROOT}/tmp`
`touch #{RAILS_ROOT}/tmp/restart.txt`
View
3 vendor/RedCloth-3.0.4/bin/redcloth
@@ -1,3 +0,0 @@
-#!/usr/bin/ruby18
-require 'redcloth'
-puts RedCloth.new( ARGF.read ).to_html
View
160 vendor/RedCloth-3.0.4/doc/CHANGELOG
@@ -1,160 +0,0 @@
---- %YAML:1.0
-- version: 3.0.4
- date: 2005-02-18
- changes:
- - The caps class doesn't swallow spaces.
- - Horizontal rules required to be on an empty line.
- - Hard breaks don't screw with Markdown headers any longer.
- - Fixed error triggered by complex lists.
- - Inline markups need to be butted up against enclosing text, no spaces.
- - Fixed problem with intermingled single and double quotes.
- - Brought back lite_mode.
-
-- version: 3.0.3
- date: 2005-02-06
- changes:
- - Stack overflow regexp on code inlines obliterated.
- - Citations scaled back.
- - Toggle span tags on CAPS with :no_span_tags accessor.
-
-- version: 3.0.2
- date: 2005-02-02
- changes:
- - Stack overflow Regexps replaced.
- - All code blocks protected from formatting.
- - Hard breaks working.
- - Filter HTML now uses detailed cleaner.
-
-- version: 3.0.1
- date: 2004-11-15
- changes:
- - Using `float' rather than `text-align' to align image blocks.
- - Shelving more HTML attributes to prevent them from clashing with Textile glyphs.
- - Simplifying the block regexp.
-
-- version: 3.0
- date: 2004-10-26
- changes:
- - Broke up the Textile engine into smaller parts, recoded central block parser.
- - Added preliminary support for Markdown.
- - Added support for custom Textile prefixes.
- - RedCloth now generates XHTML fragments.
- - Complete HTML documents should now work, RedCloth ignores complex HTML.
-
-- version: 2.0.12
- date: 2004-08-09
- changes:
- - Escaping tighter for <pre> tags that share a single line.
- - No more String#htmlesc!. Moved to RedCloth#htmlesc.
- - Pruned out the code that was handling multibyte.
-
-- version: 2.0.11
- date: 2004-06-01
- changes:
- - Fixed the new 2.0-style aliased links.
- - Lines starting with div opening or closing tags aren't given paragraph tags.
- - Escaped some sample markup that was being translated by RDoc.
- - Subtle changes to the quick tags to help them interact with surrounding HTML better.
- - Ensure angle brackets inside code quick tags get escaped.
- - New patch and test by F. Ros to fix <pre> tags with class settings.
- - Commented out encode_entities and fix_entities, they do nothing now. Thanks, Denis.
- - Scaled back QTAGS a back to avoid mixing up hyphens and dels. Thanks, Denis.
- - Work on the references to ensure they are generating at least XHTML 1.0 Transitional.
-
-- version: 2.0.10
- date: 2004-05-26
- changes:
- - Table and list problems. Rewrote the <pre> handling code.. again.
-
-- version: 2.0.9
- date: 2004-05-26
- changes:
- - Improved RDoc. Ri documentation is auto-installed now!
- - Links were consuming closing HTML tags. (See latest test in tests/links.yml.)
- - Further speed patch from Denis. Good good.
- - Patch by F. Ros to fix <pre> tags with class settings.
-
-- version: 2.0.8
- date: 2004-05-22
- changes:
- - First scan of the glyphs() method only scans for pre|notextile|code, the
- deeper passes scan for all HTML. Now inlines work around HTML tags!
- (What a pain!)
- - Moved tables and blocks into glyphs to keep them shielded from the parser
- if they are in <pre> tags.
- - Patch by Denis Mertz to speed up RedCloth by compiling the various RegExps
- only once. Thanks, David!
-
-- version: 2.0.7
- date: 2004-04-21
- changes:
- - New REFERENCE and QUICK-REFERENCE. See http://hobix.com/textile/.
- - Lists rewritten to accomplish better line folding.
- - Better, greedier links.
- - Additional link and list tests.
-
-- version: 2.0.6
- date: 2004-04-16
- changes:
- - Bold and strong tags were mixed up. '*' is now strong. '**' is bold.
- They were swapped until now.
- - Horizontal alignments were pretty buggy. Combining alignments with
- indents was totally broken.
- - Fixed table problem. Now glyphs are handled between tables and blocks.
- - Nested <pre> and <code> tags are now escaped. Much better handling of
- HTML inside <pre> tags. Really: quite nice.
- - Patch from Florian Gross to fix an html filtration inconsistency.
-
-- version: 2.0.5
- date: 2004-04-14
- changes:
- - Added safe mode (patch courtesy of Florian Gross).
- - Added line folding (suggested by Jim Menard).
- - Fixing notextile tags to work multi-line.
- - Ambiguity with em-dash and block opener.
- - Footnote bug. (Thanks, Jim Menard!)
-
-- version: 2.0.4
- date: 2004-04-08
- changes:
- - Scaled back aggresiveness of the inline matching to aid the em-dash.
- - Scaled back footnotes to stay out of array indices.
-
-- version: 2.0.3
- date: 2004-04-02
- changes:
- - Handling of pre, code, notextile was all wrong. Also, got rid of the goofed up
- split then collect. Now using gsub! and recursion to handle inlines and glyphs.
- - Better acronym support.
- - Suppression of Regexp warnings.
- - Single- and double-quoted string wierdness. Thanks, Bret Pettichord.
-
-- version: 2.0.2
- date: 2004-03-08
- changes:
- - Fixed broken lists, broken tables.
- - code/pre tags now escape properly, glyphs are working, spans are working when surrounded by html tags.
- - Fixed classes and ids.
- - Restricted notextile tags to a single line.
-
-- version: 2.0.1
- date: 2004-02-10
- changes:
- - Unmatched closing slash on regexps in ruby 1.6.8.
- - Fixes to bulleted lists.
-
-- version: 2.0
- date: 2004-02-06
- changes:
- - Complete rewrite of RedCloth, against beta2 from textism.com.
-
-- version: 0.41
- date: 2003-06-20
- changes:
- - Newlines were outputing as escaped.
-
-- version: 0.4
- date: 2003-06-20
- changes:
- - Initial public release.
- - Integration of YAML-based PyTextile tests.
View
25 vendor/RedCloth-3.0.4/doc/COPYING
@@ -1,25 +0,0 @@
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name Textile nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
View
106 vendor/RedCloth-3.0.4/doc/README
@@ -1,106 +0,0 @@
-p=. !redcloth3-title.png!
-
-<div id="sidebar">
-
-h4. Get RedCloth 3
-
-p(example1). *Stable version:* "3.0.3":http://rubyforge.org/frs/download.php/2896/RedCloth-3.0.3.tar.gz
-
-Take a complete tour of Textile at "A Textile Reference":http://hobix.com/textile/.
-
-For fast syntax checking, try the "Quick Reference":http://hobix.com/textile/quick.html.
-
-p(example1). Upgrade with "RubyGems":http://rubygems.rubyforge.org/! Try:
-@gem install RedCloth@.
-
-See the "project page":http://rubyforge.org/projects/redcloth/ for bug reporting, old releases and CVS instructions. "Documentation":http://redcloth.rubyforge.org/rdoc/ is also hosted at RubyForge.
-
-h4. RedCloth Links
-
-"Instiki":http://www.instiki.org is the greatest Wiki ever! Uses RedCloth for its markup!
-
-"Hobix":http://hobix.com is a lovely little blogging package which uses RedCloth for blog entries.
-
-<div id="css-buttons">
-
-* "(css-button w3c)%W3C% xhtml 1.0(Valid XHTML 1.0!)":http://validator.w3.org/check?uri=referer
-* "(css-button w3c w3c2)%W3C% valid css(Valid CSS!)":http://jigsaw.w3.org/css-validator/check/referer
-
-</div>
-
-</div>
-
-RedCloth is a module for using Textile in Ruby. Textile is a text format. A very simple text format. Another stab at making readable text that can be converted to HTML.
-
-h2. What is Textile?
-
-Textile is a simple markup language.
-
-table{width:400px}.
-|_. textile|_. to|_. html|
-| <notextile>_a phrase_</notextile> |->|_a phrase_|
-| <notextile>*a phrase*</notextile> |->|*a phrase*|
-| <notextile>_*a phrase*_</notextile> |->|_*a phrase*_|
-| <notextile>"Google":http://google.com</notextile> |->|"Google":http://google.com|
-
-No need to use verbose HTML to build your docs, your blogs, your pages. Textile gives you readable text while you're writing and beautiful text for your readers. And if you need to break out into HTML, Textile will allow you to do so.
-
-Textile also handles some subtleties of formatting which will enhance your document's readability:
-
-* Single- and double-quotes around words or phrases are converted to curly quotations, much easier on
- the eye. "Observe!"
-
-* Double hyphens are replaced with an em-dash. Observe -- very nice!
-
-* Single hyphens are replaced with en-dashes. Observe - so cute!
-
-* Triplets of periods become an ellipsis. Observe...
-
-* The letter 'x' becomes a dimension sign when used alone. Observe: 2 x 2.
-
-* Conversion of <notextile>(TM)</notextile> to (TM), <notextile>(R)</notextile> to (R), <notextile>(C)</notextile> to (C).
-
-For more on Textile's language, hop over to "A Textile Reference":http://hobix.com/textile/.
-
-h2. Using RedCloth
-
-The RedCloth class is an extension of Ruby's String class. Use it like you would a String:
-
-<pre>
- >> r = RedCloth.new "*strong text* and _emphasized text_"
- => "*strong text* and _emphasized text_"
- >> r.gsub!( 'text', 'words' )
- => "*strong words* and _emphasized words_"
-</pre>
-
-To generate HTML from your RedCloth object, use the @RedCloth#to_html@ method:
-
-<pre>
- >> r.to_html
- => "<p><strong>strong words</strong> and <em>emphasized words</em></p>"
-</pre>
-
-
-h2. Installing RedCloth
-
-To install RedCloth via RubyGems:
-
-<pre>
- gem install RedCloth
-</pre>
-
-Or "download RedCloth":http://rubyforge.org/frs/download.php/2896/RedCloth-3.0.3.tar.gz and simply run the install.rb like so:
-
-<pre>
- ruby install.rb config
- ruby install.rb setup
- sudo ruby install.rb install
-</pre>
-
-
-h2. Acknowledgements
-
-Textile is (c) 2003 Dean Allen. All rights reserved. You can read more "here":http://www.textism.com/tools/textile/.
-
-RedCloth is also based on PyTextile, which is: Copyright (c) 2003, "Mark Pilgrim":http://diveintomark.org/. All rights reserved. You can read more about PyTextile "here":http://dealmeida.net/projects/textile.
-
View
216 vendor/RedCloth-3.0.4/doc/REFERENCE
@@ -1,216 +0,0 @@
----
-- A Textile Reference:
- - Textile is a simple text markup. Simple symbols mark words' emphasis. Blocks of text
- can be easily tagged as headers, quotes, or lists. A Textile document can then be
- converted to HTML(Hypertext Markup Language) for viewing on the web.
- - You can try Textile out on the "Textile home page":http://www.textism.com/tools/textile/.
- Textile is also available as "RedCloth":http://whytheluckystiff.net/ruby/redcloth/ for
- Ruby or "PyTextile":http://dealmeida.net/projects/textile for Python.
- - Also refer to the "*Quick Reference*":javascript:quickRedReference(); for this guide.
- - h4. Reading the Examples
- - In each section below, examples are provided to clearly illustrate. In each example,
- the Textile example is followed by the raw HTML it is translated into, followed by how
- the HTML appears in the browser.
- -
- - Textile example
- - Converted to HTML
- - Browser-view
-- Writing in Textile:
- - Textile looks for paragraphs in your text. Paragraphs are separated by one blank line.
- Every paragraph is translated as an HTML paragraph.
- - !!example "A single paragraph.\n\nFollowed by another."
- - h4. Using HTML in Textile
- - You can certainly use HTML tags inside your Textile documents. HTML will only be escaped
- if it's found in a @pre@ or @code@ block.
- - !!example "I am <b>very</b> serious.\n\n<pre>\n I am <b>very</b> serious.\n</pre>"
- - h4. Line Breaks
- - Line breaks are ignored.
- - !!example "I spoke.\nAnd none replied."
- - Line breaks can be converted to HTML breaks by setting @hard_breaks@.
- - h4. Entities
- - Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye.
- - !!example '"Observe!"'
- - Double hyphens are replaced with an em-dash.
- - !!example Observe -- very nice!
- - Single hyphens are replaced with en-dashes.
- - !!example Observe - tiny and brief.
- - Triplets of periods become an ellipsis.
- - !!example Observe...
- - The letter 'x' becomes a dimension sign when used alone.
- - !!example 'Observe: 2 x 2.'
- - Conversion of trademark and copyright symbols.
- - !!example 'one(TM), two(R), three(C).'
-- Quick Block Modifiers:
- - Blocks of text default to being treated as paragraphs. But modifers can be affixed
- to the beginning of a block to change its treatment.
- - h4. Headers
- - To make an entire paragraph into a Header, place "h<em>n</em>." at
- its beginning, where _n_ is a number from 1-6.
- - !!example h1. Header 1
- - !!example h2. Header 2
- - !!example h3. Header 3
- - h4. Block Quotes
- - To make an entire paragraph into a block quotation, place
- "bq." before it.
- - !!example "An old text\n\nbq. A block quotation.\n\nAny old text"
- - h4. Footnotes
- - Numeric references within text to footnotes appear between square brackets.
- - !!example This is covered elsewhere[1].
- - To create the footnote that corresponds to its reference within the text, begin a new paragraph with fn and the
- footnote's number, followed by a dot and a space.
- - !!example fn1. Down here, in fact.
-- Quick Phrase Modifiers:
- - h4. Structural Emphasis
- - Emphasis to text is added by surrounding a phrase with underscores. In HTML, this often
- appears as <em>italics</em>.
- - !!example I _believe_ every word.
- - Strength can be give to text by surrounding with asterisks. In HTML, this strength appears
- as <strong>bold</strong>.
- - !!example And then? She *fell*!
- - Both italics and bold can be forced by doubling the underscores or asterisks.
- - !!example "I __know__.\nI **really** __know__."
- - Use double question marks to indicate _citation_. The title of a book, for instance.
- - !!example "??Cat's Cradle?? by Vonnegut"
- - Code phrases can be surrounded by at-symbols.
- - !!example "Convert with @r.to_html@"
- - To indicate a passage which has been deleted, surround the passage with hypens.
- - !!example "I'm -sure- not sure."
- - Pluses around a passage indicate its insertion.
- - !!example "You are a +pleasant+ child."
- - To superscript a phrase, surround with carets.
- - !!example "a^2^ + b^2^ = c^2^"
- - To subscript, surround with tildes.
- - !!example "log~2~x"
- - h4. HTML-Specific
- - Lastly, if you find yourself needing to customize the style of a passage, use percent symbols
- to translate the passage as an HTML span.
- - !!example I'm %unaware% of most soft drinks.
- - This way, you can apply style settings, as described in the next section to arbitrary phrases.
- - !!example "I'm %{color:red}unaware%\nof most soft drinks."
-- Attributes:
- - Tailoring Textile to suit your needs is quite easy. Attributes allow you to provide CSS(Cascading
- Style Sheets) information about any phrase.
- - h4. Block Attributes
- - A block can be tagged with a CSS class by circling the class in parentheses and
- placing it just before the period which marks the block.
- - !!example p(example1). An example
- - An element ID can be given by prefixing the ID with a pound symbol and using it in place of
- the class.
- - !!example p(#big-red). Red here
- - Class and ID can be combined by placing the class first.
- - !!example p(example1#big-red2). Red here
- - Style settings can be provided directly by surrounding them in curly braces.
- - !!example p{color:blue;margin:30px}. Spacey blue
- - Language designations can be given between angel brackets.
- - !!example p[fr]. rouge
- - h4. Phrase Attributes
- - All block attributes can be applied to phrases as well by placing them just inside the
- opening modifier.
- - !!example "I seriously *{color:red}blushed*\nwhen I _(big)sprouted_ that\ncorn stalk from my\n%[es]cabeza%."
- - h4. Block Alignments
- - Text inside blocks can be aligned in four basic ways.
- - !!example p<. align left
- - !!example p>. align right
- - !!example p=. centered
- - !!example p<>. justified
- - Indentation can also be specified by provide a single left paren for every 1em to the left. A single right
- paren for every 1em to the right.
- - !!example p(. left ident 1em
- - !!example p((. left ident 2em
- - !!example p))). right ident 3em
- - h4. Combining Alignments
- - Identation may be coupled with alignment.
- - !!example "h2()>. Bingo."
- - And, furthermore, coupled with language settings and CSS styles.
- - !!example "h3()>[no]{color:red}. Bingo"
- - h4. HTML in Textile
- - Textile is designed for quickening the simple markups. For more complex formatting, you are encouraged
- to break out into HTML.
- - For example, long code blocks belong between @pre@ and @code@ tags. Please also indent your code inside
- the tags to be sure that all Textile processors out there will ignore the contents.
- - !!example |
- <pre>
- <code>
- a.gsub!( /</, '' )
- </code>
- </pre>
- - You may also choose to surround sections with @div@ tags to separate your document into sections.
- "Instiki":http://www.instiki.org/ uses this technique to float a sidebar to the right.
- - !!example |
- <div style="float:right;">
-
- h3. Sidebar
-
- "Hobix":http://hobix.com/
- "Ruby":http://ruby-lang.org/
-
- </div>
-
- The main text of the
- page goes here and will
- stay to the left of the
- sidebar.
-
-- Lists:
- - h4. Numeric Lists
- - To make a numbered list, place each item in its own paragraph, preceded by "#".
- - !!example "# A first item\n# A second item\n# A third"
- - These lists may be nested by increasing the number of pound symbols preceding child entries.
- - !!example "# Fuel could be:\n## Coal\n## Gasoline\n## Electricity\n# Humans need only:\n## Water\n## Protein"
- - h4. Bulleted Lists
- - Bulleted lists use an asterisk in place of the pound.
- - !!example "* A first item\n* A second item\n* A third"
- - These lists may be nested in like manner.
- - !!example "* Fuel could be:\n** Coal\n** Gasoline\n** Electricity\n* Humans need only:\n** Water\n** Protein"
-- External References:
- - h4. Hypertext Links
- - Basic links are comprised of a phrase which is linked to a URL(Universal Resource Locator). Place the
- descriptive phrase in quotation marks. Follow it immediately by a colon and the URL.
- - !!example I searched "Google":http://google.com.
- - Notice, the link won't include any trailing punctuation.
- - h4. Link Aliases
- - If you are using the same link several times in your document, or you'd just like to be a tad more
- organized, you can use a link alias. Place the URL anywhere in your document, beginning with its
- alias in square brackets. Then, use the alias in place of the URL, using the link format above.
- - !!example |
- I am crazy about "Hobix":hobix
- and "it's":hobix "all":hobix I ever
- "link to":hobix!
-
- [hobix]http://hobix.com
- - h4. Embedded Images
- - You can embed an image in your Textile document by surrounding its URL with exclamation marks.
- - !!example "!http://hobix.com/sample.jpg!"
- - URLs may be relative.
- - A title for the image can also be provided in parens, just before the closing exclamation.
- - !!example "!openwindow1.gif(Bunny.)!"
- - The title also acts as *alt* text should the image not be found.
- - Links can be attached to images with a colon.
- - !!example "!openwindow1.gif!:http://hobix.com/"
- - h4. Image Alignments
- - Alignments can be applied as well to images.
- - !!example "!>obake.gif!\n\nAnd others sat all round the small\nmachine and paid it to sing to them."
- - h4. Acronyms
- - Definitions for acronyms can be provided by following an acronym with its definition in parens.
- - !!example We use CSS(Cascading Style Sheets).
-- Tables:
- - Simple tables can be built by separating fields with pipe characters
- - !!example "| name | age | sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |"
- - Specify header cells by marking them with an underscore and period.
- - !!example "|_. name |_. age |_. sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |"
- - h4. Cell Attributes
- - The period used above marks the end of a cell's attributes. Other attributes can be applied as well.
- - !!example "|_. attribute list |\n|<. align left |\n|>. align right|\n|=. center |\n|<>. justify |\n|^. valign top |\n|~. bottom |"
- - You can also specify colspans with a backslash, followed by the cell width.
- - !!example "|\\2. spans two cols |\n| col 1 | col 2 |"
- - Rowspan is specified by a forward slash, followed by the row height.
- - !!example "|/3. spans 3 rows | a |\n| b |\n| c |"
- - All block attributes can be applied to table cells as well.
- - !!example "|{background:#ddd}. Grey cell|"
- - h4. Table and Row Attributes
- - Table-wide attributes can be applied before the first row of the table. On its own line, followed by
- a period.
- - !!example "table{border:1px solid black}.\n|This|is|a|row|\n|This|is|a|row|"
- - Attributes can be applied to a single row by supplying the attribute before the row starts, using a
- @table@ modifier and following it by a period.
- - !!example "|This|is|a|row|\n{background:#ddd}. |This|is|grey|row|"
View
359 vendor/RedCloth-3.0.4/doc/make.rb
@@ -1,359 +0,0 @@
-$:.unshift '../lib'
-require 'yaml'
-require 'redcloth'
-
-class String
- #
- # Flexible HTML escaping
- #
- def htmlesc!( mode )
- gsub!( '&', '&amp;' )
- gsub!( '"', '&quot;' ) if mode != :NoQuotes
- gsub!( "'", '&#039;' ) if mode == :Quotes
- gsub!('<', '&lt;')
- gsub!('>', '&gt;')
- end
-end
-
-def a_name( phrase )
- phrase.downcase.
- gsub( /\W+/, '-' )
-end
-
-file_name = ARGV.shift
-case file_name
-when 'README'
- puts <<-HTML
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>RedCloth [Textile Humane Web Text for Ruby]</title>
- <style type="text/css">
- BODY {
- margin: 10px 60px 40px 60px;
- font-family: georgia, serif;
- font-size: 12pt;
- }
- TABLE {
- padding: 15px;
- width: 250px;
- }
- TH {
- text-align: left;
- }
- TD {
- border-top: solid 1px #eee;
- }
- H4 {
- border: solid 1px #caa;
- margin: 10px 15px 5px 10px;
- padding: 5px;
- color: white;
- background-color: #333;
- font-weight: bold;
- font-size: 12pt;
- }
- P {
- margin: 10px 15px 5px 15px;
- }
- P.example1 {
- background-color: #FEE;
- font-weight: bold;
- font-size: 9pt;
- padding: 5px;
- }
- P.example2 {
- border: solid 1px #DDD;
- background-color: #EEE;
- font-size: 9pt;
- padding: 5px;
- }
- .big {
- font-size: 15pt;
- }
- #big-red {
- font-size: 15pt;
- color: red;
- }
- #big-red2 {
- font-size: 15pt;
- color: red;
- }
- #sidebar {
- float: right;
- font-family: verdana, arial, sans-serif;
- font-size: 10pt;
- border-left: solid 1px #999;
- margin-left: 10px;
- width: 200px;
- }
- /* VARIATION BUTTON STYLING (v2.0) - SIZABLE SIZE */
- #css-buttons ul{list-style: none;margin: 0 0 10px 0;padding: 0;}
- #css-buttons li{border: 1px solid #999; margin: 5px 0 0 20px; width:9.0em;}
- head:first-child+body #css-buttons li{padding-right:2px;}
- #css-buttons li a{color: #333; text-decoration: none;}
-
- .css-button {
- display:block;
- font: 0.8em verdana, arial, sans-serif;
- padding: 2px 0 2px 0px; border: 1px solid white;
- text-decoration: none; width:100%;
- background: #ddd;color: #333;
- }
-
- .css-button span {
- font: bold 1.0em verdana, arial, sans-serif;
- padding: 2px 3px 2px 3px; color: #fff;
- }
-
- /* BUTTON LOGO STYLING */
- .rss span{background:#f60;}
- .w3c span {background: #fff; color: #069; font: bold 1.1em helvetica, arial, Sans-Serif;}
- .w3c2{background: #fc6;color: black !important;}
- </style>
- </head>
- <body>
- HTML
- puts RedCloth.new( File.open( file_name ).read ).to_html
- puts "</body>"
- puts "</html>"
-when 'QUICK-REFERENCE'
- YAML::add_private_type( "example" ) do |type, val|
- esc = val.dup
- esc.htmlesc!( :NoQuotes )
- [ :example, esc.gsub( /\n/, '<br />' ),
- RedCloth.new( val ).to_html ]
- end
-
- content = YAML::load( File.open( 'REFERENCE' ) )
-
- sections = content.collect { |c| c.keys.first }
- sections.shift
-
- puts <<-HTML
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Textile Quick Reference</title>
- <style type="text/css">
- BODY {
- margin: 5px;
- }
- TABLE {
- font-family: georgia, serif;
- font-size: 10pt;
- padding: 5px;
- width: 200px;
- }
- TH {
- padding-top: 10px;
- }
- TD {
- border-top: solid 1px #eee;
- }
- H1 {
- font-size: 18pt;
- }
- H4 {
- color: #999;
- background-color: #fee;
- border: solid 1px #caa;
- margin: 10px 15px 5px 10px;
- padding: 5px;
- }
- P {
- margin: 2px 5px 2px 5px;
- }
- TD.example1 PRE {
- background-color: #FEE;
- font-family: georgia, serif;
- font-size: 8pt;
- padding: 5px;
- padding: 5px;
- }
- TD.example3 {
- border: solid 1px #DDD;
- background-color: #EEE;
- font-size: 8pt;
- padding: 5px;
- }
- .big {
- font-size: 12pt;
- }
- #big-red {
- font-size: 12pt;
- color: red;
- }
- #big-red2 {
- font-size: 15pt;
- color: red;
- }
- </style>
- </head>
- <body>
- <table>
- <tr><th colspan='3'><h1>Textile Quick Reference</h1></th></tr>
- <tr><th colspan='3'>Sections: #{ sections.collect { |s| "<a href='##{ a_name( s ) }'>#{ s.gsub( /\s/, '&nbsp;' ) }</a>" }.join( ' | ' ) }</th></tr>
- HTML
-
- ct = 0
- content.each do |section|
- section.each do |header, parags|
- puts "<tr><th colspan='5'><a name='#{ a_name( header ) }'>#{ header }</a></th></tr>" if ct.nonzero?
- parags.each do |p|
- if p.is_a?( Array ) and p[0] == :example
- puts "<tr><td class='example1'><pre>#{ p[1] }</pre></td><td>&rarr;</td>" +
- "<td class='example2'>#{ p[2] }</td></tr>"
- end
- end
- end
- ct += 1
- end
- puts "</table>"
- puts "</body>"
- puts "</html>"
-
-when 'REFERENCE'
- YAML::add_private_type( "example" ) do |type, val|
- esc = val.dup
- esc.htmlesc!( :NoQuotes )
- [ esc.gsub( /\n/, '<br />' ),
- RedCloth.new( val ).to_html.
- gsub( /;(\w)/, '; \1' ).
- htmlesc!( :NoQuotes ).
- gsub( /\n/, '<br />' ),
- RedCloth.new( val ).to_html ]
- end
-
- content = YAML::load( File.open( file_name ) )
-
- sections = content.collect { |c| c.keys.first }
- sections.shift
-
- puts <<-HTML
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Textile Reference</title>
- <style type="text/css">
- BODY {
- margin: 10px 30px;
- }
- TABLE {
- font-family: georgia, serif;
- font-size: 11pt;
- padding: 15px;
- }
- TH {
- border-bottom: solid 1px black;
- font-size: 24pt;
- font-weight: bold;
- padding-top: 30px;
- }
- H1 {
- font-size: 42pt;
- }
- H4 {
- color: #666;
- background-color: #fee;
- border: solid 1px #caa;
- margin: 10px 0px 5px 0px;
- padding: 5px;
- }
- P {
- margin: 10px 15px 5px 15px;
- }
- TD.sections {
- background: black;
- color: white;
- font-family: georgia, serif;
- font-weight: bold;
- font-size: 9pt;
- padding: 5px;
- }
- TD.sections A { color: #CCEEFF; }
- TD.sections A:link { color: #CCEEFF; }
- TD.sections A:visited { color: #CCEEFF; }
- TD.sections A:active { color: #EEEEEE; }
- TD.sections A:hover { color: #EEEEEE; }
-
- TD.example1 PRE {
- background-color: #B30;
- color: white;
- font-family: georgia, serif;
- font-weight: bold;
- font-size: 9pt;
- padding: 5px;
- }
- TD.example2 P {
- border: solid 1px #DDD;
- background-color: #EEE;
- font-family: georgia, serif;
- font-size: 9pt;
- padding: 5px;
- }
- TD.example3 {
- border: solid 1px #EED;
- background-color: #FFE;
- padding: 5px;
- }
- .big {
- font-size: 15pt;
- }
- #big-red {
- font-size: 15pt;
- color: red
- }
- </style>
- <script type="text/javascript">
- function quickRedReference() {
- window.open(
- "quick.html",
- "redRef",
- "height=600,width=550,channelmode=0,dependent=0," +
- "directories=0,fullscreen=0,location=0,menubar=0," +
- "resizable=0,scrollbars=1,status=1,toolbar=0"
- );
- }
- </script>
- </head>
- <body>
- <table>
- HTML
-
- ct = 0
- content.each do |section|
- section.each do |header, parags|
- if ct.zero?
- puts "<tr><th colspan='3'><h1>#{ header }</h1></th></tr>"
- puts "<tr><td class='sections' colspan='3'>Sections: #{ sections.collect { |s| "<a href='##{ a_name( s ) }'>#{ s.gsub( /\s/, '&nbsp;' ) }</a>" }.join( ' | ' ) }</td></tr>"
- else
- puts "<tr><th colspan='3'><a name='#{ a_name( header ) }'><small>#{ ct }.</small></a><br />#{ header }</th></tr>"
- end
- parags.each do |p|
- if p.is_a? Array
- puts "<tr><td class='example1' valign='top'><pre>#{ p[0] }</pre></td><td>&rarr;</td>" +
- "<td class='example2'><p>#{ p[1] }</p></td></tr><tr><td colspan='2'></td>" +
- "<td class='example3'>#{ p[2] }</td></tr>"
- else
- puts "<tr><td class='explain' colspan='3'>"
- puts RedCloth.new( p ).to_html
- puts "</td></tr>"
- end
- end
- unless ct.zero?
- puts "<tr><td colspan='5' style='border-bottom: solid 1px #eee;'></td></tr>"
- end
- end
- ct += 1
- end
- puts "</table>"
- puts "</body>"
- puts "</html>"
-end
View
1,130 vendor/RedCloth-3.0.4/lib/redcloth.rb
@@ -1,1130 +0,0 @@
-# vim:ts=4:sw=4:
-# = RedCloth - Textile and Markdown Hybrid for Ruby
-#
-# Homepage:: http://whytheluckystiff.net/ruby/redcloth/
-# Author:: why the lucky stiff (http://whytheluckystiff.net/)
-# Copyright:: (cc) 2004 why the lucky stiff (and his puppet organizations.)
-# License:: BSD
-#
-# (see http://hobix.com/textile/ for a Textile Reference.)
-#
-# Based on (and also inspired by) both:
-#
-# PyTextile: http://diveintomark.org/projects/textile/textile.py.txt
-# Textism for PHP: http://www.textism.com/tools/textile/
-#
-#
-
-# = RedCloth
-#
-# RedCloth is a Ruby library for converting Textile and/or Markdown
-# into HTML. You can use either format, intermingled or separately.
-# You can also extend RedCloth to honor your own custom text stylings.
-#
-# RedCloth users are encouraged to use Textile if they are generating
-# HTML and to use Markdown if others will be viewing the plain text.
-#
-# == What is Textile?
-#
-# Textile is a simple formatting style for text
-# documents, loosely based on some HTML conventions.
-#
-# == Sample Textile Text
-#
-# h2. This is a title
-#
-# h3. This is a subhead
-#
-# This is a bit of paragraph.
-#
-# bq. This is a blockquote.
-#
-# = Writing Textile
-#
-# A Textile document consists of paragraphs. Paragraphs
-# can be specially formatted by adding a small instruction
-# to the beginning of the paragraph.
-#
-# h[n]. Header of size [n].
-# bq. Blockquote.
-# # Numeric list.
-# * Bulleted list.
-#
-# == Quick Phrase Modifiers
-#
-# Quick phrase modifiers are also included, to allow formatting
-# of small portions of text within a paragraph.
-#
-# \_emphasis\_
-# \_\_italicized\_\_
-# \*strong\*
-# \*\*bold\*\*
-# ??citation??
-# -deleted text-
-# +inserted text+
-# ^superscript^
-# ~subscript~
-# @code@
-# %(classname)span%
-#
-# ==notextile== (leave text alone)
-#
-# == Links
-#
-# To make a hypertext link, put the link text in "quotation
-# marks" followed immediately by a colon and the URL of the link.
-#
-# Optional: text in (parentheses) following the link text,
-# but before the closing quotation mark, will become a Title
-# attribute for the link, visible as a tool tip when a cursor is above it.
-#
-# Example:
-#
-# "This is a link (This is a title) ":http://www.textism.com
-#
-# Will become:
-#
-# <a href="http://www.textism.com" title="This is a title">This is a link</a>
-#
-# == Images
-#
-# To insert an image, put the URL for the image inside exclamation marks.
-#
-# Optional: text that immediately follows the URL in (parentheses) will
-# be used as the Alt text for the image. Images on the web should always
-# have descriptive Alt text for the benefit of readers using non-graphical
-# browsers.
-#
-# Optional: place a colon followed by a URL immediately after the
-# closing ! to make the image into a link.
-#
-# Example:
-#
-# !http://www.textism.com/common/textist.gif(Textist)!
-#
-# Will become:
-#
-# <img src="http://www.textism.com/common/textist.gif" alt="Textist" />
-#
-# With a link:
-#
-# !/common/textist.gif(Textist)!:http://textism.com
-#
-# Will become:
-#
-# <a href="http://textism.com"><img src="/common/textist.gif" alt="Textist" /></a>
-#
-# == Defining Acronyms
-#
-# HTML allows authors to define acronyms via the tag. The definition appears as a
-# tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
-# this should be used at least once for each acronym in documents where they appear.
-#
-# To quickly define an acronym in Textile, place the full text in (parentheses)
-# immediately following the acronym.
-#
-# Example:
-#
-# ACLU(American Civil Liberties Union)
-#
-# Will become:
-#
-# <acronym title="American Civil Liberties Union">ACLU</acronym>
-#
-# == Adding Tables
-#
-# In Textile, simple tables can be added by seperating each column by
-# a pipe.
-#
-# |a|simple|table|row|
-# |And|Another|table|row|
-#
-# Attributes are defined by style definitions in parentheses.
-#
-# table(border:1px solid black).
-# (background:#ddd;color:red). |{}| | | |
-#
-# == Using RedCloth
-#
-# RedCloth is simply an extension of the String class, which can handle
-# Textile formatting. Use it like a String and output HTML with its
-# RedCloth#to_html method.
-#
-# doc = RedCloth.new "
-#
-# h2. Test document
-#
-# Just a simple test."
-#
-# puts doc.to_html
-#
-# By default, RedCloth uses both Textile and Markdown formatting, with
-# Textile formatting taking precedence. If you want to turn off Markdown
-# formatting, to boost speed and limit the processor:
-#
-# class RedCloth::Textile.new( str )
-
-class RedCloth < String
-
- VERSION = '3.0.4'
- DEFAULT_RULES = [:textile, :markdown]
-
- #
- # Two accessor for setting security restrictions.
- #
- # This is a nice thing if you're using RedCloth for
- # formatting in public places (e.g. Wikis) where you
- # don't want users to abuse HTML for bad things.
- #
- # If +:filter_html+ is set, HTML which wasn't
- # created by the Textile processor will be escaped.
- #
- # If +:filter_styles+ is set, it will also disable
- # the style markup specifier. ('{color: red}')
- #
- attr_accessor :filter_html, :filter_styles
-
- #
- # Accessor for toggling hard breaks.
- #
- # If +:hard_breaks+ is set, single newlines will
- # be converted to HTML break tags. This is the
- # default behavior for traditional RedCloth.
- #
- attr_accessor :hard_breaks
-
- # Accessor for toggling lite mode.
- #
- # In lite mode, block-level rules are ignored. This means
- # that tables, paragraphs, lists, and such aren't available.
- # Only the inline markup for bold, italics, entities and so on.
- #
- # r = RedCloth.new( "And then? She *fell*!", [:lite_mode] )
- # r.to_html
- # #=> "And then? She <strong>fell</strong>!"
- #
- attr_accessor :lite_mode
-
- #
- # Accessor for toggling span caps.
- #
- # Textile places `span' tags around capitalized
- # words by default, but this wreaks havoc on Wikis.
- # If +:no_span_caps+ is set, this will be
- # suppressed.
- #
- attr_accessor :no_span_caps
-
- #
- # Establishes the markup predence. Available rules include:
- #
- # == Textile Rules
- #
- # The following textile rules can be set individually. Or add the complete
- # set of rules with the single :textile rule, which supplies the rule set in
- # the following precedence:
- #
- # refs_textile:: Textile references (i.e. [hobix]http://hobix.com/)
- # block_textile_table:: Textile table block structures
- # block_textile_lists:: Textile list structures
- # block_textile_prefix:: Textile blocks with prefixes (i.e. bq., h2., etc.)
- # inline_textile_image:: Textile inline images
- # inline_textile_link:: Textile inline links
- # inline_textile_span:: Textile inline spans
- # glyphs_textile:: Textile entities (such as em-dashes and smart quotes)
- #
- # == Markdown
- #
- # refs_markdown:: Markdown references (for example: [hobix]: http://hobix.com/)
- # block_markdown_setext:: Markdown setext headers
- # block_markdown_atx:: Markdown atx headers
- # block_markdown_rule:: Markdown horizontal rules
- # block_markdown_bq:: Markdown blockquotes
- # block_markdown_lists:: Markdown lists
- # inline_markdown_link:: Markdown links
- attr_accessor :rules
-
- # Returns a new RedCloth object, based on _string_ and
- # enforcing all the included _restrictions_.
- #
- # r = RedCloth.new( "h1. A <b>bold</b> man", [:filter_html] )
- # r.to_html
- # #=>"<h1>A &lt;b&gt;bold&lt;/b&gt; man</h1>"
- #
- def initialize( string, restrictions = [] )
- restrictions.each { |r| method( "#{ r }=" ).call( true ) }
- super( string )
- end
-
- #
- # Generates HTML from the Textile contents.
- #
- # r = RedCloth.new( "And then? She *fell*!" )
- # r.to_html( true )
- # #=>"And then? She <strong>fell</strong>!"
- #
- def to_html( *rules )
- rules = DEFAULT_RULES if rules.empty?
- # make our working copy
- text = self.dup
-
- @urlrefs = {}
- @shelf = []
- textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
- :block_textile_prefix, :inline_textile_image, :inline_textile_link,
- :inline_textile_code, :inline_textile_span, :glyphs_textile]
- markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
- :block_markdown_bq, :block_markdown_lists,
- :inline_markdown_reflink, :inline_markdown_link]
- @rules = rules.collect do |rule|
- case rule
- when :markdown
- markdown_rules
- when :textile
- textile_rules
- else
- rule
- end
- end.flatten
-
- # standard clean up
- incoming_entities text
- clean_white_space text
- clean_html text if filter_html
-
- # start processor
- @pre_list = []
- rip_offtags text
- no_textile text
- hard_break text
- unless @lite_mode
- refs text
- blocks text
- end
- inline text
- smooth_offtags text
-
- retrieve text
-
- text.gsub!( /<\/?notextile>/, '' )
- text.gsub!( /x%x%/, '&#38;' )
- text.strip!
- text
-
- end
-
- #######
- private
- #######
- #
- # Mapping of 8-bit ASCII codes to HTML numerical entity equivalents.
- # (from PyTextile)
- #
- TEXTILE_TAGS =
-
- [[128, 8364], [129, 0], [130, 8218], [131, 402], [132, 8222], [133, 8230],
- [134, 8224], [135, 8225], [136, 710], [137, 8240], [138, 352], [139, 8249],
- [140, 338], [141, 0], [142, 0], [143, 0], [144, 0], [145, 8216], [146, 8217],
- [147, 8220], [148, 8221], [149, 8226], [150, 8211], [151, 8212], [152, 732],
- [153, 8482], [154, 353], [155, 8250], [156, 339], [157, 0], [158, 0], [159, 376]].
-
- collect! do |a, b|
- [a.chr, ( b.zero? and "" or "&#{ b };" )]
- end
-
- #
- # Regular expressions to convert to HTML.
- #
- A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
- A_VLGN = /[\-^~]/
- C_CLAS = '(?:\([^)]+\))'
- C_LNGE = '(?:\[[^\]]+\])'
- C_STYL = '(?:\{[^}]+\})'
- S_CSPN = '(?:\\\\\d+)'
- S_RSPN = '(?:/\d+)'
- A = "(?:#{A_HLGN}?#{A_VLGN}?|#{A_VLGN}?#{A_HLGN}?)"
- S = "(?:#{S_CSPN}?#{S_RSPN}|#{S_RSPN}?#{S_CSPN}?)"
- C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)"
- # PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' )
- PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
- PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
- PUNCT_Q = Regexp::quote( '*-_+^~%' )
- HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
-
- # Text markup tags, don't conflict with block tags
- SIMPLE_HTML_TAGS = [
- 'tt', 'b', 'i', 'big', 'small', 'em', 'strong', 'dfn', 'code',
- 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'a', 'img', 'br',
- 'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo'
- ]
-
- QTAGS = [
- ['**', 'b'],
- ['*', 'strong'],
- ['??', 'cite', :limit],
- ['-', 'del', :limit],
- ['__', 'i'],
- ['_', 'em', :limit],
- ['%', 'span', :limit],
- ['+', 'ins', :limit],
- ['^', 'sup'],
- ['~', 'sub']
- ]
- QTAGS.collect! do |rc, ht, rtype|
- rcq = Regexp::quote rc
- re =
- case rtype
- when :limit
- /(\W)
- (#{rcq})
- (#{C})
- (?::(\S+?))?
- (\S.*?\S|\S)
- #{rcq}
- (?=\W)/x
- else
- /(#{rcq})
- (#{C})
- (?::(\S+))?
- (\S.*?\S|\S)
- #{rcq}/xm
- end
- [rc, ht, re, rtype]
- end
-
- # Elements to handle
- GLYPHS = [
- # [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1&#8217;\2' ], # single closing
- [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1&#8217;' ], # single closing
- [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '&#8217;' ], # single closing
- [ /\'/, '&#8216;' ], # single opening
- [ /</, '&lt;' ], # less-than
- [ />/, '&gt;' ], # greater-than
- # [ /([^\s\[{(])?"(\s|:|$)/, '\1&#8221;\2' ], # double closing
- [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1&#8221;' ], # double closing
- [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '&#8221;' ], # double closing
- [ /"/, '&#8220;' ], # double opening
- [ /\b( )?\.{3}/, '\1&#8230;' ], # ellipsis
- [ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '<acronym title="\2">\1</acronym>' ], # 3+ uppercase acronym
- [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^<A-Za-z0-9]|$)/, '\1<span class="caps">\2</span>\3', :no_span_caps ], # 3+ uppercase caps
- [ /(\.\s)?\s?--\s?/, '\1&#8212;' ], # em dash
- [ /\s->\s/, ' &rarr; ' ], # right arrow
- [ /\s-\s/, ' &#8211; ' ], # en dash
- [ /(\d+) ?x ?(\d+)/, '\1&#215;\2' ], # dimension sign
- [ /\b ?[(\[]TM[\])]/i, '&#8482;' ], # trademark
- [ /\b ?[(\[]R[\])]/i, '&#174;' ], # registered
- [ /\b ?[(\[]C[\])]/i, '&#169;' ] # copyright
- ]
-
- H_ALGN_VALS = {
- '<' => 'left',
- '=' => 'center',
- '>' => 'right',
- '<>' => 'justify'
- }
-
- V_ALGN_VALS = {
- '^' => 'top',
- '-' => 'middle',
- '~' => 'bottom'
- }
-
- #
- # Flexible HTML escaping
- #
- def htmlesc( str, mode )
- str.gsub!( '&', '&amp;' )
- str.gsub!( '"', '&quot;' ) if mode != :NoQuotes
- str.gsub!( "'", '&#039;' ) if mode == :Quotes
- str.gsub!( '<', '&lt;')
- str.gsub!( '>', '&gt;')
- end
-
- # Search and replace for Textile glyphs (quotes, dashes, other symbols)
- def pgl( text )
- GLYPHS.each do |re, resub, tog|
- next if tog and method( tog ).call
- text.gsub! re, resub
- end
- end
-
- # Parses Textile attribute lists and builds an HTML attribute string
- def pba( text_in, element = "" )
-
- return '' unless text_in
-
- style = []
- text = text_in.dup
- if element == 'td'
- colspan = $1 if text =~ /\\(\d+)/
- rowspan = $1 if text =~ /\/(\d+)/
- style << "vertical-align:#{ v_align( $& ) };" if text =~ A_VLGN
- end
-
- style << "#{ $1 };" if not filter_styles and
- text.sub!( /\{([^}]*)\}/, '' )
-
- lang = $1 if
- text.sub!( /\[([^)]+?)\]/, '' )
-
- cls = $1 if
- text.sub!( /\(([^()]+?)\)/, '' )
-
- style << "padding-left:#{ $1.length }em;" if
- text.sub!( /([(]+)/, '' )
-
- style << "padding-right:#{ $1.length }em;" if text.sub!( /([)]+)/, '' )
-
- style << "text-align:#{ h_align( $& ) };" if text =~ A_HLGN
-
- cls, id = $1, $2 if cls =~ /^(.*?)#(.*)$/
-
- atts = ''
- atts << " style=\"#{ style.join }\"" unless style.empty?
- atts << " class=\"#{ cls }\"" unless cls.to_s.empty?
- atts << " lang=\"#{ lang }\"" if lang
- atts << " id=\"#{ id }\"" if id
- atts << " colspan=\"#{ colspan }\"" if colspan
- atts << " rowspan=\"#{ rowspan }\"" if rowspan
-
- atts
- end
-
- TABLE_RE = /^(?:table(_?#{S}#{A}#{C})\. ?\n)?^(#{A}#{C}\.? ?\|.*?\|)(\n\n|\Z)/m
-
- # Parses a Textile table block, building HTML from the result.
- def block_textile_table( text )
- text.gsub!( TABLE_RE ) do |matches|
-
- tatts, fullrow = $~[1..2]
- tatts = pba( tatts, 'table' )
- tatts = shelve( tatts ) if tatts
- rows = []
-
- fullrow.
- split( /\|$/m ).
- delete_if { |x| x.empty? }.
- each do |row|
-
- ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
-
- cells = []
- row.split( '|' ).each do |cell|
- ctyp = 'd'
- ctyp = 'h' if cell =~ /^_/
-
- catts = ''
- catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\. ?)(.*)/
-
- unless cell.strip.empty?
- catts = shelve( catts ) if catts
- cells << "\t\t\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>"
- end
- end
- ratts = shelve( ratts ) if ratts
- rows << "\t\t<tr#{ ratts }>\n#{ cells.join( "\n" ) }\n\t\t</tr>"
- end
- "\t<table#{ tatts }>\n#{ rows.join( "\n" ) }\n\t</table>\n\n"
- end
- end
-
- LISTS_RE = /^([#*]+?#{C} .*?)$(?![^#*])/m
- LISTS_CONTENT_RE = /^([#*]+)(#{A}#{C}) (.*)$/m
-
- # Parses Textile lists and generates HTML
- def block_textile_lists( text )
- text.gsub!( LISTS_RE ) do |match|
- lines = match.split( /\n/ )
- last_line = -1
- depth = []
- lines.each_with_index do |line, line_id|
- if line =~ LISTS_CONTENT_RE
- tl,atts,content = $~[1..3]
- if depth.last
- if depth.last.length > tl.length
- (depth.length - 1).downto(0) do |i|
- break if depth[i].length == tl.length
- lines[line_id - 1] << "</li>\n\t</#{ lT( depth[i] ) }l>\n\t"
- depth.pop
- end
- end
- if depth.last and depth.last.length == tl.length
- lines[line_id - 1] << '</li>'
- end
- end
- unless depth.last == tl
- depth << tl
- atts = pba( atts )
- atts = shelve( atts ) if atts
- lines[line_id] = "\t<#{ lT(tl) }l#{ atts }>\n\t<li>#{ content }"
- else
- lines[line_id] = "\t\t<li>#{ content }"
- end
- last_line = line_id
-
- else
- last_line = line_id
- end
- if line_id - last_line > 1 or line_id == lines.length - 1
- depth.delete_if do |v|
- lines[last_line] << "</li>\n\t</#{ lT( v ) }l>"
- end
- end
- end
- lines.join( "\n" )
- end
- end
-
- CODE_RE = /(\W)
- @
- (?:\|(\w+?)\|)?
- (.+?)
- @
- (?=\W)/x
-
- def inline_textile_code( text )
- text.gsub!( CODE_RE ) do |m|
- before,lang,code,after = $~[1..4]
- lang = " lang=\"#{ lang }\"" if lang
- rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }" )
- end
- end
-
- def lT( text )
- text =~ /\#$/ ? 'o' : 'u'
- end
-
- def hard_break( text )
- text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
- end
-
- BLOCKS_GROUP_RE = /\n{2,}(?! )/m
-
- def blocks( text, deep_code = false )
- text.replace( text.split( BLOCKS_GROUP_RE ).collect do |blk|
- plain = blk !~ /\A[#*> ]/
-
- # skip blocks that are complex HTML
- if blk =~ /^<\/?(\w+).*>/ and not SIMPLE_HTML_TAGS.include? $1
- blk
- else
- # search for indentation levels
- blk.strip!
- if blk.empty?
- blk
- else
- code_blk = nil
- blk.gsub!( /((?:\n(?:\n^ +[^\n]*)+)+)/m ) do |iblk|
- flush_left iblk
- blocks iblk, plain
- iblk.gsub( /^(\S)/, "\t\\1" )
- if plain
- code_blk = iblk; ""
- else
- iblk
- end
- end
-
- block_applied = 0
- @rules.each do |rule_name|
- block_applied += 1 if ( rule_name.to_s.match /^block_/ and method( rule_name ).call( blk ) )
- end
- if block_applied.zero?
- if deep_code
- blk = "\t<pre><code>#{ blk }</code></pre>"
- else
- blk = "\t<p>#{ blk }</p>"
- end
- end
- # hard_break blk
- blk + "\n#{ code_blk }"
- end
- end
-
- end.join( "\n\n" ) )
- end
-
- def textile_bq( tag, atts, cite, content )
- cite, cite_title = check_refs( cite )
- cite = " cite=\"#{ cite }\"" if cite
- atts = shelve( atts ) if atts
- "\t<blockquote#{ cite }>\n\t\t<p#{ atts }>#{ content }</p>\n\t</blockquote>"
- end
-
- def textile_p( tag, atts, cite, content )
- atts = shelve( atts ) if atts
- "\t<#{ tag }#{ atts }>#{ content }</#{ tag }>"
- end
-
- alias textile_h1 textile_p
- alias textile_h2 textile_p
- alias textile_h3 textile_p
- alias textile_h4 textile_p
- alias textile_h5 textile_p
- alias textile_h6 textile_p
-
- def textile_fn_( tag, num, atts, cite, content )
- atts << " id=\"fn#{ num }\""
- content = "<sup>#{ num }</sup> #{ content }"
- atts = shelve( atts ) if atts
- "\t<p#{ atts }>#{ content }</p>"
- end
-
- BLOCK_RE = /^(([a-z]+)(\d*))(#{A}#{C})\.(?::(\S+))? (.*)$/m
-
- def block_textile_prefix( text )
- if text =~ BLOCK_RE
- tag,tagpre,num,atts,cite,content = $~[1..6]
- atts = pba( atts )
-
- # pass to prefix handler
- if respond_to? "textile_#{ tag }", true
- text.gsub!( $&, method( "textile_#{ tag }" ).call( tag, atts, cite, content ) )
- elsif respond_to? "textile_#{ tagpre }_", true
- text.gsub!( $&, method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content ) )
- end
- end
- end
-
- SETEXT_RE = /\A(.+?)\n([=-])[=-]* *$/m
- def block_markdown_setext( text )
- if text =~ SETEXT_RE
- tag = if $2 == "="; "h1"; else; "h2"; end
- blk, cont = "<#{ tag }>#{ $1 }</#{ tag }>", $'
- blocks cont
- text.replace( blk + cont )
- end
- end
-
- ATX_RE = /\A(\#{1,6}) # $1 = string of #'s
- [ ]*
- (.+?) # $2 = Header text
- [ ]*
- \#* # optional closing #'s (not counted)
- $/x
- def block_markdown_atx( text )
- if text =~ ATX_RE
- tag = "h#{ $1.length }"
- blk, cont = "<#{ tag }>#{ $2 }</#{ tag }>\n\n", $'
- blocks cont
- text.replace( blk + cont )
- end
- end
-
- MARKDOWN_BQ_RE = /\A(^ *> ?.+$(.+\n)*\n*)+/m
-
- def block_markdown_bq( text )
- text.gsub!( MARKDOWN_BQ_RE ) do |blk|
- blk.gsub!( /^ *> ?/, '' )
- flush_left blk
- blocks blk
- blk.gsub!( /^(\S)/, "\t\\1" )
- "<blockquote>\n#{ blk }\n</blockquote>\n\n"
- end
- end
-
- MARKDOWN_RULE_RE = /^(#{
- ['*', '-', '_'].collect { |ch| '( ?' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' )
- })$/
-
- def block_markdown_rule( text )
- text.gsub!( MARKDOWN_RULE_RE ) do |blk|
- "<hr />"
- end
- end
-
- # XXX TODO XXX
- def block_markdown_lists( text )
- end
-
- def inline_textile_span( text )
- QTAGS.each do |qtag_rc, ht, qtag_re, rtype|
- text.gsub!( qtag_re ) do |m|
-
- case rtype
- when :limit
- sta,qtag,atts,cite,content = $~[1..5]
- else
- qtag,atts,cite,content = $~[1..4]
- sta = ''
- end
- atts = pba( atts )
- atts << " cite=\"#{ cite }\"" if cite
- atts = shelve( atts ) if atts
-
- "#{ sta }<#{ ht }#{ atts }>#{ content }</#{ ht }>"
-
- end
- end
- end
-
- LINK_RE = /
- ([\s\[{(]|[#{PUNCT}])? # $pre
- " # start
- (#{C}) # $atts
- ([^"]+?) # $text
- \s?
- (?:\(([^)]+?)\)(?="))? # $title
- ":
- (\S+?) # $url
- (\/)? # $slash
- ([^\w\/;]*?) # $post
- (?=<|\s|$)
- /x
-
- def inline_textile_link( text )
- text.gsub!( LINK_RE ) do |m|
- pre,atts,text,title,url,slash,post = $~[1..7]
-
- url, url_title = check_refs( url )
- title ||= url_title
-
- atts = pba( atts )
- atts = " href=\"#{ url }#{ slash }\"#{ atts }"
- atts << " title=\"#{ title }\"" if title
- atts = shelve( atts ) if atts
-
- "#{ pre }<a#{ atts }>#{ text }</a>#{ post }"
- end
- end
-
- MARKDOWN_REFLINK_RE = /
- \[([^\[\]]+)\] # $text
- [ ]? # opt. space
- (?:\n[ ]*)? # one optional newline followed by spaces
- \[(.*?)\] # $id
- /x
-
- def inline_markdown_reflink( text )
- text.gsub!( MARKDOWN_REFLINK_RE ) do |m|
- text, id = $~[1..2]
-
- if id.empty?
- url, title = check_refs( text )
- else
- url, title = check_refs( id )
- end
-
- atts = " href=\"#{ url }\""
- atts << " title=\"#{ title }\"" if title
- atts = shelve( atts )
-
- "<a#{ atts }>#{ text }</a>"
- end
- end
-
- MARKDOWN_LINK_RE = /
- \[([^\[\]]+)\] # $text
- \( # open paren
- [ \t]* # opt space
- <?(.+?)>? # $href
- [ \t]* # opt space
- (?: # whole title
- (['"]) # $quote
- (.*?) # $title
- \3 # matching quote
- )? # title is optional
- \)
- /x
-
- def inline_markdown_link( text )
- text.gsub!( MARKDOWN_LINK_RE ) do |m|
- text, url, quote, title = $~[1..4]
-
- atts = " href=\"#{ url }\""
- atts << " title=\"#{ title }\"" if title
- atts = shelve( atts )
-
- "<a#{ atts }>#{ text }</a>"
- end
- end
-
- TEXTILE_REFS_RE = /(^ *)\[([^\n]+?)\](#{HYPERLINK})(?=\s|$)/
- MARKDOWN_REFS_RE = /(^ *)\[([^\n]+?)\]:\s+<?(#{HYPERLINK})>?(?:\s+"((?:[^"]|\\")+)")?(?=\s|$)/m
-
- def refs( text )
- @rules.each do |rule_name|
- method( rule_name ).call( text ) if rule_name.to_s.match /^refs_/
- end
- end
-
- def refs_textile( text )
- text.gsub!( TEXTILE_REFS_RE ) do |m|
- flag, url = $~[2..3]
- @urlrefs[flag.downcase] = [url, nil]
- nil
- end
- end
-
- def refs_markdown( text )
- text.gsub!( MARKDOWN_REFS_RE ) do |m|
- flag, url = $~[2..3]
- title = $~[6]
- @urlrefs[flag.downcase] = [url, title]
- nil
- end
- end
-
- def check_refs( text )
- ret = @urlrefs[text.downcase] if text
- ret || [text, nil]
- end
-
- IMAGE_RE = /
- (<p>|.|^) # start of line?
- \! # opening
- (\<|\=|\>)? # optional alignment atts
- (#{C}) # optional style,class atts
- (?:\. )? # optional dot-space
- ([^\s(!]+?) # presume this is the src
- \s? # optional space
- (?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # optional title
- \! # closing
- (?::#{ HYPERLINK })? # optional href
- /x
-
- def inline_textile_image( text )
- text.gsub!( IMAGE_RE ) do |m|
- stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
- atts = pba( atts )
- atts = " src=\"#{ url }\"#{ atts }"
- atts << " title=\"#{ title }\"" if title
- atts << " alt=\"#{ title }\""
- # size = @getimagesize($url);
- # if($size) $atts.= " $size[3]";
-
- href, alt_title = check_refs( href ) if href
- url, url_title = check_refs( url )
-
- out = ''
- out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href
- out << "<img#{ shelve( atts ) } />"
- out << "</a>#{ href_a1 }#{ href_a2 }" if href
-
- if algn
- algn = h_align( algn )
- if stln == "<p>"
- out = "<p style=\"float:#{ algn }\">#{ out }"
- else
- out = "#{ stln }<div style=\"float:#{ algn }\">#{ out }</div>"
- end
- else
- out = stln + out
- end
-
- out
- end
- end
-
- def shelve( val )
- @shelf << val
- " :redsh##{ @shelf.length }:"
- end
-
- def retrieve( text )
- @shelf.each_with_index do |r, i|
- text.gsub!( " :redsh##{ i + 1 }:", r )
- end
- end
-
- def incoming_entities( text )
- ## turn any incoming ampersands into a dummy character for now.
- ## This uses a negative lookahead for alphanumerics followed by a semicolon,
- ## implying an incoming html entity, to be skipped
-
- text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" )
- end
-
- def no_textile( text )
- text.gsub!( /(^|\s)==([^=]+.*?)==(\s|$)?/,
- '\1<notextile>\2</notextile>\3' )
- text.gsub!( /^ *==([^=]+.*?)==/m,
- '\1<notextile>\2</notextile>\3' )
- end
-
- def clean_white_space( text )
- # normalize line breaks
- text.gsub!( /\r\n/, "\n" )
- text.gsub!( /\r/, "\n" )
- text.gsub!( /\t/, ' ' )
- text.gsub!( /^ +$/, '' )
- text.gsub!( /\n{3,}/, "\n\n" )
- text.gsub!( /"$/, "\" " )
-
- # if entire document is indented, flush
- # to the left side
- flush_left text
- end
-
- def flush_left( text )
- indt = 0
- if text =~ /^ /
- while text !~ /^ {#{indt}}\S/
- indt += 1
- end unless text.empty?
- if indt.nonzero?
- text.gsub!( /^ {#{indt}}/, '' )
- end
- end
- end
-
- def footnote_ref( text )
- text.gsub!( /\b\[([0-9]+?)\](\s)?/,
- '<sup><a href="#fn\1">\1</a></sup>\2' )
- end
-
- OFFTAGS = /(code|pre|kbd|notextile)/
- OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi
- OFFTAG_OPEN = /<#{ OFFTAGS }/
- OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
- HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
- ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m
-
- def glyphs_textile( text, level = 0 )
- if text !~ HASTAG_MATCH
- pgl text
- footnote_ref text
- else
- codepre = 0
- text.gsub!( ALLTAG_MATCH ) do |line|
- ## matches are off if we're between <code>, <pre> etc.
- if $1
- if line =~ OFFTAG_OPEN
- codepre += 1
- elsif line =~ OFFTAG_CLOSE