pax_global_header00006660000000000000000000000064145206210040014504gustar00rootroot0000000000000052 comment=8297da8aa071b3bf1584738229f277833bd20c49 redcloth-4.3.3/000077500000000000000000000000001452062100400133175ustar00rootroot00000000000000redcloth-4.3.3/.gemtest000066400000000000000000000000001452062100400147560ustar00rootroot00000000000000redcloth-4.3.3/.gitignore000066400000000000000000000006161452062100400153120ustar00rootroot00000000000000*.log *.rbc *.sw? .bundle .DS_Store coverage doc/rdoc/* ext/redcloth_scan/*.bundle ext/redcloth_scan/*.class ext/redcloth_scan/*.jar ext/redcloth_scan/*.java ext/redcloth_scan/*.so ext/redcloth_scan/*.[co] ext/redcloth_scan/extconf.rb ext/redcloth_scan/Makefile ext/redcloth_scan/redcloth_*.rb lib/*.bundle lib/*.jar lib/*.so lib/**/*.so lib/redcloth_scan.rb pkg rdoc release tmp Gemfile.lock .rbx/redcloth-4.3.3/.rspec000066400000000000000000000000101452062100400144230ustar00rootroot00000000000000--color redcloth-4.3.3/.rvmrc000066400000000000000000000000411452062100400144440ustar00rootroot00000000000000rvm --create use default@redclothredcloth-4.3.3/.travis.yml000066400000000000000000000003551452062100400154330ustar00rootroot00000000000000language: ruby cache: bundler sudo: false rvm: - 2.0.0 - 2.2.3 - 1.9.3 - 1.9.2 - ruby-head - 1.8.7 - ree matrix: fast_finish: true compiler: - clang - gcc before_script: - bundle update - bundle exec rake clobber redcloth-4.3.3/CHANGELOG000066400000000000000000000276541452062100400145470ustar00rootroot00000000000000== 4.3.3 / Nov 2nd, 2023 * Add tests for CVE-2023-31606 [Helio Cola] * Fix rake compile [Helio Cola and Faria Education Group] * Fix CVE-2023-31606 (ReDOS possible in the sanitize_html function) [Kornelius Kalnbach and Merbin Russel] == 4.3.2 / May 23rd, 2016 * Fix additional case for CVE-2012-6684 [Joshua Siler] == 4.3.1 / May 17th, 2016 * Fix additional case for CVE-2012-6684 [Joshua Siler] == 4.3.0 / April 29th, 2016 * Remove JRuby and Windows cross compilation and support * Add Ruby 2.2.3 testing and support * include CVE-2012-6684 fix [Tomas Pospisek] * fix by [Antonio Terceiro] * see http://sources.debian.net/src/ruby-redcloth/4.2.9-4/debian/patches/0001-Filter-out-javascript-links-when-using-filter_html-o.patch/ * vulnerability reported by [Kousuke Ebihara] * see http://co3k.org/blog/redcloth-unfixed-xss-en == 4.2.9.1 / February 24, 2015 * Lazy-load latex_entities.yml [Charlie Somerville] == 4.2.9 / November 25, 2011 * Fix RbConfig / Config warning in Ruby 1.9.3. [Steve Purcell, Robert Gleeson, and unclaimedbaggage] * Use RSTRING_NOT_MODIFIED header for Rubinius [Dirkjan Bussink] == 4.2.8 / August 17, 2011 * Do not treat warnings as errors so it compiles cleanly. [Tomasz Wałkuski] == 4.2.7 / February 10, 2011 * Fixed typo in gemspec to make case-sensitive require work. [Gabe da Silveira] * Tested installing the gem and requiring it with both cases on Ubuntu 8.04, 10.10 and OS X Version 10.6.6. * Have spaces around the en-dash in LaTeX [Benjamin Quorning] * Turned double-quote close to smart quotes in LaTeX [Jonathan D. Blake] === 4.2.6 / February 9, 2011 * Add case-sensitive require back into the gemspec. * Fix rdoc options in gemspec. === 4.2.5 / February 7, 2011 * Fix bundler and rubygems-test incompatibilities. Working around bug: https://github.com/carlhuda/bundler/issues/issue/1021 === 4.2.4 / February 7, 2011 * Add .gemtest to opt-in to rubygems-test program (gem install rubygems-test to participate) * Allow attributes to be set on hr and br tags [Jesse Stormier] * Fix dangling
  • [Stephen Bannasch] * Switch to bundler and rake-compiler for gem management/compilation * Fix invalid YAML for Ruby 1.9.2 [Aaron Patterson] === 4.2.3 / March 1, 2010 * Allow quotes in styles so you can do things like listing font-families. [Jason Garber] * Fix uninitialized constant Gem::Specification::PLATFORM_CROSS_TARGETS in Rails [Jason Garber] * Allow uppercase letters in class and ID attributes [Jason Garber] * Fix compatibility with newer Echoe, by using full-name for Platform [Flameeyes] * Fixes for PPC/PPC64 [Flameeyes] * Added a modified copy of 'Textile Reference' to a doc folder [codesponge] * Add footnote return links [Jonathan Rudenberg] * Add bug report link to the README === 4.2.2 / June 30, 2009 * Fix regression where percent wasn't accepted in style attribute. [Jason Garber] === 4.2.1 / June 16, 2009 * Fix regression where period wasn't accepted in style attribute. [Jason Garber] === 4.2.0 / June 10, 2009 * Fixed image with title, href, and text afterward not being made a link. [Jason Garber] * Pass string encoding through in Ruby 1.9. [Jason Garber] * Allow two-letter acronyms. [Jason Garber] * Removed vertical alignment in lists. It doesn't make sense and it conflicts with other things. [Jason Garber] * Allow table cells to be empty. [Jason Garber] * Resolve conflict between table signature and blocks beginning with t. [Jason Garber] * Enable code signature to capture trailing space when in square brackets. [Jason Garber] * Allow emphasized phrases to include underscores. [Jason Garber] * Include an ending question mark in a citation. [Jason Garber] * Fix blocks being included in following paragraph. [Jason Garber] * Preserve leading whitespace in pre and bc blocks. [Jason Garber] * Don't add hard break after preexisting
    . [Jason Garber] * Switched tests from Test::Unit to Rspec. [Jason Garber] * Accept multiline content in table cells. [Jason Garber] * Change to list attributes so you can give style/class to list items (taken from PyTextile). Breaks backwards compatibility. Before, the style applied to the first list item applied to the entire list. Now, class/id/style placed before the list applies to the list element and after the hash or asterisk applies to the list item. For example: * Separated attributes out to have their own mark/store variable and regs. This way, they won't conflict with captured text or backtracked text. [Jason Garber] * Added a RedCloth::EXTENSION_LANGUAGE constant so you can tell what version of the parser you are using. [Jason Garber] * Added a NotCompiledError to give a friendlier message when people just unpack RedCloth into their projects. [Jason Garber] * Added a pure-ruby version of the parser for times when you can't compile the C or Java extensions. You should avoid using it if at all possible because it is 32 times slower (and has some other problems, too)! [Jason Garber] * Ignore spaces and tabs on blank lines between blocks. #120 [Jason Garber] * Allow HTML tags with quoted attributes to be inside link text. To do this, I had to remove the possibility that attributes in HTML tags could have spaces around the equals sign or unquoted attributes. This change also greatly expands the complexity of the state machine, so compilation takes a long time. Sorry. [Jason Garber] * Many improvements to the LaTeX formatter by Bil Kleb, a NASA scientist who's been working with LaTeX for 20 years. Thanks, Bil! === 4.1.9 / February 20, 2009 * Make compatible with Ruby 1.9. * Image URLs and image titles can now contain parentheses. #71 * Handle caps properly in link titles. #77 * Remove extra preformatted line breaks after extended block code. #79 * Fix inline being recognized as block . #81 * Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89 * Recognize deleted phrases when they start at the beginning of a line. #83 * Fix escaped tag when it has the class attribute and is in a
     tag. #95
    
    * Fix dimensions and primes for LaTeX. #103
    
    * Don't allow square brackets inside lang attribute so double square brackets are interpreted like Textile 2 and RedCloth 3. #101
    
    * Improve LaTeX output for tables. #96
    
    * Fix bad parsing of bracketed image links (which would hang the interpreter in some cases). #97
    
    * Handle links containing parentheses.  Brackets are no longer required. #82 [Ryan Alyea]
    
    * Made italics use the correct LaTeX tag: textit rather than emph. #98
    
    * Fixed custom block signatures calling built-in Ruby String methods. #92
    
    * Mentioned the three supported platforms and what's necessary to build RedCloth in the README file.
    
    * Fixed a require problem that caused an error when you would gem check --test RedCloth. #91
    
    === 4.1.1 / November 19, 2008
    
    * Added 'lib/case_sensitive_require' back into gemspec.  It got left out in the conversion to echoe, so "require 'RedCloth'" didn't work. #88
    
    * Fixed  being recognized as a block-level element when using the twice-cooked method of flash embedding. #87
    
    * Added horizontal rules from RedCloth 3.  Three or more asterisks, dashes, or underscores between blocks triggers the HR tag.
    
    * echoe was not being properly registered as a development dependency; a bug in RubyGems was making it a runtime dependency
    
    * Fixed "No definition for redcloth_to Installing RDoc documentation"
    
    * Fixed wrong platform names when cross-compiling java and win32 versions
    
    === 4.1.0 / October 31, 2008
    
    * JRuby support!  [olabini]
      To run the tests with JRuby, you only need to: jruby -S rake
      To compile the jruby version of the gem: jruby -S rake compile
    
    * Added textilize ERB utility method. [edraut]
      Use it in an ERB template like this: <%=t my_textile_string %> or
      <%=r %{Some *textile* if you please!} %>
    
    * Fix extended blockcode stripping whitespace following blank line. #78
    
    
    === 4.0.4 / October 1, 2008
    
    * Added some very basic support for images in LaTeX. [virtualfunction]
    
    * Fixed missed caps and inline modifiers wrapped in parentheses. #43, #45
    
    * Removed indication of quotes explicitly with square brackets.  Textile 2.0 does not support this and it wasn't in RedCloth 3. #46
    
    * Made percent signs less greedy.  They must surround a phrase or else they must be surrounded with square brackets, just like sup, sub, and del phrases. #47
    
    * Reduced link eagerness so it wouldn't include preceding quoted phrases. #48
    
    * Fixed compatibility issues with Ruby 1.9 [Keita Yamaguchi]. #52, 53, 54
    
    * Fixed an error when a link was badly nested in parentheses. #55
    
    * Fixed an error on superscript/subscript parenthetical phrase. #56
    
    * Fixed bold phrases starting with a number being recognized as unordered lists. #60
    
    * Fixed behavior of unclosed (multi-paragraph) quotes and incorrect handling of links inside double quotations. #59, #63
    
    * Fixed empty block HTML disappearing. #64
    
    
    === 4.0.3 / August 18, 2008
    
    * Fix NoMethodError: private method gsub!' called for nil:NilClass when two dimensions followed by a space. #38
    
    * Fixed unititialized constant RedCloth::TextileDoc with Rails 2.1.  Came from a workaround for Rails bug #320 that was applied even when not necessary. #42
    
    
    === 4.0.2 / August 15, 2008
    
    * Fixed link references/aliases not being recognized when they include hyphens. #36
    
    * Dimensions in feet and inches use correct typographic characters. #25
    
    * Limit overzealous superscript and subscript.  Sup/sub phrases must be surrounded by spaces or square brackets, as in Textile 2. #35
    
    * Fixed HTML before tables causing the opening table tag to be emitted twice. #33
    
    * Cleaned up unused code that was causing a warning. #28
    
    * Workaround for Rails 2.1 bug that loads a previous version of RedCloth before loading the unpacked gem.  Has since been fixed in edge rails. #30
    
    * Added a RedCloth::VERSION.to_s and .== methods so you can puts and compare RedCloth::VERSION just like in previous RedCloth releases. #26
    
    * Fixed HTML block ending tags terminating blocks prematurely. #22
    
    
    === 4.0.1 / July 24, 2008
    
    * Fixed lines starting with dashes being recognized as a definition list when there were no definitions.
    
    * Created alias RedCloth.rb so Rails 2.1 gem dependency works on case-sensitive operating systems	.
    * Fixed parsing sentences that had two em dashes surrounded by spaces from becoming del phrases. #19
    
    * Fixed links including prior quoted phrases. #17
    
    
    === 4.0.0 / July 21, 2008
    
    * New SuperRedCloth (RedCloth 4.0) is a total rewrite using Ragel for the parsing.
    
    * Markdown support has been removed.
    
    * Single newlines become 
    tags, just as in traditional RedCloth and other Textile parsers. * HTML special characters are automatically escaped inside code signatures, like Textile 2. This means you can simply write @
    @ and the symbols are escaped whereas in RedCloth 3 you had to write @<br />@ to make the code fragment readable. * The restrictions parameter is observed just like previous versions (except :hard_breaks is now the default). * Arguments to RedCloth#to_html are called so extensions made for prior versions can work. Note: extensions need to be included rather than defined directly within the RedCloth class as was previously possible. * Custom block tags can be implemented as in the previous version, though the means of implementing them differs. * HTML embedded in the Textile input does not often need to be escaped from Textile parsing. * The parser will not wrap lines that begin with a space in paragraph tags. * Rudimentary support for LaTeX is built in. * RedCloth::VERSION on a line by itself inserts the version number into the output. * Output (less newlines and tabs) is identical to Textile 2 except a few cases where the RedCloth way was preferable. * Over 500 tests prevent regression * It's 40 times faster than the previous version. redcloth-4.3.3/COPYING000066400000000000000000000020211452062100400143450ustar00rootroot00000000000000Copyright (c) 2011 Jason Garber Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. redcloth-4.3.3/Gemfile000066400000000000000000000001761452062100400146160ustar00rootroot00000000000000source 'https://rubygems.org' gemspec group :compilation do gem 'rvm', '~> 1.11.3.9' gem 'rake-compiler', '~> 0.7.1' end redcloth-4.3.3/README.rdoc000066400000000000000000000121141452062100400151240ustar00rootroot00000000000000= RedCloth - Textile parser for Ruby Homepage:: http://redcloth.org Maintainer:: Joshua Siler https://github.com/joshuasiler Author:: Jason Garber Copyright:: (c) 2011 Jason Garber License:: MIT {}[https://travis-ci.org/jgarber/redcloth] {}[https://codeclimate.com/github/jgarber/redcloth] (See http://redcloth.org/textile/ for a Textile reference.) = RedCloth RedCloth is a Ruby library for converting Textile into HTML. == Attention - Deprecating JRuby and Windows support in version 4.3 In order to prioritize merging a fix for the long standing vulnerability *CVE-2012-6684*, our {new maintainer}[https://github.com/joshuasiler] has elected to stop maintaining the precompiled versions for Windows and JRuby. == Installing RedCloth can be installed via RubyGems: gem install RedCloth == Compiling If you just want to use RedCloth, you do NOT need to build/compile it. It is compiled from C sources automatically when you install the gem on the ruby platform. Precompiled binary gems are provided for JRuby and Win32 platforms prior to version 4.3. RedCloth can be compiled with rake compile. Ragel 6.3 or greater is required. Again, Ragel is NOT needed to simply use RedCloth. === Supported platforms By default, the rake compile task builds a native C extension (MRI 1.8 or 1.9). A pure Ruby version can also be generated, but it's super slow and Ruby 1.8-only, and doesn't support multi-byte characters. The RedCloth::EXTENSION_LANGUAGE constant indicates in which language your copy of RedCloth is compiled. == Bugs Please submit bugs as issues to this repo. == Using RedCloth RedCloth is simply an extension of the String class that can handle Textile formatting. Use it like a String and output HTML with its RedCloth#to_html method. Simple use: text = "This is *my* text." RedCloth.new(text).to_html Multi-line example: doc = RedCloth.new <This is a link == 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: Textist With a link: !/common/textist.gif(Textist)!:http://textism.com Will become: Textist == 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: ACLU == Filtering HTML RedCloth doesn't filter unsafe html tags by default, do to this use the following syntax: RedCloth.new("", [:filter_html]).to_html which will filter the script tags from the HTML resulting in: "<script>alert(1)</script>" == Adding Tables In Textile, simple tables can be added by separating each column by a pipe. |a|simple|table|row| |And|Another|table|row| Styles are applied with curly braces. table{border:1px solid black}. {background:#ddd;color:red}. |a|red|row| redcloth-4.3.3/Rakefile000066400000000000000000000007421452062100400147670ustar00rootroot00000000000000# encoding: utf-8 require 'rubygems' require 'bundler' require 'rake/clean' if File.directory? "ragel" Bundler.setup Bundler::GemHelper.install_tasks Dir['tasks/**/*.rake'].each { |rake| load File.expand_path(rake) } else # Omit generation/compile tasks and dependencies. In a gem package # we only need tasks and dependencies required for running specs. Bundler.settings.without = [:compilation] Bundler.setup(:default, :development) load 'tasks/rspec.rake' end redcloth-4.3.3/bin/000077500000000000000000000000001452062100400140675ustar00rootroot00000000000000redcloth-4.3.3/bin/redcloth000077500000000000000000000015241452062100400156230ustar00rootroot00000000000000#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__) + '/../lib/') require 'optparse' require 'redcloth' if %w(--version -v).include? ARGV.first puts "#{RedCloth::NAME} #{RedCloth::VERSION}" exit(0) end output_as = "html" opts = OptionParser.new do |opts| opts.banner = "Usage: redcloth [options] [redcloth_formatted.txt]" opts.separator "If no file specified, STDIN will be used. If you are typing input, you can send an EOF by pressing ^D (^Z on Windows)" opts.separator "" opts.on("-o", "--output STYLE", "Output format (defaults to #{output_as})") do |o| output_as = o end end opts.parse! ARGV red = RedCloth.new( ARGF.read ) out_meth = "to_#{ output_as }" if red.respond_to? out_meth puts red.method( out_meth ).call else abort "** No to_#{ output_as } method found for the `#{ output_as }' format" end redcloth-4.3.3/doc/000077500000000000000000000000001452062100400140645ustar00rootroot00000000000000redcloth-4.3.3/doc/textile_reference.html000066400000000000000000001260551452062100400204570ustar00rootroot00000000000000 Textile Reference

    A Textile Reference

    Sections: Writing in Textile | Quick Block Modifiers | Quick Phrase Modifiers | Attributes | Lists | External References | Tables

    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 for viewing on the web.

    You can try Textile out on the Textile home page. Textile is also available as RedCloth for Ruby or PyTextile for Python.

    Also refer to the Quick Reference for this guide.

    Note: This file was originally authored by _why, this version has been modified by codesponge(billychamp) to fix broken links. The examples that use github.com used to point to hobix.com The broken links in the image examples have not (yet) been replaced.

    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
    1.
    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.

    A single paragraph.

    Followed by another.

    <p>A single paragraph.</p>

    <p>Followed by another.</p>

    A single paragraph.

    Followed by another.

    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.

    I am <b>very</b> serious.

    <pre>
    I am <b>very</b> serious.
    </pre>

    <p>I am <b>very</b> serious.</p>


    <pre>
    I am &lt; b&gt; very&lt;/b&gt; serious.
    </pre>

    I am very serious.

      I am <b>very</b> serious.
    

    Line Breaks

    Line breaks are converted to HTML breaks.

    I spoke.
    And none replied.

    <p>I spoke.
    And none replied.</p>

    I spoke. And none replied.

    Line breaks can be disabled in RedCloth by turning on fold_lines.

    Entities

    Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye.

    "Observe!"

    <p>&#8220; Observe!&#8221;</p>

    “Observe!”

    Double hyphens are replaced with an em-dash.

    Observe -- very nice!

    <p>Observe&#8212; very nice!</p>

    Observe—very nice!

    Single hyphens are replaced with en-dashes.

    Observe - tiny and brief.

    <p>Observe &#8211; tiny and brief.</p>

    Observe – tiny and brief.

    Triplets of periods become an ellipsis.

    Observe...

    <p>Observe&#8230;</p>

    Observe…

    The letter ‘x’ becomes a dimension sign when used alone.

    Observe: 2 x 2.

    <p>Observe: 2&#215; 2.</p>

    Observe: 2×2.

    Conversion of trademark and copyright symbols.

    one(TM), two(R), three(C).

    <p>one&#8482;, two&#174;, three&#169;.</p>

    one™, two®, three©.

    2.
    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.

    Headers

    To make an entire paragraph into a Header, place “hn.” at its beginning, where n is a number from 1-6.

    h1. Header 1

    <h1>Header 1</h1>

    Header 1

    h2. Header 2

    <h2>Header 2</h2>

    Header 2

    h3. Header 3

    <h3>Header 3</h3>

    Header 3

    Block Quotes

    To make an entire paragraph into a block quotation, place “bq.” before it.

    An old text

    bq. A block quotation.

    Any old text

    <p>An old text</p>

    <blockquote>
    <p>A block quotation.</p>
    </blockquote>

    <p>Any old text</p>

    An old text

    A block quotation.

    Any old text

    Footnotes

    Numeric references within text to footnotes appear between square brackets.

    This is covered elsewhere[1].

    <p>This is covered elsewhere<sup><a href="#fn1">1</a></sup>.</p>

    This is covered elsewhere1.

    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.

    fn1. Down here, in fact.

    <p id="fn1"><sup>1</sup> Down here, in fact.</p>

    1 Down here, in fact.

    3.
    Quick Phrase Modifiers

    Structural Emphasis

    Emphasis to text is added by surrounding a phrase with underscores. In HTML, this often appears as italics.

    I _believe_ every word.

    <p>I <em>believe</em> every word.</p>

    I believe every word.

    Strength can be give to text by surrounding with asterisks. In HTML, this strength appears as bold.

    And then? She *fell*!

    <p>And then? She <strong>fell</strong>!</p>

    And then? She fell!

    Both italics and bold can be forced by doubling the underscores or asterisks.

    I __know__.
    I **really** __know__.

    <p>I <i>know</i>.
    I <b>really</b> <i>know</i>.</p>

    I know. I really know.

    Use double question marks to indicate citation. The title of a book, for instance.

    ??Cat's Cradle?? by Vonnegut

    <p><cite>Cat&#8217; s Cradle</cite> by Vonnegut</p>

    Cat’s Cradle by Vonnegut

    Code phrases can be surrounded by at-symbols.

    Convert with @r.to_html@

    <p>Convert with <code>r.to_html</code></p>

    Convert with r.to_html

    To indicate a passage which has been deleted, surround the passage with hypens.

    I'm -sure- not sure.

    <p>I&#8217; m <del>sure</del> not sure.</p>

    I’m sure not sure.

    Pluses around a passage indicate its insertion.

    You are a +pleasant+ child.

    <p>You are a <ins>pleasant</ins> child.</p>

    You are a pleasant child.

    To superscript a phrase, surround with carets.

    a ^2^ + b ^2^ = c ^2^

    <p>a <sup>2</sup> + b <sup>2</sup> = c <sup>2</sup></p>

    a 2 + b 2 = c 2

    To subscript, surround with tildes.

    log ~2~ x

    <p>log <sub>2</sub> x</p>

    log 2 x

    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.

    I'm %unaware% of most soft drinks.

    <p>I&#8217; m <span>unaware</span> of most soft drinks.</p>

    I’m unaware of most soft drinks.

    This way, you can apply style settings, as described in the next section to arbitrary phrases.

    I'm %{color:red}unaware%
    of most soft drinks.

    <p>I&#8217; m <span style="color:red;">unaware</span>
    of most soft drinks.</p>

    I’m unaware of most soft drinks.

    4.
    Attributes

    Tailoring Textile to suit your needs is quite easy. Attributes allow you to provide CSS information about any phrase.

    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.

    p(example1). An example

    <p class="example1">An example</p>

    An example

    An element ID can be given by prefixing the ID with a pound symbol and using it in place of the class.

    p(#big-red). Red here

    <p id="big-red">Red here</p>

    Red here

    Class and ID can be combined by placing the class first.

    p(example1#big-red2). Red here

    <p class="example1" id="big-red2">Red here</p>

    Red here

    Style settings can be provided directly by surrounding them in curly braces.

    p{color:blue;margin:30px}. Spacey blue

    <p style="color:blue; margin:30px;">Spacey blue</p>

    Spacey blue

    Language designations can be given between angel brackets.

    p[fr]. rouge

    <p lang="fr">rouge</p>

    rouge

    Phrase Attributes

    All block attributes can be applied to phrases as well by placing them just inside the opening modifier.

    I seriously *{color:red}blushed*
    when I _(big)sprouted_ that
    corn stalk from my
    %[es]cabeza%.

    <p>I seriously <strong style="color:red;">blushed</strong>
    when I <em class="big">sprouted</em> that
    corn stalk from my
    <span lang="es">cabeza</span>.</p>

    I seriously blushed when I sprouted that corn stalk from my cabeza.

    Block Alignments

    Text inside blocks can be aligned in four basic ways.

    p<. align left

    <p style="text-align:left;">align left</p>

    align left

    p>. align right

    <p style="text-align:right;">align right</p>

    align right

    p=. centered

    <p style="text-align:center;">centered</p>

    centered

    p<>. justified

    <p style="text-align:justify;">justified</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.

    p(. left ident 1em

    <p style="padding-left:1em;">left ident 1em</p>

    left ident 1em

    p((. left ident 2em

    <p style="padding-left:2em;">left ident 2em</p>

    left ident 2em

    p))). right ident 3em

    <p style="padding-right:3em;">right ident 3em</p>

    right ident 3em

    Combining Alignments

    Identation may be coupled with alignment.

    h2()>. Bingo.

    <h2 style="padding-left:1em; padding-right:1em; text-align:right;">Bingo.</h2>

    Bingo.

    And, furthermore, coupled with language settings and CSS styles.

    h3()>[no]{color:red}. Bingo

    <h3 style="color:red; padding-left:1em; padding-right:1em; text-align:right;" lang="no">Bingo</h3>

    Bingo

    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.

    <pre>
    <code>
    a.gsub!( /</, '' )
    </code>
    </pre>

    <pre>
    <code>
    a.gsub!( /&lt;/, '' )
    </code>
    </pre>

    
      a.gsub!( /</, '' )
    
    

    You may also choose to surround sections with div tags to separate your document into sections. Instiki uses this technique to float a sidebar to the right.

    <div style="float:right;">

    h3. Sidebar

    "GitHub":http://github.com/
    "Ruby":http://ruby-lang.org/

    </div>

    The main text of the
    page goes here and will
    stay to the left of the
    sidebar.

    <div style="float:right;">
    <h3>Sidebar</h3>

    <p><a href="http://hobix.com/">GitHub</a>
    <a href="http://ruby-lang.org/">Ruby</a></p>


    </div>
    <p>The main text of the
    page goes here and will
    stay to the left of the
    sidebar.</p>

    Sidebar

    GitHub Ruby

    The main text of the page goes here and will stay to the left of the sidebar.

    5.
    Lists

    Numeric Lists

    To make a numbered list, place each item in its own paragraph, preceded by ”#”.

    # A first item
    # A second item
    # A third

    <ol>
    <li>A first item</li>
    <li>A second item</li>
    <li>A third</li>
    </ol>

    1. A first item
    2. A second item
    3. A third

    These lists may be nested by increasing the number of pound symbols preceding child entries.

    # Fuel could be:
    ## Coal
    ## Gasoline
    ## Electricity
    # Humans need only:
    ## Water
    ## Protein

    <ol>
    <li>Fuel could be:
    <ol>
    <li>Coal</li>
    <li>Gasoline</li>
    <li>Electricity</li>
    </ol>
    </li>
    <li>Humans need only:
    <ol>
    <li>Water</li>
    <li>Protein</li>
    </ol></li>
    </ol>

    1. Fuel could be:
      1. Coal
      2. Gasoline
      3. Electricity
    2. Humans need only:
      1. Water
      2. Protein

    Bulleted Lists

    Bulleted lists use an asterisk in place of the pound.

    * A first item
    * A second item
    * A third

    <ul>
    <li>A first item</li>
    <li>A second item</li>
    <li>A third</li>
    </ul>

    • A first item
    • A second item
    • A third

    These lists may be nested in like manner.

    * Fuel could be:
    ** Coal
    ** Gasoline
    ** Electricity
    * Humans need only:
    ** Water
    ** Protein

    <ul>
    <li>Fuel could be:
    <ul>
    <li>Coal</li>
    <li>Gasoline</li>
    <li>Electricity</li>
    </ul>
    </li>
    <li>Humans need only:
    <ul>
    <li>Water</li>
    <li>Protein</li>
    </ul></li>
    </ul>

    • Fuel could be:
      • Coal
      • Gasoline
      • Electricity
    • Humans need only:
      • Water
      • Protein
    6.
    External References

    Hypertext Links

    Basic links are comprised of a phrase which is linked to a URL. Place the descriptive phrase in quotation marks. Follow it immediately by a colon and the URL.

    I searched "Google":http://google.com.

    <p>I searched <a href="http://google.com">Google</a>.</p>

    I searched Google.

    Notice, the link won’t include any trailing punctuation.

    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.

    I am crazy about "GitHub":github
    and "it's":github "all":github I ever
    "link to":github!

    [github]http://github.com

    <p>I am crazy about <a href="http://github.com">GitHub</a>
    and <a href="http://github.com">it&#8217; s</a> <a href="http://github.com">all</a> I ever
    <a href="http://github.com">link to</a>!</p>

    I am crazy about GitHub and it’s all I ever link to!

    Embedded Images

    You can embed an image in your Textile document by surrounding its URL with exclamation marks.

    !http://hobix.com/sample.jpg!

    <p><img src="http://hobix.com/sample.jpg" alt="" /></p>

    URLs may be relative.

    A title for the image can also be provided in parens, just before the closing exclamation.

    !openwindow1.gif(Bunny.)!

    <p><img src="openwindow1.gif" title="Bunny." alt="Bunny." /></p>

    Bunny.

    The title also acts as alt text should the image not be found.

    Links can be attached to images with a colon.

    !openwindow1.gif!:http://hobix.com/

    <p><a href="http://hobix.com/"><img src="openwindow1.gif" alt="" /></a></p>

    Image Alignments

    Alignments can be applied as well to images.

    !>obake.gif!

    And others sat all round the small
    machine and paid it to sing to them.

    <p style="float:right"><img src="obake.gif" alt="" /></p>

    <p>And others sat all round the small
    machine and paid it to sing to them.</p>

    And others sat all round the small machine and paid it to sing to them.

    Acronyms

    Definitions for acronyms can be provided by following an acronym with its definition in parens.

    We use CSS(Cascading Style Sheets).

    <p>We use <acronym title="Cascading Style Sheets">CSS</acronym>.</p>

    We use CSS.

    7.
    Tables

    Simple tables can be built by separating fields with pipe characters

    | name | age | sex |
    | joan | 24 | f |
    | archie | 29 | m |
    | bella | 45 | f |

    <table>
    <tr>
    <td> name </td>
    <td> age </td>
    <td> sex </td>
    </tr>
    <tr>
    <td> joan </td>
    <td> 24 </td>
    <td> f </td>
    </tr>
    <tr>
    <td> archie </td>
    <td> 29 </td>
    <td> m </td>
    </tr>
    <tr>
    <td> bella </td>
    <td> 45 </td>
    <td> f </td>
    </tr>
    </table>

    name age sex
    joan 24 f
    archie 29 m
    bella 45 f

    Specify header cells by marking them with an underscore and period.

    |_. name |_. age |_. sex |
    | joan | 24 | f |
    | archie | 29 | m |
    | bella | 45 | f |

    <table>
    <tr>
    <th>name </th>
    <th>age </th>
    <th>sex </th>
    </tr>
    <tr>
    <td> joan </td>
    <td> 24 </td>
    <td> f </td>
    </tr>
    <tr>
    <td> archie </td>
    <td> 29 </td>
    <td> m </td>
    </tr>
    <tr>
    <td> bella </td>
    <td> 45 </td>
    <td> f </td>
    </tr>
    </table>

    name age sex
    joan 24 f
    archie 29 m
    bella 45 f

    Cell Attributes

    The period used above marks the end of a cell’s attributes. Other attributes can be applied as well.

    |_. attribute list |
    |<. align left |
    |>. align right|
    |=. center |
    |<>. justify |
    |^. valign top |
    |~. bottom |

    <table>
    <tr>
    <th>attribute list </th>
    </tr>
    <tr>
    <td style="text-align:left;">align left </td>
    </tr>
    <tr>
    <td style="text-align:right;">align right</td>
    </tr>
    <tr>
    <td style="text-align:center;">center </td>
    </tr>
    <tr>
    <td style="text-align:justify;">justify </td>
    </tr>
    <tr>
    <td style="vertical-align:top;">valign top </td>
    </tr>
    <tr>
    <td style="vertical-align:bottom;">bottom </td>
    </tr>
    </table>

    attribute list
    align left
    align right
    center
    justify
    valign top
    bottom

    You can also specify colspans with a backslash, followed by the cell width.

    |\2. spans two cols |
    | col 1 | col 2 |

    <table>
    <tr>
    <td colspan="2">spans two cols </td>
    </tr>
    <tr>
    <td> col 1 </td>
    <td> col 2 </td>
    </tr>
    </table>

    spans two cols
    col 1 col 2

    Rowspan is specified by a forward slash, followed by the row height.

    |/3. spans 3 rows | a |
    | b |
    | c |

    <table>
    <tr>
    <td rowspan="3">spans 3 rows </td>
    <td> a </td>
    </tr>
    <tr>
    <td> b </td>
    </tr>
    <tr>
    <td> c </td>
    </tr>
    </table>

    spans 3 rows a
    b
    c

    All block attributes can be applied to table cells as well.

    |{background:#ddd}. Grey cell|

    <table>
    <tr>
    <td style="background:#ddd;">Grey cell</td>
    </tr>
    </table>

    Grey cell

    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.

    table{border:1px solid black}.
    |This|is|a|row|
    |This|is|a|row|

    <table style="border:1px solid black;">
    <tr>
    <td>This</td>
    <td>is</td>
    <td>a</td>
    <td>row</td>
    </tr>
    <tr>
    <td>This</td>
    <td>is</td>
    <td>a</td>
    <td>row</td>
    </tr>
    </table>

    This is a row
    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.

    |This|is|a|row|
    {background:#ddd}. |This|is|grey|row|

    <table>
    <tr>
    <td>This</td>
    <td>is</td>
    <td>a</td>
    <td>row</td>
    </tr>
    <tr style="background:#ddd;">
    <td>This</td>
    <td>is</td>
    <td>grey</td>
    <td>row</td>
    </tr>
    </table>

    This is a row
    This is grey row
    redcloth-4.3.3/ext/000077500000000000000000000000001452062100400141175ustar00rootroot00000000000000redcloth-4.3.3/ext/redcloth_scan/000077500000000000000000000000001452062100400167275ustar00rootroot00000000000000redcloth-4.3.3/ext/redcloth_scan/redcloth.h000066400000000000000000000212511452062100400207050ustar00rootroot00000000000000#ifndef redcloth_h #define redcloth_h #ifndef RARRAY_LEN #define RARRAY_LEN(arr) RARRAY(arr)->len #define RSTRING_LEN(str) RSTRING(str)->len #define RSTRING_PTR(str) RSTRING(str)->ptr #endif // Different string conversions for ruby 1.8 and ruby 1.9. For 1.9, // we need to set the encoding of the string. // For Ruby 1.9 #ifdef HAVE_RUBY_ENCODING_H #include "ruby/encoding.h" #define STR_NEW(p,n) rb_enc_str_new((p),(n),rb_enc_from_index(ENCODING_GET(self))) #define STR_NEW2(p) rb_enc_str_new((p),strlen(p),rb_enc_from_index(ENCODING_GET(self))) // For Ruby 1.8 #else #define STR_NEW(p,n) rb_str_new((p),(n)) #define STR_NEW2(p) rb_str_new2((p)) #endif /* variable defs */ #ifndef redcloth_scan_c extern VALUE super_ParseError, mRedCloth, super_RedCloth; extern int SYM_escape_preformatted; #endif /* function defs */ void rb_str_cat_escaped(VALUE self, VALUE str, char *ts, char *te); void rb_str_cat_escaped_for_preformatted(VALUE self, VALUE str, char *ts, char *te); VALUE redcloth_inline(VALUE, char *, char *, VALUE); VALUE redcloth_inline2(VALUE, VALUE, VALUE); VALUE redcloth_attribute_parser(int, VALUE, char *, char *); VALUE redcloth_attributes(VALUE, VALUE); VALUE redcloth_link_attributes(VALUE, VALUE); VALUE red_parse_title(VALUE, VALUE, VALUE); VALUE redcloth_transform(VALUE, char *, char *, VALUE); VALUE redcloth_transform2(VALUE, VALUE); void red_inc(VALUE, VALUE); VALUE red_block(VALUE, VALUE, VALUE, VALUE); VALUE red_blockcode(VALUE, VALUE, VALUE); VALUE red_pass(VALUE, VALUE, VALUE, ID, VALUE); VALUE red_pass_code(VALUE, VALUE, VALUE, ID); /* parser macros */ #define CLEAR_REGS() regs = rb_hash_new(); attr_regs = rb_hash_new(); #define RESET_REG() reg = NULL #define MARK() reg = p; #define MARK_B() bck = p; #define MARK_ATTR() attr_reg = p; #define CAT(H) rb_str_cat(H, ts, te-ts) #define CLEAR(H) H = STR_NEW2("") #define RSTRIP_BANG(H) rb_funcall(H, rb_intern("rstrip!"), 0) #define SET_PLAIN_BLOCK(T) plain_block = STR_NEW2(T) #define RESET_TYPE(T) rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block) #define INLINE(H, T) rb_str_append(H, rb_funcall(self, rb_intern(T), 1, regs)) #define DONE(H) rb_str_append(html, H); CLEAR(H); CLEAR_REGS() #define PASS(H, A, T) rb_str_append(H, red_pass(self, regs, ID2SYM(rb_intern(A)), rb_intern(T), refs)) #define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(A))) #define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(A))) #define PARSE_IMAGE_ATTR(A) red_parse_image_attr(self, regs, ID2SYM(rb_intern(A))) #define PASS_CODE(H, A, T) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T))) #define ADD_BLOCK() \ rb_str_append(html, red_block(self, regs, block, refs)); \ extend = Qnil; \ CLEAR(block); \ CLEAR_REGS() #define ADD_EXTENDED_BLOCK() rb_str_append(html, red_block(self, regs, block, refs)); CLEAR(block); #define END_EXTENDED() extend = Qnil; CLEAR_REGS(); #define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); CLEAR_REGS() #define ADD_EXTENDED_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); #define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)), STR_NEW2(V)); #define ATTR_SET(T, V) rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), STR_NEW2(V)); #define ATTR_INC(T) red_inc(attr_regs, ID2SYM(rb_intern(T))); #define INC(N) N++; #define SET_ATTRIBUTES() \ SET_ATTRIBUTE("class_buf", "class"); \ SET_ATTRIBUTE("id_buf", "id"); \ SET_ATTRIBUTE("lang_buf", "lang"); \ SET_ATTRIBUTE("style_buf", "style"); \ rb_funcall(regs, rb_intern("merge!"), 1, attr_regs); \ attr_regs = rb_hash_new(); #define SET_ATTRIBUTE(B, A) \ if (rb_hash_aref(regs, ID2SYM(rb_intern(B))) != Qnil) rb_hash_aset(regs, ID2SYM(rb_intern(A)), rb_hash_aref(regs, ID2SYM(rb_intern(B)))); #define TRANSFORM(T) \ if (p > reg && reg >= ts) { \ VALUE str = redcloth_transform(self, reg, p, refs); \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \ /*printf("TRANSFORM(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ } else { \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \ } #define STORE(T) \ if (p > reg && reg >= ts) { \ VALUE str = STR_NEW(reg, p-reg); \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \ /*printf("STORE(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ } else { \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \ } #define STORE_B(T) \ if (p > bck && bck >= ts) { \ VALUE str = STR_NEW(bck, p-bck); \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \ /*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ } else { \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \ } #define STORE_ATTR(T) \ if (p > attr_reg && attr_reg >= ts) { \ VALUE str = STR_NEW(attr_reg, p-attr_reg); \ rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), str); \ /*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ } else { \ rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), Qnil); \ } #define STORE_URL(T) \ if (p > reg && reg >= ts) { \ char punct = 1; \ while (p > reg && punct == 1) { \ switch (*(p - 1)) { \ case ')': \ { /*needed to keep inside chars scoped for less memory usage*/\ char *temp_p = p - 1; \ signed char level = -1; \ while (temp_p > reg) { \ switch(*(temp_p - 1)) { \ case '(': ++level; break; \ case ')': --level; break; \ } \ --temp_p; \ } \ if (level == 0) { punct = 0; } else { --p; } \ } \ break; \ case '!': case '"': case '#': case '$': case '%': case ']': case '[': case '&': case '\'': \ case '*': case '+': case ',': case '-': case '.': case '(': case ':': \ case ';': case '=': case '?': case '@': case '\\': case '^': case '_': \ case '`': case '|': case '~': p--; break; \ default: punct = 0; \ } \ } \ te = p; \ } \ STORE(T); \ if ( !NIL_P(refs) && rb_funcall(refs, rb_intern("has_key?"), 1, rb_hash_aref(regs, ID2SYM(rb_intern(T)))) ) { \ rb_hash_aset(regs, ID2SYM(rb_intern(T)), rb_hash_aref(refs, rb_hash_aref(regs, ID2SYM(rb_intern(T))))); \ } #define STORE_LINK_ALIAS() \ rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href")))) #define CLEAR_LIST() list_layout = rb_ary_new() #define SET_LIST_TYPE(T) list_type = T; #define NEST() nest ++; #define RESET_NEST() nest = 0; #define LIST_LAYOUT() \ int aint = 0; \ VALUE aval = rb_ary_entry(list_index, nest-1); \ if (aval != Qnil) aint = NUM2INT(aval); \ if (strcmp(list_type, "ol") == 0 && nest > 0) \ { \ rb_ary_store(list_index, nest-1, INT2NUM(aint + 1)); \ } \ if (nest > RARRAY_LEN(list_layout)) \ { \ SET_ATTRIBUTES(); \ sprintf(listm, "%s_open", list_type); \ if (!NIL_P(rb_hash_aref(regs, ID2SYM(rb_intern("list_continue"))))) \ { \ rb_hash_aset(regs, ID2SYM(rb_intern("list_continue")), Qnil); \ rb_hash_aset(regs, ID2SYM(rb_intern("start")), rb_ary_entry(list_index, nest-1)); \ } \ else \ { \ VALUE start = rb_hash_aref(regs, ID2SYM(rb_intern("start"))); \ if (NIL_P(start) ) \ { \ rb_ary_store(list_index, nest-1, INT2NUM(1)); \ } \ else \ { \ VALUE start_num = rb_funcall(start,rb_intern("to_i"),0); \ rb_ary_store(list_index, nest-1, start_num); \ } \ } \ rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(nest)); \ rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \ rb_ary_store(list_layout, nest-1, STR_NEW2(list_type)); \ CLEAR_REGS(); \ ASET("first", "true"); \ } \ LIST_CLOSE(); \ if (nest != 0) LIST_ITEM_CLOSE(); \ CLEAR_REGS(); \ rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY_LEN(list_layout))); \ ASET("type", "li_open"); #define LIST_ITEM_CLOSE() \ if ( rb_hash_aref(regs, ID2SYM(rb_intern("first"))) == Qnil ) \ rb_str_append(html, rb_funcall(self, rb_intern("li_close"), 1, regs)); #define LIST_CLOSE() \ while (nest < RARRAY_LEN(list_layout)) \ { \ rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY_LEN(list_layout))); \ VALUE end_list = rb_ary_pop(list_layout); \ if (!NIL_P(end_list)) \ { \ StringValue(end_list); \ sprintf(listm, "%s_close", RSTRING_PTR(end_list)); \ LIST_ITEM_CLOSE(); \ rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \ } \ } #endif redcloth-4.3.3/lib/000077500000000000000000000000001452062100400140655ustar00rootroot00000000000000redcloth-4.3.3/lib/case_sensitive_require/000077500000000000000000000000001452062100400206255ustar00rootroot00000000000000redcloth-4.3.3/lib/case_sensitive_require/RedCloth.rb000066400000000000000000000005661452062100400226650ustar00rootroot00000000000000# A workaround to make Rails 2.1 gem dependency easier on case-sensitive filesystems. # Since the gem name is RedCloth and the file is redcloth.rb, config.gem 'RedCloth' doesn't # work. You'd have to use config.gem 'RedCloth', :lib => 'redcloth', and that's not # immediately obvious. This file remedies that. # require File.join(File.dirname(__FILE__), '..', 'redcloth')redcloth-4.3.3/lib/redcloth.rb000066400000000000000000000025321452062100400162200ustar00rootroot00000000000000# If this is a frozen gem in Rails 2.1 and RedCloth 3.x was already # loaded by Rails' ActionView::Helpers::TextHelper, the user will get # "redcloth_scan.bundle: Class is not a module (TypeError)" # This hack is to work around that Rails loading problem. The problem # appears to be fixed in Edge Rails [51e4106]. Object.send(:remove_const, :RedCloth) if Object.const_defined?(:RedCloth) && RedCloth.is_a?(Class) require 'rbconfig' begin conf = Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG prefix = conf['arch'] =~ /mswin|mingw/ ? "#{conf['MAJOR']}.#{conf['MINOR']}/" : '' lib = "#{prefix}redcloth_scan" require lib rescue LoadError => e e.message << %{\nCouldn't load #{lib}\nThe $LOAD_PATH was:\n#{$LOAD_PATH.join("\n")}} raise e end require 'redcloth/version' require 'redcloth/textile_doc' require 'redcloth/formatters/base' require 'redcloth/formatters/html' require 'redcloth/formatters/latex' module RedCloth # A convenience method for creating a new TextileDoc. See # RedCloth::TextileDoc. def self.new( *args, &block ) RedCloth::TextileDoc.new( *args, &block ) end # Include extension modules (if any) in TextileDoc. def self.include(*args) RedCloth::TextileDoc.send(:include, *args) end end begin require 'erb' require 'redcloth/erb_extension' include ERB::Util rescue LoadError end redcloth-4.3.3/lib/redcloth/000077500000000000000000000000001452062100400156715ustar00rootroot00000000000000redcloth-4.3.3/lib/redcloth/erb_extension.rb000066400000000000000000000010111452062100400210530ustar00rootroot00000000000000class ERB module Util # # A utility method for transforming Textile in _s_ to HTML. # # require "erb" # include ERB::Util # # puts textilize("Isn't ERB *great*?") # # _Generates_ # #

    Isn’t ERB great?

    # def textilize( s ) if s && s.respond_to?(:to_s) RedCloth.new( s.to_s ).to_html end end alias t textilize module_function :t module_function :textilize end end redcloth-4.3.3/lib/redcloth/formatters/000077500000000000000000000000001452062100400200575ustar00rootroot00000000000000redcloth-4.3.3/lib/redcloth/formatters/base.rb000066400000000000000000000031521452062100400213170ustar00rootroot00000000000000module RedCloth::Formatters module Base def ignore(opts) opts[:text] end alias_method :notextile, :ignore def redcloth_version(opts) p(:text => "#{opts[:prefix]}#{RedCloth::VERSION}") end def inline_redcloth_version(opts) RedCloth::VERSION::STRING end [:del_phrase, :sup_phrase, :sub_phrase, :span_phrase].each do |phrase_method| method = phrase_method.to_s.split('_')[0] define_method(phrase_method) do |opts| "#{opts[:beginning_space]}#{self.send(method, opts)}" end end private def pba(opts) opts.delete(:style) if filter_styles opts.delete(:class) if filter_classes opts.delete(:id) if filter_ids atts = ''.dup opts[:"text-align"] = opts.delete(:align) opts[:style] += ';' if opts[:style] && (opts[:style][-1..-1] != ';') [:float, :"text-align", :"vertical-align"].each do |a| opts[:style] = "#{a}:#{opts[a]};#{opts[:style]}" if opts[a] end [:"padding-right", :"padding-left"].each do |a| opts[:style] = "#{a}:#{opts[a]}em;#{opts[:style]}" if opts[a] end [:style, :class, :lang, :id, :colspan, :rowspan, :title, :start, :align].each do |a| atts << " #{a}=\"#{ html_esc(opts[a].to_s, :html_escape_attributes) }\"" if opts[a] end atts end def method_missing(method, opts) opts[:text] || "" end def before_transform(text) end def after_transform(text) end def formatter_methods singleton_methods.map! {|method| method.to_sym } end end end redcloth-4.3.3/lib/redcloth/formatters/html.rb000066400000000000000000000160161452062100400213540ustar00rootroot00000000000000module RedCloth::Formatters::HTML include RedCloth::Formatters::Base [:h1, :h2, :h3, :h4, :h5, :h6, :p, :pre, :div].each do |m| define_method(m) do |opts| "<#{m}#{pba(opts)}>#{opts[:text]}\n" end end [:strong, :code, :em, :i, :b, :ins, :sup, :sub, :span, :cite].each do |m| define_method(m) do |opts| opts[:block] = true "<#{m}#{pba(opts)}>#{opts[:text]}" end end def hr(opts) "\n" end def acronym(opts) opts[:block] = true "#{caps(:text => opts[:text])}" end def caps(opts) if no_span_caps opts[:text] else opts[:class] = 'caps' span(opts) end end def del(opts) opts[:block] = true "#{opts[:text]}" end [:ol, :ul].each do |m| define_method("#{m}_open") do |opts| opts[:block] = true "#{"\n" if opts[:nest] > 1}#{"\t" * (opts[:nest] - 1)}<#{m}#{pba(opts)}>\n" end define_method("#{m}_close") do |opts| "#{"\t" * (opts[:nest] - 1)}#{"\n" if opts[:nest] <= 1}" end end def li_open(opts) "#{"\t" * opts[:nest]}#{opts[:text]}" end def li_close(opts=nil) "
  • \n" end def dl_open(opts) opts[:block] = true "\n" end def dl_close(opts=nil) "\n" end [:dt, :dd].each do |m| define_method(m) do |opts| "\t<#{m}#{pba(opts)}>#{opts[:text]}\n" end end def td(opts) tdtype = opts[:th] ? 'th' : 'td' "\t\t<#{tdtype}#{pba(opts)}>#{opts[:text]}\n" end def tr_open(opts) "\t\n" end def tr_close(opts) "\t\n" end def table_open(opts) "\n" end def table_close(opts) "\n" end def bc_open(opts) opts[:block] = true "" end def bc_close(opts) "\n" end def bq_open(opts) opts[:block] = true cite = opts[:cite] ? " cite=\"#{ escape_attribute opts[:cite] }\"" : '' "\n" end def bq_close(opts) "\n" end def link(opts) if (filter_html || sanitize_html) && opts[:href] =~ /^\s*javascript:/i opts[:name] else "#{opts[:name]}" end end def image(opts) if (filter_html || sanitize_html) && ( opts[:src] =~ /^\s*javascript:/i || opts[:href] =~ /^\s*javascript:/i ) opts[:title] else opts.delete(:align) opts[:alt] = opts[:title] img = "\"#{escape_attribute" img = "#{img}" if opts[:href] img end end def footno(opts) opts[:id] ||= opts[:text] %Q{#{opts[:text]}} end def fn(opts) no = opts[:id] opts[:id] = "fn#{no}" opts[:class] = ["footnote", opts[:class]].compact.join(" ") "#{no} #{opts[:text]}

    \n" end def snip(opts) "#{opts[:text]}\n" end def quote1(opts) "‘#{opts[:text]}’" end def quote2(opts) "“#{opts[:text]}”" end def multi_paragraph_quote(opts) "“#{opts[:text]}" end def ellipsis(opts) "#{opts[:text]}…" end def emdash(opts) "—" end def endash(opts) " – " end def arrow(opts) "→" end def dim(opts) opts[:text].gsub!('x', '×') opts[:text].gsub!("'", '′') opts[:text].gsub!('"', '″') opts[:text] end def trademark(opts) "™" end def registered(opts) "®" end def copyright(opts) "©" end def entity(opts) "&#{opts[:text]};" end def amp(opts) "&" end def gt(opts) ">" end def lt(opts) "<" end def br(opts) if hard_breaks == false "\n" else "\n" end end def quot(opts) """ end def squot(opts) "’" end def apos(opts) "'" end def html(opts) "#{opts[:text]}\n" end def html_block(opts) inline_html(:text => "#{opts[:indent_before_start]}#{opts[:start_tag]}#{opts[:indent_after_start]}") + "#{opts[:text]}" + inline_html(:text => "#{opts[:indent_before_end]}#{opts[:end_tag]}#{opts[:indent_after_end]}") end def notextile(opts) if filter_html html_esc(opts[:text], :html_escape_preformatted) else opts[:text] end end def inline_html(opts) if filter_html html_esc(opts[:text], :html_escape_preformatted) else "#{opts[:text]}" # nil-safe end end def ignored_line(opts) opts[:text] + "\n" end private # escapement for regular HTML (not in PRE tag) def escape(text) html_esc(text) end # escapement for HTML in a PRE tag def escape_pre(text) html_esc(text, :html_escape_preformatted) end # escaping for HTML attributes def escape_attribute(text) html_esc(text, :html_escape_attributes) end def after_transform(text) text.chomp! end def before_transform(text) clean_html(text) if sanitize_html end # HTML cleansing stuff BASIC_TAGS = { 'a' => ['href', 'title'], 'img' => ['src', 'alt', 'title'], 'br' => [], 'i' => nil, 'u' => nil, 'b' => nil, 'pre' => nil, 'kbd' => nil, 'code' => ['lang'], 'cite' => nil, 'strong' => nil, 'em' => nil, 'ins' => nil, 'sup' => nil, 'sub' => nil, 'del' => nil, 'table' => nil, 'tr' => nil, 'td' => ['colspan', 'rowspan'], 'th' => nil, 'ol' => ['start'], 'ul' => nil, 'li' => nil, 'p' => nil, 'h1' => nil, 'h2' => nil, 'h3' => nil, 'h4' => nil, 'h5' => nil, 'h6' => nil, 'blockquote' => ['cite'], 'notextile' => nil } # Clean unauthorized tags. def clean_html( text, allowed_tags = BASIC_TAGS ) text.gsub!( /]*?)(\s?\/?)>/ ) do |m| raw = $~ tag = raw[2].downcase if allowed_tags.has_key? tag pcs = [tag] allowed_tags[tag].each do |prop| ['"', "'", ''].each do |q| q2 = ( q != '' ? q : '\s' ) if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i attrv = $1 next if (prop == 'src' or prop == 'href') and not attrv =~ %r{^(http|https|ftp):} pcs << "#{prop}=\"#{attrv.gsub('"', '\\"')}\"" break end end end if allowed_tags[tag] "<#{raw[1]}#{pcs.join " "}#{raw[4]}>" else # Unauthorized tag if block_given? yield m else '' end end end end end redcloth-4.3.3/lib/redcloth/formatters/latex.rb000066400000000000000000000157751452062100400215400ustar00rootroot00000000000000require 'yaml' module RedCloth::Formatters::LATEX include RedCloth::Formatters::Base def self.entities @entities ||= YAML.load(File.read(File.dirname(__FILE__)+'/latex_entities.yml')) end module Settings # Maps CSS style names to latex formatting options def latex_image_styles @latex_image_class_styles ||= {} end end RedCloth::TextileDoc.send(:include, Settings) # headers { :h1 => 'section', :h2 => 'subsection', :h3 => 'subsubsection', :h4 => 'paragraph', :h5 => 'subparagraph', :h6 => 'textbf', }.each do |m,tag| define_method(m) do |opts| case opts[:align] when 'left' then "\\begin{flushleft}\\#{tag}{#{opts[:text]}}\\end{flushleft}\n\n" when 'right' then "\\begin{flushright}\\#{tag}{#{opts[:text]}}\\end{flushright}\n\n" when 'center' then "\\begin{center}\\#{tag}{#{opts[:text]}}\\end{center}\n\n" else "\\#{tag}{#{opts[:text]}}\n\n" end end end # commands { :strong => 'textbf', :em => 'emph', :i => 'textit', :b => 'textbf', :ins => 'underline', :del => 'sout', }.each do |m,tag| define_method(m) do |opts| "\\#{tag}{#{opts[:text]}}" end end # inline code def code(opts) opts[:block] ? opts[:text] : "\\verb@#{opts[:text]}@" end # acronyms def acronym(opts) "#{opts[:title]} (#{opts[:text]})" end # sub/superscripts { :sup => '\textsuperscript{#1}', :sub => '\textsubscript{#1}', }.each do |m, expr| define_method(m) do |opts| expr.sub('#1', opts[:text]) end end # environments { :pre => 'verbatim', :cite => 'quote', }.each do |m, env| define_method(m) do |opts| begin_chunk(env) + opts[:text] + end_chunk(env) end end # ignore (or find a good solution later) [ :span, :div, :caps ].each do |m| define_method(m) do |opts| opts[:text].to_s end end # lists { :ol => 'enumerate', :ul => 'itemize', }.each do |m, env| define_method("#{m}_open") do |opts| opts[:block] = true "\\begin{#{env}}\n" end define_method("#{m}_close") do |opts| "\\end{#{env}}\n\n" end end def li_open(opts) " \\item #{opts[:text]}" end def li_close(opts=nil) "\n" end # paragraphs def p(opts) case opts[:align] when 'left' then "\\begin{flushleft}#{opts[:text]}\\end{flushleft}\n\n" when 'right' then "\\begin{flushright}#{opts[:text]}\\end{flushright}\n\n" when 'center' then "\\begin{center}#{opts[:text]}\\end{center}\n\n" else "#{opts[:text]}\n\n" end end # tables def td(opts) column = @table_row.size if opts[:colspan] opts[:text] = "\\multicolumn{#{opts[:colspan]}}{ #{"l " * opts[:colspan].to_i}}{#{opts[:text]}}" end if opts[:rowspan] @table_multirow_next[column] = opts[:rowspan].to_i - 1 opts[:text] = "\\multirow{#{opts[:rowspan]}}{*}{#{opts[:text]}}" end @table_row.push(opts[:text]) return "" end def tr_open(opts) @table_row = [] return "" end def tr_close(opts) multirow_columns = @table_multirow.find_all {|c,n| n > 0} multirow_columns.each do |c,n| @table_row.insert(c,"") @table_multirow[c] -= 1 end @table_multirow.merge!(@table_multirow_next) @table_multirow_next = {} @table.push(@table_row) return "" end # We need to know the column count before opening tabular context. def table_open(opts) @table = [] @table_multirow = {} @table_multirow_next = {} return "" end # FIXME: need caption and label elements similar to image -> figure def table_close(opts) output = "\\begin{table}\n".dup output << " \\centering\n" output << " \\begin{tabular}{ #{"l " * @table[0].size }}\n" @table.each do |row| output << " #{row.join(" & ")} \\\\\n" end output << " \\end{tabular}\n" output << "\\end{table}\n" output end # code blocks def bc_open(opts) opts[:block] = true begin_chunk("verbatim") + "\n" end def bc_close(opts) end_chunk("verbatim") + "\n" end # block quotations def bq_open(opts) opts[:block] = true "\\begin{quotation}\n" end def bq_close(opts) "\\end{quotation}\n\n" end # links def link(opts) "\\href{#{opts[:href]}}{#{opts[:name]}}" end # FIXME: use includegraphics with security verification # # Remember to use '\RequirePackage{graphicx}' in your LaTeX header # # FIXME: Look at dealing with width / height gracefully as this should be # specified in a unit like cm rather than px. def image(opts) # Don't know how to use remote links, plus can we trust them? return "" if opts[:src] =~ /^\w+\:\/\// # Resolve CSS styles if any have been set styling = opts[:class].to_s.split(/\s+/).collect { |style| latex_image_styles[style] }.compact.join ',' # Build latex code [ "\\begin{figure}", " \\centering", " \\includegraphics[#{styling}]{#{opts[:src]}}", (" \\caption{#{escape opts[:title]}}" if opts[:title]), (" \\label{#{escape opts[:alt]}}" if opts[:alt]), "\\end{figure}", ].compact.join "\n" end # footnotes def footno(opts) # TODO: insert a placeholder until we know the footnote content. # For this to work, we need some kind of post-processing... "\\footnotemark[#{opts[:text]}]" end def fn(opts) "\\footnotetext[#{opts[:id]}]{#{opts[:text]}}" end # inline verbatim def snip(opts) "\\verb`#{opts[:text]}`" end def quote1(opts) "`#{opts[:text]}'" end def quote2(opts) "``#{opts[:text]}''" end def ellipsis(opts) "#{opts[:text]}\\ldots{}" end def emdash(opts) "---" end def endash(opts) " -- " end def arrow(opts) "\\rightarrow{}" end def trademark(opts) "\\texttrademark{}" end def registered(opts) "\\textregistered{}" end def copyright(opts) "\\copyright{}" end # TODO: what do we do with (unknown) unicode entities ? # def entity(opts) text = opts[:text][0..0] == '#' ? opts[:text][1..-1] : opts[:text] RedCloth::Formatters::LATEX.entities[text] end def dim(opts) opts[:text].gsub!('x', '\times') opts[:text].gsub!('"', "''") period = opts[:text].slice!(/\.$/) "$#{opts[:text]}$#{period}" end # TODO: what do we do with HTML? def inline_html(opts) opts[:text] || "" end private def escape(text) latex_esc(text) end def escape_pre(text) text end # Use this for block level commands that use \begin def begin_chunk(type) chunk_counter[type] += 1 return "\\begin{#{type}}" if 1 == chunk_counter[type] '' end # Use this for block level commands that use \end def end_chunk(type) chunk_counter[type] -= 1 raise RuntimeError, "Bad latex #{type} nesting detected" if chunk_counter[type] < 0 # This should never need to happen return "\\end{#{type}}" if 0 == chunk_counter[type] '' end def chunk_counter @chunk_counter ||= Hash.new 0 end end redcloth-4.3.3/lib/redcloth/formatters/latex_entities.yml000066400000000000000000001407251452062100400236340ustar00rootroot00000000000000# based on "SGML/XML character entity reference" at http://www.bitjungle.com/isoent/ # --- #EM SPACE emsp: \hspace{1em} #EM SPACE "8195": \hspace{1em} #EN SPACE ensp: \hspace{0.5em} #EN SPACE "8194": \hspace{0.5em} #THREE-PER-EM SPACE "8196": \hspace{0.33em} #FOUR-PER-EM SPACE "8197": \hspace{0.25em} #FIGURE SPACE "8199": \hphantom{0} #PUNCTUATION SPACE "8200": \hphantom{,} #THIN SPACE thinsp: \hspace{0.167em} #THIN SPACE "8201": \hspace{0.167em} #HAIR SPACE "8202": \hspace{1pt} #EM DASH mdash: --- #EM DASH "8212": --- #EN DASH ndash: ' -- ' #EN DASH "8211": ' -- ' #HYPHEN "8208": "-" #OPEN BOX "9251": \textvisiblespace{} #HORIZONTAL ELLIPSIS hellip: \ldots{} #HORIZONTAL ELLIPSIS "8230": \ldots{} #TWO DOT LEADER "8229": \nldr{} #VULGAR FRACTION ONE THIRD "8531": \sfrac{1}{3} #VULGAR FRACTION TWO THIRDS "8532": \sfrac{2}{3} #VULGAR FRACTION ONE FIFTH "8533": \sfrac{1}{5} #VULGAR FRACTION TWO FIFTHS "8534": \sfrac{2}{5} #VULGAR FRACTION THREE FIFTHS "8535": \sfrac{3}{5} #VULGAR FRACTION FOUR FIFTHS "8536": \sfrac{4}{5} #VULGAR FRACTION ONE SIXTH "8537": \sfrac{1}{6} #VULGAR FRACTION FIVE SIXTHS "8538": \sfrac{5}{6} #CARE OF "8453": "{^c\\!/\\!_o}" #FULL BLOCK "9608": \block{} #UPPER HALF BLOCK "9600": \uhblk{} #LOWER HALF BLOCK "9604": \lhblk{} #LIGHT SHADE #requires color "9617": \textcolor[gray]{.75}{\block} #MEDIUM SHADE #requires color "9618": \textcolor[gray]{.5}{\block} #DARK SHADE #requires color "9619": \textcolor[gray]{.25}{\block} #BLACK VERTICAL RECTANGLE "9646": \marker{} #WHITE CIRCLE "9675": \circ{} #WHITE SQUARE #requires amssymb "9633": \square{} #WHITE RECTANGLE "9645": \fbox{~~} #WHITE UP-POINTING TRIANGLE #requires amssymb "9653": \vartriangle{} #WHITE DOWN-POINTING TRIANGLE #requires amssymb "9663": \triangledown{} #WHITE STAR #requires pifont "9734": \ding{73} #BULLET bull: \textbullet{} #BULLET "8226": \textbullet{} #BLACK SMALL SQUARE #requires amssymb "9642": \blacksquare{} #BLACK UP-POINTING TRIANGLE #requires amssymb "9652": \blacktriangle{} #BLACK DOWN-POINTING TRIANGLE #requires amssymb "9662": \blacktriangledown{} #BLACK LEFT-POINTING TRIANGLE #requires amssymb "9666": \blacktriangleleft{} #BLACK RIGHT-POINTING TRIANGLE #requires amssymb "9656": \blacktriangleright{} #BLACK CLUB SUIT #requires pifont clubs: \ding{168} #BLACK CLUB SUIT #requires pifont "9827": \ding{168} #BLACK DIAMOND SUIT #requires pifont diams: \ding{169} #BLACK DIAMOND SUIT #requires pifont "9830": \ding{169} #BLACK HEART SUIT #requires pifont hearts: \ding{170} #BLACK HEART SUIT "9829": \ding{170} #BLACK SPADE SUIT #requires pifont spades: \ding{171} #BLACK SPADE SUIT #requires pifont "9824": \ding{171} #MALTESE CROSS #requires pifont "10016": \maltese{} #DAGGER dagger: \dag{} #DAGGER "8224": \dag{} #DOUBLE DAGGER Dagger: \ddag{} #DOUBLE DAGGER "8225": \ddag{} #CHECK MARK #requires pifont "10003": \checkmark{} #BALLOT X #requires pifont "10007": \ding{55} #MUSIC SHARP SIGN "9839": \sharp{} #MUSIC FLAT SIGN "9837": \flat{} #MALE SIGN #requires wasysym "9794": \male{} #FEMALE SIGN #requires wasysym "9792": \female{} #TELEPHONE SIGN #requires pifont "9742": \phone{} #TELEPHONE RECORDER #requires wasysym "8981": \recorder{} #SOUND RECORDING COPYRIGHT #requires textcomp "8471": \textcircledP{} #CARET "8257": \mathchar"1356 #SINGLE LOW-9 QUOTATION MARK #requires fontenc:T1 lsquor: "," #SINGLE LOW-9 QUOTATION MARK #requires fontenc:T1 "8218": "," #DOUBLE LOW-9 QUOTATION MARK #requires fontenc:T1 ldquor: ',,' #DOUBLE LOW-9 QUOTATION MARK #requires fontenc:T1 "8222": ',,' #LATIN SMALL LIGATURE FF "64256": ff #LATIN SMALL LIGATURE FI "64257": fi #SMALL FJ LIGATURE "58290": fj #LATIN SMALL LIGATURE FFI "64259": ffi #LATIN SMALL LIGATURE FFL "64260": ffl #LATIN SMALL LIGATURE FL "64258": fl #DOUBLE HIGH-REVERSED-9 QUOTATION MARK "8223": '``' #SINGLE HIGH-REVERSED-9 QUOTATION MARK "8219": '`' #VERTICAL ELLIPSIS "8942": \vdots{} #HYPHEN BULLET "8259": \hybull{} #LOZENGE #requires amssymb loz: \lozenge{} #LOZENGE #requires amssymb "9674": \lozenge{} #LOZENGE, FILLED #requires amssymb "59403": \blacklozenge{} #WHITE LEFT-POINTING TRIANGLE "9667": \triangleleft{} #WHITE RIGHT-POINTING TRIANGLE "9657": \triangleright{} #BLACK STAR #requires amssymb "9733": \bigstar{} #MUSIC NATURAL SIGN "9838": \natural{} #PRESCRIPTION TAKE #requires textcomp "8478": \textrecipe{} #SIX POINTED BLACK STAR #requires pifont "10038": \ding{86} #POSITION INDICATOR "8982": \mathchar"2208 #BOTTOM LEFT CROP "8973": \dlcrop{} #BOTTOM RIGHT CROP "8972": \drcrop{} #TOP LEFT CROP "8975": \ulcrop{} #TOP RIGHT CROP "8974": \urcrop{} #VULGAR FRACTION ONE HALF frac12: \sfrac{1}{2} #VULGAR FRACTION ONE HALF "189": \sfrac{1}{2} #VULGAR FRACTION ONE QUARTER frac14: \sfrac{1}{4} #VULGAR FRACTION ONE QUARTER "188": \sfrac{1}{4} #VULGAR FRACTION THREE QUARTERS frac34: \sfrac{3}{4} #VULGAR FRACTION THREE QUARTERS "190": \sfrac{3}{4} #VULGAR FRACTION ONE EIGHTH "8539": \sfrac{1}{8} #VULGAR FRACTION THREE EIGHTHS "8540": \sfrac{3}{8} #VULGAR FRACTION FIVE EIGHTHS "8541": \sfrac{5}{8} #VULGAR FRACTION SEVEN EIGHTHS "8542": \sfrac{7}{8} #SUPERSCRIPT ONE sup1: ^1 #SUPERSCRIPT ONE "185": ^1 #SUPERSCRIPT TWO sup2: ^2 #SUPERSCRIPT TWO "178": ^2 #SUPERSCRIPT THREE sup3: ^3 #SUPERSCRIPT THREE "179": ^3 #PLUS SIGN "43": + #PLUS-MINUS SIGN #requires textcomp plusmn: \textpm{} #PLUS-MINUS SIGN #requires textcomp "177": \textpm{} #LESS-THAN SIGN lt: \textless{} #LESS-THAN SIGN "60": \textless{} #EQUALS SIGN "61": "=" #GREATER-THAN SIGN gt: \textgreater{} #GREATER-THAN SIGN "62": \textgreater{} #DIVISION SIGN #requires textcomp divide: \textdiv{} #DIVISION SIGN #requires textcomp "247": \textdiv{} #MULTIPLICATION SIGN #requires textcomp times: \texttimes{} #MULTIPLICATION SIGN #requires textcomp "215": \texttimes{} #CURRENCY SIGN #requires wasysym curren: \textcurrency{} #CURRENCY SIGN #requires wasysym "164": \textcurrency{} #POUND SIGN pound: \pounds{} #POUND SIGN "163": \pounds{} #DOLLAR SIGN "36": \$ #CENT SIGN #requires wasysym cent: \textcent{} #CENT SIGN #requires wasysym "162": \textcent{} #YEN SIGN #requires amsfonts yen: \textyen{} #YEN SIGN #requires amsfonts "165": \textyen{} #NUMBER SIGN "35": \# #PERCENT SIGN "37": \% #AMPERSAND amp: \& #AMPERSAND "38": \& #ASTERISK "42": \ast{} #COMMERCIAL AT "64": "@" #LEFT SQUARE BRACKET "91": "[" #REVERSE SOLIDUS "92": \textbackslash{} #RIGHT SQUARE BRACKET "93": "]" #LEFT CURLY BRACKET "123": \{ #HORIZONTAL BAR "8213": --- #VERTICAL LINE "124": \textbar{} #RIGHT CURLY BRACKET "125": \} #MICRO SIGN #requires textcomp micro: \textmu{} #MICRO SIGN #requires textcomp "181": \textmu{} #OHM SIGN #requires textcomp "8486": \textohm{} #DEGREE SIGN #requires textcomp deg: \textdegree{} #DEGREE SIGN #requires textcomp "176": \textdegree{} #MASCULINE ORDINAL INDICATOR #requires textcomp ordm: \textordmasculine{} #MASCULINE ORDINAL INDICATOR #requires textcomp "186": \textordmasculine{} #FEMININE ORDINAL INDICATOR #requires textcomp ordf: \textordfeminine{} #FEMININE ORDINAL INDICATOR #requires textcomp "170": \textordfeminine{} #SECTION SIGN #requires textcomp sect: \S{} #SECTION SIGN #requires textcomp "167": \S{} #PILCROW SIGN #requires textcomp para: \P{} #PILCROW SIGN #requires textcomp "182": \P{} #MIDDLE DOT #requires amssymb middot: \textperiodcentered{} #MIDDLE DOT #requires amssymb "183": \textperiodcentered{} #LEFTWARDS ARROW #requires textcomp larr: \textleftarrow{} #LEFTWARDS ARROW #requires textcomp "8592": \textleftarrow{} #RIGHTWARDS ARROW #requires textcomp rarr: \textrightarrow{} #RIGHTWARDS ARROW #requires textcomp "8594": \textrightarrow{} #UPWARDS ARROW #requires textcomp uarr: \textuparrow{} #UPWARDS ARROW #requires textcomp "8593": \textuparrow{} #DOWNWARDS ARROW #requires textcomp darr: \textdownarrow{} #DOWNWARDS ARROW #requires textcomp "8595": \textdownarrow{} #COPYRIGHT SIGN #requires textcomp copy: \copyright{} #COPYRIGHT SIGN #requires textcomp "169": \copyright{} #REGISTERED SIGN #requires amssymb reg: \textregistered{} #REGISTERED SIGN #requires amssymb "174": \textregistered{} #TRADE MARK SIGN trade: \texttrademark{} #TRADE MARK SIGN "8482": \texttrademark{} #BROKEN BAR #requires wasysym brvbar: \textbrokenbar{} #BROKEN BAR #requires wasysym "166": \textbrokenbar{} #NOT SIGN #requires textcomp not: \textlnot{} #NOT SIGN #requires textcomp "172": \textlnot{} #EIGHTH NOTE #requires wasysym "9834": \textmusicalnote{} #EXCLAMATION MARK "33": "!" #INVERTED EXCLAMATION MARK iexcl: "!`" #INVERTED EXCLAMATION MARK "161": "!`" #QUOTATION MARK #requires fontenc:T1 quot: "\"" #QUOTATION MARK #requires fontenc:T1 "34": "\"" #APOSTROPHE #requires textcomp "39": "'" #LEFT PARENTHESIS "40": ( #RIGHT PARENTHESIS "41": ) #COMMA "44": "," #LOW LINE "95": \_ #HYPHEN-MINUS "45": "-" #FULL STOP "46": . #SOLIDUS "47": / #COLON "58": ":" #SEMICOLON "59": ; #QUESTION MARK "63": "?" #INVERTED QUESTION MARK iquest: ?` #INVERTED QUESTION MARK "191": ?` #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK #requires fontenc:T1 laquo: \guillemotleft{} #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK #requires fontenc:T1 "171": \guillemotleft{} #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK #requires fontenc:T1 raquo: \guillemotright{} #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK #requires fontenc:T1 "187": \guillemotright{} #LEFT SINGLE QUOTATION MARK lsquo: '`' #LEFT SINGLE QUOTATION MARK "8216": '`' #RIGHT SINGLE QUOTATION MARK rsquo: "'" #RIGHT SINGLE QUOTATION MARK "8217": "'" #LEFT DOUBLE QUOTATION MARK ldquo: '``' #LEFT DOUBLE QUOTATION MARK "8220": '``' #RIGHT DOUBLE QUOTATION MARK rdquo: "''" #RIGHT DOUBLE QUOTATION MARK "8221": "''" #NO-BREAK SPACE nbsp: "~" #NO-BREAK SPACE "160": "~" #SOFT HYPHEN shy: \- #SOFT HYPHEN "173": \- #BOX DRAWINGS LIGHT HORIZONTAL "9472": \boxh{} #BOX DRAWINGS LIGHT VERTICAL "9474": \boxv{} #BOX DRAWINGS LIGHT UP AND RIGHT "9492": \boxur{} #BOX DRAWINGS LIGHT UP AND LEFT "9496": \boxul{} #BOX DRAWINGS LIGHT DOWN AND LEFT "9488": \boxdl{} #BOX DRAWINGS LIGHT DOWN AND RIGHT "9484": \boxdr{} #BOX DRAWINGS LIGHT VERTICAL AND RIGHT "9500": \boxvr{} #BOX DRAWINGS LIGHT UP AND HORIZONTAL "9524": \boxhu{} #BOX DRAWINGS LIGHT VERTICAL AND LEFT "9508": \boxvl{} #BOX DRAWINGS LIGHT DOWN AND HORIZONTAL "9516": \boxhd{} #BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL "9532": \boxvh{} #BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE "9566": \boxvR{} #BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE "9576": \boxhU{} #BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE "9569": \boxvL{} #BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE "9573": \boxhD{} #BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE "9578": \boxvH{} #BOX DRAWINGS DOUBLE HORIZONTAL "9552": \boxH{} #BOX DRAWINGS DOUBLE VERTICAL "9553": \boxV{} #BOX DRAWINGS DOUBLE UP AND RIGHT "9562": \boxUR{} #BOX DRAWINGS DOUBLE UP AND LEFT "9565": \boxUL{} #BOX DRAWINGS DOUBLE DOWN AND LEFT "9559": \boxDL{} #BOX DRAWINGS DOUBLE DOWN AND RIGHT "9556": \boxDR{} #BOX DRAWINGS DOUBLE VERTICAL AND RIGHT "9568": \boxVR{} #BOX DRAWINGS DOUBLE UP AND HORIZONTAL "9577": \boxHU{} #BOX DRAWINGS DOUBLE VERTICAL AND LEFT "9571": \boxVL{} #BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL "9574": \boxHD{} #BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL "9580": \boxVH{} #BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE "9567": \boxVr{} #BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE "9575": \boxHu{} #BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE "9570": \boxVl{} #BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE "9572": \boxHd{} #BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE "9579": \boxVh{} #BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE "9560": \boxuR{} #BOX DRAWINGS UP DOUBLE AND LEFT SINGLE "9564": \boxUl{} #BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE "9557": \boxdL{} #BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE "9555": \boxDr{} #BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE "9561": \boxUr{} #BOX DRAWINGS UP SINGLE AND LEFT DOUBLE "9563": \boxuL{} #BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE "9558": \boxDl{} #BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE "9554": \boxdR{} #ALEF SYMBOL alefsym: \aleph{} #ALEF SYMBOL "8501": \aleph{} #LOGICAL AND and: \wedge{} #LOGICAL AND "8743": \wedge{} #RIGHT ANGLE "8735": \sqangle{} #SPHERICAL ANGLE #requires amssymb "8738": \sphericalangle{} #ALMOST EQUAL TO "8776": \approx{} #BECAUSE #requires amssymb "8757": \because{} #UP TACK "8869": \bot{} #INTERSECTION cap: \cap{} #INTERSECTION "8745": \cap{} #APPROXIMATELY EQUAL TO cong: \cong{} #APPROXIMATELY EQUAL TO "8773": \cong{} #CONTOUR INTEGRAL "8750": \oint{} #UNION cup: \cup{} #UNION "8746": \cup{} #IDENTICAL TO equiv: \equiv{} #IDENTICAL TO "8801": \equiv{} #THERE EXISTS exist: \exists{} #THERE EXISTS "8707": \exists{} #FOR ALL forall: \forall{} #FOR ALL "8704": \forall{} #LATIN SMALL LETTER F WITH HOOK fnof: f #LATIN SMALL LETTER F WITH HOOK "402": f #GREATER-THAN OR EQUAL TO ge: \geq{} #GREATER-THAN OR EQUAL TO "8805": \geq{} #LEFT RIGHT DOUBLE ARROW "8660": \iff{} #INFINITY infin: \infty{} #INFINITY "8734": \infty{} #INTEGRAL int: \int{} #INTEGRAL "8747": \int{} #ELEMENT OF isin: \in{} #ELEMENT OF "8712": \in{} #LEFT ANGLE BRACKET #requires textcomp lang: \textlangle{} #LEFT ANGLE BRACKET #requires textcomp "12296": \textlangle{} #LEFTWARDS DOUBLE ARROW lArr: \Leftarrow{} #LEFTWARDS DOUBLE ARROW "8656": \Leftarrow{} #LESS-THAN OR EQUAL TO le: \leq{} #LESS-THAN OR EQUAL TO "8804": \leq{} #MINUS SIGN #requires textcomp minus: \textminus{} #MINUS SIGN #requires textcomp "8722": \textminus{} #MINUS-OR-PLUS SIGN "8723": \mp{} #NABLA nabla: \nabla{} #NABLA "8711": \nabla{} #NOT EQUAL TO ne: \not= #NOT EQUAL TO "8800": \not= #CONTAINS AS MEMBER ni: \ni{} #CONTAINS AS MEMBER "8715": \ni{} #LOGICAL OR or: \vee{} #LOGICAL OR "8744": \vee{} #PARALLEL TO "8741": \parallel{} #PARTIAL DIFFERENTIAL part: \partial{} #PARTIAL DIFFERENTIAL "8706": \partial{} #PER MILLE SIGN #requires wasysym permil: \textperthousand{} #PER MILLE SIGN #requires wasysym "8240": \textperthousand{} #UP TACK perp: \perp{} #UP TACK "8869": \perp{} #PRIME prime: ^\prime #PRIME "8242": ^\prime #DOUBLE PRIME Prime: "{''}" #DOUBLE PRIME "8243": "{''}" #PROPORTIONAL TO prop: \propto{} #PROPORTIONAL TO "8733": \propto{} #FOURTH ROOT #requires textcomp radic: \textsurd{} #FOURTH ROOT #requires textcomp "8730": \textsurd{} #RIGHT ANGLE BRACKET #requires textcomp rang: \textrangle{} #RIGHT ANGLE BRACKET #requires textcomp "12297": \textrangle{} #RIGHTWARDS DOUBLE ARROW rArr: \Rightarrow{} #RIGHTWARDS DOUBLE ARROW "8658": \Rightarrow{} #TILDE OPERATOR sim: \sim{} #TILDE OPERATOR "8764": \sim{} #APPROXIMATELY EQUAL TO "8771": \simeq{} #BLACK SQUARE #requires amssymb "9632": \square{} #SUBSET OF sub: \subset{} #SUBSET OF "8834": \subset{} #SUBSET OF OR EQUAL TO sube: \subseteq{} #SUBSET OF OR EQUAL TO "8838": \subseteq{} #SUPERSET OF sup: \supset{} #SUPERSET OF "8835": \supset{} #SUPERSET OF OR EQUAL TO supe: \supseteq{} #SUPERSET OF OR EQUAL TO "8839": \supseteq{} #THEREFORE #requires amssymb there4: \therefore{} #THEREFORE #requires amssymb "8756": \therefore{} #DOUBLE VERTICAL LINE #requires textcomp "8214": \textbardbl{} #ANGSTROM SIGN "8491": \AA{} #SCRIPT CAPITAL B #requires mathrsfs "8492": B #RING OPERATOR "8728": \circ{} #DIAERESIS "168": \ddot{} #COMBINING FOUR DOTS ABOVE "8412": \ddot{}\kern4.5pt\ddot{ } #SCRIPT CAPITAL H #requires mathrsfs "8459": H #SCRIPT CAPITAL L #requires mathrsfs "8466": L #ASTERISK OPERATOR lowast: _\ast #ASTERISK OPERATOR "8727": _\ast #NOT AN ELEMENT OF notin: \not\in{} #NOT AN ELEMENT OF "8713": \not\in{} #SCRIPT SMALL O "8500": \mathit{o} #SCRIPT CAPITAL M #requires mathrsfs "8499": M #COMBINING THREE DOTS ABOVE "8411": \ddot{}\kern 3pt\dot{ } #TRIPLE PRIME "8244": "{'''}" #ESTIMATES "8793": \stackrel{\wedge}{=} #GREEK SMALL LETTER ALPHA alpha: \alpha{} #GREEK SMALL LETTER ALPHA "945": \alpha{} #GREEK SMALL LETTER BETA beta: \beta{} #GREEK SMALL LETTER BETA "946": \beta{} #GREEK SMALL LETTER GAMMA gamma: \gamma{} #GREEK SMALL LETTER GAMMA "947": \gamma{} #GREEK CAPITAL LETTER GAMMA Gamma: \Gamma{} #GREEK CAPITAL LETTER GAMMA "915": \Gamma{} #GREEK LETTER DIGAMMA #requires amssymb "988": \digamma{} #GREEK SMALL LETTER DELTA delta: \delta{} #GREEK SMALL LETTER DELTA "948": \delta{} #GREEK CAPITAL LETTER DELTA Delta: \Delta{} #GREEK CAPITAL LETTER DELTA "916": \Delta{} #GREEK SMALL LETTER EPSILON epsilon: \epsilon{} #GREEK SMALL LETTER EPSILON "949": \epsilon{} #SMALL ELEMENT OF "8714": \epsilon{} #GREEK SMALL LETTER ZETA zeta: \zeta{} #GREEK SMALL LETTER ZETA "950": \zeta{} #GREEK SMALL LETTER ETA eta: \eta{} #GREEK SMALL LETTER ETA "951": \eta{} #GREEK SMALL LETTER THETA theta: \theta{} #GREEK SMALL LETTER THETA "952": \theta{} #GREEK CAPITAL LETTER THETA Theta: \Theta{} #GREEK CAPITAL LETTER THETA "920": \Theta{} #GREEK THETA SYMBOL thetasym: \vartheta{} #GREEK THETA SYMBOL "977": \vartheta{} #GREEK SMALL LETTER IOTA iota: \iota{} #GREEK SMALL LETTER IOTA "953": \iota{} #GREEK SMALL LETTER KAPPA kappa: \kappa{} #GREEK SMALL LETTER KAPPA "954": \kappa{} #GREEK KAPPA SYMBOL #requires amssymb "1008": \varkappa{} #GREEK SMALL LETTER LAMDA lambda: \lambda{} #GREEK SMALL LETTER LAMDA "955": \lambda{} #GREEK CAPITAL LETTER LAMDA Lambda: \Lambda{} #GREEK CAPITAL LETTER LAMDA "923": \Lambda{} #GREEK SMALL LETTER MU mu: \mu{} #GREEK SMALL LETTER MU "956": \mu{} #GREEK SMALL LETTER NU nu: \nu{} #GREEK SMALL LETTER NU "957": \nu{} #GREEK SMALL LETTER XI xi: \xi{} #GREEK SMALL LETTER XI "958": \xi{} #GREEK CAPITAL LETTER XI Xi: \Xi{} #GREEK CAPITAL LETTER XI "926": \Xi{} #GREEK SMALL LETTER PI pi: \pi{} #GREEK SMALL LETTER PI "960": \pi{} #GREEK PI SYMBOL piv: \varpi{} #GREEK PI SYMBOL "982": \varpi{} #GREEK CAPITAL LETTER PI Pi: \Pi{} #GREEK CAPITAL LETTER PI "928": \Pi{} #GREEK SMALL LETTER RHO rho: \rho{} #GREEK SMALL LETTER RHO "961": \rho{} #GREEK RHO SYMBOL "1009": \varrho{} #GREEK SMALL LETTER SIGMA sigma: \sigma{} #GREEK SMALL LETTER SIGMA "963": \sigma{} #GREEK CAPITAL LETTER SIGMA Sigma: \Sigma{} #GREEK CAPITAL LETTER SIGMA "931": \Sigma{} #GREEK SMALL LETTER FINAL SIGMA sigmaf: \varsigma{} #GREEK SMALL LETTER FINAL SIGMA "962": \varsigma{} #GREEK SMALL LETTER TAU tau: \tau{} #GREEK SMALL LETTER TAU "964": \tau{} #GREEK SMALL LETTER UPSILON upsi: \upsilon{} #GREEK SMALL LETTER UPSILON "965": \upsilon{} #GREEK UPSILON WITH HOOK SYMBOL upsih: \Upsilon{} #GREEK UPSILON WITH HOOK SYMBOL "978": \Upsilon{} #GREEK SMALL LETTER PHI phis: \phi{} #GREEK SMALL LETTER PHI "966": \phi{} #GREEK CAPITAL LETTER PHI Phi: \Phi{} #GREEK CAPITAL LETTER PHI "934": \Phi{} #GREEK PHI SYMBOL "981": \varphi{} #GREEK SMALL LETTER CHI chi: \chi{} #GREEK SMALL LETTER CHI "967": \chi{} #GREEK SMALL LETTER PSI psi: \psi{} #GREEK SMALL LETTER PSI "968": \psi{} #GREEK CAPITAL LETTER PSI Psi: \Psi{} #GREEK CAPITAL LETTER PSI "936": \Psi{} #GREEK SMALL LETTER OMEGA omega: \omega{} #GREEK SMALL LETTER OMEGA "969": \omega{} #GREEK CAPITAL LETTER OMEGA Omega: \Omega{} #GREEK CAPITAL LETTER OMEGA "937": \Omega{} #GREEK SMALL LETTER ALPHA #requires amsbsy "945": \alpha{} #GREEK SMALL LETTER BETA #requires amsbsy "946": \beta{} #GREEK SMALL LETTER GAMMA #requires amsbsy "947": \gamma{} #GREEK CAPITAL LETTER GAMMA #requires amsbsy "915": \Gamma{} #GREEK LETTER DIGAMMA #requires amsbsy,amssymb "988": \digamma{} #GREEK SMALL LETTER DELTA #requires amsbsy "948": \delta{} #GREEK CAPITAL LETTER DELTA #requires amsbsy "916": \Delta{} #GREEK SMALL LETTER EPSILON #requires amsbsy "949": \epsilon{} #GREEK SMALL LETTER EPSILON #requires amsbsy "949": \varepsilon{} #GREEK SMALL LETTER EPSILON #requires amsbsy "949": \epsilon{} #GREEK SMALL LETTER ZETA #requires amsbsy "950": \zeta{} #GREEK SMALL LETTER ETA #requires amsbsy "951": \eta{} #GREEK SMALL LETTER THETA #requires amsbsy "952": \theta{} #GREEK CAPITAL LETTER THETA #requires amsbsy "920": \Theta{} #GREEK THETA SYMBOL #requires amsbsy "977": \vartheta{} #GREEK SMALL LETTER IOTA #requires amsbsy "953": \iota{} #GREEK SMALL LETTER KAPPA #requires amsbsy "954": \kappa{} #GREEK KAPPA SYMBOL #requires amsbsy,amssymb "1008": \varkappa{} #GREEK SMALL LETTER LAMDA #requires amsbsy "955": \lambda{} #GREEK CAPITAL LETTER LAMDA #requires amsbsy "923": \Lambda{} #GREEK SMALL LETTER MU #requires amsbsy "956": \mu{} #GREEK SMALL LETTER NU #requires amsbsy "957": \nu{} #GREEK SMALL LETTER XI #requires amsbsy "958": \xi{} #GREEK CAPITAL LETTER XI #requires amsbsy "926": \Xi{} #GREEK SMALL LETTER PI #requires amsbsy "960": \pi{} #GREEK CAPITAL LETTER PI #requires amsbsy "928": \Pi{} #GREEK PI SYMBOL #requires amsbsy "982": \varpi{} #GREEK SMALL LETTER RHO #requires amsbsy "961": \rho{} #GREEK RHO SYMBOL #requires amsbsy "1009": \varrho{} #GREEK SMALL LETTER SIGMA #requires amsbsy "963": \sigma{} #GREEK CAPITAL LETTER SIGMA #requires amsbsy "931": \Sigma{} #GREEK SMALL LETTER FINAL SIGMA #requires amsbsy "962": \varsigma{} #GREEK SMALL LETTER TAU #requires amsbsy "964": \tau{} #GREEK SMALL LETTER UPSILON #requires amsbsy "965": \upsilon{} #GREEK CAPITAL LETTER UPSILON #requires amsbsy "978": \Upsilon{} #GREEK SMALL LETTER PHI #requires amsbsy "966": \phi{} #GREEK CAPITAL LETTER PHI #requires amsbsy "934": \Phi{} #GREEK PHI SYMBOL #requires amsbsy "981": \varphi{} #GREEK SMALL LETTER CHI #requires amsbsy "967": \chi{} #GREEK SMALL LETTER PSI #requires amsbsy "968": \psi{} #GREEK CAPITAL LETTER PSI #requires amsbsy "936": \Psi{} #GREEK SMALL LETTER OMEGA #requires amsbsy "969": \omega{} #GREEK CAPITAL LETTER OMEGA #requires amsbsy "937": \Omega{} #ANGLE ang: \angle{} #ANGLE "8736": \angle{} #MEASURED ANGLE #requires amssymb "8737": \measuredangle{} #BET SYMBOL #requires amssymb "8502": \beth{} #REVERSED PRIME #requires amssymb "8245": ^\backprime #COMPLEMENT #requires amssymb "8705": \complement{} #DALET SYMBOL #requires amssymb "8504": \daleth{} #SCRIPT SMALL L "8467": \ell{} #EMPTY SET empty: \emptyset{} #EMPTY SET "8709": \emptyset{} #GIMEL SYMBOL #requires amssymb "8503": \gimel{} #BLACK-LETTER CAPITAL I image: \Im{} #BLACK-LETTER CAPITAL I "8465": \Im{} #THERE DOES NOT EXIST #requires amssymb "8708": \nexists{} #CIRCLED LATIN CAPITAL LETTER S #requires amssymb "9416": \textcircled{S} #PLANCK CONSTANT OVER TWO PI "8463": \hbar{} #BLACK-LETTER CAPITAL R real: \Re{} #BLACK-LETTER CAPITAL R "8476": \Re{} #SMALL REVERSE SOLIDUS #requires amssymb "65128": \smallsetminus{} #SCRIPT CAPITAL P weierp: \wp{} #SCRIPT CAPITAL P "8472": \wp{} #N-ARY COPRODUCT "8720": \amalg{} #PERSPECTIVE #requires amssymb "8966": \doublebarwedge{} #NAND #requires amssymb "8892": \barwedge{} #DOUBLE INTERSECTION #requires amssymb "8914": \Cap{} #DOUBLE UNION #requires amssymb "8915": \Cup{} #CURLY LOGICAL OR #requires amssymb "8910": \curlyvee{} #CURLY LOGICAL AND #requires amssymb "8911": \curlywedge{} #DIAMOND OPERATOR "8900": \diamond{} #DIVISION TIMES #requires amssymb "8903": \divideontimes{} #INTERCALATE #requires amssymb "8890": \intercal{} #LEFT SEMIDIRECT PRODUCT #requires amssymb "8907": \leftthreetimes{} #LEFT NORMAL FACTOR SEMIDIRECT PRODUCT #requires amssymb "8905": \ltimes{} #SQUARED MINUS #requires amssymb "8863": \boxminus{} #CIRCLED ASTERISK OPERATOR #requires amssymb "8859": \circledast{} #CIRCLED RING OPERATOR #requires amssymb "8858": \circledcirc{} #CIRCLED DASH #requires amssymb "8861": \circleddash{} #CIRCLED DOT OPERATOR "8857": \odot{} #CIRCLED MINUS "8854": \ominus{} #CIRCLED PLUS oplus: \oplus{} #CIRCLED PLUS "8853": \oplus{} #CIRCLED DIVISION SLASH "8856": \oslash{} #CIRCLED TIMES otimes: \otimes{} #CIRCLED TIMES "8855": \otimes{} #SQUARED PLUS #requires amssymb "8862": \boxplus{} #DOT PLUS #requires amssymb "8724": \dotplus{} #RIGHT SEMIDIRECT PRODUCT #requires amssymb "8908": \rightthreetimes{} #RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT #requires amssymb "8906": \rtimes{} #DOT OPERATOR sdot: \cdot{} #DOT OPERATOR "8901": \cdot{} #SQUARED DOT OPERATOR #requires amssymb "8865": \boxdot{} #SET MINUS "8726": \setminus{} #SQUARE CAP "8851": \sqcap{} #SQUARE CUP "8852": \sqcup{} #STAR OPERATOR "8902": \star{} #SQUARED TIMES #requires amssymb "8864": \boxtimes{} #DOWN TACK "8868": \top{} #MULTISET UNION "8846": \uplus{} #WREATH PRODUCT "8768": \wr{} #LARGE CIRCLE #requires textcomp "9711": \textbigcircle{} #WHITE DOWN-POINTING TRIANGLE "9661": \bigtriangledown{} #WHITE UP-POINTING TRIANGLE "9651": \bigtriangleup{} #N-ARY COPRODUCT "8720": \coprod{} #N-ARY PRODUCT prod: \prod{} #N-ARY PRODUCT "8719": \prod{} #N-ARY SUMMATION sum: \sum{} #N-ARY SUMMATION "8721": \sum{} #ALMOST EQUAL OR EQUAL TO #requires amssymb "8778": \approxeq{} #EQUIVALENT TO asymp: \asymp{} #EQUIVALENT TO "8781": \asymp{} #ALL EQUAL TO #requires amssymb "8780": \backcong{} #SMALL CONTAINS AS MEMBER #requires amssymb "8717": \backepsilon{} #BOWTIE "8904": \bowtie{} #REVERSED TILDE #requires amssymb "8765": \backsim{} #REVERSED TILDE EQUALS #requires amssymb "8909": \backsimeq{} #GEOMETRICALLY EQUIVALENT TO #requires amssymb "8782": \Bumpeq{} #DIFFERENCE BETWEEN #requires amssymb "8783": \bumpeq{} #RING EQUAL TO #requires amssymb "8791": \circeq{} #COLON EQUALS "8788": ":=" #EQUAL TO OR PRECEDES #requires amssymb "8926": \curlyeqprec{} #EQUAL TO OR SUCCEEDS #requires amssymb "8927": \curlyeqsucc{} #PRECEDES OR EQUAL TO #requires amssymb "8828": \preccurlyeq{} #LEFT TACK "8867": \dashv{} #RING IN EQUAL TO #requires amssymb "8790": \eqcirc{} #EQUALS COLON "8789": "=:" #GEOMETRICALLY EQUAL TO #requires amssymb "8785": \doteqdot{} #APPROACHES THE LIMIT "8784": \doteq{} #APPROXIMATELY EQUAL TO OR THE IMAGE OF #requires amssymb "8786": \fallingdotseq{} #EQUAL TO OR GREATER-THAN #requires amssymb "8925": \eqslantgtr{} #EQUAL TO OR LESS-THAN #requires amssymb "8924": \eqslantless{} #IMAGE OF OR APPROXIMATELY EQUAL TO #requires amssymb "8787": \risingdotseq{} #PITCHFORK #requires amssymb "8916": \pitchfork{} #FROWN "8994": \frown{} #GREATER-THAN WITH DOT #requires amssymb "8919": \gtrdot{} #GREATER-THAN OVER EQUAL TO #requires amssymb "8807": \geqq{} #GREATER-THAN EQUAL TO OR LESS-THAN #requires amssymb "8923": \gtreqless{} #GREATER-THAN EQUAL TO OR LESS-THAN #requires amssymb "8923": \gtreqqless{} #VERY MUCH GREATER-THAN #requires amssymb "8921": \ggg{} #GREATER-THAN OR LESS-THAN #requires amssymb "8823": \gtrless{} #GREATER-THAN OR EQUIVALENT TO #requires amssymb "8819": \gtrsim{} #MUCH GREATER-THAN "8811": \gg{} #LESS-THAN WITH DOT #requires amssymb "8918": \lessdot{} #LESS-THAN OVER EQUAL TO #requires amssymb "8806": \leqq{} #LESS-THAN EQUAL TO OR GREATER-THAN #requires amssymb "8922": \lesseqqgtr{} #LESS-THAN EQUAL TO OR GREATER-THAN #requires amssymb "8922": \lesseqgtr{} #LESS-THAN OR GREATER-THAN #requires amssymb "8822": \lessgtr{} #VERY MUCH LESS-THAN #requires amssymb "8920": \lll{} #LESS-THAN OR EQUIVALENT TO #requires amssymb "8818": \lesssim{} #MUCH LESS-THAN "8810": \ll{} #NORMAL SUBGROUP OF OR EQUAL TO #requires amssymb "8884": \trianglelefteq{} #DIVIDES "8739": \mid{} #MODELS "8871": \models{} #PRECEDES "8826": \prec{} #PRECEDES OR EQUAL TO "8828": \preceq{} #PRECEDES OR EQUIVALENT TO #requires amssymb "8830": \precsim{} #CONTAINS AS NORMAL SUBGROUP OR EQUAL TO #requires amssymb "8885": \trianglerighteq{} #SUCCEEDS "8827": \succ{} #SUCCEEDS OR EQUAL TO #requires amssymb "8829": \succcurlyeq{} #SUCCEEDS OR EQUAL TO "8829": \succeq{} #SUCCEEDS OR EQUIVALENT TO #requires amssymb "8831": \succsim{} #SMILE "8995": \smile{} #SQUARE IMAGE OF #requires amssymb "8847": \sqsubset{} #SQUARE IMAGE OF OR EQUAL TO "8849": \sqsubseteq{} #SQUARE ORIGINAL OF #requires amssymb "8848": \sqsupset{} #SQUARE ORIGINAL OF OR EQUAL TO "8850": \sqsupseteq{} #DOUBLE SUBSET #requires amssymb "8912": \Subset{} #SUBSET OF OR EQUAL TO #requires amssymb "8838": \subseteqq{} #DOUBLE SUPERSET #requires amssymb "8913": \Supset{} #SUPERSET OF OR EQUAL TO #requires amssymb "8839": \supseteqq{} #DELTA EQUAL TO #requires amssymb "8796": \triangleq{} #BETWEEN #requires amssymb "8812": \between{} #RIGHT TACK "8866": \vdash{} #FORCES #requires amssymb "8873": \Vdash{} #TRUE #requires amssymb "8872": \vDash{} #XOR #requires amssymb "8891": \veebar{} #NORMAL SUBGROUP OF #requires amssymb "8882": \vartriangleleft{} #PROPORTIONAL TO #requires amssymb "8733": \varpropto{} #CONTAINS AS NORMAL SUBGROUP #requires amssymb "8883": \vartriangleright{} #TRIPLE VERTICAL BAR RIGHT TURNSTILE #requires amssymb "8874": \Vvdash{} #GREATER-THAN BUT NOT EQUAL TO #requires amssymb "8809": \gneq{} #GREATER-THAN BUT NOT EQUAL TO #requires amssymb "8809": \gneqq{} #GREATER-THAN BUT NOT EQUIVALENT TO #requires amssymb "8935": \gnsim{} #GREATER-THAN BUT NOT EQUAL TO #requires amssymb "8809": \gvertneqq{} #LESS-THAN BUT NOT EQUAL TO #requires amssymb "8808": \lneqq{} #LESS-THAN BUT NOT EQUAL TO #requires amssymb "8808": \lneq{} #LESS-THAN BUT NOT EQUIVALENT TO #requires amssymb "8934": \lnsim{} #LESS-THAN BUT NOT EQUAL TO #requires amssymb "8808": \lvertneqq{} #NOT ALMOST EQUAL TO "8777": \not\approx{} #NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO #requires amssymb "8775": \not\cong{} #NOT IDENTICAL TO "8802": \not\equiv{} #NEITHER GREATER-THAN NOR EQUAL TO #requires amssymb "8817": \not\geq{} #NEITHER GREATER-THAN NOR EQUAL TO #requires amssymb "8817": \ngeqslant{} #NOT GREATER-THAN #requires amssymb "8815": \not> #NEITHER LESS-THAN NOR EQUAL TO #requires amssymb "8816": \not\leq{} #NEITHER LESS-THAN NOR EQUAL TO #requires amssymb "8816": \nleqslant{} #NOT LESS-THAN #requires amssymb "8814": \not< #NOT NORMAL SUBGROUP OF #requires amssymb "8938": \ntriangleleft{} #NOT NORMAL SUBGROUP OF OR EQUAL TO #requires amssymb "8940": \ntrianglelefteq{} #DOES NOT DIVIDE #requires amssymb "8740": \nmid{} #NOT PARALLEL TO #requires amssymb "8742": \nparallel{} #DOES NOT PRECEDE #requires amssymb "8832": \not\prec{} #DOES NOT PRECEDE OR EQUAL #requires amssymb "8928": \not\preceq{} #DOES NOT CONTAIN AS NORMAL SUBGROUP #requires amssymb "8939": \ntriangleright{} #DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL #requires amssymb "8941": \ntrianglerighteq{} #DOES NOT SUCCEED #requires amssymb "8833": \not\succ{} #DOES NOT SUCCEED OR EQUAL #requires amssymb "8929": \not\succeq{} #NOT TILDE #requires amssymb "8769": \not\sim{} #NOT ASYMPTOTICALLY EQUAL TO "8772": \not\simeq{} #NOT A SUBSET OF nsub: \not\subset{} #NOT A SUBSET OF "8836": \not\subset{} #NEITHER A SUBSET OF NOR EQUAL TO #requires amssymb "8840": \not\subseteq{} #NEITHER A SUBSET OF NOR EQUAL TO #requires amssymb "8840": \nsubseteqq{} #NOT A SUPERSET OF "8837": \not\supset{} #NEITHER A SUPERSET OF NOR EQUAL TO #requires amssymb "8841": \nsupseteqq{} #NEITHER A SUPERSET OF NOR EQUAL TO #requires amssymb "8841": \not\supseteq{} #DOES NOT PROVE #requires amssymb "8876": \nvdash{} #NOT TRUE #requires amssymb "8877": \nvDash{} #NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE #requires amssymb "8879": \nVDash{} #DOES NOT FORCE #requires amssymb "8878": \nVdash{} #PRECEDES BUT NOT EQUIVALENT TO #requires amssymb "8936": \precnsim{} #SUCCEEDS BUT NOT EQUIVALENT TO #requires amssymb "8937": \succnsim{} #TRUE #requires amssymb "8842": \subsetneq{} #TRUE #requires amssymb "8842": \subsetneqq{} #SUPERSET OF WITH NOT EQUAL TO #requires amssymb "8843": \supsetneq{} #SUPERSET OF WITH NOT EQUAL TO #requires amssymb "8843": \supsetneqq{} #ANTICLOCKWISE TOP SEMICIRCLE ARROW #requires amssymb "8630": \curvearrowleft{} #CLOCKWISE TOP SEMICIRCLE ARROW #requires amssymb "8631": \curvearrowright{} #DOWNWARDS DOUBLE ARROW dArr: \Downarrow{} #DOWNWARDS DOUBLE ARROW "8659": \Downarrow{} #DOWNWARDS PAIRED ARROWS #requires amssymb "8650": \downdownarrows{} #DOWNWARDS HARPOON WITH BARB LEFTWARDS #requires amssymb "8643": \downharpoonleft{} #DOWNWARDS HARPOON WITH BARB RIGHTWARDS #requires amssymb "8642": \downharpoonright{} #LEFTWARDS TRIPLE ARROW #requires amssymb "8666": \Lleftarrow{} #LEFTWARDS TWO HEADED ARROW #requires amssymb "8606": \twoheadleftarrow{} #LEFTWARDS PAIRED ARROWS #requires amssymb "8647": \leftleftarrows{} #LEFTWARDS ARROW WITH HOOK "8617": \hookleftarrow{} #LEFTWARDS ARROW WITH LOOP #requires amssymb "8619": \looparrowleft{} #LEFTWARDS ARROW WITH TAIL #requires amssymb "8610": \leftarrowtail{} #LEFTWARDS HARPOON WITH BARB DOWNWARDS "8637": \leftharpoondown{} #LEFTWARDS HARPOON WITH BARB UPWARDS "8636": \leftharpoonup{} #LEFT RIGHT DOUBLE ARROW hArr: \Leftrightarrow{} #LEFT RIGHT DOUBLE ARROW "8660": \Leftrightarrow{} #LEFT RIGHT ARROW harr: \leftrightarrow{} #LEFT RIGHT ARROW "8596": \leftrightarrow{} #LEFTWARDS ARROW OVER RIGHTWARDS ARROW #requires amssymb "8646": \leftrightarrows{} #RIGHTWARDS ARROW OVER LEFTWARDS ARROW #requires amssymb "8644": \rightleftarrows{} #LEFT RIGHT WAVE ARROW #requires amssymb "8621": \leftrightsquigarrow{} #RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON "8652": \rightleftharpoons{} #LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON #requires amssymb "8651": \leftrightharpoons{} #UPWARDS ARROW WITH TIP LEFTWARDS #requires amssymb "8624": \Lsh{} #RIGHTWARDS ARROW FROM BAR "8614": \mapsto{} #MULTIMAP #requires amssymb "8888": \multimap{} #NORTH EAST ARROW "8599": \nearrow{} #LEFTWARDS DOUBLE ARROW WITH STROKE #requires amssymb "8653": \nLeftarrow{} #LEFTWARDS ARROW WITH STROKE #requires amssymb "8602": \nleftarrow{} #LEFT RIGHT DOUBLE ARROW WITH STROKE #requires amssymb "8654": \nLeftrightarrow{} #LEFT RIGHT ARROW WITH STROKE #requires amssymb "8622": \nleftrightarrow{} #RIGHTWARDS ARROW WITH STROKE #requires amssymb "8603": \nrightarrow{} #RIGHTWARDS DOUBLE ARROW WITH STROKE #requires amssymb "8655": \nRightarrow{} #NORTH WEST ARROW "8598": \nwarrow{} #ANTICLOCKWISE OPEN CIRCLE ARROW #requires amssymb "8634": \circlearrowleft{} #CLOCKWISE OPEN CIRCLE ARROW #requires amssymb "8635": \circlearrowright{} #RIGHTWARDS TRIPLE ARROW #requires amssymb "8667": \Rrightarrow{} #RIGHTWARDS TWO HEADED ARROW #requires amssymb "8608": \twoheadrightarrow{} #RIGHTWARDS PAIRED ARROWS #requires amssymb "8649": \rightrightarrows{} #RIGHTWARDS ARROW WITH HOOK "8618": \hookrightarrow{} #RIGHTWARDS ARROW WITH LOOP #requires amssymb "8620": \looparrowright{} #RIGHTWARDS ARROW WITH TAIL #requires amssymb "8611": \rightarrowtail{} #RIGHTWARDS SQUIGGLE ARROW #requires amssymb "8669": \rightsquigarrow{} #RIGHTWARDS HARPOON WITH BARB DOWNWARDS "8641": \rightharpoondown{} #RIGHTWARDS HARPOON WITH BARB UPWARDS "8640": \rightharpoonup{} #UPWARDS ARROW WITH TIP RIGHTWARDS #requires amssymb "8625": \Rsh{} #SOUTH EAST ARROW "8600": \searrow{} #SOUTH WEST ARROW "8601": \swarrow{} #UPWARDS DOUBLE ARROW uArr: \Uparrow{} #UPWARDS DOUBLE ARROW "8657": \Uparrow{} #UPWARDS PAIRED ARROWS #requires amssymb "8648": \upuparrows{} #UP DOWN DOUBLE ARROW "8661": \Updownarrow{} #UP DOWN ARROW "8597": \updownarrow{} #UPWARDS HARPOON WITH BARB LEFTWARDS #requires amssymb "8639": \upharpoonleft{} #UPWARDS HARPOON WITH BARB RIGHTWARDS #requires amssymb "8638": \upharpoonright{} #RIGHT CEILING rceil: \rceil{} #RIGHT CEILING "8969": \rceil{} #RIGHT FLOOR rfloor: \rfloor{} #RIGHT FLOOR "8971": \rfloor{} #TOP RIGHT CORNER #requires amsfonts "8989": \urcorner{} #BOTTOM RIGHT CORNER #requires amsfonts "8991": \lrcorner{} #LEFT CEILING lceil: \lceil{} #LEFT CEILING "8968": \lceil{} #LEFT FLOOR lfloor: \lfloor{} #LEFT FLOOR "8970": \lfloor{} #TOP LEFT CORNER #requires amsfonts "8988": \ulcorner{} #BOTTOM LEFT CORNER #requires amsfonts "8990": \llcorner{} #LATIN SMALL LETTER A WITH ACUTE aacute: \'{a} #LATIN SMALL LETTER A WITH ACUTE "225": \'{a} #LATIN CAPITAL LETTER A WITH ACUTE Aacute: \'{A} #LATIN CAPITAL LETTER A WITH ACUTE "193": \'{A} #LATIN SMALL LETTER A WITH CIRCUMFLEX acirc: \^{a} #LATIN SMALL LETTER A WITH CIRCUMFLEX "226": \^{a} #LATIN CAPITAL LETTER A WITH CIRCUMFLEX Acirc: \^{A} #LATIN CAPITAL LETTER A WITH CIRCUMFLEX "194": \^{A} #LATIN SMALL LETTER A WITH GRAVE agrave: \`{a} #LATIN SMALL LETTER A WITH GRAVE "224": \`{a} #LATIN CAPITAL LETTER A WITH GRAVE Agrave: \`{A} #LATIN CAPITAL LETTER A WITH GRAVE "192": \`{A} #LATIN SMALL LETTER A WITH RING ABOVE aring: \aa{} #LATIN SMALL LETTER A WITH RING ABOVE "229": \aa{} #LATIN CAPITAL LETTER A WITH RING ABOVE Aring: \AA{} #LATIN CAPITAL LETTER A WITH RING ABOVE "197": \AA{} #LATIN SMALL LETTER A WITH TILDE atilde: \~{a} #LATIN SMALL LETTER A WITH TILDE "227": \~{a} #LATIN CAPITAL LETTER A WITH TILDE Atilde: \~{A} #LATIN CAPITAL LETTER A WITH TILDE "195": \~{A} #LATIN SMALL LETTER A WITH DIAERESIS auml: \"{a} #LATIN SMALL LETTER A WITH DIAERESIS "228": \"{a} #LATIN CAPITAL LETTER A WITH DIAERESIS Auml: \"{A} #LATIN CAPITAL LETTER A WITH DIAERESIS "196": \"{A} #LATIN SMALL LETTER AE aelig: \ae{} #LATIN SMALL LETTER AE "230": \ae{} #LATIN CAPITAL LETTER AE AElig: \AE{} #LATIN CAPITAL LETTER AE "198": \AE{} #LATIN SMALL LETTER C WITH CEDILLA ccedil: \c{c} #LATIN SMALL LETTER C WITH CEDILLA "231": \c{c} #LATIN CAPITAL LETTER C WITH CEDILLA Ccedil: \c{C} #LATIN CAPITAL LETTER C WITH CEDILLA "199": \c{C} #LATIN SMALL LETTER ETH #requires amssymb eth: \dh{} #LATIN SMALL LETTER ETH #requires amssymb "240": \dh{} #LATIN CAPITAL LETTER ETH #requires wasysym ETH: \DH{} #LATIN CAPITAL LETTER ETH #requires wasysym "208": \DH{} #LATIN SMALL LETTER E WITH ACUTE eacute: \'{e} #LATIN SMALL LETTER E WITH ACUTE "233": \'{e} #LATIN CAPITAL LETTER E WITH ACUTE Eacute: \'{E} #LATIN CAPITAL LETTER E WITH ACUTE "201": \'{E} #LATIN SMALL LETTER E WITH CIRCUMFLEX ecirc: \^{e} #LATIN SMALL LETTER E WITH CIRCUMFLEX "234": \^{e} #LATIN CAPITAL LETTER E WITH CIRCUMFLEX Ecirc: \^{E} #LATIN CAPITAL LETTER E WITH CIRCUMFLEX "202": \^{E} #LATIN SMALL LETTER E WITH GRAVE egrave: \`{e} #LATIN SMALL LETTER E WITH GRAVE "232": \`{e} #LATIN CAPITAL LETTER E WITH GRAVE Egrave: \`{E} #LATIN CAPITAL LETTER E WITH GRAVE "200": \`{E} #LATIN SMALL LETTER E WITH DIAERESIS euml: \"{e} #LATIN SMALL LETTER E WITH DIAERESIS "235": \"{e} #LATIN CAPITAL LETTER E WITH DIAERESIS Euml: \"{E} #LATIN CAPITAL LETTER E WITH DIAERESIS "203": \"{E} #LATIN SMALL LETTER I WITH ACUTE iacute: \'{\i} #LATIN SMALL LETTER I WITH ACUTE "237": \'{\i} #LATIN CAPITAL LETTER I WITH ACUTE Iacute: \'{I} #LATIN CAPITAL LETTER I WITH ACUTE "205": \'{I} #LATIN SMALL LETTER I WITH CIRCUMFLEX icirc: \^{\i} #LATIN SMALL LETTER I WITH CIRCUMFLEX "238": \^{\i} #LATIN CAPITAL LETTER I WITH CIRCUMFLEX Icirc: \^{I} #LATIN CAPITAL LETTER I WITH CIRCUMFLEX "206": \^{I} #LATIN SMALL LETTER I WITH GRAVE igrave: \`{\i} #LATIN SMALL LETTER I WITH GRAVE "236": \`{\i} #LATIN CAPITAL LETTER I WITH GRAVE Igrave: \`{I} #LATIN CAPITAL LETTER I WITH GRAVE "204": \`{I} #LATIN SMALL LETTER I WITH DIAERESIS iuml: \"{\i} #LATIN SMALL LETTER I WITH DIAERESIS "239": \"{\i} #LATIN CAPITAL LETTER I WITH DIAERESIS Iuml: \"{I} #LATIN CAPITAL LETTER I WITH DIAERESIS "207": \"{I} #LATIN SMALL LETTER N WITH TILDE ntilde: \~{n} #LATIN SMALL LETTER N WITH TILDE "241": \~{n} #LATIN CAPITAL LETTER N WITH TILDE Ntilde: \~{N} #LATIN CAPITAL LETTER N WITH TILDE "209": \~{N} #LATIN SMALL LETTER O WITH ACUTE oacute: \'{o} #LATIN SMALL LETTER O WITH ACUTE "243": \'{o} #LATIN CAPITAL LETTER O WITH ACUTE Oacute: \'{O} #LATIN CAPITAL LETTER O WITH ACUTE "211": \'{O} #LATIN SMALL LETTER O WITH CIRCUMFLEX ocirc: \^{o} #LATIN SMALL LETTER O WITH CIRCUMFLEX "244": \^{o} #LATIN CAPITAL LETTER O WITH CIRCUMFLEX Ocirc: \^{O} #LATIN CAPITAL LETTER O WITH CIRCUMFLEX "212": \^{O} #LATIN SMALL LETTER O WITH GRAVE ograve: \`{o} #LATIN SMALL LETTER O WITH GRAVE "242": \`{o} #LATIN CAPITAL LETTER O WITH GRAVE Ograve: \`{O} #LATIN CAPITAL LETTER O WITH GRAVE "210": \`{O} #LATIN SMALL LETTER O WITH STROKE oslash: \o{} #LATIN SMALL LETTER O WITH STROKE "248": \o{} #LATIN CAPITAL LETTER O WITH STROKE Oslash: \O{} #LATIN CAPITAL LETTER O WITH STROKE "216": \O{} #LATIN SMALL LETTER O WITH TILDE otilde: \~{o} #LATIN SMALL LETTER O WITH TILDE "245": \~{o} #LATIN CAPITAL LETTER O WITH TILDE Otilde: \~{O} #LATIN CAPITAL LETTER O WITH TILDE "213": \~{O} #LATIN SMALL LETTER O WITH DIAERESIS ouml: \"{o} #LATIN SMALL LETTER O WITH DIAERESIS "246": \"{o} #LATIN CAPITAL LETTER O WITH DIAERESIS Ouml: \"{O} #LATIN CAPITAL LETTER O WITH DIAERESIS "214": \"{O} #LATIN SMALL LETTER SHARP S szlig: \ss{} #LATIN SMALL LETTER SHARP S "223": \ss{} #LATIN SMALL LETTER THORN #requires wasysym thorn: \th{} #LATIN SMALL LETTER THORN #requires wasysym "254": \th{} #LATIN CAPITAL LETTER THORN #requires wasysym THORN: \TH{} #LATIN CAPITAL LETTER THORN #requires wasysym "222": \TH{} #LATIN SMALL LETTER U WITH ACUTE uacute: \'{u} #LATIN SMALL LETTER U WITH ACUTE "250": \'{u} #LATIN CAPITAL LETTER U WITH ACUTE Uacute: \'{U} #LATIN CAPITAL LETTER U WITH ACUTE "218": \'{U} #LATIN SMALL LETTER U WITH CIRCUMFLEX ucirc: \^{u} #LATIN SMALL LETTER U WITH CIRCUMFLEX "251": \^{u} #LATIN CAPITAL LETTER U WITH CIRCUMFLEX Ucirc: \^{U} #LATIN CAPITAL LETTER U WITH CIRCUMFLEX "219": \^{U} #LATIN SMALL LETTER U WITH GRAVE ugrave: \`{u} #LATIN SMALL LETTER U WITH GRAVE "249": \`{u} #LATIN CAPITAL LETTER U WITH GRAVE Ugrave: \`{U} #LATIN CAPITAL LETTER U WITH GRAVE "217": \`{U} #LATIN SMALL LETTER U WITH DIAERESIS uuml: \"{u} #LATIN SMALL LETTER U WITH DIAERESIS "252": \"{u} #LATIN CAPITAL LETTER U WITH DIAERESIS Uuml: \"{U} #LATIN CAPITAL LETTER U WITH DIAERESIS "220": \"{U} #LATIN SMALL LETTER Y WITH ACUTE yacute: \'{y} #LATIN SMALL LETTER Y WITH ACUTE "253": \'{y} #LATIN CAPITAL LETTER Y WITH ACUTE Yacute: \'{Y} #LATIN CAPITAL LETTER Y WITH ACUTE "221": \'{Y} #LATIN SMALL LETTER Y WITH DIAERESIS yuml: \"{y} #LATIN SMALL LETTER Y WITH DIAERESIS "255": \"{y} #LATIN SMALL LETTER A WITH BREVE "259": \u{a} #LATIN CAPITAL LETTER A WITH BREVE "258": \u{A} #LATIN SMALL LETTER A WITH MACRON "257": \={a} #LATIN CAPITAL LETTER A WITH MACRON "256": \={A} #LATIN SMALL LETTER A WITH OGONEK #requires fontenc:T1 "261": \k{a} #LATIN CAPITAL LETTER A WITH OGONEK #requires fontenc:T1 "260": \k{A} #LATIN SMALL LETTER C WITH ACUTE "263": \'{c} #LATIN CAPITAL LETTER C WITH ACUTE "262": \'{C} #LATIN SMALL LETTER C WITH CARON "269": \v{c} #LATIN CAPITAL LETTER C WITH CARON "268": \v{C} #LATIN SMALL LETTER C WITH CIRCUMFLEX "265": \^{c} #LATIN CAPITAL LETTER C WITH CIRCUMFLEX "264": \^{C} #LATIN SMALL LETTER C WITH DOT ABOVE "267": \.{c} #LATIN CAPITAL LETTER C WITH DOT ABOVE "266": \.{C} #LATIN SMALL LETTER D WITH CARON "271": \v{d} #LATIN CAPITAL LETTER D WITH CARON "270": \v{D} #LATIN SMALL LETTER D WITH STROKE #requires fontenc:T1 "273": \dj{} #LATIN CAPITAL LETTER D WITH STROKE #requires fontenc:T1 "272": \DJ{} #LATIN SMALL LETTER E WITH CARON "283": \v{e} #LATIN CAPITAL LETTER E WITH CARON "282": \v{E} #LATIN SMALL LETTER E WITH DOT ABOVE "279": \.{e} #LATIN CAPITAL LETTER E WITH DOT ABOVE "278": \.{E} #LATIN SMALL LETTER E WITH MACRON "275": \={e} #LATIN CAPITAL LETTER E WITH MACRON "274": \={E} #LATIN SMALL LETTER E WITH OGONEK #requires fontenc:T1 "281": \k{e} #LATIN CAPITAL LETTER E WITH OGONEK #requires fontenc:T1 "280": \k{E} #LATIN SMALL LETTER G WITH ACUTE "501": \'{g} #LATIN SMALL LETTER G WITH BREVE "287": \u{g} #LATIN CAPITAL LETTER G WITH BREVE "286": \u{G} #LATIN CAPITAL LETTER G WITH CEDILLA "290": \c{G} #LATIN SMALL LETTER G WITH CIRCUMFLEX "285": \^{g} #LATIN CAPITAL LETTER G WITH CIRCUMFLEX "284": \^{G} #LATIN SMALL LETTER G WITH DOT ABOVE "289": \.{g} #LATIN CAPITAL LETTER G WITH DOT ABOVE "288": \.{G} #LATIN SMALL LETTER H WITH CIRCUMFLEX "293": \^{h} #LATIN CAPITAL LETTER H WITH CIRCUMFLEX "292": \^{H} #LATIN SMALL LETTER H WITH STROKE "295": \hstrok{} #LATIN CAPITAL LETTER H WITH STROKE "294": \Hstrok{} #LATIN CAPITAL LETTER I WITH DOT ABOVE "304": \.{I} #LATIN CAPITAL LETTER I WITH MACRON "298": \={I} #LATIN SMALL LETTER I WITH MACRON "299": \={\i} #LATIN SMALL LIGATURE IJ "307": i\kern -.15em j #LATIN CAPITAL LIGATURE IJ "306": I\kern -.15em J #LATIN SMALL LETTER DOTLESS I "305": \i{} #LATIN SMALL LETTER I WITH OGONEK #requires fontenc:T1 "303": \k{i} #LATIN CAPITAL LETTER I WITH OGONEK #requires fontenc:T1 "302": \k{I} #LATIN SMALL LETTER I WITH TILDE "297": \~{\i} #LATIN CAPITAL LETTER I WITH TILDE "296": \~{I} #LATIN SMALL LETTER J WITH CIRCUMFLEX "309": \^{\j} #LATIN CAPITAL LETTER J WITH CIRCUMFLEX "308": \^{J} #LATIN SMALL LETTER K WITH CEDILLA "311": \c{k} #LATIN CAPITAL LETTER K WITH CEDILLA "310": \c{K} #LATIN SMALL LETTER KRA "312": \textsc{k} #LATIN SMALL LETTER L WITH ACUTE "314": \'{l} #LATIN CAPITAL LETTER L WITH ACUTE "313": \'{L} #LATIN SMALL LETTER L WITH CARON "318": \v{l} #LATIN CAPITAL LETTER L WITH CARON "317": \v{L} #LATIN SMALL LETTER L WITH CEDILLA "316": \c{l} #LATIN CAPITAL LETTER L WITH CEDILLA "315": \c{L} #LATIN SMALL LETTER L WITH MIDDLE DOT "320": \lmidot{} #LATIN CAPITAL LETTER L WITH MIDDLE DOT "319": \Lmidot{} #LATIN SMALL LETTER L WITH STROKE "322": \l{} #LATIN CAPITAL LETTER L WITH STROKE "321": \L{} #LATIN SMALL LETTER N WITH ACUTE "324": \'{n} #LATIN CAPITAL LETTER N WITH ACUTE "323": \'{N} #LATIN SMALL LETTER ENG #requires fontenc:T1 "331": \ng{} #LATIN CAPITAL LETTER ENG #requires fontenc:T1 "330": \NG{} #LATIN SMALL LETTER N PRECEDED BY APOSTROPHE "329": n\kern-.2em\textsf{'} #LATIN SMALL LETTER N WITH CARON "328": \v{n} #LATIN CAPITAL LETTER N WITH CARON "327": \v{N} #LATIN SMALL LETTER N WITH CEDILLA "326": \c{n} #LATIN CAPITAL LETTER N WITH CEDILLA "325": \c{N} #LATIN SMALL LETTER O WITH DOUBLE ACUTE "337": \H{o} #LATIN CAPITAL LETTER O WITH DOUBLE ACUTE "336": \H{O} #LATIN CAPITAL LETTER O WITH MACRON "332": \={O} #LATIN SMALL LETTER O WITH MACRON "333": \={o} #LATIN SMALL LIGATURE OE oelig: \oe{} #LATIN SMALL LIGATURE OE "339": \oe{} #LATIN CAPITAL LIGATURE OE OElig: \OE{} #LATIN CAPITAL LIGATURE OE "338": \OE{} #LATIN SMALL LETTER R WITH ACUTE "341": \'{r} #LATIN CAPITAL LETTER R WITH ACUTE "340": \'{R} #LATIN SMALL LETTER R WITH CARON "345": \v{r} #LATIN CAPITAL LETTER R WITH CARON "344": \v{R} #LATIN SMALL LETTER R WITH CEDILLA "343": \c{r} #LATIN CAPITAL LETTER R WITH CEDILLA "342": \c{R} #LATIN SMALL LETTER S WITH ACUTE "347": \'{s} #LATIN CAPITAL LETTER S WITH ACUTE "346": \'{S} #LATIN SMALL LETTER S WITH CARON scaron: \v{s} #LATIN SMALL LETTER S WITH CARON "353": \v{s} #LATIN CAPITAL LETTER S WITH CARON Scaron: \v{S} #LATIN CAPITAL LETTER S WITH CARON "352": \v{S} #LATIN SMALL LETTER S WITH CEDILLA "351": \c{s} #LATIN CAPITAL LETTER S WITH CEDILLA "350": \c{S} #LATIN SMALL LETTER S WITH CIRCUMFLEX "349": \^{s} #LATIN CAPITAL LETTER S WITH CIRCUMFLEX "348": \^{S} #LATIN SMALL LETTER T WITH CARON "357": \v{t} #LATIN CAPITAL LETTER T WITH CARON "356": \v{T} #LATIN SMALL LETTER T WITH CEDILLA "355": \c{t} #LATIN CAPITAL LETTER T WITH CEDILLA "354": \c{T} #LATIN SMALL LETTER T WITH STROKE "359": \tstrok{} #LATIN CAPITAL LETTER T WITH STROKE "358": \Tstrok{} #LATIN SMALL LETTER U WITH BREVE "365": \u{u} #LATIN CAPITAL LETTER U WITH BREVE "364": \u{U} #LATIN SMALL LETTER U WITH DOUBLE ACUTE "369": \H{u} #LATIN CAPITAL LETTER U WITH DOUBLE ACUTE "368": \H{U} #LATIN SMALL LETTER U WITH MACRON "363": \={u} #LATIN CAPITAL LETTER U WITH MACRON "362": \={U} #LATIN SMALL LETTER U WITH OGONEK #requires fontenc:T1 "371": \k{u} #LATIN CAPITAL LETTER U WITH OGONEK #requires fontenc:T1 "370": \k{U} #LATIN SMALL LETTER U WITH RING ABOVE "367": \r{u} #LATIN CAPITAL LETTER U WITH RING ABOVE "366": \r{U} #LATIN SMALL LETTER U WITH TILDE "361": \~{u} #LATIN CAPITAL LETTER U WITH TILDE "360": \~{U} #LATIN SMALL LETTER W WITH CIRCUMFLEX "373": \^{w} #LATIN CAPITAL LETTER W WITH CIRCUMFLEX "372": \^{W} #LATIN SMALL LETTER Y WITH CIRCUMFLEX "375": \^{y} #LATIN CAPITAL LETTER Y WITH CIRCUMFLEX "374": \^{Y} #LATIN CAPITAL LETTER Y WITH DIAERESIS Yuml: \"{Y} #LATIN CAPITAL LETTER Y WITH DIAERESIS "376": \"{Y} #LATIN SMALL LETTER Z WITH ACUTE "378": \'{z} #LATIN CAPITAL LETTER Z WITH ACUTE "377": \'{Z} #LATIN SMALL LETTER Z WITH CARON "382": \v{z} #LATIN CAPITAL LETTER Z WITH CARON "381": \v{Z} #LATIN SMALL LETTER Z WITH DOT ABOVE "380": \.{z} #LATIN CAPITAL LETTER Z WITH DOT ABOVE "379": \.{Z} #ACUTE ACCENT #requires textcomp acute: \'{} #ACUTE ACCENT #requires textcomp "180": \'{} #BREVE #requires textcomp "728": \u{} #CARON #requires textcomp "711": \v{} #CEDILLA cedil: \c{} #CEDILLA "184": \c{} #CIRCUMFLEX ACCENT circ: \^{} #CIRCUMFLEX ACCENT "94": \^{} #DOUBLE ACUTE ACCENT #requires textcomp "733": \H{} #DIAERESIS #requires textcomp uml: \"{} #DIAERESIS #requires textcomp "168": \"{} #DOT ABOVE "729": \.{} #GRAVE ACCENT #requires textcomp "96": \`{} #MACRON #requires textcomp macr: \={} #MACRON #requires textcomp "175": \={} #OGONEK #requires fontenc:T1 "731": \k{} #RING ABOVE "730": \r{} #TILDE #requires textcomp tilde: \~{} #TILDE #requires textcomp "126": \~{} #HORIZONTAL TABULATION "9": \>,\= #LINE FEED "10": "\n" #SINGLE LEFT-POINTING ANGLE QUOTATION MARK #requires fontenc:T1 lsaquo: \guilsinglleft{} #SINGLE LEFT-POINTING ANGLE QUOTATION MARK #requires fontenc:T1 "8249": \guilsinglleft{} #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK #requires fontenc:T1 rsaquo: \guilsinglright{} #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK #requires fontenc:T1 "8250": \guilsinglright{} #OVERLINE oline: \={} #OVERLINE "8254": \={} #FRACTION SLASH #requires textcomp frasl: \textfractionsolidus{} #FRACTION SLASH #requires textcomp "8260": \textfractionsolidus{} #EURO SIGN #requires textcomp euro: \texteuro{} #EURO SIGN #requires textcomp "8364": \texteuro{} #LEFTWARDS DASHED ARROW #requires amssymb "8672": \dashleftarrow{} #RIGHTWARDS DASHED ARROW #requires amssymb "8674": \dashrightarrow{} #INVERTED OHM SIGN #requires amssymb "8487": \textmho{} #PROPORTION "8759": "::" #LEFT WHITE SQUARE BRACKET #requires stmaryrd "12314": \textlbrackdbl{} #PER TEN THOUSAND SIGN #requires textcomp "8241": \textpertenthousand{} #RIGHT WHITE SQUARE BRACKET #requires stmaryrd "12315": \textrbrackdbl{} #MODIFIER LETTER LOW MACRON "717": \b{} #COMBINING DOT BELOW "803": \d{} #COMBINING DOUBLE INVERTED BREVE "865": \t{} #REFERENCE MARK #requires textcomp "8251": \textreferencemark{} redcloth-4.3.3/lib/redcloth/textile_doc.rb000066400000000000000000000057571452062100400205370ustar00rootroot00000000000000module RedCloth class TextileDoc < String # # Accessors 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. # Alternatively, if +:sanitize_html+ is set, # HTML can pass through the Textile processor but # unauthorized tags and attributes will be removed. # # If +:filter_styles+ is set, it will also disable # the style markup specifier. ('{color: red}') # # If +:filter_classes+ is set, it will also disable # class attributes. ('!(classname)image!') # # If +:filter_ids+ is set, it will also disable # id attributes. ('!(classname#id)image!') # attr_accessor :filter_html, :sanitize_html, :filter_styles, :filter_classes, :filter_ids # # Deprecated accessor for toggling hard breaks. # # Traditional RedCloth converted single newlines # to HTML break tags, but later versions required # +:hard_breaks+ be set to enable this behavior. # +:hard_breaks+ is once again the default. # 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 fell!" # 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 # Returns a new RedCloth object, based on _string_, observing # any _restrictions_ specified. # # r = RedCloth.new( "h1. A *bold* man" ) # #=> "h1. A *bold* man" # r.to_html # #=>"

    A bold man

    " # def initialize( string, restrictions = [] ) restrictions.each { |r| method("#{r}=").call( true ) } super( string ) end # # Generates HTML from the Textile contents. # # RedCloth.new( "And then? She *fell*!" ).to_html # #=>"

    And then? She fell!

    " # def to_html( *rules ) apply_rules(rules) to(RedCloth::Formatters::HTML) end # # Generates LaTeX from the Textile contents. # # RedCloth.new( "And then? She *fell*!" ).to_latex # #=> "And then? She \\textbf{fell}!\n\n" # def to_latex( *rules ) apply_rules(rules) to(RedCloth::Formatters::LATEX) end private def apply_rules(rules) rules.each do |r| method(r).call(self) if self.respond_to?(r) end end end endredcloth-4.3.3/lib/redcloth/version.rb000066400000000000000000000014311452062100400177020ustar00rootroot00000000000000module RedCloth module VERSION MAJOR = 4 MINOR = 3 TINY = 3 # RELEASE_CANDIDATE = 0 STRING = [MAJOR, MINOR, TINY].compact.join('.') TAG = "REL_#{[MAJOR, MINOR, TINY].compact.join('_')}".upcase.gsub(/\.|-/, '_') FULL_VERSION = "#{[MAJOR, MINOR, TINY].compact.join('.')}" class << self def to_s STRING end def ==(arg) STRING == arg end end end NAME = "RedCloth" GEM_NAME = NAME URL = "http://redcloth.org/" description = "Textile parser for Ruby." if RedCloth.const_defined?(:EXTENSION_LANGUAGE) SUMMARY = "#{NAME}-#{VERSION::FULL_VERSION}-#{EXTENSION_LANGUAGE}" else SUMMARY = "#{NAME}-#{VERSION::FULL_VERSION}" end DESCRIPTION = SUMMARY + " - #{description}\n#{URL}" end redcloth-4.3.3/lib/tasks/000077500000000000000000000000001452062100400152125ustar00rootroot00000000000000redcloth-4.3.3/lib/tasks/pureruby.rake000066400000000000000000000010131452062100400177260ustar00rootroot00000000000000# Apparently this file gets loaded by Rails. Only want to define the pureruby # task in the context of RedCloth compilation (echoe loaded). if Gem::Specification.const_defined?(:PLATFORM_CROSS_TARGETS) Gem::Specification::PLATFORM_CROSS_TARGETS << "pureruby" task 'pureruby' do reset_target 'pureruby' end if target = ARGV.detect do |arg| # Hack to get the platform set before the Rakefile evaluates Gem::Specification::PLATFORM_CROSS_TARGETS.include? arg end reset_target target end endredcloth-4.3.3/ragel/000077500000000000000000000000001452062100400144115ustar00rootroot00000000000000redcloth-4.3.3/ragel/redcloth_attributes.c.rl000066400000000000000000000021271452062100400212450ustar00rootroot00000000000000/* * redcloth_attributes.c.rl * * Copyright (C) 2009 Jason Garber */ #define RSTRING_NOT_MODIFIED #include #include "redcloth.h" %%{ machine redcloth_attributes; include redcloth_common "redcloth_common.c.rl"; include redcloth_attributes "redcloth_attributes.rl"; }%% %% write data nofinal; VALUE redcloth_attribute_parser(machine, self, p, pe) int machine; VALUE self; char *p, *pe; { int cs, act; char *ts = 0, *te = 0, *reg = 0, *bck = NULL, *attr_reg = NULL, *eof = NULL; VALUE regs = rb_hash_new(); VALUE attr_regs = rb_hash_new(); %% write init; cs = machine; %% write exec; return regs; } VALUE redcloth_attributes(self, str) VALUE self, str; { StringValue(str); int cs = redcloth_attributes_en_inline; return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1); } VALUE redcloth_link_attributes(self, str) VALUE self, str; { StringValue(str); int cs = redcloth_attributes_en_link_says; return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1); } redcloth-4.3.3/ragel/redcloth_attributes.rb.rl000066400000000000000000000023511452062100400214250ustar00rootroot00000000000000# # redcloth_attributes.rb.rl # # Copyright (C) 2009 Jason Garber # %%{ machine redcloth_attributes; include redcloth_common "redcloth_common.rb.rl"; include redcloth_attributes "redcloth_attributes.rl"; }%% module RedCloth class RedclothAttributes < BaseScanner def self.redcloth_attributes(str) self.new.redcloth_attributes(str) end def self.redcloth_link_attributes(str) self.new.redcloth_link_attributes(str) end def redcloth_attribute_parser(cs, data) @data = data + "\0" @regs = {} @attr_regs = {} @p = 0 @pe = @data.length %% write init; #% @cs = cs %% write exec; #% return @regs end def redcloth_attributes(str) self.cs = self.redcloth_attributes_en_inline return redcloth_attribute_parser(cs, str) end def redcloth_link_attributes(str) self.cs = self.redcloth_attributes_en_link_says; return redcloth_attribute_parser(cs, str) end def initialize %%{ variable data @data; variable p @p; variable pe @pe; variable cs @cs; variable ts @ts; variable te @te; write data nofinal; }%% end end endredcloth-4.3.3/ragel/redcloth_attributes.rl000066400000000000000000000011601452062100400210200ustar00rootroot00000000000000/* * redcloth_attributes.rl * * Copyright (C) 2009 Jason Garber */ %%{ machine redcloth_attributes; C2 = ( C_CLASS_ID | C_STYL | C_LNGE )+ ; mtext_with_attributes = ( C2 mtext >A %T ) >X ; inline := |* mtext_with_attributes { SET_ATTRIBUTES(); } ; *|; link_text_with_attributes = C2 "."* " "* ( mtext+ ) >A %{ STORE("name"); } ; link_text_without_attributes = ( mtext+ ) >B %{ STORE_B("name_without_attributes"); } ; link_says := |* link_text_with_attributes { SET_ATTRIBUTES(); } ; link_text_without_attributes { SET_ATTRIBUTE("name_without_attributes", "name"); } ; *|; }%%; redcloth-4.3.3/ragel/redcloth_common.c.rl000066400000000000000000000013641452062100400203510ustar00rootroot00000000000000%%{ machine redcloth_common; action esc { rb_str_cat_escaped(self, block, ts, te); } action esc_pre { rb_str_cat_escaped_for_preformatted(self, block, ts, te); } action ignore { rb_str_append(block, rb_funcall(self, rb_intern("ignore"), 1, regs)); } # conditionals action starts_line { p == orig_p || *(p-1) == '\r' || *(p-1) == '\n' || *(p-1) == '\f' } action starts_phrase { p == orig_p || *(p-1) == '\r' || *(p-1) == '\n' || *(p-1) == '\f' || *(p-1) == ' ' } action extended { !NIL_P(extend) } action not_extended { NIL_P(extend) } action following_hash_is_ol_not_id { (*(p+1) == '#') ? (*(p+2) == '#' || *(p+2) == '*' || *(p+2) == ' ') : 1 == 1 } include redcloth_common "redcloth_common.rl"; }%%;redcloth-4.3.3/ragel/redcloth_common.rb.rl000066400000000000000000000014771452062100400205370ustar00rootroot00000000000000%%{ machine redcloth_common; action esc { rb_str_cat_escaped(@block, @ts, @te); } action esc_pre { rb_str_cat_escaped_for_preformatted(@block, STR_NEW(@ts, @te-@ts)); } action ignore { @block << @textile_doc.ignore(@regs); } # conditionals action starts_line { @p == 0 || @data[(@p-1), 1] == "\r" || @data[(@p-1), 1] == "\n" || @data[(@p-1), 1] == "\f" } action starts_phrase { @p == 0 || @data[(@p-1), 1] == "\r" || @data[(@p-1), 1] == "\n" || @data[(@p-1), 1] == "\f" || @data[(@p-1), 1] == " " } action extended { !@extend.nil? } action not_extended { @extend.nil? } action following_hash_is_ol_not_id { @data[(@p+1), 1] == "#" ? (@data[(@p+2), 1] == "#" || @data[(@p+2), 1] == "*" || @data[(@p+2), 1] == " ") : true } include redcloth_common "redcloth_common.rl"; }%%;redcloth-4.3.3/ragel/redcloth_common.rl000066400000000000000000000117011452062100400201240ustar00rootroot00000000000000%%{ machine redcloth_common; action A { MARK(); } action B { MARK_B(); } action ATTR { MARK_ATTR(); } action SET_ATTR { SET_ATTRIBUTES(); } action T { STORE("text"); } action X { CLEAR_REGS(); RESET_REG(); } action cat { CAT(block); } # simple LF = ( '\n' ) ; default = ^0 ; EOF = 0 ; # textile element attributes class = [A-Za-z0-9\- _]+ ; id = [A-Za-z0-9\-_]+ ; style_chars = [A-Za-z0-9: ;\-_#&.%'"]; style_url = "url(" [a-z0-9'".\\/#?=+@_\-]+ ")"; style = style_chars (style_chars+ | style_url)* ; # maybe put in uri when in url() language = [a-z\-_]+ ; A_LEFT = "<" %{ ATTR_SET("align", "left"); } ; A_RIGHT = ">" %{ ATTR_SET("align", "right"); } ; A_JUSTIFIED = "<>" %{ ATTR_SET("align", "justify"); } ; A_CENTER = "=" %{ ATTR_SET("align", "center"); } ; A_PADLEFT = "(" when following_hash_is_ol_not_id %{ ATTR_INC("padding-left"); } ; A_PADRIGHT = ")" %{ ATTR_INC("padding-right"); } ; A_HLGN = ( A_LEFT | A_RIGHT | A_JUSTIFIED | A_CENTER | A_PADLEFT | A_PADRIGHT ) ; A_LIMIT = ( A_LEFT | A_CENTER | A_RIGHT ) ; A_VLGN = ( "-" %{ ATTR_SET("vertical-align", "middle"); } | "^" %{ ATTR_SET("vertical-align", "top"); } | "~" %{ ATTR_SET("vertical-align", "bottom"); } ) ; C_CLASS = class >ATTR %{ STORE_ATTR("class"); } ; C_ID = "#" id >ATTR %{ STORE_ATTR("id"); } ; C_CLASS_ID = "(" ( C_CLASS | C_ID | C_CLASS C_ID ) ")" ; C_LNGE = ( "[" language >ATTR %{ STORE_ATTR("lang"); } "]" ) ; C_STYL = ( "{" style >ATTR %{ STORE_ATTR("style"); } "}" ) ; S_CSPN = ( "\\" [0-9]+ >ATTR %{ STORE_ATTR("colspan"); } ) ; S_RSPN = ( "/" [0-9]+ >ATTR %{ STORE_ATTR("rowspan"); } ) ; D_HEADER = "_" %{ ATTR_SET("th", "true"); } ; A = ( ( A_HLGN | A_VLGN )* ) ; A2 = ( A_LIMIT? ) ; S = ( S_CSPN | S_RSPN )* ; C = ( C_CLASS_ID | C_STYL | C_LNGE )* ; D = ( D_HEADER ) ; N_CONT = "_" %{ ATTR_SET("list_continue", "true"); }; N_NUM = digit+ >ATTR %{ STORE_ATTR("start"); }; N = ( N_CONT | N_NUM )? ; PUNCT = ( "!" | '"' | "#" | "$" | "%" | "&" | "'" | "," | "-" | "." | "/" | ":" | ";" | "=" | "?" | "\\" | "^" | "`" | "|" | "~" | "[" | "]" | "(" | ")" | "<" ) ; dotspace = ("." " "*) ; indent = [ \t]* ; # very un-DRY; Adrian says an action-stripping macro will come in a future Ragel version A_LEFT_noactions = "<" ; A_RIGHT_noactions = ">" ; A_JUSTIFIED_noactions = "<>" ; A_CENTER_noactions = "=" ; A_PADLEFT_noactions = "(" ; A_PADRIGHT_noactions = ")" ; A_HLGN_noactions = ( A_LEFT_noactions | A_RIGHT_noactions | A_JUSTIFIED_noactions | A_CENTER_noactions | A_PADLEFT_noactions | A_PADRIGHT_noactions ) ; A_VLGN_noactions = ( "-" | "^" | "~" ) ; C_CLASS_noactions = ( "(" ( class )? ("#" id )? ")" ) ; C_LNGE_noactions = ( "[" language "]" ) ; C_STYL_noactions = ( "{" style "}" ) ; A_noactions = ( ( A_HLGN_noactions | A_VLGN_noactions )* ) ; C_noactions = ( C_CLASS_noactions | C_STYL_noactions | C_LNGE_noactions )* ; C_noquotes_noactions = C_noactions -- '"' ; N_CONT_noactions = "_" ; N_NUM_noactions = digit+ ; N_noactions = ( N_CONT_noactions | N_NUM_noactions )? ; # text blocks trailing = PUNCT - ("'" | '"') ; chars = (default - space)+ ; phrase = chars -- trailing ; # html tags (from Hpricot) NameChar = [\-A-Za-z0-9._:?] ; Name = [A-Za-z_:] NameChar* ; NameAttr = NameChar+ ; Q1Attr = [^']* ; Q2Attr = [^"]* ; UnqAttr = ( space | [^ \t\r\n<>"'] [^ \t\r\n<>]* ) ; Nmtoken = NameChar+ ; Attr = NameAttr "=" ('"' Q2Attr '"' | "'" Q1Attr "'" ) space* ; AttrEnd = ( NameAttr space* "=" space* UnqAttr? | Nmtoken ) ; AttrSet = ( Attr | Nmtoken space+ ) ; script_tag_start = ( "]* ">" ) >X >A %T ; script_tag_end = ( "" >A %T LF? ) >X ; code_tag_start = "]* ">" ; code_tag_end = "
    " ; notextile = "" >X LF? default+ >A %T :>> ""; # URI tokens (lifted from Mongrel) CTL = (cntrl | 127); safe = ("$" | "-" | "_" | "."); extra = ("!" | "*" | "'" | "(" | ")" | "," | "#"); reserved = (";" | "/" | "?" | ":" | "@" | "&" | "=" | "+"); unsafe = (CTL | " " | "\"" | "%" | "<" | ">"); national = any -- (alpha | digit | reserved | extra | safe | unsafe); unreserved = (alpha | digit | safe | extra | national); escape = ("%" xdigit xdigit); uchar = (unreserved | escape); pchar = (uchar | ":" | "@" | "&" | "=" | "+"); scheme = ( alpha | digit | "+" | "-" | "." )+ ; absolute_uri = (scheme ":" (uchar | reserved )*); safepath = (pchar* (alpha | digit | safe) pchar*) ; path = (safepath ( "/" pchar* )*) ; query = ( uchar | reserved )* ; param = ( pchar | "/" )* ; params = (param ( ";" param )*) ; rel_path = (path (";" params)?) ("?" query)?; absolute_path = ("/"+ rel_path?); target = ("#" pchar*) ; uri = (target | absolute_uri | absolute_path | rel_path) ; # common title = ( '(' default+ >ATTR %{ STORE_ATTR("title"); } :> ')' ) ; word = ( alnum | safe | " " ) ; mspace = ( ( " " | "\t" | LF )+ ) -- LF{2} ; mtext = ( chars (mspace chars)* ) ; }%%; redcloth-4.3.3/ragel/redcloth_inline.c.rl000066400000000000000000000116371452062100400203430ustar00rootroot00000000000000/* * redcloth_inline.c.rl * * Copyright (C) 2009 Jason Garber */ #define RSTRING_NOT_MODIFIED #include #include "redcloth.h" %%{ machine redcloth_inline; include redcloth_common "redcloth_common.c.rl"; include redcloth_inline "redcloth_inline.rl"; }%% %% write data nofinal; VALUE red_pass(VALUE self, VALUE regs, VALUE ref, ID meth, VALUE refs) { VALUE txt = rb_hash_aref(regs, ref); if (!NIL_P(txt)) rb_hash_aset(regs, ref, redcloth_inline2(self, txt, refs)); return rb_funcall(self, meth, 1, regs); } VALUE red_parse_attr(VALUE self, VALUE regs, VALUE ref) { VALUE txt = rb_hash_aref(regs, ref); VALUE new_regs = redcloth_attributes(self, txt); return rb_funcall(regs, rb_intern("merge!"), 1, new_regs); } VALUE red_parse_link_attr(VALUE self, VALUE regs, VALUE ref) { VALUE txt = rb_hash_aref(regs, ref); VALUE new_regs = red_parse_title(self, redcloth_link_attributes(self, txt), ref); return rb_funcall(regs, rb_intern("merge!"), 1, new_regs); } VALUE red_parse_image_attr(VALUE self, VALUE regs, VALUE ref) { return red_parse_title(self, regs, ref); } VALUE red_parse_title(VALUE self, VALUE regs, VALUE ref) { // Store title/alt VALUE txt = rb_hash_aref(regs, ref); if ( txt != Qnil ) { char *p = RSTRING_PTR(txt) + RSTRING_LEN(txt); if (*(p - 1) == ')') { signed char level = -1; p--; while (p > RSTRING_PTR(txt) && level < 0) { switch(*(p - 1)) { case '(': ++level; break; case ')': --level; break; } --p; } VALUE title = STR_NEW(p + 1, RSTRING_PTR(txt) + RSTRING_LEN(txt) - 2 - p ); if (p > RSTRING_PTR(txt) && *(p - 1) == ' ') --p; if (p != RSTRING_PTR(txt)) { rb_hash_aset(regs, ref, STR_NEW(RSTRING_PTR(txt), p - RSTRING_PTR(txt) )); rb_hash_aset(regs, ID2SYM(rb_intern("title")), title); } } } return regs; } VALUE red_pass_code(VALUE self, VALUE regs, VALUE ref, ID meth) { VALUE txt = rb_hash_aref(regs, ref); if (!NIL_P(txt)) { VALUE txt2 = STR_NEW2(""); rb_str_cat_escaped_for_preformatted(self, txt2, RSTRING_PTR(txt), RSTRING_PTR(txt) + RSTRING_LEN(txt)); rb_hash_aset(regs, ref, txt2); } return rb_funcall(self, meth, 1, regs); } VALUE red_block(VALUE self, VALUE regs, VALUE block, VALUE refs) { ID method; VALUE fallback; VALUE sym_text = ID2SYM(rb_intern("text")); VALUE btype = rb_hash_aref(regs, ID2SYM(rb_intern("type"))); block = rb_funcall(block, rb_intern("strip"), 0); VALUE attr_regs = rb_hash_new(); if ((!NIL_P(block)) && !NIL_P(btype)) { method = rb_str_intern(btype); if (method == ID2SYM(rb_intern("notextile"))) { rb_hash_aset(regs, sym_text, block); } else { rb_hash_aset(regs, sym_text, redcloth_inline2(self, block, refs)); } if (rb_ary_includes(rb_funcall(self, rb_intern("formatter_methods"), 0), method)) { block = rb_funcall(self, SYM2ID(method), 1, regs); } else { fallback = rb_hash_aref(regs, ID2SYM(rb_intern("fallback"))); if (!NIL_P(fallback)) { rb_str_append(fallback, rb_hash_aref(regs, sym_text)); CLEAR_REGS(); rb_hash_aset(regs, sym_text, fallback); } block = rb_funcall(self, rb_intern("p"), 1, regs); } } return block; } VALUE red_blockcode(VALUE self, VALUE regs, VALUE block) { VALUE btype = rb_hash_aref(regs, ID2SYM(rb_intern("type"))); if (RSTRING_LEN(block) > 0) { rb_hash_aset(regs, ID2SYM(rb_intern("text")), block); block = rb_funcall(self, rb_intern(RSTRING_PTR(btype)), 1, regs); } return block; } void red_inc(VALUE regs, VALUE ref) { int aint = 0; VALUE aval = rb_hash_aref(regs, ref); if (aval != Qnil) aint = NUM2INT(aval); rb_hash_aset(regs, ref, INT2NUM(aint + 1)); } VALUE redcloth_inline(self, p, pe, refs) VALUE self; char *p, *pe; VALUE refs; { int cs, act; char *ts = NULL, *te = NULL, *reg = NULL, *attr_reg = NULL, *eof = NULL; char *orig_p = p; VALUE block = STR_NEW2(""); VALUE regs = Qnil; VALUE attr_regs = Qnil; %% write init; %% write exec; return block; } /** Append characters to a string, escaping (&, <, >, ", ') using the formatter's escape method. * @param str ruby string * @param ts start of character buffer to append * @param te end of character buffer */ void rb_str_cat_escaped(self, str, ts, te) VALUE self, str; char *ts, *te; { VALUE source_str = STR_NEW(ts, te-ts); VALUE escaped_str = rb_funcall(self, rb_intern("escape"), 1, source_str); rb_str_concat(str, escaped_str); } void rb_str_cat_escaped_for_preformatted(self, str, ts, te) VALUE self, str; char *ts, *te; { VALUE source_str = STR_NEW(ts, te-ts); VALUE escaped_str = rb_funcall(self, rb_intern("escape_pre"), 1, source_str); rb_str_concat(str, escaped_str); } VALUE redcloth_inline2(self, str, refs) VALUE self, str, refs; { StringValue(str); return redcloth_inline(self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1, refs); } redcloth-4.3.3/ragel/redcloth_inline.rb.rl000066400000000000000000000047471452062100400205300ustar00rootroot00000000000000# # redcloth_inline.rb.rl # # Copyright (C) 2009 Jason Garber # %%{ machine redcloth_inline; include redcloth_common "redcloth_common.rb.rl"; include redcloth_inline "redcloth_inline.rl"; }%% module RedCloth class RedclothInline < BaseScanner def self.redcloth_inline2(textile_doc, data, refs) self.new.redcloth_inline(textile_doc, data, refs) end def red_parse_attr(regs, ref) txt = regs[ref.to_sym] new_regs = redcloth_attributes(txt) return regs.merge!(new_regs) end def red_parse_link_attr(regs, ref) txt = regs[ref.to_sym] new_regs = red_parse_title(redcloth_link_attributes(txt), ref) return regs.merge!(new_regs) end def red_parse_image_attr(regs, ref) return red_parse_title(regs, ref); end def red_parse_title(regs, ref) # Store title/alt name = regs[ref.to_sym] if ( !name.nil? ) s = name.to_s p = s.length if (s[p - 1,1] == ')') level = -1 p -= 1 while (p > 0 && level < 0) do case s[p - 1, 1] when '('; level += 1 when ')'; level -= 1 end p -= 1 end title = s[p + 1, (s.length - 1) - (p + 1)] p -= 1 if (p > 0 && s[p - 1, 1] == ' ') if (p != 0) regs[ref.to_sym] = s[0, p] regs[:title] = title end end end return regs; end def red_pass_code(regs, ref, meth) txt = regs[ref.to_sym] if (!txt.nil?) txt2 = "" rb_str_cat_escaped_for_preformatted(txt2, txt) regs[ref.to_sym] = txt2 end return @textile_doc.send(meth, regs) end def redcloth_inline(textile_doc, data, refs) @textile_doc = textile_doc @data = data + "\0" @refs = refs @p = 0 @pe = @data.length @orig_data = @data.dup CLEAR_REGS() @block = "" %% write init; %% write exec; ##% return block end def redcloth_attributes(str) return RedCloth::RedclothAttributes.redcloth_attributes(str) end def redcloth_link_attributes(str) return RedCloth::RedclothAttributes.redcloth_link_attributes(str) end def initialize %%{ variable data @data; variable p @p; variable pe @pe; variable cs @cs; variable ts @ts; variable te @te; write data nofinal; }%% end end endredcloth-4.3.3/ragel/redcloth_inline.rl000066400000000000000000000162621452062100400201210ustar00rootroot00000000000000/* * redcloth_inline.rl * * Copyright (C) 2009 Jason Garber */ %%{ machine redcloth_inline; # html start_tag_noactions = "<" Name space+ AttrSet* (AttrEnd)? ">" | "<" Name ">" ; empty_tag_noactions = "<" Name space+ AttrSet* (AttrEnd)? "/>" | "<" Name "/>" ; end_tag_noactions = "" ; any_tag_noactions = ( start_tag_noactions | empty_tag_noactions | end_tag_noactions ) ; start_tag = start_tag_noactions >X >A %T ; empty_tag = empty_tag_noactions >X >A %T ; end_tag = end_tag_noactions >X >A %T ; html_comment = ("") >X >A %T; html_break = ("" LF?) >X >A %T ; # links link_text_char = (default - [ "<>]) ; link_text_char_or_tag = ( link_text_char | any_tag_noactions ) ; link_mtext = ( link_text_char+ (mspace link_text_char+)* ) ; quoted_mtext = '"' link_mtext '"' ; link_mtext_including_tags = ( link_text_char_or_tag+ (mspace link_text_char_or_tag+)* ) ; mtext_including_quotes = (link_mtext ' "' link_mtext '" ' link_mtext?)+ ; link_says = ( C_noactions "."* " "* (quoted_mtext | mtext_including_quotes | link_mtext_including_tags ) ) >A %{ STORE("name"); } ; link_says_noquotes_noactions = ( C_noquotes_noactions "."* " "* ((link_mtext) -- '":') ) ; link = ( '"' link_says :>> '":' %A uri %{ STORE_URL("href"); } ) >X ; link_noquotes_noactions = ( '"' link_says_noquotes_noactions '":' uri ) ; bracketed_link = ( '["' link_says '":' %A uri %{ STORE("href"); } :> "]" ) >X ; # images image_title = ( '(' mtext ')' ) ; image_is = ( A2 C ". "? (uri image_title?) >A %{ STORE("src"); } ) ; image_link = ( ":" uri >A %{ STORE_URL("href"); } ) ; image = ( "!" image_is :> "!" %A image_link? ) >X %SET_ATTR ; bracketed_image = ( "[!" image_is :> "!" %A image_link? "]" ) >X %SET_ATTR ; # footnotes footno = "[" >X %A digit+ %T "]" ; # markup end_markup_phrase = (" " | PUNCT | EOF | LF) @{ fhold; }; code = ("@" >X mtext >A %T :> "@") | ("[@" >X default+ >A %T :>> "@]") ; script_tag = ( "]* ">" (default+ -- "") "" LF? ) >X >A %T ; strong = "["? "*" >X mtext >A %T :> "*" "]"? ; b = "["? "**" >X mtext >A %T :> "**" "]"? ; mtext_excluding_underscore = mtext -- "_" ; emtext = mtext_excluding_underscore ("_" mtext_excluding_underscore)*; em = "["? "_" >X emtext >A %T "_" "]"? ; i = "["? "__" >X emtext >A %T :>> ("__" "]"?) ; del = "[-" >X C ( mtext ) >A %T :>> "-]" ; emdash_parenthetical_phrase_with_spaces = " -- " mtext " -- " ; del_phrase = (( " " >A %{ STORE("beginning_space"); } "-" | "-" when starts_line) >X C ( mtext ) >A %T :>> ( "-" end_markup_phrase )) - emdash_parenthetical_phrase_with_spaces ; ins = "["? "+" >X mtext >A %T :> "+" "]"? ; sup = "[^" >X mtext >A %T :> "^]" ; sup_phrase = ( "^" when starts_phrase) >X ( mtext ) >A %T :>> ( "^" end_markup_phrase ) ; sub = "[~" >X mtext >A %T :> "~]" ; sub_phrase = ( "~" when starts_phrase) >X ( mtext ) >A %T :>> ( "~" end_markup_phrase ) ; span = "[%" >X mtext >A %T :> "%]" ; span_phrase = (("%" when starts_phrase) >X ( mtext ) >A %T :>> ( "%" end_markup_phrase )) ; cite = "["? "??" >X mtext >A >ATTR :>> ("?" @T ( "?" | "?" @{ STORE_ATTR("text"); } "?" %SET_ATTR )) "]"? ; ignore = "["? "==" >X %A mtext %T :> "==" "]"? ; snip = "["? "```" >X %A mtext %T :> "```" "]"? ; # quotes quote1 = "'" >X %A mtext %T :> "'" ; non_quote_chars_or_link = (chars -- '"') | link_noquotes_noactions ; mtext_inside_quotes = ( non_quote_chars_or_link (mspace non_quote_chars_or_link)* ) ; html_tag_up_to_attribute_quote = "<" Name space+ NameAttr space* "=" space* ; quote2 = ('"' >X %A ( mtext_inside_quotes - (mtext_inside_quotes html_tag_up_to_attribute_quote ) ) %T :> '"' ) ; multi_paragraph_quote = (('"' when starts_line) >X %A ( chars -- '"' ) %T ); # glyphs ellipsis = ( " "? >A %T "..." ) >X ; emdash = "--" ; arrow = "->" ; endash = " - " ; acronym = ( [A-Z] >A [A-Z0-9]{1,} %T "(" default+ >A %{ STORE("title"); } :> ")" ) >X ; caps_noactions = upper{3,} ; caps = ( caps_noactions >A %*T ) >X ; dim_digit = [0-9.]+ ; prime = ("'" | '"')?; dim_noactions = dim_digit prime (("x" | " x ") dim_digit prime) %T (("x" | " x ") dim_digit prime)? ; dim = dim_noactions >X >A %T ; tm = [Tt] [Mm] ; trademark = " "? ( "[" tm "]" | "(" tm ")" ) ; reg = [Rr] ; registered = " "? ( "[" reg "]" | "(" reg ")" ) ; cee = [Cc] ; copyright = ( "[" cee "]" | "(" cee ")" ) ; entity = ( "&" %A ( '#' digit+ | ( alpha ( alpha | digit )+ ) ) %T ';' ) >X ; # info redcloth_version = "[RedCloth::VERSION]" ; other_phrase = phrase -- dim_noactions; code_tag := |* code_tag_end { CAT(block); fgoto main; }; default => esc_pre; *|; main := |* image { PARSE_IMAGE_ATTR("src"); INLINE(block, "image"); }; bracketed_image { PARSE_IMAGE_ATTR("src"); INLINE(block, "image"); }; link { PARSE_LINK_ATTR("name"); PASS(block, "name", "link"); }; bracketed_link { PARSE_LINK_ATTR("name"); PASS(block, "name", "link"); }; code { PASS_CODE(block, "text", "code"); }; code_tag_start { CAT(block); fgoto code_tag; }; notextile { INLINE(block, "notextile"); }; strong { PARSE_ATTR("text"); PASS(block, "text", "strong"); }; b { PARSE_ATTR("text"); PASS(block, "text", "b"); }; em { PARSE_ATTR("text"); PASS(block, "text", "em"); }; i { PARSE_ATTR("text"); PASS(block, "text", "i"); }; del { PASS(block, "text", "del"); }; del_phrase { PASS(block, "text", "del_phrase"); }; ins { PARSE_ATTR("text"); PASS(block, "text", "ins"); }; sup { PARSE_ATTR("text"); PASS(block, "text", "sup"); }; sup_phrase { PARSE_ATTR("text"); PASS(block, "text", "sup_phrase"); }; sub { PARSE_ATTR("text"); PASS(block, "text", "sub"); }; sub_phrase { PARSE_ATTR("text"); PASS(block, "text", "sub_phrase"); }; span { PARSE_ATTR("text"); PASS(block, "text", "span"); }; span_phrase { PARSE_ATTR("text"); PASS(block, "text", "span_phrase"); }; cite { PARSE_ATTR("text"); PASS(block, "text", "cite"); }; ignore => ignore; snip { PASS(block, "text", "snip"); }; quote1 { PASS(block, "text", "quote1"); }; quote2 { PASS(block, "text", "quote2"); }; multi_paragraph_quote { PASS(block, "text", "multi_paragraph_quote"); }; ellipsis { INLINE(block, "ellipsis"); }; emdash { INLINE(block, "emdash"); }; endash { INLINE(block, "endash"); }; arrow { INLINE(block, "arrow"); }; caps { INLINE(block, "caps"); }; acronym { INLINE(block, "acronym"); }; dim { INLINE(block, "dim"); }; trademark { INLINE(block, "trademark"); }; registered { INLINE(block, "registered"); }; copyright { INLINE(block, "copyright"); }; footno { PASS(block, "text", "footno"); }; entity { INLINE(block, "entity"); }; script_tag { INLINE(block, "inline_html"); }; start_tag { INLINE(block, "inline_html"); }; end_tag { INLINE(block, "inline_html"); }; empty_tag { INLINE(block, "inline_html"); }; html_comment { INLINE(block, "inline_html"); }; html_break { INLINE(block, "inline_html"); }; redcloth_version { INLINE(block, "inline_redcloth_version"); }; other_phrase => esc; PUNCT => esc; space => esc; EOF; *|; }%%; redcloth-4.3.3/ragel/redcloth_scan.c.rl000066400000000000000000000130321452062100400200000ustar00rootroot00000000000000/* * redcloth_scan.c.rl * * Copyright (C) 2009 Jason Garber */ #define redcloth_scan_c #define RSTRING_NOT_MODIFIED #include #include "redcloth.h" VALUE mRedCloth, super_ParseError, super_RedCloth, super_HTML, super_LATEX; VALUE SYM_escape_preformatted, SYM_escape_attributes; %%{ machine redcloth_scan; include redcloth_common "redcloth_common.c.rl"; action extend { extend = rb_hash_aref(regs, ID2SYM(rb_intern("type"))); } include redcloth_scan "redcloth_scan.rl"; }%% %% write data nofinal; VALUE redcloth_transform(self, p, pe, refs) VALUE self; char *p, *pe; VALUE refs; { char *orig_p = p, *orig_pe = pe; int cs, act, nest = 0; char *ts = NULL, *te = NULL, *reg = NULL, *bck = NULL, *attr_reg = NULL, *eof = NULL; VALUE html = STR_NEW2(""); VALUE table = STR_NEW2(""); VALUE block = STR_NEW2(""); VALUE regs, attr_regs; CLEAR_REGS() VALUE list_layout = Qnil; const char *list_type = NULL; VALUE list_index = rb_ary_new(); VALUE plain_block; SET_PLAIN_BLOCK("p"); VALUE extend = Qnil; char listm[10] = ""; VALUE refs_found = rb_hash_new(); %% write init; %% write exec; if (RSTRING_LEN(block) > 0) { ADD_BLOCK(); } if ( NIL_P(refs) && rb_funcall(refs_found, rb_intern("empty?"), 0) == Qfalse ) { return redcloth_transform(self, orig_p, orig_pe, refs_found); } else { rb_funcall(self, rb_intern("after_transform"), 1, html); return html; } } VALUE redcloth_transform2(self, str) VALUE self, str; { StringValue(str); rb_funcall(self, rb_intern("before_transform"), 1, str); return redcloth_transform(self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1, Qnil); } /* * Converts special characters into HTML entities. */ static VALUE redcloth_html_esc(int argc, VALUE* argv, VALUE self) //(self, str, level) { VALUE str, level; rb_scan_args(argc, argv, "11", &str, &level); VALUE new_str = STR_NEW2(""); if (str == Qnil) return new_str; StringValue(str); if (RSTRING_LEN(str) == 0) return new_str; char *ts = RSTRING_PTR(str), *te = RSTRING_PTR(str) + RSTRING_LEN(str); char *t = ts, *t2 = ts; const char *ch = NULL; if (te <= ts) return Qnil; while (t2 < te) { ch = NULL; // normal + pre switch (*t2) { case '&': ch = "amp"; break; case '>': ch = "gt"; break; case '<': ch = "lt"; break; } // normal (non-pre) if (level != SYM_escape_preformatted) { switch (*t2) { case '\n': ch = "br"; break; case '"' : ch = "quot"; break; case '\'': ch = (level == SYM_escape_attributes) ? "apos" : "squot"; break; } } if (ch != NULL) { if (t2 > t) rb_str_cat(new_str, t, t2-t); rb_str_concat(new_str, rb_funcall(self, rb_intern(ch), 1, rb_hash_new())); t = t2 + 1; } t2++; } if (t2 > t) rb_str_cat(new_str, t, t2-t); return new_str; } /* * Converts special characters into LaTeX entities. */ static VALUE redcloth_latex_esc(VALUE self, VALUE str) { VALUE new_str = STR_NEW2(""); if (str == Qnil) return new_str; StringValue(str); if (RSTRING_LEN(str) == 0) return new_str; char *ts = RSTRING_PTR(str), *te = RSTRING_PTR(str) + RSTRING_LEN(str); char *t = ts, *t2 = ts; const char *ch = NULL; if (te <= ts) return Qnil; while (t2 < te) { ch = NULL; switch (*t2) { case '{': ch = "#123"; break; case '}': ch = "#125"; break; case '\\': ch = "#92"; break; case '#': ch = "#35"; break; case '$': ch = "#36"; break; case '%': ch = "#37"; break; case '&': ch = "amp"; break; case '_': ch = "#95"; break; case '^': ch = "circ"; break; case '~': ch = "tilde"; break; case '<': ch = "lt"; break; case '>': ch = "gt"; break; case '\n': ch = "#10"; break; } if (ch != NULL) { if (t2 > t) rb_str_cat(new_str, t, t2-t); VALUE opts = rb_hash_new(); rb_hash_aset(opts, ID2SYM(rb_intern("text")), STR_NEW2(ch)); rb_str_concat(new_str, rb_funcall(self, rb_intern("entity"), 1, opts)); t = t2 + 1; } t2++; } if (t2 > t) rb_str_cat(new_str, t, t2-t); return new_str; } /* * Transforms a Textile document with +formatter+ */ static VALUE redcloth_to(self, formatter) VALUE self, formatter; { rb_funcall(self, rb_intern("delete!"), 1, STR_NEW2("\r")); VALUE working_copy = rb_obj_clone(self); rb_extend_object(working_copy, formatter); if (rb_funcall(working_copy, rb_intern("lite_mode"), 0) == Qtrue) { return redcloth_inline2(working_copy, self, rb_hash_new()); } else { return redcloth_transform2(working_copy, self); } } void Init_redcloth_scan() { mRedCloth = rb_define_module("RedCloth"); rb_define_const( mRedCloth, "EXTENSION_LANGUAGE", rb_str_new2("C") ); /* A Textile document that can be converted to other formats. See the README for Textile syntax. */ super_RedCloth = rb_define_class_under(mRedCloth, "TextileDoc", rb_cString); rb_define_method(super_RedCloth, "to", redcloth_to, 1); super_ParseError = rb_define_class_under(super_RedCloth, "ParseError", rb_eException); /* Escaping */ rb_define_method(super_RedCloth, "html_esc", redcloth_html_esc, -1); rb_define_method(super_RedCloth, "latex_esc", redcloth_latex_esc, 1); SYM_escape_preformatted = ID2SYM(rb_intern("html_escape_preformatted")); SYM_escape_attributes = ID2SYM(rb_intern("html_escape_attributes")); } redcloth-4.3.3/ragel/redcloth_scan.rb.rl000066400000000000000000000256741452062100400202000ustar00rootroot00000000000000# # redcloth_scan.rb.rl # # Copyright (C) 2009 Jason Garber # %%{ machine redcloth_scan; include redcloth_common "redcloth_common.rb.rl"; action extend { @extend = @regs[:type] } include redcloth_scan "redcloth_scan.rl"; }%% module RedCloth EXTENSION_LANGUAGE = "Ruby" class TextileDoc < String def to(formatter) self.delete!("\r") working_copy = self.clone working_copy.extend(formatter) if (working_copy.lite_mode) return working_copy.redcloth_inline2(self, {}) else return working_copy.redcloth_transform2(self) end end class ParseError < Exception; end def redcloth_transform2(textile_doc) before_transform(textile_doc) return RedCloth::RedclothScan.transform(self, textile_doc, nil) end def redcloth_inline2(textile_doc, refs) return RedCloth::RedclothInline.redcloth_inline2(self, textile_doc, refs) end def html_esc(input, level=nil) return "" if input.nil? || input.empty? str = input.dup str.gsub!('&') { amp({}) } str.gsub!('>') { gt({}) } str.gsub!('<') { lt({}) } if (level != :html_escape_preformatted) str.gsub!("\n") { br({}) } str.gsub!('"') { quot({}) } str.gsub!("'") { level == :html_escape_attributes ? apos({}) : squot({}) } end return str; end LATEX_ESCAPE_CHARACTERS = { '{' => "#123", '}' => "#125", '\\' => "#92", '#' => "#35", '$' => "#36", '%' => "#37", '&' => "amp", '_' => "#95", '^' => "circ", '~' => "tilde", '<' => "lt", '>' => "gt", '\n'=> "#10" } def latex_esc(str) return "" if str.nil? || str.empty? ch_regex = Regexp.new(LATEX_ESCAPE_CHARACTERS.keys.map {|ch| Regexp.escape(ch) }.join("|")) str.gsub(ch_regex) {|ch| entity({:text => LATEX_ESCAPE_CHARACTERS[ch]}) } end end class BaseScanner attr_accessor :p, :pe, :refs attr_reader :data attr_accessor :orig_data, :cs, :act, :ts, :te, :reg, :bck, :eof, :html, :table, :block, :regs, :attr_regs attr_accessor :list_layout, :list_type, :list_index, :list_continue, :listm, :refs_found, :plain_block def STR_NEW(p,n) @data[p, n] end def MARK() @reg = @p end def MARK_B() @bck = @p end def MARK_ATTR() @attr_reg = @p end def CLEAR_REGS() @regs = {} @attr_regs = {} end def RESET_REG() @reg = nil end def CAT(h) h << @data[@ts, @te - @ts] end def CLEAR(h) h.replace("") end def RSTRIP_BANG(h) h.rstrip! end def SET_PLAIN_BLOCK(t) @plain_block = t end def RESET_TYPE() @regs[:type] = @plain_block end def INLINE(h, t) h << @textile_doc.send(t, @regs) end def DONE(h) @html << h CLEAR(h) CLEAR_REGS() end def PASS(h, a, t) h << red_pass(@regs, a.to_sym, t, @refs) end def PARSE_ATTR(a) red_parse_attr(@regs, a) end def PARSE_LINK_ATTR(a) red_parse_link_attr(@regs, a) end def PARSE_IMAGE_ATTR(a) red_parse_image_attr(@regs, a) end def PASS_CODE(h, a, t) h << red_pass_code(@regs, a, t) end def ADD_BLOCK() @html << red_block(@regs, @block, @refs) @extend = nil CLEAR(@block) CLEAR_REGS() end def ADD_EXTENDED_BLOCK() @html << red_block(@regs, @block, @refs) CLEAR(@block) end def END_EXTENDED() @extend = nil CLEAR_REGS() end def ADD_BLOCKCODE() @html << red_blockcode(@regs, @block) CLEAR(@block) CLEAR_REGS() end def ADD_EXTENDED_BLOCKCODE() @html << red_blockcode(@regs, @block) CLEAR(@block) end def ASET(t, v) @regs[t.to_sym] = v end def ATTR_SET(t, v) @attr_regs[t.to_sym] = v end def ATTR_INC(t) red_inc(@attr_regs, t.to_sym) end def SET_ATTRIBUTES() SET_ATTRIBUTE("class_buf", "class") SET_ATTRIBUTE("id_buf", "id") SET_ATTRIBUTE("lang_buf", "lang") SET_ATTRIBUTE("style_buf", "style") @regs.merge!(@attr_regs) end def SET_ATTRIBUTE(b, a) @regs[a.to_sym] = @regs[b.to_sym] unless @regs[b.to_sym].nil? end def TRANSFORM(t) if (@reg && @p > @reg && @reg >= @ts) str = self.class.transform(@textile_doc, STR_NEW(reg, p-reg), @refs) @regs[t.to_sym] = str # /*printf("TRANSFORM(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ else @regs[t.to_sym] = nil end end def STORE(t) if (@reg && @p > @reg && @reg >= @ts) str = @data[@reg, @p - @reg] @regs[t.to_sym] = str # /*printf("STORE(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ else @regs[t.to_sym] = nil end end def STORE_B(t) if (@bck && @p > @bck && @bck >= @ts) str = @data[@bck, @p - @bck] @regs[t.to_sym] = str # /*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ else @regs[t.to_sym] = nil end end def STORE_ATTR(t) if (@attr_reg && @p > @attr_reg && (@attr_reg >= (@ts || 0))) str = @data[@attr_reg, @p - @attr_reg] @attr_regs[t.to_sym] = str # /*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \ else @attr_regs[t.to_sym] = nil end end def STORE_URL(t) if (@reg && @p > @reg && @reg >= @ts) punct = true while (@p > @reg && punct) case @data[@p - 1, 1] when ')' temp_p = @p - 1 level = -1 while (temp_p > @reg) case @data[temp_p - 1, 1] when '('; level += 1 when ')'; level -= 1 end temp_p -= 1 end if (level == 0) punct = false else @p -= 1 end when '!', '"', '#', '$', '%', ']', '[', '&', '\'', '*', '+', ',', '-', '.', '(', ':', ';', '=', '?', '@', '\\', '^', '_', '`', '|', '~' @p -= 1 else punct = false end end @te = @p end STORE(t) if ( ! @refs.nil? && @refs.has_key?(@regs[t.to_sym]) ) @regs[t.to_sym] = @refs[@regs[t.to_sym]] end end def STORE_LINK_ALIAS() @refs_found[@regs[:text]] = @regs[:href] end def CLEAR_LIST() @list_layout = [] end def SET_LIST_TYPE(t) @list_type = t end def NEST() @nest += 1 end def RESET_NEST() @nest = 0 end def LIST_LAYOUT() aint = 0 aval = @list_index[@nest-1] aint = aval.to_i unless aval.nil? if (@list_type == "ol" && @nest > 0) @list_index[@nest-1] = aint + 1 end if (@nest > @list_layout.length) SET_ATTRIBUTES(); listm = sprintf("%s_open", @list_type) if (@regs[:list_continue]) @regs[:list_continue] = nil @regs[:start] = @list_index[@nest-1] else start = @regs[:start] if (start.nil?) @list_index[@nest-1] = 1 else start_num = start.to_i @list_index[@nest-1] = start_num end end @regs[:nest] = @nest @html << @textile_doc.send(listm, @regs) @list_layout[@nest-1] = @list_type CLEAR_REGS() ASET("first", true) end LIST_CLOSE() LIST_ITEM_CLOSE() unless @nest == 0 CLEAR_REGS() @regs[:nest] = @list_layout.length ASET("type", "li_open") end def LIST_ITEM_CLOSE() @html << @textile_doc.send("li_close", @regs) unless @regs[:first] end def LIST_CLOSE() while (@nest < @list_layout.length) @regs[:nest] = @list_layout.length end_list = @list_layout.pop if (!end_list.nil?) listm = sprintf("%s_close", end_list) LIST_ITEM_CLOSE() @html << @textile_doc.send(listm, @regs) end end end def red_pass(regs, ref, meth, refs) txt = regs[ref] regs[ref] = RedCloth::RedclothInline.redcloth_inline2(@textile_doc, txt, refs) if (!txt.nil?) return @textile_doc.send(meth, regs) end def red_inc(regs, ref) aint = 0 aval = regs[ref] aint = aval.to_i if (!aval.nil?) regs[ref] = aint + 1 end def red_block(regs, block, refs) sym_text = :text btype = @regs[:type] block = block.strip if (!block.nil? && !btype.nil?) method = btype.intern if (method == :notextile) @regs[sym_text] = block else @regs[sym_text] = RedCloth::RedclothInline.redcloth_inline2(@textile_doc, block, refs) end if (@textile_doc.send(:formatter_methods).include? method) #FIXME: This is a hack to get around private method. block = @textile_doc.send(method, @regs) else fallback = @regs[:fallback] if (!fallback.nil?) fallback << @regs[sym_text] CLEAR_REGS() @regs[sym_text] = fallback end block = @textile_doc.p(@regs); end end return block end def red_blockcode(regs, block) btype = regs[:type] if (block.length > 0) regs[:text] = block block = @textile_doc.send(btype, regs) end return block end def rb_str_cat_escaped(str, ts, te) source_str = STR_NEW(ts, te-ts); escaped_str = @textile_doc.send(:escape, source_str) #FIXME: This is a hack to get around private method. str << escaped_str end def rb_str_cat_escaped_for_preformatted(str, text) escaped_str = @textile_doc.send(:escape_pre, text) #FIXME: This is a hack to get around private method. str << escaped_str end end class RedclothScan < BaseScanner def self.transform(textile_doc, data, refs) self.new.transform(textile_doc, data, refs) end def transform(textile_doc, data, refs) @textile_doc = textile_doc @data = data + "\0" @refs = refs @p = 0 @pe = @data.length @orig_data = data.dup @html = "" @table = "" @block = "" CLEAR_REGS() @list_layout = nil @list_index = []; SET_PLAIN_BLOCK("p") @extend = nil @listm = [] @refs_found = {} %% write init; %% write exec; ADD_BLOCK() if (block.length > 0) if ( refs.nil? && !refs_found.empty? ) return transform(@textile_doc, orig_data, refs_found) else @textile_doc.send(:after_transform, html) return html end end def initialize %%{ variable data @data; variable p @p; variable pe @pe; variable cs @cs; variable ts @ts; variable te @te; write data nofinal; }%% end end endredcloth-4.3.3/ragel/redcloth_scan.rl000066400000000000000000000226511452062100400175660ustar00rootroot00000000000000/* * redcloth_scan.rl * * Copyright (C) 2009 Jason Garber */ %%{ machine redcloth_scan; # blocks notextile_tag = notextile (LF+ | EOF) ; noparagraph_line_start = " "+ ; notextile_block_start = ( "notextile" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " "+ ) %SET_ATTR ; pre_tag_start = "]* ">" (space* code_tag_start)? ; pre_tag_end = (code_tag_end space*)? "" LF? ; pre_block_start = ( "pre" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " " ) %SET_ATTR ; bc_start = ( "bc" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " " ) %SET_ATTR ; bq_start = ( "bq" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) ( ":" %A uri %{ STORE("cite"); } )? " "+ ) %SET_ATTR ; non_ac_btype = ( "bq" | "bc" | "pre" | "notextile" | "table" ); btype = (alpha alnum*) -- (non_ac_btype | "fn" digit+); block_start = ( btype >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " "+ ) >B %{ STORE_B("fallback"); } %SET_ATTR ; all_btypes = btype | non_ac_btype; next_block_start = ( all_btypes A_noactions C_noactions :> "."+ " " ) >A @{ fexec(reg); } ; double_return = LF [ \t]* LF LF* ; block_end = ( double_return | EOF ); ftype = ( "fn" >A %{ STORE("type"); } digit+ >A %{ STORE("id"); } ) ; footnote_start = ( ftype A C :> dotspace ) %SET_ATTR ; ul = "*" %{NEST(); SET_LIST_TYPE("ul");}; ol = "#" %{NEST(); SET_LIST_TYPE("ol");}; ul_start = ( ul | ol )* ul A_HLGN_noactions* C_noactions :> " "+ ; ol_start = ( ul | ol )* ol N A_HLGN_noactions* C_noactions :> " "+ ; list_start = " "* A_HLGN* C ( ul_start | ol_start ) >B >{RESET_NEST();} @{ fexec(bck); } ; dt_start = "-" . " "+ ; dd_start = ":=" ; long_dd = dd_start " "* LF %{ ADD_BLOCK(); ASET("type", "dd"); } any+ >A %{ TRANSFORM("text"); } :>> "=:" ; dl_start = (dt_start mtext (LF dt_start mtext)* " "* dd_start) ; blank_line = LF; link_alias = ( "[" >{ ASET("type", "ignore"); } %A chars %T "]" %A uri %{ STORE_URL("href"); } ) ; horizontal_rule = '*'{3,} | '-'{3,} | '_'{3,} ; # image lookahead IMG_A_LEFT = "<" %{ ASET("float", "left"); } ; IMG_A_RIGHT = ">" %{ ASET("float", "right"); } ; aligned_image = ( "["? "!" (IMG_A_LEFT | IMG_A_RIGHT) ) >A @{ fexec(reg); } ; # html blocks BlockTagName = Name - ("pre" | "notextile" | "a" | "applet" | "basefont" | "bdo" | "br" | "font" | "iframe" | "img" | "map" | "object" | "param" | "embed" | "q" | "script" | "span" | "sub" | "sup" | "abbr" | "acronym" | "cite" | "code" | "del" | "dfn" | "em" | "ins" | "kbd" | "samp" | "strong" | "var" | "b" | "big" | "i" | "s" | "small" | "strike" | "tt" | "u"); block_start_tag = "<" BlockTagName space+ AttrSet* (AttrEnd)? ">" | "<" BlockTagName ">"; block_empty_tag = "<" BlockTagName space+ AttrSet* (AttrEnd)? "/>" | "<" BlockTagName "/>" ; block_end_tag = "" ; html_start = indent >B %{STORE_B("indent_before_start");} block_start_tag >B %{STORE_B("start_tag");} indent >B %{STORE_B("indent_after_start");} ; html_end = indent >B %{STORE_B("indent_before_end");} block_end_tag >B %{STORE_B("end_tag");} (indent LF?) >B %{STORE_B("indent_after_end");} ; standalone_html = indent (block_start_tag | block_empty_tag | block_end_tag) indent (LF+ | EOF); html_end_terminating_block = ( LF indent block_end_tag ) >A @{ fexec(reg); } ; # tables td_text = (default - LF)+ ; btext = (td_text (LF td_text)* ( LF{2} )?) | [\t ]* ; tddef = ( D? S A C :> dotspace ) %SET_ATTR ; td = ( tddef? btext >A %T :> "|" >{PASS(table, "text", "td");} ) >X ; trdef = ( A C :> dotspace ) %SET_ATTR ; tr = ( trdef? "|" %{INLINE(table, "tr_open");} td+ ) >X %{INLINE(table, "tr_close");} ; trows = ( tr (LF >X tr)* ) ; tdef = ( "table" %X A C :> dotspace LF ) %SET_ATTR ; table = ( tdef? trows >{CLEAR(table); INLINE(table, "table_open"); RESET_REG();} ) ; # info redcloth_version = ("RedCloth" >A ("::" | " " ) "VERSION"i ":"? " ")? %{STORE("prefix");} "RedCloth::VERSION" (LF* EOF | double_return) ; pre_tag := |* pre_tag_end { CAT(block); DONE(block); fgoto main; }; default => esc_pre; *|; pre_block := |* EOF { ADD_BLOCKCODE(); fgoto main; }; double_return when extended { ADD_EXTENDED_BLOCKCODE(); }; double_return when not_extended { ADD_BLOCKCODE(); fgoto main; } ; double_return next_block_start when extended { ADD_EXTENDED_BLOCKCODE(); END_EXTENDED(); fgoto main; }; double_return next_block_start when not_extended { ADD_BLOCKCODE(); fgoto main; }; default => esc_pre; *|; script_tag := |* script_tag_end { CAT(block); ASET("type", "ignore"); ADD_BLOCK(); fgoto main; }; EOF { ASET("type", "ignore"); ADD_BLOCK(); fgoto main; }; default => cat; *|; noparagraph_line := |* LF { ADD_BLOCK(); fgoto main; }; default => cat; *|; notextile_block := |* EOF { ADD_BLOCK(); fgoto main; }; double_return when extended { CAT(block); ADD_EXTENDED_BLOCK(); CAT(html); }; double_return when not_extended { ADD_BLOCK(); CAT(html); fgoto main; } ; double_return next_block_start when extended { CAT(block); ADD_EXTENDED_BLOCK(); END_EXTENDED(); fgoto main; }; double_return next_block_start when not_extended { ADD_BLOCK(); CAT(html); fgoto main; }; default => cat; *|; html := |* html_end { ADD_BLOCK(); fgoto main; }; default => cat; *|; bc := |* EOF { ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); fgoto main; }; double_return when extended { ADD_EXTENDED_BLOCKCODE(); CAT(html); }; double_return when not_extended { ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); fgoto main; }; double_return next_block_start when extended { ADD_EXTENDED_BLOCKCODE(); CAT(html); RSTRIP_BANG(html); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); END_EXTENDED(); fgoto main; }; double_return next_block_start when not_extended { ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); fgoto main; }; default => esc_pre; *|; bq := |* EOF { ADD_BLOCK(); INLINE(html, "bq_close"); fgoto main; }; double_return when extended { ADD_EXTENDED_BLOCK(); }; double_return when not_extended { ADD_BLOCK(); INLINE(html, "bq_close"); fgoto main; }; double_return next_block_start when extended { ADD_EXTENDED_BLOCK(); INLINE(html, "bq_close"); END_EXTENDED(); fgoto main; }; double_return next_block_start when not_extended { ADD_BLOCK(); INLINE(html, "bq_close"); fgoto main; }; html_end_terminating_block when extended { ADD_EXTENDED_BLOCK(); INLINE(html, "bq_close"); END_EXTENDED(); fgoto main; }; html_end_terminating_block when not_extended { ADD_BLOCK(); INLINE(html, "bq_close"); fgoto main; }; default => cat; *|; block := |* EOF { ADD_BLOCK(); fgoto main; }; double_return when extended { ADD_EXTENDED_BLOCK(); }; double_return when not_extended { ADD_BLOCK(); fgoto main; }; double_return next_block_start when extended { ADD_EXTENDED_BLOCK(); END_EXTENDED(); fgoto main; }; double_return next_block_start when not_extended { ADD_BLOCK(); fgoto main; }; html_end_terminating_block when extended { ADD_EXTENDED_BLOCK(); END_EXTENDED(); fgoto main; }; html_end_terminating_block when not_extended { ADD_BLOCK(); fgoto main; }; LF list_start { ADD_BLOCK(); CLEAR_LIST(); LIST_LAYOUT(); fgoto list_item; }; default => cat; *|; footnote := |* block_end { ADD_BLOCK(); fgoto main; }; default => cat; *|; ul_item = ( ul | ol )* ul A_HLGN* C :> " "+ ; ol_item = ( ul | ol )* ol N_noactions A_HLGN* C :> " "+ ; list_item := (" "* ( ul_item | ol_item )) @{ SET_ATTRIBUTES(); fgoto list_content; } ; list_content := |* LF list_start { ADD_BLOCK(); LIST_LAYOUT(); fgoto list_item; }; block_end { ADD_BLOCK(); RESET_NEST(); LIST_LAYOUT(); fgoto main; }; default => cat; *|; dl := |* LF dt_start { ADD_BLOCK(); ASET("type", "dt"); }; dd_start { ADD_BLOCK(); ASET("type", "dd"); }; long_dd { INLINE(html, "dd"); CLEAR_REGS(); }; block_end { ADD_BLOCK(); INLINE(html, "dl_close"); fgoto main; }; default => cat; *|; main := |* noparagraph_line_start { ASET("type", "ignored_line"); fgoto noparagraph_line; }; notextile_tag { INLINE(html, "notextile"); }; notextile_block_start { ASET("type", "notextile"); fgoto notextile_block; }; script_tag_start { CAT(block); fgoto script_tag; }; pre_tag_start { ASET("type", "notextile"); CAT(block); fgoto pre_tag; }; pre_block_start { fgoto pre_block; }; standalone_html { ASET("type", "html"); CAT(block); ADD_BLOCK(); }; html_start { ASET("type", "html_block"); fgoto html; }; bc_start { INLINE(html, "bc_open"); ASET("type", "code"); SET_PLAIN_BLOCK("code"); fgoto bc; }; bq_start { INLINE(html, "bq_open"); ASET("type", "p"); fgoto bq; }; block_start { fgoto block; }; footnote_start { fgoto footnote; }; horizontal_rule { INLINE(html, "hr"); }; list_start { CLEAR_LIST(); LIST_LAYOUT(); fgoto list_item; }; dl_start { fexec(ts + 1); INLINE(html, "dl_open"); ASET("type", "dt"); fgoto dl; }; table { INLINE(table, "table_close"); DONE(table); fgoto block; }; link_alias { STORE_LINK_ALIAS(); DONE(block); }; aligned_image { RESET_TYPE(); fgoto block; }; redcloth_version { INLINE(html, "redcloth_version"); }; blank_line => cat; default { CLEAR_REGS(); RESET_TYPE(); CAT(block); fgoto block; }; EOF; *|; }%%; redcloth-4.3.3/redcloth.gemspec000066400000000000000000000032271452062100400164740ustar00rootroot00000000000000# -*- encoding: utf-8 -*- redcloth_dir = Dir.pwd =~ /redcloth\/tmp/ ? File.expand_path("../../../..", Dir.pwd) : File.expand_path("..", __FILE__) $LOAD_PATH.unshift File.join(redcloth_dir, 'lib') require "redcloth/version" Gem::Specification.new do |s| s.name = "RedCloth" s.version = RedCloth::VERSION.to_s s.authors = ["Jason Garber", "Joshua Siler", "Ola Bini"] s.description = "Textile parser for Ruby." s.summary = RedCloth::SUMMARY s.email = "redcloth-upwards@rubyforge.org" s.homepage = "http://redcloth.org" s.rubyforge_project = "redcloth" s.rubygems_version = "1.3.7" s.default_executable = "redcloth" s.files = Dir['.gemtest', '.rspec', 'CHANGELOG', 'COPYING', 'Gemfile', 'README.rdoc', 'Rakefile', 'doc/**/*', 'bin/**/*', 'lib/**/*', 'redcloth.gemspec', 'spec/**/*', 'tasks/**/*'] s.test_files = Dir['spec/**/*'] s.executables = ['redcloth'] s.extra_rdoc_files = ["README.rdoc", "COPYING", "CHANGELOG"] s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source", "--title", "RedCloth", "--main", "README.rdoc"] s.require_paths += ["lib/case_sensitive_require", "ext"] s.files -= Dir['lib/**/*.bundle'] s.files -= Dir['lib/**/*.so'] s.platform = 'ruby' s.files += %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"} s.files += ["ext/redcloth_scan/redcloth.h"] s.extensions = Dir['ext/**/extconf.rb'] s.add_development_dependency('bundler', '> 1.3.4') s.add_development_dependency('rake', '~> 13') s.add_development_dependency('rspec', '~> 3.12') s.add_development_dependency('diff-lcs', '~> 1.5') s.license = "MIT" end redcloth-4.3.3/spec/000077500000000000000000000000001452062100400142515ustar00rootroot00000000000000redcloth-4.3.3/spec/benchmark_spec.rb000066400000000000000000000010461452062100400175430ustar00rootroot00000000000000require File.dirname(__FILE__) + '/spec_helper' describe "Benchmarking", :type => :formatter do version = RedCloth::VERSION.is_a?(Module) ? RedCloth::VERSION::STRING : RedCloth::VERSION platform = RedCloth.const_defined?(:EXTENSION_LANGUAGE) ? RedCloth::EXTENSION_LANGUAGE : (version < "4.0.0" ? "ruby-regex" : "C") it "should not be too slow" do # puts "Benchmarking version #{version} compiled in #{platform}..." fixtures.each do |name, doc| if doc['html'] RedCloth.new(doc['in']).to_html end end end endredcloth-4.3.3/spec/custom_tags_spec.rb000066400000000000000000000027401452062100400201430ustar00rootroot00000000000000require File.dirname(__FILE__) + '/spec_helper' module FigureTag def fig( opts ) label, img = opts[:text].split('|').map! {|str| str.strip} html = %Q{
    \n}.dup html << %Q{ \n} html << %Q{ Figure #{label}\n} html << %Q{ \n} html << %Q{

    Figure #{label}

    \n} html << %Q{
    \n} end end describe "custom tags" do it "should recognize the custom tag" do input = %Q{The first line of text.\n\n}.dup input << %Q{fig. 1.1 | img.jpg\n\n} input << %Q{The last line of text.\n} r = RedCloth.new input r.extend FigureTag html = %Q{

    The first line of text.

    \n}.dup html << %Q{
    \n} html << %Q{ \n} html << %Q{ Figure 1.1\n} html << %Q{ \n} html << %Q{

    Figure 1.1

    \n} html << %Q{
    \n} html << %Q{

    The last line of text.

    } r.to_html.should == html end it "should fall back if custom tag isn't defined" do r = RedCloth.new %Q/fig()>[no]{color:red}. 1.1 | img.jpg/ r.to_html.should == "

    fig()>[no]{color:red}. 1.1 | img.jpg

    " end it "should not call just regular string methods" do r = RedCloth.new "next. " r.extend FigureTag html = "

    next.

    " r.to_html.should == html end end redcloth-4.3.3/spec/erb_spec.rb000066400000000000000000000006031452062100400163570ustar00rootroot00000000000000require File.dirname(__FILE__) + '/spec_helper' describe "ERB helper" do it "should add a textile tag to ERB" do template = %{<%=t "This new ERB tag makes is so _easy_ to use *RedCloth*" %>} expected = %{

    This new ERB tag makes is so easy to use RedCloth

    } ERB.new(template).result.should == expected end endredcloth-4.3.3/spec/extension_spec.rb000066400000000000000000000014101452062100400176200ustar00rootroot00000000000000require File.dirname(__FILE__) + '/spec_helper' # http://www.ralree.info/2006/9/13/extending-redcloth module RedClothSmileyExtension def refs_smiley(text) text.gsub!(/(\s)~(:P|:D|:O|:o|:S|:\||;\)|:'\(|:\)|:\()/) do |m| bef,ma = $~[1..2] filename = "/images/emoticons/"+(ma.unpack("c*").join('_'))+".png" "#{bef}" end end end RedCloth.send(:include, RedClothSmileyExtension) describe RedClothSmileyExtension do it "should include the extension" do input = %Q{You're so silly! ~:P} html = %Q{

    You’re so silly!

    } RedCloth.new(input).to_html(:textile, :refs_smiley).should == html end endredcloth-4.3.3/spec/fixtures/000077500000000000000000000000001452062100400161225ustar00rootroot00000000000000redcloth-4.3.3/spec/fixtures/basic.yml000066400000000000000000000714351452062100400177400ustar00rootroot00000000000000--- name: paragraphs desc: Textile looks for paragraphs in your text. Paragraphs are separated by one blank line. Every paragraph is translated as an HTML paragraph. in: |- A single paragraph. Followed by another. html: |-

    A single paragraph.

    Followed by another.

    --- name: blocks with spaces on the blank line in between in: "This is line one\n \nThis is line two" html: "

    This is line one

    \n

    This is line two

    " --- name: blocks with tabl on the blank line in between in: "This is line one\n\t\nThis is line two" html: "

    This is line one

    \n

    This is line two

    " --- name: block containing block start in: |- I saw a ship. It ate my elephant. html: |-

    I saw a ship. It ate my elephant.

    --- name: extended block containing block start in: |- p.. I saw a ship. It ate my elephant. When the elephant comes to take a p. you... html: |-

    I saw a ship. It ate my elephant.

    When the elephant comes to take a p. you…

    --- name: blockquote containing block start in: |- bq. I saw a ship. It ate my elephant. html: |-

    I saw a ship. It ate my elephant.

    --- name: extended blockquote containing block start in: |- bq.. I saw a ship. It ate my elephant. When the elephant comes to take a p. you... html: |-

    I saw a ship. It ate my elephant.

    When the elephant comes to take a p. you…

    --- name: notextile block in: |- Some text:
      Some code
      
    Some more text. html: |-

    Some text:

      Some code
      

    Some more text.

    --- name: notextile block containing block start in: |- notextile. I saw a ship. It ate my elephant. html: |- I saw a ship. It ate my elephant. valid_html: false --- name: extended notextile block containing block start in: |- notextile.. I saw a ship. It ate my elephant. When the elephant comes to take a p. you... html: |- I saw a ship. It ate my elephant. When the elephant comes to take a p. you... valid_html: false --- name: pre block containing block start in: |- pre. I saw a ship. It ate my elephant. html: |-
    I saw a ship. It ate my elephant.
    --- name: extended pre block containing block start in: |- pre.. I saw a ship. It ate my elephant. When the elephant comes to take a p. you... html: |-
    I saw a ship. It ate my elephant.
    When the elephant comes to take a p. you...
    --- name: html tags desc: 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. in: |- I am very serious.
        I am very serious.
      
    html: |-

    I am very serious.

        I am <b>very</b> serious.
      
    --- name: line breaks desc: Line breaks are converted to HTML breaks. in: |- I spoke. And none replied. html: |-

    I spoke.
    And none replied.

    html_no_breaks: |-

    I spoke. And none replied.

    lite_mode_html: |- I spoke.
    And none replied. --- name: curly quotes desc: Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye. in: "\"Observe!\"" html:

    “Observe!”

    --- name: quotes contained in multi-paragraph quotes in: |- "I first learned about this thing called "Redcloth" several years ago. "It's wonderful." html: |-

    “I first learned about this thing called “Redcloth” several years ago.

    “It’s wonderful.”

    --- name: double hyphens desc: Double hyphens are replaced with an em-dash. in: Observe--very nice! html:

    Observe—very nice!

    latex: "Observe---very nice!\n\n" --- name: double hyphens with spaces desc: Double hyphens are replaced with an em-dash and surrounding spaces are preserved. in: Observe -- very nice! html:

    Observe — very nice!

    latex: "Observe --- very nice!\n\n" --- name: parenthetical phrase set off with em dashes desc: Sentences with two em dashes should not turn them into strikethroughs in: An emdash indicates a parenthetical thought--like this one--which is set apart from the rest of a sentence. html: "

    An emdash indicates a parenthetical thought—like this one—which is set apart from the rest of a sentence.

    " latex: "An emdash indicates a parenthetical thought---like this one---which is set apart from the rest of a sentence.\n\n" --- name: parenthetical phrase set off with em dashes surrounded by spaces desc: Sentences with two em dashes should not turn them into strikethroughs in: An emdash indicates a parenthetical thought -- like this one -- which is set apart from the rest of a sentence. html: "

    An emdash indicates a parenthetical thought — like this one — which is set apart from the rest of a sentence.

    " latex: "An emdash indicates a parenthetical thought --- like this one --- which is set apart from the rest of a sentence.\n\n" --- name: single hyphens with spaces desc: Single hyphens are replaced with en-dashes if they are surrounded by spaces. in: Observe - tiny and brief. html:

    Observe – tiny and brief.

    latex: "Observe -- tiny and brief.\n\n" --- name: midword hyphens desc: Single hyphens are left alone if not surrounded by spaces. in: Observe the nicely-done hyphen. html:

    Observe the nicely-done hyphen.

    --- name: ellipses desc: Triplets of periods become an ellipsis. in: Observe... html:

    Observe…

    lite_mode_html: Observe… --- name: dimension sign desc: The letter 'x' becomes a dimension sign when used between digits. in: "Observe: 2x3." html: "

    Observe: 2×3.

    " latex: "Observe: $2\\times3$.\n\n" --- name: dimension sign with space after in: "The room is 2x3 inches big." html: "

    The room is 2×3 inches big.

    " latex: "The room is $2\\times3$ inches big.\n\n" --- name: dimension sign with spaces in: "Observe: 2 x 4." html: "

    Observe: 2 × 4.

    " latex: "Observe: $2 \\times 4$.\n\n" --- name: dimension signs chained in: "Observe: 2x3x4." html: "

    Observe: 2×3×4.

    " lite_mode_html: "Observe: 2×3×4." latex: "Observe: $2\\times3\\times4$.\n\n" --- name: dimension signs with double primes in: 'My mouse: 2.5" x 4".' html: '

    My mouse: 2.5″ × 4″.

    ' latex: "My mouse: $2.5'' \\times 4''$.\n\n" --- name: dimension signs with single primes in: "My office: 5' x 4.5'." html: "

    My office: 5′ × 4.5′.

    " latex: "My office: $5' \\times 4.5'$.\n\n" --- name: trademark and copyright desc: Conversion of trademark and copyright symbols. in: one(TM), two(R), three(C). html:

    one™, two®, three©.

    lite_mode_html: one™, two®, three©. --- name: headers desc: To make an entire paragraph into a Header, place “hn.” at its beginning, where n is a number from 1-6. in: h3. Header 3 html:

    Header 3

    --- name: blockquote desc: To make an entire paragraph into a block quotation, place “bq.” before it. in: |- Any old text bq. A block quotation. Any old text html: |-

    Any old text

    A block quotation.

    Any old text

    --- name: footnote reference desc: Numeric references within text to footnotes appear between square brackets. in: This is covered elsewhere[1]. html:

    This is covered elsewhere1.

    --- name: footnote desc: 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. in: fn1. Down here, in fact. html:

    1 Down here, in fact.

    --- name: em desc: Emphasis to text is added by surrounding a phrase with underscores. In HTML, this often appears as italics. in: I _believe_ every word. html:

    I believe every word.

    lite_mode_html: "I believe every word." --- name: strong desc: Strength can be give to text by surrounding with asterisks. In HTML, this strength appears as bold. in: And then? She *fell*! html:

    And then? She fell!

    lite_mode_html: "And then? She fell!" --- name: strong phrase beginning with a number desc: A strong phrase at the beginning of a line that begins with a number should not be recognized as a ul with a start value (no such thing) in: "*10 times as many*" html: "

    10 times as many

    " --- name: force bold italics desc: Both italics and bold can be forced by doubling the underscores or asterisks. in: |- I __know__. I **really** __know__. html: |-

    I know.
    I really know.

    --- name: citation desc: Use double question marks to indicate citation. The title of a book, for instance. in: ??Cat's Cradle?? by Vonnegut html:

    Cat’s Cradle by Vonnegut

    --- name: code phrases desc: Code phrases can be surrounded by at-symbols. in: Convert with @r.to_html@ html:

    Convert with r.to_html

    lite_mode_html: Convert with r.to_html --- name: code phrases not created with multiple email addresses in: Please email why@domain.com or jason@domain.com. html:

    Please email why@domain.com or jason@domain.com.

    --- name: del desc: To indicate a passage which has been deleted, surround the passage with hypens. in: I'm -sure- not sure. html: "

    I’m sure not sure.

    " --- name: del beginning a phrase in: -delete- html: "

    delete

    " --- name: ins desc: Pluses around a passage indicate its insertion. in: You are a +pleasant+ child. html:

    You are a pleasant child.

    --- name: superscript desc: To superscript a phrase, surround with carets. in: a ^2^ + b ^2^ = c ^2^ html:

    a 2 + b 2 = c 2

    --- name: parenthetical superscript phrase in: '^(image courtesy NASA)^' html: '

    (image courtesy NASA)

    ' --- name: subscript desc: To subscript, surround with tildes. in: log ~2~ x html:

    log 2 x

    --- name: parenthetical subscript phrase in: '~(image courtesy NASA)~' html: '

    (image courtesy NASA)

    ' --- name: tight superscript and subscript desc: if you want your superscript or subscript to not be surrounded by spaces, you must use square brackets in: f(x, n) = log[~4~]x[^n^] html: '

    f(x, n) = log4xn

    ' --- name: span desc: Lastly, if you find yourself needing to customize the style of a passage, use percent symbols to translate the passage as an HTML span. in: I'm %unaware% of most soft drinks. html:

    I’m unaware of most soft drinks.

    --- name: style span desc: This way, you can apply style settings, as described in the next section to arbitrary phrases. in: |- I'm %{color:red}unaware% of most %{font-size:0.5em;}soft drinks%. html: |-

    I’m unaware
    of most soft drinks.

    lite_mode_html: |- I’m unaware
    of most soft drinks. --- name: percent sign desc: though percent signs indicate a span, they shouldn't be overly greedy. in: |- http://blah.com/one%20two%20three (min)5%-95%(max) html: |-

    http://blah.com/one%20two%20three
    (min)5%-95%(max)

    --- name: css class desc: 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. in: p(example1). An example html:

    An example

    --- name: css id desc: An element ID can be given by prefixing the ID with a pound symbol and using it in place of the class. in: p(#big-red). Red here html:

    Red here

    --- name: css id with initial uppercase desc: CSS IDs are supposed to be lowercase, but Textile understands the invalid capitalization nonetheless in: p(#Foo). bar html:

    bar

    --- name: css class uppercase desc: CSS classes are supposed to be lowercase, but Textile understands the invalid capitalization nonetheless in: p(fooBar). baz html:

    baz

    --- name: class and id combined desc: Class and ID can be combined by placing the class first. in: p(example1#big-red2). Red here html:

    Red here

    --- name: css style desc: Style settings can be provided directly by surrounding them in curly braces. in: p{color:blue;margin:30px;font-size:120%;font-family:'Comic Sans'}. Spacey blue html:

    Spacey blue

    --- name: language designations desc: Language designations can be given between angel brackets. in: p[fr]. rouge html:

    rouge

    --- name: block attributes on phrase modifiers desc: All block attributes can be applied to phrases as well by placing them just inside the opening modifier. in: |- I seriously *{color:red}blushed* when I _(big)sprouted_ that corn stalk from my %[es]cabeza%. html: |-

    I seriously blushed
    when I sprouted that
    corn stalk from my
    cabeza.

    --- name: inline attributes preceded by text are treated as literal desc: modifiers must come first, without anything before them in: |- I *seriously {color:red}blushed* when I _first (big)sprouted_ that corn stalk from my %grande [es]cabeza%. html: |-

    I seriously {color:red}blushed
    when I first (big)sprouted that
    corn stalk from my
    grande [es]cabeza.

    --- name: align justified desc: Text inside blocks can be aligned in four basic ways. in: p<>. justified html:

    justified

    --- name: indentation desc: 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. in: p))). right ident 3em html:

    right ident 3em

    --- name: indentation and alignment desc: Identation may be coupled with alignment. in: h2()>. Bingo. html:

    Bingo.

    --- name: many modifiers combined desc: And, furthermore, coupled with language settings and CSS styles. in: h3()>[no]{color:red}. Bingo html:

    Bingo

    --- name: code blocks desc: 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. in: |
      
        a.gsub!( /
      
    html: |-
      
        a.gsub!( /</, '' )
      
      
    --- name: div tags desc: You may also choose to surround sections with div tags to separate your document into sections. Instiki uses this technique to float a sidebar to the right. in: |
    h3. Sidebar "Hobix":http://hobix.com/ "Ruby":http://ruby-lang.org/
    The main text of the page goes here and will stay to the left of the sidebar. html: |-

    Sidebar

    Hobix
    Ruby

    The main text of the page goes here and will stay to the left of the sidebar.

    --- name: numbered list desc: To make a numbered list, place each item in its own paragraph, preceded by ”#”. in: |- # A first item # A second item # A third html: |-
    1. A first item
    2. A second item
    3. A third
    --- name: nested numbered lists desc: These lists may be nested by increasing the number of pound symbols preceding child entries. in: |- # Fuel could be: ## Coal ## Gasoline ## Electricity # Humans need only: ## Water ## Protein html: |-
    1. Fuel could be:
      1. Coal
      2. Gasoline
      3. Electricity
    2. Humans need only:
      1. Water
      2. Protein
    --- name: bulleted list desc: Bulleted lists use an asterisk in place of the pound. in: |- * A first item * A second item * A third html: |-
    • A first item
    • A second item
    • A third
    --- name: nested bulleted lists desc: These lists may be nested in like manner. in: |- * Fuel could be: ** Coal ** Gasoline ** Electricity * Humans need only: ** Water ** Protein html: |-
    • Fuel could be:
      • Coal
      • Gasoline
      • Electricity
    • Humans need only:
      • Water
      • Protein
    --- name: links desc: Basic links are comprised of a phrase which is linked to a URL. Place the descriptive phrase in quotation marks. Follow it immediately by a colon and the URL. in: I searched "Google":http://google.com. html:

    I searched Google.

    lite_mode_html: I searched Google. --- name: link aliases desc: 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. in: |- I am crazy about "Hobix":hobix and "it's":hobix "all":hobix I ever "link to":hobix! [hobix]http://hobix.com html: |-

    I am crazy about Hobix
    and it’s all I ever
    link to!

    --- name: image desc: You can embed an image in your Textile document by surrounding its URL with exclamation marks. in: "!http://hobix.com/sample.jpg!" html:

    lite_mode_html: --- name: image title desc: A title for the image can also be provided in parens, just before the closing exclamation. in: "!openwindow1.gif(Bunny.)!" html:

    Bunny.

    --- name: image links desc: Links can be attached to images with a colon. in: "!openwindow1.gif!:http://hobix.com/" html:

    --- name: image alignments desc: Alignments can be applied as well to images. in: |- !>obake.gif! And others sat all round the small machine and paid it to sing to them. html: |-

    And others sat all round the small
    machine and paid it to sing to them.

    --- name: acronym definitions desc: Definitions for acronyms can be provided by following an acronym with its definition in parens. in: We use CSS(Cascading Style Sheets). html:

    We use CSS.

    lite_mode_html: We use CSS. no_span_caps_html:

    We use CSS.

    --- name: two-letter acronyms in: It employs AI(artificial intelligence) processing. html:

    It employs AI processing.

    --- name: tables desc: Simple tables can be built by separating fields with pipe characters in: |- | name | age | sex | | joan | 24 | f | | archie | 29 | m | | bella | 45 | f | html: |-
    name age sex
    joan 24 f
    archie 29 m
    bella 45 f
    --- name: table headers desc: Specify header cells by marking them with an underscore and period. in: |- |_. name |_. age |_. sex | | joan | 24 | f | | archie | 29 | m | | bella | 45 | f | html: |-
    name age sex
    joan 24 f
    archie 29 m
    bella 45 f
    --- name: table cell attributes desc: The period used above marks the end of a cell’s attributes. Other attributes can be applied as well. in: |- |_. attribute list | |<. align left | |>. align right| |=. center | |<>. justify | |^. valign top | |~. bottom | html: |-
    attribute list
    align left
    align right
    center
    justify
    valign top
    bottom
    --- name: table colspan desc: You can also specify colspans with a backslash, followed by the cell width. in: |- |\2. spans two cols | | col 1 | col 2 | html: |-
    spans two cols
    col 1 col 2
    --- name: table rowspan desc: Rowspan is specified by a forward slash, followed by the row height. in: |- |/3. spans 3 rows | a | | b | | c | html: |-
    spans 3 rows a
    b
    c
    --- name: block attributes applied to table cells desc: All block attributes can be applied to table cells as well. in: "|{background:#ddd}. Grey cell|" html: |-
    Grey cell
    --- name: block attributes applied to a table desc: Table-wide attributes can be applied before the first row of the table. On its own line, followed by a period. in: |- table{border:1px solid black}. |This|is|a|row| |This|is|a|row| html: |-
    This is a row
    This is a row
    --- name: block attributes applied to a table row desc: 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. in: |- |This|is|a|row| {background:#ddd}. |This|is|grey|row| html: |-
    This is a row
    This is grey row
    --- name: extended block followed by pre block in: |- div.. Just a test. Second div. pre. A pre block ends it. html: |-
    Just a test.
    Second div.
    A pre block ends it.
    --- name: extended block followed by blockquote in: |- div.. Just a test. Second div. bq. A blockquote ends it. html: |-
    Just a test.
    Second div.

    A blockquote ends it.

    --- name: extended block followed by block code in: |- div.. Just a test. Second div. bc. A blockcode ends it. html: |-
    Just a test.
    Second div.
    A blockcode ends it.
    --- name: extended block followed by notextile block in: |- div.. Just a test. Second div. notextile. A notextile block ends it. html: |-
    Just a test.
    Second div.
    A notextile block ends it. valid_html: false --- name: simple parentheses in: |- before (in parens) after html: |-

    before (in parens) after

    --- name: parentheses in underscores in: |- before _(in parens)_ after html: |-

    before (in parens) after

    --- name: parentheses in asterisks in: |- before *(in parens)* after html: |-

    before (in parens) after

    --- name: parentheses in underscores in quotes in: |- "before _(in parens)_ after" html: |-

    “before (in parens) after”

    --- name: underscores in parentheses in: |- one _two three_ (four _five six_) seven html: |-

    one two three (four five six) seven

    --- name: underscores in parentheses in quotes in: |- "one _two three_ (four _five six_) seven" html: |-

    “one two three (four five six) seven”

    --- name: underscores in parentheses 2 in: |- one (two _three four_) five html: |-

    one (two three four) five

    --- name: underscores in parentheses in quotes 2 in: |- "one (two _three four_) five" html: |-

    “one (two three four) five”

    --- name: caps in parentheses desc: Uppercase words of three or more characters that are in parentheses should be recognized as well as those not in parentheses. in: IBM or (HAL) html:

    IBM or (HAL)

    no_span_caps_html:

    IBM or (HAL)

    --- name: phrase modifiers in parentheses desc: Inline modifiers are expected to work in parentheses as well. in: |- __Amanita__s are mushrooms. Lungworts (__Lobaria__) are lichens. Blah blah (normal text **bold**) blah. html: |-

    __Amanita__s are mushrooms.
    Lungworts (Lobaria) are lichens.
    Blah blah (normal text bold) blah.

    --- name: square brackets are preserved in: |- citation ["(Berk.) Hilton"], see [Papers "blah blah."] html: |-

    citation [“(Berk.) Hilton”], see
    [Papers “blah blah.”]

    --- name: horizontal rule using asterisks in: |- Just some *** text *** Some more text. html: |-

    Just some * text


    Some more text.

    --- name: horizontal rule using more than three asterisks in: |- Just some **** text **** Some more text. html: |-

    Just some **** text


    Some more text.

    --- name: horizontal rule using dashes in: |- Just some --- text --- Some more text. html: |-

    Just some - text


    Some more text.

    --- name: horizontal rule using underscores in: |- Just some ___ text ___ Some more text. html: |-

    Just some ___ text


    Some more text.

    --- name: lang attribute cannot contain square brackets in: "some @[[code]]@" html: "

    some [[code]]

    " --- name: pre blocks preserve leading whitespace in: |- pre. Text in a pre block is displayed in a fixed-width font. It preserves s p a c e s, line breaks and ascii bunnies. html: |-
         Text in a pre block
      is displayed in a fixed-width
           font. It preserves
        s p a c e s, line breaks
           and ascii bunnies.
    --- name: code blocks preserve leading whitespace in: |- bc. false } else { html: |-
      false
      } else {
    --- name: citation ending with question mark in: "??What the Story Morning Glory???" html: |-

    What the Story Morning Glory?

    --- name: citation including question mark in: "??What's the Matter with Kansas? How Conservatives Won the Heart of America?? is a great book!" html: |-

    What’s the Matter with Kansas? How Conservatives Won the Heart of America is a great book!

    --- name: emphasized word including underscore in: |- _trythis_ it will keep the empahsis. _and_this_too_ it should keep the emphasis but does not with redcloth. html: |-

    trythis it will keep the empahsis.
    and_this_too it should keep the emphasis but does not with redcloth.

    --- name: code captures spaces when made explicit with square brackets in: "Start a paragraph with [@p. @] (that's p, a period, and a space)." html: "

    Start a paragraph with p. (that’s p, a period, and a space).

    " --- name: unrecognized block starting with t not eaten in: "tel. 0 700 123 123" html: "

    tel. 0 700 123 123

    " --- name: bolded number at start of phrase in: "*22 watermelons* is my limit" html: "

    22 watermelons is my limit

    " --- name: bolded paragraph in: "*- I would expect it to be a bolded paragraph.*" html:

    - I would expect it to be a bolded paragraph.

    redcloth-4.3.3/spec/fixtures/code.yml000066400000000000000000000203651452062100400175650ustar00rootroot00000000000000--- name: inline code in: 'This is an empty dictionary: @{}@' html: '

    This is an empty dictionary: {}

    ' latex: "This is an empty dictionary: \\verb@{}@\n\n" --- name: inline snip in: "The ```command``` is here." html: "

    The

    command
    \n is here.

    " latex: "The \\verb`command` is here.\n\n" --- name: inline code escapement in: 'Please type @cat "file.txt" > otherfile.txt@ at the prompt.' html: '

    Please type cat "file.txt" > otherfile.txt at the prompt.

    ' latex: "Please type \\verb@cat \"file.txt\" > otherfile.txt@ at the prompt.\n\n" --- name: inline code escapement with digits in: |- Regex-based string substitution with Ruby's gsub!: @"123<789".gsub!(/ "123789"@ html: |-

    Regex-based string substitution with Ruby’s gsub!: "123<789".gsub!(/</, "") => "123789"

    latex: |+ Regex-based string substitution with Ruby's gsub!: \verb@"123<789".gsub!(/ "123789"@ --- name: inlne code escapement describing textile paragraph styling in: 'This paragraph is aligned left but if you add this: @p>.@ to the beginning it will be aligned right.' html: '

    This paragraph is aligned left but if you add this: p>. to the beginning it will be aligned right.

    ' latex: "This paragraph is aligned left but if you add this: \\verb@p>.@ to the beginning it will be aligned right.\n\n" --- name: escapes code snippet containing html tag in: 'At the top of each page, please put @

    Title

    @ in the HTML.' html: '

    At the top of each page, please put <h2>Title</h2> in the HTML.

    ' latex: "At the top of each page, please put \\verb@

    Title

    @ in the HTML.\n\n" --- name: escaping in blockcode in: 'bc. This is within a block of code, so < and > should be entities. You can talk about a

    tag if you wish and it will be properly escaped.' html: '

    This is within a block of code, so < and > should be entities.  You can talk about a <p class="foo"> tag if you wish and it will be properly escaped.
    ' --- name: escaping in pre in: '
    This is within a block of code, so < and > should be entities.  You can talk about a 

    tag in pre tags too.

    ' html: '
    This is within a block of code, so < and > should be entities.  You can talk about a <p class="foo"> tag in pre tags too.
    ' --- name: escaping in normal text in: |- This is a regular paragraph. AT&T. £38 > $38. html: |-

    This is a regular paragraph. AT&T. £38 > $38.

    latex: "This is a regular paragraph. AT\\&T. \\pounds{}38 \\textgreater{} \\$38.\n\n" --- name: preservation of existing entities in: "Math fact: 3 < 5 & 5 > 3 but £6 > $6. Oh, and 2 ÷ 4 is ½." html: "

    Math fact: 3 < 5 & 5 > 3 but £6 > $6. Oh, and 2 ÷ 4 is ½.

    " latex: "Math fact: 3 \\textless{} 5 \\& 5 \\textgreater{} 3 but \\pounds{}6 \\textgreater{} \\$6. Oh, and 2 \\textdiv{} 4 is \\sfrac{1}{2}.\n\n" --- name: escaping of existing entities in blockcode in: "bc. Math fact: 3 < 5 & 5 > 3 but £5 > $5." html: "
    Math fact: 3 &lt; 5 &amp; 5 &gt; 3 but &pound;5 &#62; $5.
    " latex: "\\begin{verbatim}\nMath fact: 3 < 5 & 5 > 3 but £5 > $5.\\end{verbatim}\n" --- name: no formatting within pre in: |-
      
      # *test*
      __not italics__
      no hard breaks
      
      
    html: |-
      
      # *test*
      __not italics__
      no hard breaks
      
      
    --- name: no formatting within blockcode in: |- bc. __not italics__ html: |-
    __not italics__
    --- name: double-equals as inline notextile in: |- p. Regular paragraph ==Escaped portion -- will not be formatted by Textile at all== p. Back to normal. html: |-

    Regular paragraph

    Escaped portion -- will not be formatted by Textile at all

    Back to normal.

    --- name: notextile tags in: |- # *test* html: |- # *test* valid_html: false --- name: unfinished notextile tag in: |- # *test* html: |-

    1. test
    valid_html: false --- name: unfinished script tag in: |- filtered_html:

    Just a little harmless xss <script src=http://ha.ckers.org/xss.js></script>

    --- name: escapes partial inline script tag desc: The end tag is malformed, but it must be escaped since a browser would recognize it in: Just a little harmless xss Just a little harmless xss <script src=http://ha.ckers.org/xss.js></script

    valid_html: false --- name: escapes partial scanner-level script tag desc: The end tag is malformed, but it must be escaped since a browser would recognize it anyway. in: filtered_html: '<hr />' valid_html: false --- name: processes text beginning with space in: ' This should be escaped: ' filtered_html: 'This should be <b>escaped</b>: <script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script>' --- name: processes script tags beginning with space in: ' ' filtered_html: '<script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script>' --- name: processes text in notextile tags in: |- This should be escaped: filtered_html: |- This should be <b>escaped</b>: <script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script> --- name: processes text in inline notextile tags in: |- This should be escaped: filtered_html: |-

    This should be <b>escaped</b>: <script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script>

    --- name: escapes script tags in: |- filtered_html: |- <script type="text/javascript"> alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye"); </script> --- name: escapes HTML entities within script tags in: |- filtered_html: |- <script type="text/javascript"> <!-- document.write("Hello World!") //--> </script> --- name: escapes inline html tags in: |- p. Letting people inject their own HTML can be dangerous!. filtered_html: |-

    Letting people inject their own HTML can be <em>dangerous</em>!.

    --- name: escapes html in comments in: |- p. You can't have people injecting HTML into . filtered_html: |-

    You can’t have people injecting HTML into <!-- <b>comments</b>! -->.

    --- name: escapes html in inline code tags in: |- p. I have some awesome code here. filtered_html: |-

    I have some <em>awesome</em> code here.

    --- name: escapes html notextile block in: |- notextile. This is a notextile block. filtered_html: |- This is a <em>notextile</em> block. --- name: escapes html in pre tags in: |-
      This should be escaped.
      
    filtered_html: |-
      This should be <em>escaped</em>.
      
    --- name: escapes html in: |-
    This should be escaped
    filtered_html: |- <div>This should be escaped</div> --- name: escapes html in html in: |-
    This should be bold
    filtered_html: |- <div>This should be <b>bold</b></div> --- in: Here's a bad image filtered_html:

    Here’s a bad image <img src="JaVaScRiPt:alert('XSS');">

    --- in: Just some random > and < characters, but also a
    tag. filtered_html:

    Just some random > and < characters, but also a <br/> tag.

    --- in: |- Quotes outside "pre" tags are escaped. Tags are completely escaped outside pre tags.
      
        # only < and > are escaped inside pre tags.  "Quotes" remain.
    
        
    a = 1
    Bad code here.
    filtered_html: |-

    Quotes outside “pre” tags are escaped.

    <a href="test">Tags are completely escaped outside pre tags.</a>

      
        # only < and > are escaped inside pre tags.  "Quotes" remain.
    
        <div>
          a = 1
        </div>
    
        Bad code here.
    
        <script language="JavaScript">
          window.open( "abfiltered_html:blank" );
        </script>
      
      
    --- in: /me <3 beer filtered_html:

    /me <3 beer

    redcloth-4.3.3/spec/fixtures/filter_pba.yml000066400000000000000000000015751452062100400207640ustar00rootroot00000000000000--- name: filter styles in: "p{color:red}. Test" style_filtered_html: "

    Test

    " --- name: filter classes in: "p(myclass). Test" class_filtered_html: "

    Test

    " --- name: filter ids in: "p(#myid). Test" id_filtered_html: "

    Test

    " --- name: correct application of double quote entity when using styles in: 'p{background: #white url("../chunky_bacon.jpg")}. The quick brown "cartoon" fox jumps over the lazy dog' html: '

    The quick brown “cartoon” fox jumps over the lazy dog

    ' --- name: correct application of single quote entity when using styles in: "p{background: #white url('../chunky_bacon.jpg')}. The quick brown 'cartoon' fox jumps over the lazy dog" html: '

    The quick brown ‘cartoon’ fox jumps over the lazy dog

    ' redcloth-4.3.3/spec/fixtures/html.yml000066400000000000000000000262471452062100400176240ustar00rootroot00000000000000--- in: '*this is strong*' html: '

    this is strong

    ' --- in: '*this test is strong*' html: '

    this test is strong

    ' --- in: 'A simple ' html: '

    A simple

    ' --- in: 'A simple ' html: '

    A simple

    ' --- name: no breaks between HTML elements in: |-
    • You can put HTML code right in Textile.
    • It will not insert a break between elements
    • or wrap it all in a p tag.
    • It should insert a hard break if you break.
    html: |-
    • You can put HTML code right in Textile.
    • It will not insert a break between elements
    • or wrap it all in a p tag.
    • It should insert a hard break
      if you break.
    --- name: line breaks desc: Explicit HTML line breaks are not double-broken in: |- I spoke.
    And none replied. html: |-

    I spoke.
    And none replied.

    html_no_breaks: |-

    I spoke.
    And none replied.

    lite_mode_html: |- I spoke.
    And none replied. --- name: mixing of textile and XHTML in: |- test Regular *paragraph*.
    This is one paragraph. This is another. !an/image.jpg! * A list * in a div.
    Another paragraph. html: |-

    test

    Regular paragraph.

    This is one paragraph.

    This is another.

    • A list
    • in a div.

    Another paragraph.

    --- name: mixing of textile and XHTML in: |- test Regular *paragraph*. html: |-

    test

    Regular paragraph.

    --- name: wraps inline HTML in paragraphs in: 'asd blabla "google":http://google.com' html: '

    asd blabla google

    ' --- name: self closing XHTML with following text not recognized comment: it will not recognize the self-closing block element in: '
    this has been a horizontal rule' html: '


    this has been a horizontal rule

    ' valid_html: false --- name: self closing HTML with following text not recognized comment: it will not recognize the self-closing block element in: '
    that was a horizontal rule too' html: '
    that was a horizontal rule too' valid_html: false --- name: preserves block html in: |-
    123 Anystreet

    Explicit paragraph

    html: |-
    123 Anystreet

    Explicit paragraph

    valid_html: false --- name: preserves empty block standalone elements in: "
    " html: "
    " valid_html: false --- name: unfinished standalone HTML in: |-
    This is some div text. More div text. html: |-

    This is some div text.

    More div text.

    valid_html: false --- name: unfinished HTML block in: |-
    This is some div text. More div text. html: |-
    This is some div text.

    More div text. valid_html: false --- name: complex example from real life in: |-
    h1. Contact Please contact us if you have questions or need help making arrangements.
    h2. Tom (540) 555-1212 h3. Jerry (540) 555-1234
    html: |-

    Contact

    Please contact us if you have questions or need help making arrangements.

    Tom

    (540) 555-1212

    Jerry

    (540) 555-1234

    valid_html: false --- name: embedded javascript in: |- html: |- --- name: inline embedded javascript in: |- Please email me at . html: |-

    Please email me at .

    --- name: HTML end tag can end paragraph in: |-
    This is a paragraph.
    html: |-

    This is a paragraph.

    --- name: HTML end tag can end blockquote in: |-
    bq. This is a blockquote.
    html: |-

    This is a blockquote.

    --- name: before table does not affect table in: |-
    h2. heading |a|b|c| |d|e|f| html: |-

    heading

    a b c
    d e f
    --- name: tilde in innerHTML is not altered in: 'http://foo.com/bar?something=1~2~3' html: '

    http://foo.com/bar?something=1~2~3

    ' --- name: empty block in: |-
    html: |-
    --- name: objects in paragraphs are not modified in: |-

    html: |-

    --- name: in code escaped properly in: "
    some bold text
    " html: "
    some <b>bold</b> text
    " --- name: in code with class attribute escaped properly in: "
    some bold text
    " html: "
    some <b>bold</b> text
    " --- name: notextile beginning the line in: |- Sir Bobby Robson, is a famous footballer html: |-

    Sir Bobby Robson, is a famous footballer

    --- name: br tag with class in: "br(clear). " html: "
    " --- name: hr tag with class in: "hr(clear). " html: "
    " redcloth-4.3.3/spec/fixtures/images.yml000066400000000000000000000356451452062100400201270ustar00rootroot00000000000000--- in: This is an !image.jpg! html:

    This is an

    latex: |+ This is an \begin{figure} \centering \includegraphics[]{image.jpg} \end{figure} --- in: This is an !image.jpg(with alt text)! html:

    This is an with alt text

    latex: |+ This is an \begin{figure} \centering \includegraphics[]{image.jpg} \caption{with alt text} \end{figure} --- in: This is an !http://example.com/i/image.jpg! html:

    This is an

    # Note that we are removing remote links fro security reasons for now latex: |+ This is an --- in: This is an !http://example.com/i/image.jpg#a1! html:

    This is an

    --- in: This is an !image.jpg!. html:

    This is an .

    --- in: This is an !image.jpg(with alt text)!. html:

    This is an with alt text.

    --- in: This is an !http://example.com/i/image.jpg!. html:

    This is an .

    --- in: This is an !http://example.com/i/image.jpg#a1!. html:

    This is an .

    --- in: This is not an image!!! html:

    This is not an image!!!

    --- in: This is not an! image! html:

    This is not an! image!

    --- in: This is an !http://example.com/i/image.jpg!:#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:#a html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/ html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/#a html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10 html:

    This is an

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b. html:

    This is an .

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1. html:

    This is an .

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a. html:

    This is an .

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1. html:

    This is an .

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10. html:

    This is an .

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b, but this is not. html:

    This is an , but this is not.

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1, but this is not. html:

    This is an , but this is not.

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a, but this is not. html:

    This is an , but this is not.

    --- in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1, but this is not. html:

    This is an , but this is not.

    --- in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not. html:

    (This is an ) This is not.

    --- in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b) This is not. html:

    (This is an ) This is not.

    --- in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1) This is not. html:

    (This is an ) This is not.

    --- in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a) This is not. html:

    (This is an ) This is not.

    --- in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1) This is not. html:

    (This is an ) This is not.

    --- in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not. html:

    (This is an ) This is not.

    --- name: image with relative src with dot in: "!../../image.jpg!" html:

    latex: |+ \begin{figure} \centering \includegraphics[]{../../image.jpg} \end{figure} --- name: image with class in: "!(myclass)image.jpg!" html:

    --- name: image with class and dotspace in: "!(myclass). image.jpg!" html:

    --- name: image with class and relative src with dots in: "!(myclass)../../image.jpg!" html:

    --- name: image with class and dotspace and relative src with dots in: "!(myclass). ../../image.jpg!" html:

    --- name: image with style in: "!{color:red}image.jpg!" html:

    --- name: image with style and dotspace in: "!{color:red}. image.jpg!" html:

    --- name: image attributes has ampersand html entity in alt and title in: "!/pictures/cat_and_fox.jpg(Trady Blix & The cartoon fox)!" html: '

    Trady Blix & The cartoon fox

    ' latex: |+ \begin{figure} \centering \includegraphics[]{/pictures/cat_and_fox.jpg} \caption{Trady Blix \& The cartoon fox} \end{figure} --- name: image attributes has double quote html entity in alt and title in: '!/pictures/bacon.jpg(The fox said: "Have some chunky bacon")!' html: '

    The fox said: "Have some chunky bacon"

    ' latex: |+ \begin{figure} \centering \includegraphics[]{/pictures/bacon.jpg} \caption{The fox said: "Have some chunky bacon"} \end{figure} --- name: image attributes has single quote html entity in alt and title in: "!/pictures/bacon.jpg(The fox said: 'Have some chunky bacon')!" html: '

    The fox said: 'Have some chunky bacon'

    ' --- name: in square brackets in: This is an [!image.jpg!] you see. html:

    This is an you see.

    --- name: with link in square brackets in: This is an [!image.jpg!:http://example.com/] you see. html:

    This is an you see.

    --- name: url containing parentheses in: "!http://commons.wikimedia.org/wiki/File:Rubis_sur_calcite_2(Vietnam).jpg!" html: |-

    --- name: with alt and url containing parentheses in: "!http://commons.wikimedia.org/wiki/File:Rubis_sur_calcite_2(Vietnam).jpg(a big rock)!" html: |-

    a big rock

    --- name: with link that contains parentheses in: "!image.jpg(Alt text with (parentheses).)!" html: |-

    Alt text with (parentheses).

    --- name: with link and title and text afterward in: "!/image_r.jpg(description)!:image.jpg text." html: |-

    description text.

    redcloth-4.3.3/spec/fixtures/instiki.yml000066400000000000000000000036551452062100400203300ustar00rootroot00000000000000--- # Bugs filed at http://www.instiki.org/show/BugReports in: |- _Hi, Joe Bob?, this should all be in italic!_ html: |-

    Hi, Joe Bob?, this should all be in italic!

    --- in: '*this span is strong*' html: '

    this span is strong

    ' --- in: '*this Camel Thing? is strong*' html: '

    this Camel Thing? is strong

    ' --- in: '_this span is italic_' html: '

    this span is italic

    ' --- in: '%{color:red}nested span because of Camel Word?%' html: '

    nested span because of Camel Word?

    ' --- in: |- h2. Version History * "Version 0.0":http://www.threewordslong.com/render-0-8-9b.patch - Early version using MD5 hashes. * "Version 0.1":http://www.threewordslong.com/chunk-0-1.patch.gz - First cut of new system. Much cleaner. * "Version 0.2":http://www.threewordslong.com/chunk-0-2.patch.gz - Fixed problem with "authors" page and some tests. html: |-

    Version History

    • Version
      0.0
      – Early version using MD5 hashes.
    • Version
      0.1
      – First cut of new system. Much cleaner.
    • Version 0.2 – Fixed problem with “authors” page and some tests.
    --- in: "--richSeymour --whyTheLuckyStiff" html: "

    —richSeymour —whyTheLuckyStiff

    " redcloth-4.3.3/spec/fixtures/links.yml000066400000000000000000000325261452062100400177750ustar00rootroot00000000000000--- in: '"link text":#1' html:

    link text

    --- in: '"link text":#a' html:

    link text

    --- in: '"link text":#a1' html:

    link text

    --- in: '"link text":#a10' html:

    link text

    --- in: '"link text":index.html' html:

    link text

    --- in: '"link text":index.html#1' html:

    link text

    --- in: '"link text":index.html#a' html:

    link text

    --- in: '"link text":index.html#a1' html:

    link text

    --- in: '"link text":index.html#a10' html:

    link text

    --- in: '"link text":http://example.com/' html:

    link text

    --- in: '"link text":http://example.com/#1' html:

    link text

    --- in: '"link text":http://example.com/#a' html:

    link text

    --- in: '"link text":http://example.com/#a1' html:

    link text

    --- in: '"link text":http://example.com/#a10' html:

    link text

    --- in: '"link text":http://example.com/index.html' html:

    link text

    --- in: '"link text":http://example.com/index.html#a' html:

    link text

    --- in: '"link text":http://example.com/index.html#1' html:

    link text

    --- in: '"link text":http://example.com/index.html#a1' html:

    link text

    --- in: '"link text":http://example.com/index.html#a10' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar#a' html:

    link text

    --- in: '"link & text":http://example.com/?foo=bar#a' html:

    link & text

    --- in: '"link text":http://example.com/?foo=bar#1' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar#a1' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar#a10' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar&a=b' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar&a=b#1' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar&a=b#a' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar&a=b#a1' html:

    link text

    --- in: '"link text":http://example.com/?foo=bar&a=b#a10' html:

    link text

    --- in: 'This is a "link":http://example.com/' html:

    This is a link

    --- in: 'This is a "link":http://example.com/.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/index.html.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/index.html#a.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/index.html#1.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/index.html#a1.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/index.html#a10.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/?foo=bar.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/?foo=bar#1.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/?foo=bar#a.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/?foo=bar#a1.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/?foo=bar#a10.' html:

    This is a link.

    --- in: 'This is a "link":http://example.com/?foo=bar#a10, but this is not.' html:

    This is a link, but this is not.

    --- in: '(This is a "link":http://example.com/?foo=bar#a10) but this is not.' html:

    (This is a link) but this is not.

    --- in: '"link text(link title)":http://example.com/' html:

    link text

    # --- # in: '"link text(link title) ":http://example.com/' # html:

    “link text(link title) “:http://example.com/

    # comments: this is a real test and should pass --- name: link with title attribute in: '"(link) text(link title)":http://example.com/' html:

    text

    comments: link text can not contain parentheses --- name: link with space between link text and title attribute in: '"text (link title)":http://example.com/' html:

    text

    --- in: '"Dive Into XML":http://www.xml.com/pub/au/164' html:

    Dive Into XML

    --- in: '"Lab Exercises":../lab/exercises/exercises.html.' html:

    Lab Exercises.

    --- in: 'Go to "discuss":http://www.dreammoods.com/cgibin/cutecast/cutecast.pl?forum=1&thread=26627 to discuss.' html:

    Go to discuss to discuss.

    --- in: '* "rubylang":http://www.ruby-lang.org/en/' html: "" --- in: 'The ION coding style document found at "IONCodingStyleGuide.doc":http://perforce:8081/@md=d&cd=//&c=82E@//depot/systest/system/main/pub/doc/IONCodingStyleGuide.doc?ac=22 codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in ION. Test text' html:

    The ION coding style document found at IONCodingStyleGuide.doc codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in ION. Test text

    --- in: '"testing":' html: "

    “testing”:

    " --- name: trailing space not absorbed by link in: '"Link":/foo.html me' html: "

    Link me

    " --- name: trailing comma stays outside link in: '"Link":/foo.html, me' html: "

    Link, me

    " --- name: trailing exclamation stays outside link in: '"Link":/foo.html! me' html: "

    Link! me

    " --- name: trailing semicolon stays outside link in: '"Link":/foo.html; me' html: "

    Link; me

    " --- name: trailing period stays outside link in: '"Link":/foo.html.' html: "

    Link.

    " --- name: whose text is a parenthetical statement in: '"(just in case you were wondering)":http://slashdot.org/' html: '

    (just in case you were wondering)

    ' --- name: that has a class and whose text is a parenthetical statement in: '"(myclass) (just in case you were wondering)":http://slashdot.org/' html: '

    (just in case you were wondering)

    ' --- name: link containing parentheses in: '"It is (very) fortunate that this works":http://slashdot.org/' html: '

    It is (very) fortunate that this works

    ' --- name: link containing quotes in: '"He said it is "very unlikely" this works":http://slashdot.org/' html: '

    He said it is “very unlikely” this works

    ' --- name: link containing multiple quotes in: '"He said it is "very unlikely" the "economic stimulus" works":http://slashdot.org/' html: '

    He said it is “very unlikely” the “economic stimulus” works

    ' --- name: linked quoted phrase in: '""Open the pod bay doors please, HAL."":http://www.youtube.com/watch?v=npN9l2Bd06s' html: '

    “Open the pod bay doors please, HAL.”

    ' --- name: link following quoted phrase in: '"quote" text "quote" text "link":http://google.com' html: '

    “quote” text “quote” text link

    ' --- name: links containing underscores in: 'This is a link to a "Wikipedia article about Barack":http://en.wikipedia.org/wiki/Barack_Obama' html: '

    This is a link to a Wikipedia article about Barack

    ' --- name: links containing parentheses in: 'This is a link to a ["Wikipedia article about Textile":http://en.wikipedia.org/wiki/Textile_(markup_language)]' html: '

    This is a link to a Wikipedia article about Textile

    ' --- name: links contained in parentheses in: 'This is a regular link (but in parentheses: "Google":http://www.google.com)' html: '

    This is a regular link (but in parentheses: Google)

    ' --- name: links containing parentheses without brackets in: 'This is a link to a "Wikipedia article about Textile":http://en.wikipedia.org/wiki/Textile_(markup_language)' html: '

    This is a link to a Wikipedia article about Textile

    ' --- name: links containing parentheses period at end without brackets in: 'This is a link to a "Wikipedia article about Textile":http://en.wikipedia.org/wiki/Textile_(markup_language).' html: '

    This is a link to a Wikipedia article about Textile.

    ' --- name: broken links containing parentheses without brackets in: 'This is a link to a "Wikipedia article about Textile":http://en.wikipedia.org/wiki/Textile_(markup_language' html: '

    This is a link to a Wikipedia article about Textile

    ' --- name: links containing parentheses without brackets inside a parenthesis in: 'Textile is awesome! (Check out the "Wikipedia article about Textile":http://en.wikipedia.org/wiki/Textile_(markup_language))' html: '

    Textile is awesome! (Check out the Wikipedia article about Textile)

    ' --- name: quotes and follow link in: 'Some "text" followed by a "link":http://redcloth.org.' html: '

    Some “text” followed by a link.

    ' lite_mode_html: 'Some “text” followed by a link.' --- name: link alias containing dashes in: |- "link":google-rocks [google-rocks]http://google.com html: |-

    link

    --- name: contained in multi-paragraph quotes in: |- "I first learned about "Redcloth":http://redcloth.org/ several years ago. "It's wonderful." html: |-

    “I first learned about Redcloth several years ago.

    “It’s wonderful.”

    --- name: as html in notextile contained in multi-paragraph quotes in: |- "Here is a link. "I like links." html: |-

    “Here is a link.

    “I like links.”

    --- name: contained in para with multiple quotes in: |- "My wife, Tipper, and I will donate 100% of the proceeds of the award to the "Alliance For Climate Protection":http://www.looktothestars.org/charity/638-alliance-for-climate-protection," said Gore in an email. "I am deeply honored to receive the Nobel Peace Prize." html: |-

    “My wife, Tipper, and I will donate 100% of the proceeds of the award to the Alliance For Climate Protection,” said Gore in an email. “I am deeply honored to receive the Nobel Peace Prize.”

    --- name: with caps in the title in: |- "British Skin Foundation (BSF)":http://www.britishskinfoundation.org.uk html: |-

    British Skin Foundation

    --- name: containing HTML tags with quotes in: |- "*apply online*":/admissions/apply/ html: |-

    apply online

    redcloth-4.3.3/spec/fixtures/lists.yml000066400000000000000000000201001452062100400177740ustar00rootroot00000000000000--- name: code in bullet list in: "* command run: @time ruby run-tests.rb > toto@" html: "
      \n\t
    • command run: time ruby run-tests.rb > toto
    • \n
    " --- # Bret Pettichord, Thanks. name: hard break in list in: |- * first line * second line * third line html: |-
    • first line
    • second
      line
    • third line
    --- name: mixed nesting in: |- * bullet *# number *# number *#* bullet *# number *# number with a break * bullet ** okay html: |-
    • bullet
      1. number
      2. number
        • bullet
      3. number
      4. number with
        a break
    • bullet
      • okay
    --- name: list continuation in: |- # one # two # three # one # two # three #_ four # five # six html: |-
    1. one
    2. two
    3. three
    1. one
    2. two
    3. three
    1. four
    2. five
    3. six
    valid_html: false comment: there's not a good, valid alternative to the start attribute --- name: continue after break in: |- # one # two # three test #_ four # five # six test #_ seven # eight # nine html: |-
    1. one
    2. two
    3. three

    test

    1. four
    2. five
    3. six

    test

    1. seven
    2. eight
    3. nine
    valid_html: false comment: there's not a good, valid alternative to the start attribute --- name: continue list when prior list contained nested list in: |- # one # two # three #_ four # five ## sub-note ## another sub-note # six #_ seven # eight # nine html: |-
    1. one
    2. two
    3. three
    1. four
    2. five
      1. sub-note
      2. another sub-note
    3. six
    1. seven
    2. eight
    3. nine
    valid_html: false comment: there's not a good, valid alternative to the start attribute --- name: list start number in: |- #293 two ninety three # two ninety four # two ninety five #9 nine # ten # eleven html: |-
    1. two ninety three
    2. two ninety four
    3. two ninety five
    1. nine
    2. ten
    3. eleven
    valid_html: false comment: there's not a good, valid alternative to the start attribute --- name: continue list after started list in: |- #9 nine # ten # eleven #_ twelve # thirteen # fourteen html: |-
    1. nine
    2. ten
    3. eleven
    1. twelve
    2. thirteen
    3. fourteen
    valid_html: false comment: there's not a good, valid alternative to the start attribute --- name: end notes in: |- h2. End Notes # End Notes should be a numbered list # Like this # They must have anchors in the text h2. See Also * See Also notes should be bullets * Like this html: |-

    End Notes

    1. End Notes should be a numbered list
    2. Like this
    3. They must have anchors in the text

    See Also

    • See Also notes should be bullets
    • Like this
    --- name: ordered list immediately following paragraph desc: Normally a paragraph and a list that follows it should be separated by two newlines. Textile-2.0.0 recognizes the list even when separated by only one newline, but creates invalid XHTML by placing the list inside the paragraph. RedCloth recognizes the pattern for backward compatibility, but creates valid XHTML. in: |- A simple example. # One # Two html: |-

    A simple example.

    1. One
    2. Two
    --- name: unordered list immediately following paragraph in: |- A simple example. * One * Two html: |-

    A simple example.

    • One
    • Two
    --- name: ordered list immediately following extended block in: |- div.. Here it comes. A simple example. # One # Two html: |-
    Here it comes.
    A simple example.
    1. One
    2. Two
    --- name: unordered list immediately following extended block in: |- div.. Here it comes. A simple example. * One * Two html: |-
    Here it comes.
    A simple example.
    • One
    • Two
    --- name: unordered list with leading spaces in: " * notice the leading space\n * RedCloth 3.0.4 used to accept it\n * Now we do too" html: |-
    • notice the leading space
    • RedCloth 3.0.4 used to accept it
    • Now we do too
    --- name: ordered list with leading spaces in: " # notice the leading space\n # RedCloth 3.0.4 used to accept it\n # Now we do too" html: |-
    1. notice the leading space
    2. RedCloth 3.0.4 used to accept it
    3. Now we do too
    --- name: unordered with classes in: |- *(class-one) one *(class-two) two *(class-three) three html: |-
    • one
    • two
    • three
    --- name: unordered with alignments in: |- *< one *> two *<> three *= four html: |-
    • one
    • two
    • three
    • four
    --- name: with attributes that apply to the whole list in: |- (class#id)# one # two # three html: |-
    1. one
    2. two
    3. three
    --- name: with id on the list in: |- (#my-id)# one # two # three html: |-
    1. one
    2. two
    3. three
    --- name: with class on the list in: |- (my-class)# one # two # three html: |-
    1. one
    2. two
    3. three
    --- name: with id on the list item in: |- # one #(#my-item) two # three html: |-
    1. one
    2. two
    3. three
    --- name: with attributes that apply to the first list item in: |- #(class#id) one # two # three html: |-
    1. one
    2. two
    3. three
    --- name: changed from textism basics desc: "This was in Textism basics, but when I changed the format of list styles, I removed it" in: |- {color:blue}# one # two # three html: |-
    1. one
    2. two
    3. three
    --- name: changed from threshold list attributes desc: "Was: 'Attributes applied to the first list item will apply to the list itself.' but then we changed it" in: |- *{color:red} Item one * Item two * Item three html: |-
    • Item one
    • Item two
    • Item three
    --- name: with one padding-left increment in: "(# one" html: |-
    1. one
    --- name: with one padding-left increment and class in: "((myclass)# one" html: |-
    1. one
    --- name: with two padding-left increments in: "((# two" html: |-
    1. two
    --- name: with one padding-right increment in: ")# one" html: |-
    1. one
    --- name: with padding-left and padding-right increments in: "()# two" html: |-
    1. two
    --- name: with padding-left and padding-right increments switched in: ")(# two" html: |-
    1. two
    --- name: with padding-left and padding-right increments and class in: "()(myclass)# two" html: |-
    1. two
    redcloth-4.3.3/spec/fixtures/poignant.yml000066400000000000000000000076741452062100400205020ustar00rootroot00000000000000--- # Tests from the (Poignant Guide) in: > h3. False ! if plastic_cup print "Plastic cup is on the up 'n' up!" end If @plastic_cup@ contains either @nil@ or @false@, you won't see anything print to the screen. They're not on the @if@ guest list. So @if@ isn't going to run any of the code it's protecting. But @nil@ and @false@ need not walk away in shame. They may be of questionable character, but @unless@ runs a smaller establishment that caters to the bedraggled. The @unless@ keyword has a policy of only allowing those with a negative charge in. Who are: @nil@ and @false@.
        unless plastic_cup
          print "Plastic cup is on the down low."
        end
      
    You can also use @if@ and @unless@ at the end of a single line of code, if that's all that is being protected.
        print "Yeah, plastic cup is up again!" if plastic_cup
        print "Hardly. It's down." unless plastic_cup
      
    Now that you've met @false@, I'm sure you can see what's on next. html: |-

    False

    Shape of a cat.

    The cat Trady Blix. Frozen in emptiness. Immaculate whiskers rigid. Placid eyes of lake. Tail of warm icicle. Sponsored by a Very Powerful Pause Button.

    The darkness surrounding Blix can be called negative space. Hang on to that phrase. Let it suggest that the emptiness has a negative connotation. In a similar way, nil has a slightly sour note that it whistles.

    Generally speaking, everything in Ruby has a positive charge to it. This spark flows through strings, numbers, regexps, all of it. Only two keywords wear a shady cloak: nil and false draggin us down.

    You can test that charge with an if keyword. It looks very much like the do blocks we saw in the last chapter, in that both end with an end.

        if plastic_cup
          print "Plastic cup is on the up 'n' up!"
        end
      

    If plastic_cup contains either nil or false, you won’t see anything print to the screen. They’re not on the if guest list. So if isn’t going to run any of the code it’s protecting.

    But nil and false need not walk away in shame. They may be of questionable character, but unless runs a smaller establishment that caters to the bedraggled. The unless keyword has a policy of only allowing those with a negative charge in. Who are: nil and false.

        unless plastic_cup
          print "Plastic cup is on the down low."
        end
      

    You can also use if and unless at the end of a single line of code, if that’s all that is being protected.

        print "Yeah, plastic cup is up again!" if plastic_cup
        print "Hardly. It's down." unless plastic_cup
      

    Now that you’ve met false, I’m sure you can see what’s on next.

    redcloth-4.3.3/spec/fixtures/sanitize_html.yml000066400000000000000000000037661452062100400215330ustar00rootroot00000000000000--- in: Just a little harmless xss . sanitized_html:

    Just a little harmless xss stuff.

    --- in: Here's a bad image sanitized_html:

    Here’s a bad image

    --- in: Just some random > and < characters, but also a
    tag. sanitized_html:

    Just some random > and < characters, but also a
    tag.

    --- name: processes text beginning with space in: ' This began with a space and ends with some XSS: ' sanitized_html: 'This began with a space and ends with some XSS: alert(“Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye”);' --- name: processes text in notextile tags in: |- The bad tags should be missing: sanitized_html: |- The bad tags should be missing: alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye"); --- name: processes text in inline notextile tags in: |- The bad tags should be missing: sanitized_html: |-

    The bad tags should be missing: alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");

    --- name: removes script tags in: |- sanitized_html: "alert(“Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye”);" --- name: removes nested script tags in: |- sanitized_html: |- alert(“Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye”);redcloth-4.3.3/spec/fixtures/table.yml000066400000000000000000000171631452062100400177440ustar00rootroot00000000000000--- in: | |a|b|c| |1|2|3| h3. A header after the table html: |-
    a b c
    1 2 3

    A header after the table

    latex: |+ \begin{table} \centering \begin{tabular}{ l l l } a & b & c \\ 1 & 2 & 3 \\ \end{tabular} \end{table} \subsubsection{A header after the table} --- in: | |_. a|_. b|_. c| |1|2|3| html: |-
    a b c
    1 2 3
    --- in: |- |This|is|a|simple|table| |This|is|a|simple|row| html: |-
    This is a simple table
    This is a simple row
    latex: |+ \begin{table} \centering \begin{tabular}{ l l l l l } This & is & a & simple & table \\ This & is & a & simple & row \\ \end{tabular} \end{table} --- in: |- table{border:1px solid black}. |This|is|a|row| |This|is|a|row| html: |-
    This is a row
    This is a row
    --- in: '{background:#ddd}. |This|is|a|row|' html: |-
    This is a row
    --- in: |- |a|b|c| | |2|3| html: |-
    a b c
    2 3
    --- in: |- table{width: 200px; border:2px solid gray;}. |_=. Alignment| |=. centered| |=(. a bit right| |=). a bit left| |>). almost right| |<(. almost left| |>. right| |<. left| html: |-
    Alignment
    centered
    a bit right
    a bit left
    almost right
    almost left
    right
    left
    --- in: |- |{background:#ddd}. Cell with gray background|Normal cell| |\2. Cell spanning 2 columns| |/2. Cell spanning 2 rows|one| |two| |>. Right-aligned cell|<. Left-aligned cell| html: |-
    Cell with gray background Normal cell
    Cell spanning 2 columns
    Cell spanning 2 rows one
    two
    Right-aligned cell Left-aligned cell
    latex: |+ \begin{table} \centering \begin{tabular}{ l l } Cell with gray background & Normal cell \\ \multicolumn{2}{ l l }{Cell spanning 2 columns} \\ \multirow{2}{*}{Cell spanning 2 rows} & one \\ & two \\ Right-aligned cell & Left-aligned cell \\ \end{tabular} \end{table} --- name: row spanning mid-row in: |- |1|2|3| |1|/3. 2|3| |1|3| |1|3| |1|2|3| html: |-
    1 2 3
    1 2 3
    1 3
    1 3
    1 2 3
    latex: |+ \begin{table} \centering \begin{tabular}{ l l l } 1 & 2 & 3 \\ 1 & \multirow{3}{*}{2} & 3 \\ 1 & & 3 \\ 1 & & 3 \\ 1 & 2 & 3 \\ \end{tabular} \end{table} --- in: | {background:#ddd}. |S|Target|Complete|App|Milestone| |!/i/g.gif!|11/29/04|11/29/04|011|XML spec complete (KH is on schedule)| |!/i/g.gif!|11/22/04|11/22/04|070|Dialog pass 1 builds an index file| |!/i/g.gif!|11/24/04|11/24/04|070|Dialog pass 2 98% complete| |!/i/g.gif!|11/30/04|11/30/04|070|Feature complete. Passes end-to-end smoke test.| |!/i/w.gif!|12/02/04| |011|Dialog pass 1 and 2 complete (98+%)| |!/i/w.gif!|12/03/04| |081|Feature complete| html: |-
    S Target Complete App Milestone
    11/29/04 11/29/04 011 XML spec complete (KH is on schedule)
    11/22/04 11/22/04 070 Dialog pass 1 builds an index file
    11/24/04 11/24/04 070 Dialog pass 2 98% complete
    11/30/04 11/30/04 070 Feature complete. Passes end-to-end smoke test.
    12/02/04 011 Dialog pass 1 and 2 complete (98+%)
    12/03/04 081 Feature complete
    --- name: combined table header and colspan in: |- table(my_class). |_\2. a |_. b |_. c | | 1 | 2 | 3 | 4 | html: |-
    a b c
    1 2 3 4
    --- name: two adjacent tables in: |- |a|b|c| |1|2|3| html: |-
    a b c
    1 2 3
    --- name: with cell attributes in: "|[en]. lang-ok|{color:red;}. style-ok|(myclass). class-ok|" html: |-
    lang-ok style-ok class-ok
    --- name: with improper cell attributes in: "|[en]lang-bad|{color:red;}style-bad|(myclass)class-bad|" html: |-
    [en]lang-bad {color:red;}style-bad (myclass)class-bad
    --- name: with line breaks in the cell in: |- |a|b b| |c c|d| html: |-
    a b
    b
    c
    c
    d
    --- name: with missing cells desc: This is improper formatting, so as long as it doesn't choke, I don't care how it is handled in: |- |a|b| |a| |a|b| html: |-
    a b
    a
    a b
    --- name: with empty cells desc: cells can be empty. Textile2 skips empties, but we don't want to do that. in: |- ||b| |a|| |a| | html: |-
    b
    a
    a
    redcloth-4.3.3/spec/fixtures/textism.yml000066400000000000000000000261271452062100400203520ustar00rootroot00000000000000--- name: header one in: h1. Header 1 html:

    Header 1

    latex: "\\section{Header 1}\n\n" --- name: header two in: h2. Header 2 html:

    Header 2

    latex: "\\subsection{Header 2}\n\n" --- name: header three in: h3. Header 3 html:

    Header 3

    latex: "\\subsubsection{Header 3}\n\n" --- name: header four in: h4. Header 4 html:

    Header 4

    latex: "\\paragraph{Header 4}\n\n" --- name: header five in: h5. Header 5 html:
    Header 5
    latex: "\\subparagraph{Header 5}\n\n" --- name: header six in: h6. Header 6 html:
    Header 6
    latex: "\\textbf{Header 6}\n\n" --- name: blockquote in: |- Any old text. bq. A block quotation. Any old text. html: |-

    Any old text.

    A block quotation.

    Any old text.

    latex: |+ Any old text. \begin{quotation} A block quotation. \end{quotation} Any old text. --- in: |- # A first item # A second item # A third item # A fourth item html: |-
    1. A first item
    2. A second item
    3. A third item
    4. A fourth item
    latex: |+ \begin{enumerate} \item A first item \item A second item \item A third item \item A fourth item \end{enumerate} --- in: |- * A first item * A second item * A third item * A fourth item html: |-
    • A first item
    • A second item
    • A third item
    • A fourth item
    latex: |+ \begin{itemize} \item A first item \item A second item \item A third item \item A fourth item \end{itemize} --- in: _a phrase_ html:

    a phrase

    latex: "\\emph{a phrase}\n\n" --- in: __a phrase__ html:

    a phrase

    latex: "\\textit{a phrase}\n\n" --- in: '*a phrase*' html:

    a phrase

    latex: "\\textbf{a phrase}\n\n" --- in: '**a phrase**' html:

    a phrase

    latex: "\\textbf{a phrase}\n\n" --- in: Nabokov's ??Pnin?? html:

    Nabokov’s Pnin

    latex: "Nabokov's \\begin{quote}Pnin\\end{quote}\n\n" --- name: del part of word in: 'A very [-extra-]ordinary day.' html: "

    A very extraordinary day.

    " latex: "A very \\sout{extra}ordinary day.\n\n" --- name: del part of word that contains a hyphen in: 'An [-extra-extra-]ordinary day.' html:

    An extra-extraordinary day.

    latex: "An \\sout{extra-extra}ordinary day.\n\n" --- name: del a phrase in: 'Delete -a phrase- this way.' html:

    Delete a phrase this way.

    latex: "Delete \\sout{a phrase} this way.\n\n" --- name: del a phrase that contains hyphens in: 'Delete -a no-nonsense phrase- this way.' html:

    Delete a no-nonsense phrase this way.

    latex: "Delete \\sout{a no-nonsense phrase} this way.\n\n" --- in: +a phrase+ html:

    a phrase

    latex: "\\underline{a phrase}\n\n" --- in: ^a phrase^ html:

    a phrase

    latex: "\\textsuperscript{a phrase}\n\n" --- in: ~a phrase~ html:

    a phrase

    latex: "\\textsubscript{a phrase}\n\n" --- in: "%(myclass)SPAN%" html:

    SPAN

    no_span_caps_html:

    SPAN

    --- in: "%{color:red}red%" html:

    red

    --- in: "%[fr]rouge%" html:

    rouge

    --- in: _(big)red_ html:

    red

    --- in: p=. A centered paragraph. html:

    A centered paragraph.

    latex: "\\begin{center}A centered paragraph.\\end{center}\n\n" --- in: p(bob). A paragraph html:

    A paragraph

    --- in: p{color:#ddd}. A paragraph html:

    A paragraph

    --- in: p[fr]. A paragraph html:

    A paragraph

    --- in: h2()>. right-aligned header2, indented 1em both side html:

    right-aligned header2, indented 1em both side

    --- in: h3=. centered header html:

    centered header

    latex: "\\begin{center}\\subsubsection{centered header}\\end{center}\n\n" --- in: '!>/image.gif! right-aligned image' html:

    right-aligned image

    --- in: p[no]{color:red}. A Norse of a different colour. html:

    A Norse of a different colour.

    --- in: |- |This|is|a|simple|table| |This|is|a|simple|row| html: |-
    This is a simple table
    This is a simple row
    latex: | \begin{table} \centering \begin{tabular}{ l l l l l } This & is & a & simple & table \\ This & is & a & simple & row \\ \end{tabular} \end{table} --- in: |- table{border:1px solid black}. |This|is|a|row| |This|is|a|row| html: |-
    This is a row
    This is a row
    --- in: '{background:#ddd}. |This|is|a|row|' html: |-
    This is a row
    --- in: |- |{background:#ddd}. Cell with gray background| |\2. Cell spanning 2 columns| |/3. Cell spanning 3 rows| |>. Right-aligned cell| html: |-
    Cell with gray background
    Cell spanning 2 columns
    Cell spanning 3 rows
    Right-aligned cell
    --- name: basics in: |- h2{color:green}. This is a title h3. This is a subhead p{color:red}. This is some text of dubious character. Isn't the use of "quotes" just lazy writing -- and theft of 'intellectual property' besides? I think the time has come to see a block quote. bq[fr]. This is a block quote. I'll admit it's not the most exciting block quote ever devised. Simple list: # one # two # three Multi-level list: # one ## aye ## bee ## see # two ## x ## y # three html: |-

    This is a title

    This is a subhead

    This is some text of dubious character. Isn’t the use of “quotes” just lazy writing — and theft of ‘intellectual property’ besides? I think the time has come to see a block quote.

    This is a block quote. I’ll admit it’s not the most exciting block quote ever devised.

    Simple list:

    1. one
    2. two
    3. three

    Multi-level list:

    1. one
      1. aye
      2. bee
      3. see
    2. two
      1. x
      2. y
    3. three
    --- name: tougher stuff in: |- Multi-level list: # one ## aye ## bee ## see # two ## x ## y # three Mixed list: * Point one * Point two ## Step 1 ## Step 2 ## Step 3 * Point three ** Sub point 1 ** Sub point 2 Well, that went well. How about we insert an old-fashioned hypertext link? Will the quote marks in the tags get messed up? No! "This is a link (optional title)":http://www.textism.com html: |-

    Multi-level list:

    1. one
      1. aye
      2. bee
      3. see
    2. two
      1. x
      2. y
    3. three

    Mixed list:

    • Point one
    • Point two
      1. Step 1
      2. Step 2
      3. Step 3
    • Point three
      • Sub point 1
      • Sub point 2

    Well, that went well. How about we insert an old-fashioned hypertext link? Will the quote marks in the tags get messed up? No!

    This is a link

    --- name: table in: |- table{border:1px solid black}. |_. this|_. is|_. a|_. header| <{background:gray}. |\2. this is|{background:red;width:200px}. a|^<>{height:200px}. row| |this|<>{padding:10px}. is|^. another|(bob#bob). row| html: |-
    this is a header
    this is a row
    this is another row
    --- in: |- An image: !/common/textist.gif(optional alt text)! # Librarians rule # Yes they do # But you knew that Some more text of dubious character. Here is a noisome string of CAPITAL letters. Here is something we want to _emphasize_. That was a linebreak. And something to indicate *strength*. Of course I could use my own HTML tags if I felt like it. html: |-

    An image:

    optional alt text

    1. Librarians rule
    2. Yes they do
    3. But you knew that

    Some more text of dubious character. Here is a noisome string of CAPITAL letters. Here is something we want to emphasize.
    That was a linebreak. And something to indicate strength. Of course I could use my own HTML tags if I felt like it.

    --- name: code in: |- h3. Coding This is some code, "isn't it". Watch those quote marks! Now for some preformatted text:
      
          $text = str_replace("

    %::%

    ","",$text); $text = str_replace("%::%

    ","",$text); $text = str_replace("%::%","",$text);
    This isn't code. html: |-

    Coding

    This is some code, "isn't it". Watch those quote marks! Now for some preformatted text:

      
          $text = str_replace("<p>%::%</p>","",$text);
          $text = str_replace("%::%</p>","",$text);
          $text = str_replace("%::%","",$text);
      
      
      

    This isn’t code.

    --- name: hard break in: |- trivial break next html: |-

    trivial
    break

    next

    --- name: normal paragraphs in: |- trivial paragraphs html: |-

    trivial

    paragraphs

    --- name: hard break in a list in: |- * first line * second line * third line html: |-
    • first line
    • second
      line
    • third line
    --- name: copyright symbol at line start in: "(C) copyright conversion (C) test." html: "

    © copyright conversion © test.

    " redcloth-4.3.3/spec/fixtures/threshold.yml000066400000000000000000000550431452062100400206500ustar00rootroot00000000000000--- # From http://thresholdstate.com/articles/4312/the-textile-reference-manual name: paragraph desc: Paragraphs are separated by blank lines. Each paragraph of text is transformed into a XHTML

    paragraph block. in: |- A paragraph. Another paragraph. html: |-

    A paragraph.

    Another paragraph.

    --- name: line breaks desc: Line breaks within paragraphs are transformed into XHTML line breaks. in: |- A paragraph with a line break. html: |-

    A paragraph with
    a line break.

    --- name: xhtml tags desc: Simple XHTML tags may be included in a paragraph. in: Here's some bold text. html:

    Here’s some bold text.

    --- name: no paragraph tags desc: A line beginning with a space will be left untouched, and not wrapped in

    tags. in: " No paragraph tags here." html: "No paragraph tags here." valid_html: false --- name: smart quotes desc: Single and double typewriter quotation marks ' and " are transformed into typographically correct “curly” quote marks. in: '"Proceed!" said he to the host.' html: '

    “Proceed!” said he to the host.

    ' --- name: smart quotes 2 in: "'Proceed!' said he to the host." html: "

    ‘Proceed!’ said he to the host.

    " --- name: nested quotation marks desc: Single and double quotation marks may be nested one inside the other. in: |- "'I swear, captain,' replied I." html: |-

    “‘I swear, captain,’ replied I.”

    --- name: nested quotation marks 2 in: |- '"I swear, captain," replied I.' html: |-

    ‘“I swear, captain,” replied I.’

    --- name: apostrophe glyphs desc: Single quotation marks ' will be turned into apostrophe glyphs when used as such. in: Greengrocers' apostrophe's. html:

    Greengrocers’ apostrophe’s.

    --- name: em-dash glyphs desc: Double -- dashes become an em-dash glyph. in: You know the Italian proverb -- Chi ha compagno ha padrone. html:

    You know the Italian proverb — Chi ha compagno ha padrone.

    --- name: em-dash glyphs 2 in: You know the Italian proverb--Chi ha compagno ha padrone. html:

    You know the Italian proverb—Chi ha compagno ha padrone.

    --- name: en-dash glyphs desc: Single - dashes are replaced with en-dashes. in: You know the Italian proverb - Chi ha compagno ha padrone. html:

    You know the Italian proverb – Chi ha compagno ha padrone.

    --- name: ellipsis character desc: Three period marks become an ellipsis character. in: Meanwhile... html:

    Meanwhile…

    --- name: dimension character desc: An “x” is replaced with the dimension character when used between numbers. in: 1 x 2 x 3 = 6 html:

    1 × 2 × 3 = 6

    --- name: dimension character 2 in: 1x2x3 = 6 html:

    1×2×3 = 6

    --- name: trademark register copyright desc: Trademark, Registered and Copyright symbols are represented by their common plain text equivalents. in: Registered(r) Trademark(tm) Copyright (c). html:

    Registered® Trademark™ Copyright ©.

    --- name: acronyms desc: Acronyms consist of three or more uppercase characters, followed immediately by words in parentheses. in: ABC(Always Be Closing) html:

    ABC

    no_span_caps_html:

    ABC

    latex: "Always Be Closing (ABC)\n\n" --- name: uppercase desc: Uppercase words of three or more characters are enclosed with a special span element. in: IBM or HAL html:

    IBM or HAL

    no_span_caps_html:

    IBM or HAL

    latex: "IBM or HAL\n\n" --- name: emphasis desc: Emphasis is added with _ underscores. in: The _underlying_ cause. html:

    The underlying cause.

    --- name: strong text desc: Strong text is indicated by * asterisks. in: The *underlying* cause. html:

    The underlying cause.

    --- name: italic text desc: em is a semantic tag, usually represented by browsers as italic text. To produce italic tags instead, use double underscores. in: The __underlying__ cause. html:

    The underlying cause.

    --- name: bold text desc: strong is a semantic tag, usually represented by browsers as bold text. To produce bold tags instead, use double asterisks. in: The **underlying** cause. html:

    The underlying cause.

    --- name: citation desc: Double question marks represent a citation, like the title of a book. in: ??The Count of Monte Cristo??, by Dumas. html:

    The Count of Monte Cristo, by Dumas.

    --- name: inserted and deleted text desc: Inserted and deleted text is represented by + plus and - minus symbols. in: Scratch -that-, replace with +this+. html:

    Scratch that, replace with this.

    --- name: subscript desc: Subscript text is indicated by ~ tilde characters. in: log ~2~ n html:

    log 2 n

    --- name: superscript desc: Superscript text is indicated by ^ caret characters. in: 2 ^x^ html:

    2 x

    --- name: span tag desc: Percentage marks will enclose text with a XHTML span tag. in: The %underlying% cause. html:

    The underlying cause.

    --- name: code desc: To include a short snippet of code such as XHTML or Javascript, surround it with @ “at” symbols. XHTML significant characters within a code phrase will be escaped for display to the reader. in: About the @
    @ tag. html:

    About the <hr /> tag.

    --- name: links desc: Links are represented by double quotes and a colon. in: '"link text":http://example.com/' html:

    link text

    --- name: local links desc: The host name may be omitted for local links. in: '"link text":/example' html:

    link text

    --- name: link title desc: A title may be placed in () parentheses. in: '"link text(with title)":http://example.com/' html:

    link text

    --- name: link alias desc: For frequent linking to a single URL, you can specify a link alias with [] square brackets. in: |- Here's "a link":tstate, and "another link":tstate to the same site. [tstate]http://thresholdstate.com/ html: |-

    Here’s a link, and
    another link to the same site.

    --- name: image desc: Use ! exclamation marks to insert an image tag. in: "!/img.gif!" html:

    --- name: image 2 in: "!http://thresholdstate.com/img.gif!" html:

    --- name: image alt desc: Use () parentheses to include “alt” text. in: "!/img.gif(alt text)!" html:

    alt text

    --- name: image links desc: Images may be combined with links by using an !image! in place of the link text. in: "!/img.gif!:http://textpattern.com/" html:

    --- name: headers desc: Headers are represented by h1., h2., … h6.. in: h1. Heading 1 html:

    Heading 1

    --- name: headers 2 in: h2. Heading 2 html:

    Heading 2

    --- name: headers 3 in: h6. Heading 6 html:
    Heading 6
    --- name: paragraph text desc: "Paragraph p text is represented by p.. This is the default block type: any paragraph without a block modifier will automatically be enclosed with p tags." in: |- p. A paragraph. Continued. Also a paragraph. html: |-

    A paragraph.
    Continued.

    Also a paragraph.

    --- name: block quote desc: bq. indicates a quoted block of text. in: |- bq. A quotation. Continued. Regular paragraph. html: |-

    A quotation.
    Continued.

    Regular paragraph.

    --- name: block quote citation desc: Block quotes may include a citation URL immediately following the period. in: bq.:http://thresholdstate.com/ A cited quotation. html: |-

    A cited quotation.

    --- name: footnotes desc: Footnotes are represented by the fn1., fn2., … block modifiers. in: |- A footnote reference[1]. fn1. The footnote. html: |-

    A footnote reference1.

    1 The footnote.

    # html: |- #

    A footnote reference1.

    #

    1 The footnote.

    --- name: block code desc: Code such as XHTML, Javascript or PHP may be displayed using the bc. “block code” modifier. XHTML significant characters such as < and > will be escaped within code blocks – bc is used for displaying code to the reader, not for executing it. note: Note that Textile will interpret any blank lines within the code as indicating the end of the code block. See Extended Blocks below for an explanation of how to display longer blocks of code. in: |- bc. html: |-
    <script>
      // a Javascript example
      alert("Hello World");
      </script>
    --- name: preformatted text desc: Use the pre. block modifier for pre-formatted text. XHTML significant characters within the block will be escaped. note: pre. is almost identical to bc., with the exception that ... tags are not used within the
     block.
    in: |-
      pre. Pre-formatted
      text
    html: |-
      
    Pre-formatted
      text
    latex: |- \begin{verbatim}Pre-formatted text\end{verbatim} --- name: notextile desc: The notextile. block modifier applies no Textile processing at all to a block. Raw XHTML characters are passed through untouched, so this may be used to insert explicit XHTML markup, or execute Javascript or PHP code. in: |- notextile. html: |- valid_html: false --- name: class attribute desc: CSS classes are specified with () parentheses. in: p(myclass). My classy paragraph. html:

    My classy paragraph.

    --- name: id attribute desc: CSS IDs are specified with () parentheses. in: p(#myid). My ID paragraph. html:

    My ID paragraph.

    --- name: style attribute desc: CSS styles are specified with {} braces. in: p{color:red}. Red rum. html:

    Red rum.

    --- name: lang attribute desc: Languages are specified with [] brackets. in: p[fr-fr]. En français. html:

    En français.

    --- name: phrase modifiers desc: The same syntax may be applied to phrase modifiers. in: A *(myclass)classy* phrase. html:

    A classy phrase.

    --- name: phrase modifiers 2 in: An _(#myid2)ID_ phrase. html:

    An ID phrase.

    --- name: phrase modifiers 3 in: The %{color:blue}blue% room. html:

    The blue room.

    --- name: block and phrase attributes combined desc: Block and phrase attributes may be combined. in: p(myclass#myid3){color:green}[de-de]. A complex paragraph. html:

    A complex paragraph.

    --- name: block and phrase attributes combined 2 in: A ??(myclass#myid4){color:green}[de-de]complex?? phrase. html:

    A complex phrase.

    --- name: extended blocks desc: Normally a block modifier covers a single block of text, and ends at the first blank line. To extend a block over multiple paragraphs that include blank lines, use a block modifier with two period marks instead of one. To close the extended block, use a different block modifier on the next paragraph. in: |- bq.. A quote. The quote continued. p. Back to paragraph text. html: |-

    A quote.

    The quote continued.

    Back to paragraph text.

    --- name: extended block code desc: Extended blocks are useful for displaying longer examples of code that contain blank lines. in: |- A PHP code example. bc.. p. Following paragraph. html: |-

    A PHP code example.

    <?php
      function hello() {
      // display a hello message
    
      print "Hello, World";
      }
      ?>

    Following paragraph.

    --- name: extended block attributes desc: Any block attributes on an extended block will be included on each following block. in: |- p(myclass).. A classy paragraph. Another classy paragraph. p. Not so classy. html: |-

    A classy paragraph.

    Another classy paragraph.

    Not so classy.

    --- name: extended block quote attributes desc: Attributes on bq.. extended blocks will be included on both the inner and outer blocks. in: |- bq(myclass).. Quote paragraph 1. Paragraph 2. html: |-

    Quote paragraph 1.

    Paragraph 2.

    --- name: extended block code attributes desc: Attributes on bc.. extended blocks will be included on both the inner and outer blocks. in: |- bc(myclass).. Code block 1. Code block 2. html: |-
    Code block 1.
    
      Code block 2.
    --- name: raw xhtml left in tact desc: Raw XHTML tags are generally left untouched by Textile. Span tags that enclose only part of a block of text will be left intact, while the block itself is treated normally. in: bold and italic, the hard way. html:

    bold and italic, the hard way.

    --- name: paragraphs entirely raw xhtml desc: Paragraphs that consist entirely of raw XHTML block tags will not be enclosed in

    ...

    tags. in:
    My div
    html:
    My div
    --- name: paragraphs with inline xhtml desc: Paragraphs that consist only of inline XHTML tags, will be enclosed in

    ...

    tags. in: image html:

    image

    --- name: paragraphs with inline xhtml 2 in: I'll make my own way. html: '

    I’ll make my own way.

    ' --- name: paragraphs partly enclosed in xhtml block tags desc: Paragraphs that are only partly enclosed in block tags will be enclosed in

    ...

    tags. in:
    inside
    and outside. html:
    inside

    and outside.

    # html:

    inside
    and outside.

    --- name: complex xhtml blocks desc: Textile can’t always identify the beginning and end of long or complex blocks of XHTML. To prevent Textile from enclosing complex XHTML blocks in paragraph tags, either use a space at the beginning of each line... in: "
    \n My div\n
    " html: "
    \nMy div\n
    " --- name: complex xhtml blocks 2 desc: ...or a notexile.. extended block. in: |- notextile..
    My div
    html: |-
    My div
    --- name: complex xhtml blocks with inline formatting desc: Textile will not wrap lines that start with a space in paragraph tags, but it should parse inline signatures in: "
    \n My *div*\n
    " html: "
    \nMy div\n
    " --- name: explicit pre escapement desc: The contents of explicit
    ...
    tags are escaped for display. in: |-
      A HTML example
      
    html: |-
      A HTML <b>example</b>
      
    note: This syntax is supported for backwards compatibility only, and doesn’t always work as expected. The block modifier pre. should be used instead. --- name: explicit code escapement desc: The contents of explicit ... tags are escaped for display. in: |- Another HTML example html: |-

    Another HTML <b>example</b>

    note: This syntax is supported for backwards compatibility only, and doesn’t always work as expected. The block modifier bc. should be used instead. --- name: notextile tags desc: Blocks enclosed by the pseudo tag ... will be left untouched. in: |- p. Leave me alone html: |- p. Leave me alone # html: |- #

    # p. Leave me alone #

    note: This syntax is supported for backwards compatibility only, and doesn’t always work as expected. The block modifier notextile. should be used instead. valid_html: false --- name: left aligned text desc: Left alignment is specified with a < less than symbol. in: p<. Left-aligned paragraph. html:

    Left-aligned paragraph.

    --- name: right aligned text desc: Right alignment is specified with a > greater than symbol. in: h3>. Right-aligned heading. html:

    Right-aligned heading.

    --- name: justified text desc: Use both <> symbols for justified text. in: p<>. Justified paragraph. html:

    Justified paragraph.

    --- name: centered text desc: An = equals symbol represents centered text. in: h3=. Centered heading. html:

    Centered heading.

    --- name: padding desc: Use empty ( and ) parentheses to add padding to blocks, in multiples of 1 em. in: p(. Left pad 1em. html:

    Left pad 1em.

    --- name: padding 2 in: p)). Right pad 2em. html:

    Right pad 2em.

    --- name: padding 3 in: p(). Left and right pad 1em. html:

    Left and right pad 1em.

    --- name: numeric lists desc: Numeric lists are represented by lines beginning with #. in: |- # Item one # Item two # Item three html: |-
    1. Item one
    2. Item two
    3. Item three
    --- name: bulleted lists desc: Bulleted lists are represented by lines beginning with *. in: |- * Item A * Item B * Item C html: |-
    • Item A
    • Item B
    • Item C
    --- name: nested lists desc: Use multiple # or * symbols to create nested lists. in: |- # Item one ## Item one-A ## Item one-B ### Item one-B-a # Item two html: |-
    1. Item one
      1. Item one-A
      2. Item one-B
        1. Item one-B-a
    2. Item two
    --- name: tables desc: Tables can be constructed using | “pipe” symbols to separate cells. in: "|a|simple|table|" html: |-
    a simple table
    --- name: table heading cells desc: Use _. to indicate table heading cells. in: |- |_. a|_. table|_. heading| |a|table|row| html: |-
    a table heading
    a table row
    --- name: cell attributes desc: Attributes may be applied separately to individual cells, rows, and entire tables. Cell attributes are placed within each cell. in: "|a|{color:red}. styled|cell|" html: |-
    a styled cell
    --- name: row attributes desc: Row attributes are placed at the beginning of a row, followed by a dot and a space. in: (rowclass). |a|classy|row| html: |-
    a classy row
    --- name: table attributes desc: Table attributes are specified by placing the special table. block modifier immediately before the table. in: |- table(tableclass). |a|classy|table| |a|classy|table| html: |-
    a classy table
    a classy table
    --- name: vertical alignment desc: Special alignment symbols are available for vertical alignment within table cells. in: "|^. top alignment|" html: |-
    top alignment
    --- name: vertical alignment 2 in: |- |-. middle alignment| html: |-
    middle alignment
    --- name: vertical alignment 3 in: |- |~. bottom alignment| html: |-
    bottom alignment
    --- name: column span desc: Use a \ backslash to indicate a column span. in: |- |\2. spans two cols | | col 1 | col 2 | html: |-
    spans two cols
    col 1 col 2
    --- name: row span desc: Use a / forward slash to indicate a row span. in: |- |/3. spans 3 rows | row a | | row b | | row c | html: |-
    spans 3 rows row a
    row b
    row c
    --- name: whitespace required desc: Links, images and phrase modifiers normally require surrounding whitespace. in: this*won't*work html:

    this*won’t*work

    --- name: modifier without whitespace desc: To use these without whitespace, surround the modifier with [] square brackets. in: this[*will*]work html:

    thiswillwork

    --- name: modifier without whitespace 2 desc: This is particularly useful in conjunction with superscript and subscript. in: 1[^st^], 2[^nd^], 3[^rd^]. html:

    1st, 2nd, 3rd.

    --- name: modifier without whitespace 3 in: 2 log[~n~] html:

    2 logn

    --- name: modifier without whitespace 4 desc: It can also be used to include links and images without surrounding whitespace. in: |- A close[!/img.gif!]image. A tight["text":http://thresholdstate.com/]link. A ["footnoted link":http://thresholdstate.com/][1]. html: |-

    A closeimage.
    A tighttextlink.
    A footnoted link1.

    # html: |- #

    A closeimage.
    # A tighttextlink.
    # A footnoted link1.

    redcloth-4.3.3/spec/formatters/000077500000000000000000000000001452062100400164375ustar00rootroot00000000000000redcloth-4.3.3/spec/formatters/class_filtered_html_spec.rb000066400000000000000000000002641452062100400240070ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "class_filtered_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:filter_classes]).to_html end endredcloth-4.3.3/spec/formatters/filtered_html_spec.rb000066400000000000000000000002531452062100400226200ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "filtered_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:filter_html]).to_html end endredcloth-4.3.3/spec/formatters/html_no_breaks_spec.rb000066400000000000000000000003061452062100400227640ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "html_no_breaks" do examples_from_yaml do |doc| red = RedCloth.new(doc['in']) red.hard_breaks = false red.to_html end endredcloth-4.3.3/spec/formatters/html_spec.rb000066400000000000000000000006031452062100400207410ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "HTML" do examples_from_yaml do |doc| RedCloth.new(doc['in']).to_html end it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in HTML" do lambda { RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_html }.should_not raise_error end endredcloth-4.3.3/spec/formatters/id_filtered_html_spec.rb000066400000000000000000000002551452062100400232760ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "id_filtered_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:filter_ids]).to_html end endredcloth-4.3.3/spec/formatters/latex_spec.rb000066400000000000000000000006101452062100400211100ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "LaTeX" do examples_from_yaml do |doc| RedCloth.new(doc['in']).to_latex end it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in LaTeX" do lambda { RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_latex }.should_not raise_error end endredcloth-4.3.3/spec/formatters/lite_mode_html_spec.rb000066400000000000000000000002521452062100400227620ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "lite_mode_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:lite_mode]).to_html end endredcloth-4.3.3/spec/formatters/no_span_caps_html_spec.rb000066400000000000000000000002601452062100400234630ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "no_span_caps_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:no_span_caps]).to_html end endredcloth-4.3.3/spec/formatters/sanitized_html_spec.rb000066400000000000000000000002561452062100400230170ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "sanitized_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:sanitize_html]).to_html end endredcloth-4.3.3/spec/formatters/style_filtered_html_spec.rb000066400000000000000000000002631452062100400240410ustar00rootroot00000000000000require File.dirname(__FILE__) + '/../spec_helper' describe "style_filtered_html" do examples_from_yaml do |doc| RedCloth.new(doc['in'], [:filter_styles]).to_html end endredcloth-4.3.3/spec/parser_spec.rb000066400000000000000000000076321452062100400171140ustar00rootroot00000000000000require File.dirname(__FILE__) + '/spec_helper' describe RedCloth do describe "#new" do it "should accept options" do lambda { RedCloth.new("test", [:hard_breaks]) }.should_not raise_error end end it "should have a VERSION" do RedCloth.const_defined?("VERSION").should be_truthy RedCloth::VERSION.const_defined?("STRING").should be_truthy end it "should show the version as a string" do RedCloth::VERSION::STRING.should == RedCloth::VERSION.to_s RedCloth::VERSION.should == RedCloth::VERSION::STRING end it "should have EXTENSION_LANGUAGE" do RedCloth.const_defined?("EXTENSION_LANGUAGE").should be_truthy RedCloth::EXTENSION_LANGUAGE.should_not be_empty RedCloth::DESCRIPTION.should include(RedCloth::EXTENSION_LANGUAGE) end it "should not segfault on a badly formatted table" do RedCloth.new(%Q{| one | two |\nthree | four |}).to_html.should =~ /td/ end it "should not segfault on a table without a block end" do RedCloth.new("| a | b |\n| c | d |\nh3. foo").to_html.should =~ /h3/ end it "should not segfault on a table with empty cells" do RedCloth.new(%Q{|one || |\nthree | four |}).to_html.should =~ /td/ end it "should not segfault on an unfinished html block with filter_html" do lambda { RedCloth.new(%Q{
    Some text}, [:filter_html]).to_html }.should_not raise_error end it "should parse RedCloth::VERSION in input" do RedCloth.new("RedCloth::VERSION").to_html.should == "

    #{RedCloth::VERSION::STRING}

    " end it "should not parse RedCloth::VERSION if it's not on a line by itself" do input = "RedCloth::VERSION won't output the RedCloth::VERSION unless it's on a line all by itself.\n\nRedCloth::VERSION" html = "

    RedCloth::VERSION won’t output the RedCloth::VERSION unless it’s on a line all by itself.

    \n

    #{RedCloth::VERSION::STRING}

    " RedCloth.new(input).to_html.should == html end it "should output the RedCloth::VERSION if it's labeled on a line by itself" do input = "RedCloth::VERSION: RedCloth::VERSION" html = "

    RedCloth::VERSION: #{RedCloth::VERSION::STRING}

    " RedCloth.new(input).to_html.should == html end it "should output the RedCloth::VERSION if it's labeled in a sentence on a line by itself" do input = "RedCloth version RedCloth::VERSION" html = "

    RedCloth version #{RedCloth::VERSION::STRING}

    " RedCloth.new(input).to_html.should == html end it "should output the RedCloth::VERSION in brackets" do input = "The current RedCloth version is [RedCloth::VERSION]" html = "

    The current RedCloth version is #{RedCloth::VERSION::STRING}

    " RedCloth.new(input).to_html.should == html end it "should strip carriage returns" do input = "This is a paragraph\r\n\r\nThis is a\r\nline break.\r\n\r\n
    \r\ntest\r\n\r\n
    " html = "

    This is a paragraph

    \n

    This is a
    \nline break.

    \n
    \n

    test

    \n
    " RedCloth.new(input).to_html.should == html end it "should not add spurious li tags to the end of markup" do input = "* one\n* two\n* three \n\n" failing_input = "* one\n* two\n* three \n\n\n" RedCloth.new(input).to_html.should_not match(/
  • $/) RedCloth.new(failing_input).to_html.should_not match(/
  • $/) end if RUBY_VERSION > "1.9.0" it "should preserve character encoding" do input = "This is an ISO-8859-1 string".dup input.force_encoding 'iso-8859-1' output = RedCloth.new(input).to_html output.should == "

    This is an ISO-8859-1 string

    " output.encoding.to_s.should == "ISO-8859-1" end it "should not raise ArgumentError: invalid byte sequence" do s = "\xa3".dup s.force_encoding 'iso-8859-1' lambda { RedCloth.new(s).to_html }.should_not raise_error end end end redcloth-4.3.3/spec/security/000077500000000000000000000000001452062100400161205ustar00rootroot00000000000000redcloth-4.3.3/spec/security/CVE-2012-6684_spec.rb000066400000000000000000000032171452062100400210660ustar00rootroot00000000000000# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-6684 require 'redcloth' describe 'CVE-2012-6684' do it 'should not let javascript links pass through' do # PoC from http://co3k.org/blog/redcloth-unfixed-xss-en output = RedCloth.new('["clickme":javascript:alert(%27XSS%27)]', [:filter_html, :filter_styles, :filter_classes, :filter_ids]).to_html expect(output).to_not match(/href=.javascript:alert/) output = RedCloth.new('["clickme":jAvascript:alert(%27XSS%27)]', [:filter_html, :filter_styles, :filter_classes, :filter_ids]).to_html expect(output).to_not match(/href=.jAvascript:alert/) end it 'should not let javascript links pass through on images' do output = RedCloth.new('"! Example

    ") end end redcloth-4.3.3/spec/spec_helper.rb000066400000000000000000000017751452062100400171010ustar00rootroot00000000000000$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) require 'redcloth' require 'yaml' def examples_from_yaml(&block) formatter = description.downcase define_method("format_as_#{formatter}", &block) fixtures.each do |name, doc| if doc[formatter] example("should output #{formatter} for #{name}") do output = method("format_as_#{formatter}").call(doc) output.should == doc[formatter] end else example("should not raise errors when rendering #{formatter} for #{name}") do lambda { method("format_as_#{formatter}").call(doc) }.should_not raise_error end end end end def fixtures return @fixtures if @fixtures @fixtures = {} Dir[File.join(File.dirname(__FILE__), *%w[fixtures *.yml])].each do |testfile| testgroup = File.basename(testfile, '.yml') num = 0 YAML::load_stream(File.open(testfile)) do |doc| name = doc['name'] || num @fixtures["#{testgroup} #{name}"] = doc num += 1 end end @fixtures end redcloth-4.3.3/tasks/000077500000000000000000000000001452062100400144445ustar00rootroot00000000000000redcloth-4.3.3/tasks/compile.rake000066400000000000000000000021201452062100400167330ustar00rootroot00000000000000CLEAN.include [ 'tmp', '**/*.{o,obj,class,pdb,lib,def,exp,log,rbc}', 'ext/redcloth_scan/**/redcloth_*.rb', 'ext/redcloth_scan/Makefile', 'ext/redcloth_scan/extconf.rb', ] CLOBBER.include [ 'pkg', '**/*.{c,java}', 'lib/**/*.{bundle,so,o,obj,pdb,lib,def,exp,jar}', 'lib/redcloth_scan.rb', ] # Load the Gem specification for the current platform (Ruby or JRuby). def gemspec(platform = 'ruby') Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__)) end require 'rake/extensiontask' require File.dirname(__FILE__) + '/ragel_extension_task' extconf = "ext/redcloth_scan/extconf.rb" file extconf do FileUtils.mkdir(File.dirname(extconf)) unless File.directory?(File.dirname(extconf)) File.open(extconf, "w") do |io| io.write(<<-EOF) require 'mkmf' CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags'] $CFLAGS << ' -O0 -Wall ' if CONFIG['CC'] =~ /gcc/ dir_config("redcloth_scan") have_library("c", "main") create_makefile("redcloth_scan") EOF end end Rake::RagelExtensionTask.new("redcloth_scan", gemspec) do |ext| endredcloth-4.3.3/tasks/ragel_extension_task.rb000066400000000000000000000055651452062100400212140ustar00rootroot00000000000000module Rake module RagelGenerationTasks RAGEL_INCLUDE_PATTERN = /include \w+ "([^"]+)";/ RAGEL_VERSION_COMMAND = "ragel -v" attr_accessor :rl_dir attr_accessor :machines def init(name = nil, gem_spec = nil) super @rl_dir = "ragel" @machines = %w(scan inline attributes) end def lang raise NotImplementedError end def source_files @source_files ||= machines.map {|m| target(m) } end def define super define_ragel_tasks end def define_ragel_tasks machines.each do |machine| file target(machine) => [*ragel_sources(machine)] do mkdir_p(File.dirname(target(machine))) unless File.directory?(File.dirname(target(machine))) ensure_ragel_version sh "ragel #{flags} #{lang_ragel(machine)} -o #{target(machine)}" end file extconf => [target(machine)] if lang == 'c' end end def target(machine) { 'scan' => { 'c' => "#{@ext_dir}/redcloth_scan.c", 'rb' => "#{@ext_dir}/redcloth_scan.rb" }, 'inline' => { 'c' => "#{@ext_dir}/redcloth_inline.c", 'rb' => "#{@ext_dir}/redcloth_inline.rb" }, 'attributes' => { 'c' => "#{@ext_dir}/redcloth_attributes.c", 'rb' => "#{@ext_dir}/redcloth_attributes.rb" } }[machine][lang] end def lang_ragel(machine) "#{@rl_dir}/redcloth_#{machine}.#{lang}.rl" end def ragel_sources(machine) deps = [lang_ragel(machine), ragel_file_dependencies(lang_ragel(machine))].flatten.dup deps += ["#{@ext_dir}/redcloth.h"] if lang == 'c' deps # FIXME: merge that header file into other places so it can be eliminated? end def ragel_file_dependencies(ragel_file) found = find_ragel_includes(ragel_file) found + found.collect {|file| ragel_file_dependencies(file)} end def find_ragel_includes(file) File.open(file).grep(RAGEL_INCLUDE_PATTERN) { $1 }.map do |file| "#{@rl_dir}/#{file}" end end def flags code_style_flag = preferred_code_style ? " -" + preferred_code_style : "" "-#{host_language_flag}#{code_style_flag}" end def host_language_flag { 'c' => 'C', 'rb' => 'R' }[lang] end def preferred_code_style { 'c' => 'T0', 'rb' => 'F1' }[lang] end def ensure_ragel_version @ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i} raise unless @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 3) rescue STDERR.puts "Ragel 6.3 or greater is required." exit(1) end end class RagelExtensionTask < ExtensionTask include RagelGenerationTasks def lang "c" end end endredcloth-4.3.3/tasks/release.rake000066400000000000000000000005511452062100400167310ustar00rootroot00000000000000namespace :release do desc 'Push all gems to rubygems.org' # 1. run rake test # 2. update changelog # 3. change version in version.rb # 4. branch into stable vx.x branch # 5. git tag and push tag # 5.1. git tag vx.x.x # 5.2. git push --follow-tags task :gem do sh("gem build redcloth.gemspec") sh("gem push RedCloth-*.gem") end end redcloth-4.3.3/tasks/rspec.rake000066400000000000000000000004351452062100400164260ustar00rootroot00000000000000require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) RSpec::Core::RakeTask.new(:rcov) do |t| t.rcov = true t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/} end task :default => :spec task :spec => :compile RSpec::Core::RakeTask.new(:test) # for rubygems-testredcloth-4.3.3/tasks/rvm.rake000066400000000000000000000040071452062100400161150ustar00rootroot00000000000000require 'rvm' namespace :rvm do RVM_RUBIES = ['ruby-1.8.6-p398', 'ruby-1.9.1-p243', 'ruby-1.9.2-p136', 'ruby-2.2.3p173'] RVM_GEMSET_NAME = 'redcloth' task :setup do unless @rvm_setup rvm_lib_path = "#{`echo $rvm_path`.strip}/lib" #$LOAD_PATH.unshift(rvm_lib_path) unless $LOAD_PATH.include?(rvm_lib_path) require 'rvm' require 'tmpdir' @rvm_setup = true end end desc "Runs specs under each rvm ruby" task :spec => :setup do puts rvm_rubies.join(',') rvm_each_rubie do # Make sure all dependencies are installed but ignore Gemfile.lock. It # gets confused when locked to java and running ruby and vice-versa. STDERR << RVM.run('bundle update').stderr result = RVM.run("rake test") STDOUT << result.stdout STDERR << result.stderr end end desc "Show rubies" task :rubies => :setup do puts rvm_rubies.join(",") end namespace :install do task :rubies => :setup do installed_rubies = RVM.list_strings RVM_RUBIES.each do |rubie| if installed_rubies.include?(rubie) puts "info: Rubie #{rubie} already installed." else good_msg = "info: Rubie #{rubie} installed." bad_msg = "Failed #{rubie} install! Check RVM logs here: #{RVM.path}/log/#{rubie}" puts "info: Rubie #{rubie} installation inprogress. This could take awhile..." if RVM.install(rubie,{}) puts(good_msg) RVM.use(rubie) RVM.perform_set_operation(:gem, 'install', 'bundler') RVM.reset_current! else abort(bad_msg) end end end end end task :remove => :setup do rvm_rubies.each { |rubie| RVM.remove(rubie) } end end # RVM Helper Methods def rvm_each_rubie rvm_rubies.each do |rubie| RVM.use(rubie) puts "Using #{rubie}" yield end ensure RVM.reset_current! end def rvm_rubies(options={}) RVM_RUBIES.map{ |rubie| "#{rubie}@#{RVM_GEMSET_NAME}" } end redcloth-4.3.3/test/000077500000000000000000000000001452062100400142765ustar00rootroot00000000000000redcloth-4.3.3/test/ragel_profiler.rb000066400000000000000000000035541452062100400176260ustar00rootroot00000000000000class RagelProfiler MEM_CONVERSION = 1024 COMMANDS = { :compile => %w(ragel rlgen-cd gcc-4.0 gnumake cc1), :test => %w(ruby) } FIELDS = %w(compile_time compile_max_rss test_time test_max_rss file_size) @@results = {} def initialize(name) @name = name @@results[name] = [] end def measure(type) raise "not a valid type" unless COMMANDS.keys.include?(type) regex = COMMANDS[type].map {|c| Regexp.escape(c) }.join("|") t = Thread.new do Thread.current[:max] = 0 loop do Thread.current[:max] = [run(regex), Thread.current[:max]].max sleep 0.5 end end begin_time = Time.now yield total_time = Time.now - begin_time t.kill store_result(type, "time", total_time) store_result(type, "max_rss", t[:max]) end def ext_size(file) store_result(:file, "size", File.size(file) / MEM_CONVERSION) end def self.results out = [] out << "name\t" + FIELDS.join("\t") @@results.each do |name, results| out << [name, results ].flatten.join("\t") end out.join("\n") end private def store_result(type, metric, value) index = FIELDS.index("#{type.to_s}_#{metric}") @@results[@name][index] = "%.2f" % value end def run(ps_regex) ps_command = "ps axucww" ps_output = `#{ps_command}` fields = ps_output.to_a.first.downcase.split memory_index = fields.index("rss") pid_index = fields.index("pid") ppid_index = fields.index("ppid") total = ps_output.grep(/(#{ps_regex})\s+$/i).map do |com| Float(com.split[memory_index]).abs end.inject(0) { |s,v| s += v } if total return total/MEM_CONVERSION else STDERR.puts "Command not found. No processes found matching #{ps_regex}." end end endredcloth-4.3.3/test/validate_fixtures.rb000066400000000000000000000036001452062100400203440ustar00rootroot00000000000000#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), 'helper') require 'erb' require 'w3c_validators' class ValidateFixtures < Test::Unit::TestCase include W3CValidators def setup @v = MarkupValidator.new sleep 1 # delay per WC3 request end HTML_4_0_TEMPLATE = < <%= test_name %> <%= content %> EOD XHTML_1_0_TEMPLATE = < <%= test_name %> <%= content %> EOD fixtures.each do |name, doc| if doc['html'] && (doc['valid_html'].nil? || doc['valid_html']) define_method("test_html_output_validity_of_#{name}") do assert_produces_valid_html(name, doc['html']) end define_method("test_xhtml_output_validity_of_#{name}") do assert_produces_valid_xhtml(name, doc['html']) end end end private def assert_produces_valid_html(test_name, content) body = ERB.new(HTML_4_0_TEMPLATE, nil,'-%').result(binding) assert_validates(body) end def assert_produces_valid_xhtml(test_name, content) body = ERB.new(XHTML_1_0_TEMPLATE, nil,'-%').result(binding) assert_validates(body) end def assert_validates(body) results = @v.validate_text(body) errors = results.errors warnings = results.warnings.reject {|w| w.message_id == "247" } # NET-enabling start-tag requires SHORTTAG YES. assert(errors.empty?, "Validator errors: \n" + errors.collect {|e| "'#{e.to_s}'"}.join("\n")) assert(warnings.empty?, "Validator warnings: \n" + warnings.collect {|w| "'#{w.to_s}'"}.join("\n")) end end