maruku-0.6.0/0000755000175000017500000000000011573154515012726 5ustar vincentvincentmaruku-0.6.0/docs/0000755000175000017500000000000011573154515013656 5ustar vincentvincentmaruku-0.6.0/docs/markdown_syntax.md0000644000175000017500000006622411573154515017442 0ustar vincentvincentcss: style.css Markdown: Syntax ================ * [Overview](#overview) * [Philosophy](#philosophy) * [Inline HTML](#html) * [Automatic Escaping for Special Characters](#autoescape) * [Block Elements](#block) * [Paragraphs and Line Breaks](#p) * [Headers](#header) * [Blockquotes](#blockquote) * [Lists](#list) * [Code Blocks](#precode) * [Horizontal Rules](#hr) * [Span Elements](#span) * [Links](#link) * [Emphasis](#em) * [Code](#code) * [Images](#img) * [Miscellaneous](#misc) * [Backslash Escapes](#backslash) * [Automatic Links](#autolink) **Note:** This document is itself written using Markdown; you can [see the source for it by adding '.text' to the URL][src]. [src]: /projects/markdown/syntax.text * * *

Overview

Philosophy

Markdown is intended to be as easy-to-read and easy-to-write as is feasible. Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions. While Markdown's syntax has been influenced by several existing text-to-HTML filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], [Grutatext] [5], and [EtText] [6] -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email. [1]: http://docutils.sourceforge.net/mirror/setext.html [2]: http://www.aaronsw.com/2002/atx/ [3]: http://textism.com/tools/textile/ [4]: http://docutils.sourceforge.net/rst.html [5]: http://www.triptico.com/software/grutatxt.html [6]: http://ettext.taint.org/doc/ To this end, Markdown's syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like \*emphasis\*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you've ever used email.

Inline HTML

Markdown's syntax is intended for one purpose: to be used as a format for *writing* for the web. Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is *not* to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a *publishing* format; Markdown is a *writing* format. Thus, Markdown's formatting syntax only addresses issues that can be conveyed in plain text. For any markup that is not covered by Markdown's syntax, you simply use HTML itself. There's no need to preface it or delimit it to indicate that you're switching from Markdown to HTML; you just use the tags. The only restrictions are that block-level HTML elements -- e.g. `
`, ``, `
`, `

`, etc. -- must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted) `

` tags around HTML block-level tags. For example, to add an HTML table to a Markdown article: This is a regular paragraph.

Foo
This is another regular paragraph. Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an HTML block. Span-level HTML tags -- e.g. ``, ``, or `` -- can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you'd prefer to use HTML `` or `` tags instead of Markdown's link or image syntax, go right ahead. Unlike block-level HTML tags, Markdown syntax *is* processed within span-level tags.

Automatic Escaping for Special Characters

In HTML, there are two characters that demand special treatment: `<` and `&`. Left angle brackets are used to start tags; ampersands are used to denote HTML entities. If you want to use them as literal characters, you must escape them as entities, e.g. `<`, and `&`. Ampersands in particular are bedeviling for web writers. If you want to write about 'AT&T', you need to write '`AT&T`'. You even need to escape ampersands within URLs. Thus, if you want to link to: http://images.google.com/images?num=30&q=larry+bird you need to encode the URL as: http://images.google.com/images?num=30&q=larry+bird in your anchor tag `href` attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites. Markdown allows you to use these characters naturally, taking care of all the necessary escaping for you. If you use an ampersand as part of an HTML entity, it remains unchanged; otherwise it will be translated into `&`. So, if you want to include a copyright symbol in your article, you can write: © and Markdown will leave it alone. But if you write: AT&T Markdown will translate it to: AT&T Similarly, because Markdown supports [inline HTML](#html), if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write: 4 < 5 Markdown will translate it to: 4 < 5 However, inside Markdown code spans and blocks, angle brackets and ampersands are *always* encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single `<` and `&` in your example code needs to be escaped.) * * *

Block Elements

Paragraphs and Line Breaks

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line -- a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs. The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard-wrapped" text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type's "Convert Line Breaks" option) which translate every line break character in a paragraph into a `
` tag. When you *do* want to insert a `
` break tag using Markdown, you end a line with two or more spaces, then type return. Yes, this takes a tad more effort to create a `
`, but a simplistic "every line break is a `
`" rule wouldn't work for Markdown. Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] work best -- and look better -- when you format them with hard breaks. [bq]: #blockquote [l]: #list Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. Setext-style headers are "underlined" using equal signs (for first-level headers) and dashes (for second-level headers). For example: This is an H1 ============= This is an H2 ------------- Any number of underlining `=`'s or `-`'s will work. Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example: # This is an H1 ## This is an H2 ###### This is an H6 Optionally, you may "close" atx-style headers. This is purely cosmetic -- you can use this if you think it looks better. The closing hashes don't even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) : # This is an H1 # ## This is an H2 ## ### This is an H3 ######

Blockquotes

Markdown uses email-style `>` characters for blockquoting. If you're familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a `>` before every line: > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse > id sem consectetuer libero luctus adipiscing. Markdown allows you to be lazy and only put the `>` before the first line of a hard-wrapped paragraph: > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of `>`: > This is the first level of quoting. > > > This is nested blockquote. > > Back to the first level. Blockquotes can contain other Markdown elements, including headers, lists, and code blocks: > ## This is a header. > > 1. This is the first list item. > 2. This is the second list item. > > Here's some example code: > > return shell_exec("echo $input | $markdown_script"); Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists. Unordered lists use asterisks, pluses, and hyphens -- interchangably -- as list markers: * Red * Green * Blue is equivalent to: + Red + Green + Blue and: - Red - Green - Blue Ordered lists use numbers followed by periods: 1. Bird 2. McHale 3. Parish It's important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:
  1. Bird
  2. McHale
  3. Parish
If you instead wrote the list in Markdown like this: 1. Bird 1. McHale 1. Parish or even: 3. Bird 1. McHale 8. Parish you'd get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don't have to. If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number. List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab. To make lists look nice, you can wrap items with hanging indents: * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. But if you want to be lazy, you don't have to: * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. If list items are separated by blank lines, Markdown will wrap the items in `

` tags in the HTML output. For example, this input: * Bird * Magic will turn into:

  • Bird
  • Magic
But this: * Bird * Magic will turn into:
  • Bird

  • Magic

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be intended by either 4 spaces or one tab: 1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. 2. Suspendisse id sem consectetuer libero luctus adipiscing. It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy: * This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Another item in the same list. To put a blockquote within a list item, the blockquote's `>` delimiters need to be indented: * A list item with a blockquote: > This is a blockquote > inside a list item. To put a code block within a list item, the code block needs to be indented *twice* -- 8 spaces or two tabs: * A list item with a code block: It's worth noting that it's possible to trigger an ordered list by accident, by writing something like this: 1986. What a great season. In other words, a *number-period-space* sequence at the beginning of a line. To avoid this, you can backslash-escape the period: 1986\. What a great season.

Code Blocks

Pre-formatted code blocks are used for writing about programming or markup source code. Rather than forming normal paragraphs, the lines of a code block are interpreted literally. Markdown wraps a code block in both `
` and `` tags.

To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab. For example, given this input:

    This is a normal paragraph:

        This is a code block.

Markdown will generate:

    

This is a normal paragraph:

This is a code block.
    
One level of indentation -- 4 spaces or 1 tab -- is removed from each line of the code block. For example, this: Here is an example of AppleScript: tell application "Foo" beep end tell will turn into:

Here is an example of AppleScript:

tell application "Foo"
        beep
    end tell
    
A code block continues until it reaches a line that is not indented (or the end of the article). Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) are automatically converted into HTML entities. This makes it very easy to include example HTML source code using Markdown -- just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets. For example, this: will turn into:
<div class="footer">
        &copy; 2004 Foo Corporation
    </div>
    
Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it's also easy to use Markdown to write about Markdown's own syntax.

Horizontal Rules

You can produce a horizontal rule tag (`
`) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule: * * * *** ***** - - - --------------------------------------- * * *

Span Elements

Markdown supports two style of links: *inline* and *reference*. In both styles, the link text is delimited by [square brackets]. To create an inline link, use a set of regular parentheses immediately after the link text's closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an *optional* title for the link, surrounded in quotes. For example: This is [an example](http://example.com/ "Title") inline link. [This link](http://example.net/) has no title attribute. Will produce:

This is an example inline link.

This link has no title attribute.

If you're referring to a local resource on the same server, you can use relative paths: See my [About](/about/) page for details. Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link: This is [an example][id] reference-style link. You can optionally use a space to separate the sets of brackets: This is [an example] [id] reference-style link. Then, anywhere in the document, you define your link label like this, on a line by itself: [id]: http://example.com/ "Optional Title Here" That is: * Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces); * followed by a colon; * followed by one or more spaces (or tabs); * followed by the URL for the link; * optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses. The following three link definitions are equivalent: [foo]: http://example.com/ "Optional Title Here" [foo]: http://example.com/ 'Optional Title Here' [foo]: http://example.com/ (Optional Title Here) **Note:** There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles. The link URL may, optionally, be surrounded by angle brackets: [id]: "Optional Title Here" You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs: [id]: http://example.com/longish/path/to/resource/here "Optional Title Here" Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output. Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: [link text][a] [link text][A] are equivalent. The *implicit link name* shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets -- e.g., to link the word "Google" to the google.com web site, you could simply write: [Google][] And then define the link: [Google]: http://google.com/ Because link names may contain spaces, this shortcut even works for multiple words in the link text: Visit [Daring Fireball][] for more information. And then define the link: [Daring Fireball]: http://daringfireball.net/ Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they're used, but if you want, you can put them all at the end of your document, sort of like footnotes. Here's an example of reference links in action: I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]. [1]: http://google.com/ "Google" [2]: http://search.yahoo.com/ "Yahoo Search" [3]: http://search.msn.com/ "MSN Search" Using the implicit link name shortcut, you could instead write: I get 10 times more traffic from [Google][] than from [Yahoo][] or [MSN][]. [google]: http://google.com/ "Google" [yahoo]: http://search.yahoo.com/ "Yahoo Search" [msn]: http://search.msn.com/ "MSN Search" Both of the above examples will produce the following HTML output:

I get 10 times more traffic from Google than from Yahoo or MSN.

For comparison, here is the same paragraph written using Markdown's inline link style: I get 10 times more traffic from [Google](http://google.com/ "Google") than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or [MSN](http://search.msn.com/ "MSN Search"). The point of reference-style links is not that they're easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it's 176 characters; and as raw HTML, it's 234 characters. In the raw HTML, there's more markup than there is text. With Markdown's reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.

Emphasis

Markdown treats asterisks (`*`) and underscores (`_`) as indicators of emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML `` tag. E.g., this input: *single asterisks* _single underscores_ **double asterisks** __double underscores__ will produce: single asterisks single underscores double asterisks double underscores You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span. Emphasis can be used in the middle of a word: un*fucking*believable But if you surround an `*` or `_` with spaces, it'll be treated as a literal asterisk or underscore. To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it: \*this text is surrounded by literal asterisks\*

Code

To indicate a span of code, wrap it with backtick quotes (`` ` ``). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example: Use the `printf()` function. will produce:

Use the printf() function.

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters: ``There is a literal backtick (`) here.`` which will produce this:

There is a literal backtick (`) here.

The backtick delimiters surrounding a code span may include spaces -- one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span: A single backtick in a code span: `` ` `` A backtick-delimited string in a code span: `` `foo` `` will produce:

A single backtick in a code span: `

A backtick-delimited string in a code span: `foo`

With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this: Please don't use any `` tags. into:

Please don't use any <blink> tags.

You can write this: `—` is the decimal-encoded equivalent of `—`. to produce:

&#8212; is the decimal-encoded equivalent of &mdash;.

Images

Admittedly, it's fairly difficult to devise a "natural" syntax for placing images into a plain text document format. Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: *inline* and *reference*. Inline image syntax looks like this: ![Alt text](/path/to/img.jpg) ![Alt text](/path/to/img.jpg "Optional title") That is: * An exclamation mark: `!`; * followed by a set of square brackets, containing the `alt` attribute text for the image; * followed by a set of parentheses, containing the URL or path to the image, and an optional `title` attribute enclosed in double or single quotes. Reference-style image syntax looks like this: ![Alt text][id] Where "id" is the name of a defined image reference. Image references are defined using syntax identical to link references: [id]: url/to/image "Optional title attribute" As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML `` tags. * * *

Miscellaneous

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: Markdown will turn this into: http://example.com/ Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this: into something like this: address@exa mple.com which will render in a browser as a clickable link to "address@example.com". (This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won't fool all of them. It's better than nothing, but an address published in this way will probably eventually start receiving spam.)

Backslash Escapes

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown's formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML `` tag), you can backslashes before the asterisks, like this: \*literal asterisks\* Markdown provides backslash escapes for the following characters: \ backslash ` backtick * asterisk _ underscore {} curly braces [] square brackets () parentheses # hash mark + plus sign - minus sign (hyphen) . dot ! exclamation mark maruku-0.6.0/docs/other_stuff.md0000644000175000017500000000367211573154515016540 0ustar vincentvincent* *Jan. 22* With very minimal changes, Maruku now works in JRuby. It is very slow, though. Some benchmarks: * G4 1.5GhZ, Ruby 1.8.5: Maruku (to_html): parsing 0.65 sec + rendering 0.40 sec = 1.04 sec Maruku (to_latex): parsing 0.70 sec + rendering 0.21 sec = 0.91 sec * G4 1.5GhZ, JRuby 1.9.2: Maruku (to_html): parsing 4.77 sec + rendering 2.24 sec = 7.01 sec Maruku (to_latex): parsing 4.04 sec + rendering 1.12 sec = 5.16 sec * *Jan. 21* Integration of Blahtex. PNG export of formula and alignment works ok in Mozilla, Safari, Camino, Opera. IE7 is acting strangely. * Support for LaTeX-style formula input, and export to MathML. [Jacques Distler] is integrating Maruku into Instiki (a Ruby On Rails-based wiki software), as to have a Ruby wiki with proper math support. You know, these physicists like all those funny symbols. * To have the MathML export, it is needed to install one of: * [RiTeX] (`gem install ritex`) * [itex2MML] supports much more complex formulas than Ritex. * PNG for old browser is not here yet. The plan is to use BlahTeX. * Command line options for the `maruku` command: Usage: maruku [options] [file1.md [file2.md ... -v, --[no-]verbose Run verbosely -u, --[no-]unsafe Use unsafe features -b Break on error -m, --math-engine ENGINE Uses ENGINE to render MathML --pdf Write PDF --html Write HTML --tex Write LaTeX --inspect Shows the parsing result --version Show version -h, --help Show this message * Other things: * Created the embryo of an extension system. Please don't use it yet, as probably the API is bound to change. * There are a couple of hidden, unsafe, features that are not enabled by default. maruku-0.6.0/docs/math.md0000644000175000017500000001035311573154515015133 0ustar vincentvincentTitle: Math support in Maruku LaTeX preamble: math_preamble.tex LaTeX use listings: true CSS: math.css style.css use numbered headers: true Math support in Maruku ====================== This document describes Maruku's support of inline LaTeX-style math. At the moment, **these features are experimental**, are probably buggy and the syntax and implementation are bound to change in the near future. Also, there are many subtleties of which one must care for correctly serving the XHTML+MathML document to browsers. In fact, *this documentation is __not__ enough to get you started*, unless you feel very adventurous. * toc {:toc} Syntax --------------------------------------- ### Inline math Inline math is contained inside couples of `$`. Everything inside will be passed as-is to LaTeX: no Markdown interpretation will take place. Example: $x^{n}+y^{n} \neq z^{n}$ for $n \geq 3$ > Example: $x^{n}+y^{n} \neq z^{n}$ for $n \geq 3$ ### Equations Equations are specified using either the `$$ ... $$` or `\[ ... \]` LaTeX notation. Equations can span multiple lines. \[ \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{exists.} \] > \[ > \sum_{n=1}^\infty \frac{1}{n} > \text{ is divergent, but } > \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \quad \text{exists.} > \] Some random AMSTeX symbols: $$ \beth \Subset \bigtriangleup \bumpeq \ggg \pitchfork $$ $$ \beth \Subset \bigtriangleup \bumpeq \ggg \pitchfork $$ ## Cross references ## {#cross} Create a label for an equation in two ways: * LaTeX style: Consider \eqref{a}: $$ \alpha = \beta \label{a} $$ * More readable style: Consider (eq:a): $$ \alpha = \beta $$ (a) You can mix the two. Labels will work as expected also in the PDF output, whatever style you use: Maruku will insert the necessary `\label` commands. The following are 4 equations, labeled A,B,C,D: $$ \alpha $$ (A) \[ \beta \] (B) $$ \gamma \label{C} $$ \[ \delta \label{D} \] You can now refer to (eq:A), (eq:B), \eqref{C}, \eqref{D}. Enabling the extension --------------------------------------- ### On the command line Use the `-m` option to choose the kind of output. Possible choices are: `--math-engine itex2mml` : Outputs MathML using [itex2mml](#using_itex2mml). `--math-engine ritex` : Outputs MathML using [ritex](#using_ritex). `--math-engine blahtex` : Outputs MathML using [blahtex](#using_blahtex). `--math-images blahtex` : Outputs PNGs using [blahtex](#using_blahtex). ### With embedded Maruku You have to enable the math extension like this: require 'maruku' # loads maruku require 'maruku/ext/math' # loads the math extension Use the following to choose the engine: MaRuKu::Globals[:html_math_engine] = 'ritex' MaRuKu::Globals[:html_png_engine] = 'blahtex' Available MathML engines are 'none', 'itex2mml', 'blahtex'. 'blahtex' is the only PNG engine available. External libraries needed ------------------------- To output MathML or PNGs, it is needed to install one of the following libraries ### Using `ritex` ### {#using_ritex} Install with $ gem install ritex ritex's abilities are very limited, but it is the easiest to install. ### Using `itex2mml` ### {#using_itex2mml} itex2mml supports much more LaTeX commands/environments than ritex. Install itex2mml using the instructions at: > This is a summary of the available LaTeX commands: > Moreover, [Jacques Distler] is integrating Maruku+itex2mml+[Instiki]. You can find more information here: > [Jacques Distler]: http://golem.ph.utexas.edu/~distler [instiki]: http://www.instiki.org ### Using `blahtex` ### {#using_blahtex} Download from . Make sure you have the command-line `blahtex` in your path. Subtleties ---------- ### Serving the right content/type ### * Mozilla wants files to have the `.xhtml` extension. ... ### Where PNGS are put ### * `Globals[:math_png_dir]` * `Globals[:math_png_dir_url]` ### Styling equations #### ... ### Aligning PNGs #### * using `ex` * **IE7 bug** ... maruku-0.6.0/docs/changelog.md0000644000175000017500000002244411573154515016135 0ustar vincentvincentCSS: style.css LaTeX CJK: true HTML use syntax: true #### Changes in 0.5.6 #### {#stable} * News: - Now Maruku is in the official Gentoo Portage tree (done by [Aggelos Orfanakos]) * New stuff: - Attribute `maruku_signature` defaults to false. (many people asked this) - unittests scripts are included in the distribution. - New attribute `filter_html`: if true, raw HTML/XML is discarded. (asked by Marik) - Command line: if output file is `-`, Maruku writes to stdout. * Bug fixes: * Another tiny bug in HTML parsing. * In latex, `\linebreak` was used instead of `\newline` (reported by Sam Kleinman) * Fixed bug with non-alpha numeric characters in ref.ids (reported by Aggelos Orfanakos) * Pending bugs/feature requests: - Maruku does not allow 3-space indented lists. - Lists item whose first character is UTF8 are not recognized (reported by Aggelos Orfanakos) - Maruku cannot output `"`-delimited attributes, because `REXML` does not support it. [Aggelos Orfanakos]: http://agorf.gr/ #### Changes in 0.5.5 #### * Features: * Input of HTML numeric entities: Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef. > Examples of numeric character references include © or © > for the copyright symbol, Α or Α for the Greek capital > letter alpha, and ا or ا for the Arabic letter alef. * Bug fixes: * Alt text was ignored for images. * Fixed minor bug in reading HTML inside paragraph. * Changed rules for block-level HTML to make it similar to Markdown.pl. For example: Paragraph
will be translated to

Paragraph

while this: Paragraph
becomes

Paragraph

* **Pending bugs**: there are some problems when parsing lists. It is difficult to get it right because the spec is very fuzzy. At the moment, list items cannot be indented by more than 1 space. #### Changes in 0.5.4 #### * Features: * [All HTML attributes](http://www.w3.org/TR/html4/index/attributes.html) are supported. > Science is a wonderful thing if one does not > have to earn one's living at it. {: cite="http://en.wikiquote.org/wiki/Albert_Einstein"} * Attribute `doc_prefix`. * Math: * `\begin{equation}` and `\end{equation}` are understood. * Math parsing enabled per-instance using the `math_enabled` attribute. * `math_numbered` attribute. * Bug fixes: * Runs quietly with `ruby -w`. * Fixed a bug which could cause data-loss when reading indented lines. #### Changes in 0.5.3 #### * Features: * [All HTML `table` attributes](http://www.w3.org/TR/html4/struct/tables.html#h-11.2.1) can be used (`summary`, `width`, `frame`, `rules`, `border`, `cellspacing`, `cellpadding`). The next version will hopefully use all HTML attributes. * Bug fixes: * Crash on this line: (found by Aggelos Orfanakos) [test][]: * Regression with attribute system (found by Charles) #### Changes in 0.5.1 #### * Bug fixes: * Workaround for Internet Explorer bug: be very sure that `'` is always written as `'`. * Support for empty images ref: `![image]` and `![image][]`. * Fixed bug in parsing attribute lists definitions. * Minor things: * Now code blocks are written as a `` element inside a `
`, and
		`` elements have both `class` and `lang` attributes set 
		to the specified language.
		
		Example:

			    Example
			{:lang=ruby}
		{:lang=markdown}
		
		produces:
		
			
Example
{:lang=xml} #### Changes in 0.5.0 #### * Syntax changes: * Compatibility with newest Markdown.pl: `[text]` as a synonim of `[text][]`. * Meta data: the first IAL in a span environment now refers to the parent. This makes it possible to set attributes for cells: Head | Head | ---------------+-------+-- {:r} Hello + ... {:r: scope='row'} The first cell will have the `scope` attribute set to `row`. * New settings: * Disable the Maruku signature by setting `maruku signature: false` * Stricter doctype. By the way -- did I mention it? -- **Maruku HTML has always been proper validating XHTML strict** (if a page does not validate, please report it as a bug). Of course, this only matters when using `maruku` as a standalone program. * I have updated the XHTML DTD used to support MathML: currently using XHTML+MathML+SVG. * Content-type set to `application/xhtml+xml` * All entities are written as numeric entities. * Bug fixes * Many fixes in the code handling the sanitizing of inline HTML. * `markdown=1` did not propagate to children. * LaTeX: An exception was raised if an unknown entity was used. #### Changes in 0.4.2 #### * Adapted syntax to the [new meta-data proposal][proposal]. * Changes in LaTeX export: * Links to external URLs are blue by default. * New attributes: `latex_preamble` to add a custom preamble, and `latex_cjk` to add packages for UTF-8 Japanese characters. (**support for this is still shaky**). Example: Title: my document LaTeX CJK: true LaTeX preamble: preamble.tex Content * Bug fixes + Images were not given `id` or `class` attributes. + Fixed bug in LaTeX export with handling of `<`,`>` enclosed URLs: ``. #### Changes in 0.4.1 aka "Typographer" #### * Implemented SmartyPants support: 'Twas a "test" to 'remember' -- in the '90s --- while I was <>. She was 6\"12\'. > 'Twas a "test" to 'remember' -- in the '90s --- while I was <>. > She was 6\"12\'. I adapted the code from RubyPants. * Server directives between `` are properly preserved. * Changes in LaTeX export: * Now Japanese text rendering sort of works, using the following packages: \usepackage[C40]{fontenc} \usepackage[cjkjis]{ucs} \usepackage[utf8x]{inputenc} Nevertheless, I could only get bitmap fonts working -- probably it's a problem with my setup. A quick test: 日本、中国、ひらがな、カタカナ。 * Fixed bugs in rendering of immediate links. * External packages are `require`d only if needed. * More symbols supported. See the symbol list [in HTML](http://maruku.rubyforge.org/entity_test.html) and [in PDF](http://maruku.rubyforge.org/entity_test.pdf). #### Changes in 0.4 #### * First implementation of [the new meta-data syntax][meta]. * General refactorization of the code and much cleaner error reporting. * Created [the RDOC documentation][rdoc]. * The `add_whitespace` method took too much time -- it was O(n^2). * Added unit-tests for block-level elements. [rdoc]: http://maruku.rubyforge.org/rdoc/ [meta]: http://maruku.rubyforge.org/proposal.html [Jacques Distler]: http://golem.ph.utexas.edu/~distler [itex2MML]: http://golem.ph.utexas.edu/~distler/blog/itex2MML.html [math]: http://rubyforge.maruku.org/math.html #### Changes in 0.3 #### * A real parser is used instead of a regexp-based system, also for span-level elements. Now Maruku is almost 2x faster than Bluecloth, while having more features. Here are some benchmarks: BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec This is the result of running `lib/maruku/tests/benchmark.rb` on the Markdown specification. * Prettier HTML output by adding whitespace. * Added a full suite of unit-tests for the span-level parser. * Error management: Having a real parser, Maruku warns you about syntax issues. The default action is to warn and try to continue. If you do this: Maruku.new(string, {:on_error => :raise}) then syntax errors will cause an exception to be raised (you can catch this and retry). * Fixed a series of bugs in handling inline HTML code. Immediate TODO-list: * UTF-8 input/output works OK for HTML, however I am having pain trying to export to LaTeX. I want at least Japanese characters support, so if you know how to do this you are very welcome to give me an hand. For example: in the HTML version, you should see accented characters in this parenthesis: > (àèìòù) and Japanese text in these other parentheses: > (カタカナで 私の 名前は アンドレア チェンシ です). > > (日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください). In the LaTeX version, these do not appear. I know how to do LaTeX with ISO-8859-1 encoding (European characters), but I'm struggling with half-baked solutions for UTF-8 encoded documents. * Implement the [new meta-data proposal][proposal]. * Exporting to Markdown (pretty printing). * Exporting to HTML splitting in multiple files. * RubyPants. * Support for images in PDF. [proposal]: http://maruku.rubyforge.org/proposal.html [contact]: http://www.dis.uniroma1.it/~acensi/contact.html [markdown-discuss]: http://six.pairlist.net/mailman/listinfo/markdown-discuss [tracker]: http://rubyforge.org/tracker/?group_id=2795 maruku-0.6.0/docs/maruku.md0000644000175000017500000002120411573154515015503 0ustar vincentvincentCSS: style.css Use numbered headers: true HTML use syntax: true LaTeX use listings: true LaTeX CJK: false LaTeX preamble: preamble.tex ![MaRuKu](logo.png){#logo} Mar**u**k**u**: a Markdown-superset interpreter =============================================== [Maruku] is a Markdown interpreter written in [Ruby]. > [Last release](#release_notes) is version 0.5.6 -- 2007-05-22. > > Install using [rubygems]: > > $ gem install maruku > > Use this command to update to latest version: > > $ gem update maruku > {#news} [rubygems]: http://rubygems.org * * * Maruku allows you to write in an easy-to-read-and-write syntax, like this: > [This document in Markdown][this_md] Then it can be translated to HTML: > [This document in HTML][this_html] or LaTeX, which is then converted to PDF: > [This document in PDF][this_pdf] Maruku implements: * the original [Markdown syntax][markdown_html] ([HTML][markdown_html] or [PDF][markdown_pdf]), translated by Maruku). * all the improvements in [PHP Markdown Extra]. * a new [meta-data syntax][meta_data_proposal] __Authors__: Maruku has been developed so far by [Andrea Censi]. Contributors are most welcome! __The name of the game__: Maruku is the [romaji] transliteration of the [katakana] transliteration of "Mark", the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable "ru" appears in Maruku. [romaji]: http://en.wikipedia.org/wiki/Romaji [katakana]: http://en.wikipedia.org/wiki/Katakana [tests]: http://maruku.rubyforge.org/tests/ [maruku]: http://maruku.rubyforge.org/ [markdown_html]: http://maruku.rubyforge.org/markdown_syntax.html [markdown_pdf]: http://maruku.rubyforge.org/markdown_syntax.pdf [this_md]: http://maruku.rubyforge.org/maruku.md [this_html]: http://maruku.rubyforge.org/maruku.html [this_pdf]: http://maruku.rubyforge.org/maruku.pdf [Andrea Censi]: http://www.dis.uniroma1.it/~acensi/ [contact]: http://www.dis.uniroma1.it/~acensi/contact.html [gem]: http://rubygems.rubyforge.org/ [tracker]: http://rubyforge.org/tracker/?group_id=2795 [ruby]: http://www.ruby-lang.org [bluecloth]: http://www.deveiate.org/projects/BlueCloth [Markdown syntax]: http://daringfireball.net/projects/markdown/syntax [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/ [math syntax]: http://maruku.rubyforge.org/math.xhtml [blahtex]: http://www.blahtex.org [ritex]: http://ritex.rubyforge.org [itex2mml]: http://golem.ph.utexas.edu/~distler/code/itexToMML/ [syntax]: http://syntax.rubyforge.org/ [listings]: http://www.ctan.org/tex-archive/macros/latex/contrib/listings/ [meta_data_proposal]: http://maruku.rubyforge.org/proposal.html [markdown-discuss]: http://six.pairlist.net/mailman/listinfo/markdown-discuss * * * Table of contents: (**auto-generated by Maruku!**) * This list will contain the toc (it doesn't matter what you write here) {:toc} * * * {:ruby: lang=ruby code_background_color='#efffef'} {:shell: lang=sh code_background_color='#efefff'} {:markdown: code_background_color='#ffefef'} {:html: lang=xml} Release notes {#release_notes} -------------- Note: Maruku seems to be very robust, nevertheless it is still beta-level software. So if you want to use it in production environments, please check back in a month or so, while we squash the remaining bugs. In the meantime, feel free to toy around, and please signal problems, request features, by [contacting me][contact] or using the [tracker][tracker]. For issues about the Markdown syntax itself and improvements to it, please write to the [Markdown-discuss mailing list][markdown-discuss]. Have fun! See the [changelog](http://maruku.rubyforge.org/changelog.html#stable). Usage -------- ### Embedded Maruku ### This is the basic usage: require 'rubygems' require 'maruku' doc = Maruku.new(markdown_string) puts doc.to_html {:ruby} The method `to_html` outputs only an HTML fragment, while the method `to_html_document` outputs a complete XHTML 1.0 document: puts doc.to_html_document {:ruby} You can have the REXML document tree with: tree = doc.to_html_document_tree {:ruby} ### From the command line ### There is one command-line program installed: `maruku`. Without arguments, it converts Markdown to HTML: $ maruku file.md # creates file.html {:shell} With the `--pdf` arguments, it converts Markdown to LaTeX, then calls `pdflatex` to transform to PDF: $ maruku --pdf file.md # creates file.tex and file.pdf {:shell} Maruku summary of features {#features} -------------------------- * Supported syntax * [Basic Markdown][markdown_syntax] * [Markdown Extra](#extra) * [Meta-data syntax](#meta) * Output * XHTML * Syntax highlighting via the [`syntax`][syntax] library. * LaTeX * [Translation of HTML entities to LaTeX](#entities) * Syntax highlighting via the [`listings`][listings] package. * Misc * [Documentation for supported attributes][supported_attributes] * [Automatic generation of the TOC](#toc-generation) [supported_attributes]: exd.html **Experimental features (not released yet)** * [LaTeX Math syntax][math_syntax] (not enabled by default) * An extension system for adding new syntax is available, but the API is bound to change in the future, so please don't use it. * LaTeX to MathML using either one of [`ritex`][ritex], [`itex2mml`][itex2mml], [`blahtex`][blahtex]. * LaTeX to PNG using [`blahtex`][blahtex]. ### New meta-data syntax {#meta} Maruku implements a syntax that allows to attach "meta" information to objects. See [this proposal][meta_data_proposal] for how to attach metadata to the elements. See the [documentation for supported attributes][supported_attributes]. Meta-data for the document itself is specified through the use of email headers: Title: A simple document containing meta-headers CSS: style.css Content of the document {:markdown} When creating the document through Maruku.new(s).to_html_document {:ruby} the title and stylesheet are added as expected. Meta-data keys are assumed to be case-insensitive. ### Automatic generation of the table of contents ### {#toc-generation} If you create a list, and then set the `toc` attribute, when rendering Maruku will create an auto-generated table of contents. * This will become a table of contents (this text will be scraped). {:toc} You can see an example of this at the beginning of this document. ### Use HTML entities ### {#entities} If you want to use HTML entities, go on! We will take care of the translation to LaTeX: Entity | Result ------------|---------- `©` | © `£` | £ `λ` | λ `—` | — See the [list of supported entities][ent_html] ([pdf][ent_pdf]). [ent_html]: http://maruku.rubyforge.org/entity_test.html [ent_pdf]: http://maruku.rubyforge.org/entity_test.pdf ### This header contains *emphasis* **strong text** and `code` #### Note that this header contains formatting and it still works, also in the table of contents. And [This is a *link* with **all** ***sort*** of `weird stuff`](#features) in the text. Examples of PHP Markdown Extra syntax {#extra} ------------------------------------- * tables Col1 | Very very long head | Very very long head| -----|:-------------------:|-------------------:| cell | center-align | right-align | {:markdown} Col1 | Very very long head | Very very long head| -----|:-------------------:|-------------------:| cell | center-align | right-align | * footnotes [^foot] * footnotes [^foot] [^foot]: I really was missing those. {:markdown} [^foot]: I really was missing those. * Markdown inside HTML elements
This is a div with Markdown **strong text**
{:html}
This is a div with Markdown **strong text**
* header ids ## Download ## {#download} {:markdown} For example, [a link to the download](#download) header. * definition lists Definition list : something very hard to parse {:markdown} Definition list : something very hard to parse * abbreviations or ABB for short. *[ABB]: Simply an abbreviation maruku-0.6.0/docs/entity_test.md0000644000175000017500000000103111573154515016546 0ustar vincentvincent List of symbols supported by Maruku =================================== maruku-0.6.0/docs/proposal.md0000644000175000017500000001517511573154515016050 0ustar vincentvincentCSS: style.css LaTeX_use_listings: true html_use_syntax: true use_numbered_headers: true Proposal for adding a meta-data syntax to Markdown ============================================= This document describes a syntax for attaching meta-data to block-level elements (headers, paragraphs, code blocks,…), and to span-level elements (links, images,…). ***Note: this is an evolving proposal*** Last updated **January 10th, 2007**: * Changed the syntax for compatibility with a future extension mechanism. The first character in the curly braces must be a colon, optionally followed by a space: {: ref .class #id} The old syntax was `{ref .class #id}`. For ALDs, the new syntax is: {:ref_id: key=val .class #id } instead of: {ref_id}: key=val .class #id Converters that don't use this syntax may just ignore everything which is in curly braces and starts with ":". * IAL can be put both *before* and *after* the element. There is no ambiguity as a blank line is needed between elements: Paragraph 1 {:par2} Paragraph 2 is equivalent to: Paragraph 1 Paragraph 2 {:par2} * Simplified rules for escaping. *Table of contents:* > * Table of contents > {:toc} Overview -------- This proposal describes two additions to the Markdown syntax: 1. inline attribute lists (IAL) ## Header ## {: key=val .class #id ref_id} 2. attribute lists definitions (ALD) {:ref_id: key=val .class #id} Every span-level or block-level element can be followed by an IAL: ### Header ### {: #header1 class=c1} Paragraph *with emphasis*{: class=c1} second line of paragraph {: class=c1} In this example, the three IALs refer to the header, the emphasis span, and the entire paragraph, respectively. IALs can reference ALDs. The result of the following example is the same as the previous one: ### Header ### {: #header1 c1} Paragraph *with emphasis*{:c1} second line of paragraph {:c1} {:c1: class=c1} Attribute lists --------------- This is an example attribute list, which shows everything you can put inside: {: key1=val key2="long val" #myid .class1 .class2 ref1 ref2} More in particular, an attribute list is a whitespace-separated list of elements of 4 different kinds: 1. key/value pairs (quoted if necessary) 2. [references to ALD](#using_tags) (`ref1`,`ref2`) 3. [id specifiers](#class_id) (`#myid`) 4. [class specifiers](#class_id) (`.myclass`) ### `id` and `class` are special ### {#class_id} For ID and classes there are special shortcuts: * `#myid` is a shortcut for `id=myid` * `.myclass` means "add `myclass` to the current `class` attribute". So these are equivalent: {: .class1 .class2} {: class="class1 class2"} The following attribute lists are equivalent: {: #myid .class1 .class2} {: id=myid class=class1 .class2} {: id=myid class="class1 class2"} {: id=myid class="will be overridden" class=class1 .class2} Where to put inline attribute lists ---------------------------------- ### For block-level elements ### For paragraphs and other block-level elements, IAL go **after** the element: This is a paragraph. Line 2 of the paragraph. {: #myid .myclass} A quote with a citation url: > Who said that? {: cite=google.com} Note: empty lines between the block and the IAL are not tolerated. So this is not legal: This is a paragraph. Line 2 of the paragraph. {: #myid .myclass} Attribute lists may be indented up to 3 spaces: Paragraph1 {:ok} Paragraph2 {:ok} Paragraph2 {:ok} {:code_show_spaces} ### For headers ### For headers, you can put attribute lists on the same line: ### Header ### {: #myid} Header {: #myid .myclass} ------ or, as like other block-level elements, on the line below: ### Header ### {: #myid} Header ------ {: #myid .myclass} ### For span-level elements ### For span-level elements, meta-data goes immediately **after** in the flow. For example, in this: This is a *chunky paragraph*{: #id1} {: #id2} the ID of the `em` element is set to `id1` and the ID of the paragraph is set to `id2`. This works also for links, like this: This is [a link][ref]{:#myid rel=abc rev=abc} For images, this: This is ![Alt text](url "fresh carrots") is equivalent to: This is ![Alt text](url){:title="fresh carrots"} Using attributes lists definition {#using_tags} --------------------------------- In an attribute list, you can have: 1. `key=value` pairs, 2. id attributes (`#myid`) 3. class attributes (`.myclass`) Everything else is interpreted as a reference to an ALD. # Header # {:ref} Blah blah blah. {:ref: #myhead .myclass lang=fr} Of course, more than one IAL can reference the same ALD: # Header 1 # {:1} ... # Header 2 # {:1} {:1: .myclass lang=fr} The rules {:#grammar} --------- ### The issue of escaping ### 1. No escaping in code spans/blocks. 2. Everywhere else, **all** PUNCTUATION characters **can** be escaped, and **must** be escaped when they could trigger links, tables, etc. A punctuation character is anything not a letter, a number, or whitespace (`[^a-zA-Z0-9\s\n]`). 3. As a rule, quotes **must** be escaped inside quoted values: * Inside `"quoted values"`, you **must** escape `"`. * Inside `'quoted values'`, you **must** escape `'`. * Other examples: `"bah 'bah' bah"` = `"bah \'bah\' bah"` = `'bah \'bah\' bah'` `'bah "bah" bah'` = `'bah \"bah\" bah'` = `"bah \"bah\" bah"` 4. There is an exception for backward compatibility, in links/images titles: [text](url "title"with"quotes") The exception is not valid for attribute lists and in other contexts, where you have to use the canonical syntax. ### Syntax for attribute lists #### Consider the following attribute list: {: key=value ref key2="quoted value" } In this string, `key`, `value`, and `ref` can be substituted by any string that does not contain whitespace, or the unescaped characters `}`,`=`,`'`,`"`. Inside a quoted value you **must** escape the other kind of quote. Also, you **must** escape a closing curly brace `}` inside quoted values. This rule is for making life easier for interpreter that just want to skip the meta-data. If you don't implement this syntax, you can get rid of the IAL by using this regular expression (this is written in Ruby): r = /\{:(\\\}|[^\}])*\}/ s.gsub(r, '') # ignore metadata {:ruby} Basically: match everything contained in a couple of `{:` and `}`, taking care of escaping of `}`. This `\\\}|[^\}]` means: eat either any character which is not a `}` or an escape sequence `\}`. For this example, this is {: skipped="\}" val=\} bar} for me {: also this} the result is: this is for me maruku-0.6.0/docs/div_syntax.md0000644000175000017500000000102111573154515016362 0ustar vincentvincent## Option number 1 ## * `[ ]{0,3}\+={2,}` pushes the stack * `[ ]{0,3}\-={2,}` pops the stack +================ {#id} IAL can be put on the same line of a push +== {#id2} Or on the same line of a pop: -== -============== ## Option number 2 ## Double braces: {{ }}{} I don't like, it gets too messy because there are too many braces. +================ {#id} nested div: +======================== inside nested DIV -======================== -============== maruku-0.6.0/lib/0000755000175000017500000000000011573154515013474 5ustar vincentvincentmaruku-0.6.0/lib/maruku/0000755000175000017500000000000011573154515015000 5ustar vincentvincentmaruku-0.6.0/lib/maruku/defaults.rb0000644000175000017500000000354711573154515017145 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ module MaRuKu Globals = { :unsafe_features => false, :on_error => :warning, :use_numbered_headers => false, :maruku_signature => false, :code_background_color => '#fef', :code_show_spaces => false, :filter_html => false, :html_math_output_mathml => true, # also set :html_math_engine :html_math_engine => 'none', #ritex, itex2mml :html_math_output_png => false, :html_png_engine => 'none', :html_png_dir => 'pngs', :html_png_url => 'pngs/', :html_png_resolution => 200, :html_use_syntax => false, :latex_use_listings => false, :latex_cjk => false, :latex_cache_file => "blahtex_cache.pstore", # cache file for blahtex filter :debug_keep_ials => false, :doc_prefix => '' } class MDElement def get_setting(sym) if self.attributes.has_key?(sym) then return self.attributes[sym] elsif self.doc && self.doc.attributes.has_key?(sym) then return self.doc.attributes[sym] elsif MaRuKu::Globals.has_key?(sym) return MaRuKu::Globals[sym] else $stderr.puts "Bug: no default for #{sym.inspect}" nil end end end endmaruku-0.6.0/lib/maruku/usage/0000755000175000017500000000000011573154515016104 5ustar vincentvincentmaruku-0.6.0/lib/maruku/usage/example1.rb0000644000175000017500000000072311573154515020147 0ustar vincentvincentrequire 'maruku' text = < :raise, :error_stream => s}) puts "Error! It should have thrown an exception." rescue # puts "ok, got error" end begin Maruku.new(invalid, {:on_error => :warning, :error_stream => s}) rescue puts "Error! It should not have thrown an exception." end maruku-0.6.0/lib/maruku/structures.rb0000644000175000017500000001023411573154515017550 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ class Module def safe_attr_accessor1(symbol, klass) attr_reader symbol code = <<-EOF def #{symbol}=(val) if not val.kind_of? #{klass} s = "\nCould not assign an object of type \#{val.class} to #{symbol}.\n\n" s += "Tried to assign object of class \#{val.class}:\n"+ "\#{val.inspect}\n"+ "to \#{self.class}::#{symbol} constrained to be of class #{klass}.\n" raise s end @#{symbol} = val end EOF module_eval code end def safe_attr_accessor2(symbol, klass) attr_accessor symbol end alias safe_attr_accessor safe_attr_accessor2 end module MaRuKu # I did not want to have a class for each possible element. # Instead I opted to have only the class "MDElement" # that represents eveything in the document (paragraphs, headers, etc). # # You can tell what it is by the variable `node_type`. # # In the instance-variable `children` there are the children. These # can be of class 1) String or 2) MDElement. # # The @doc variable points to the document to which the MDElement # belongs (which is an instance of Maruku, subclass of MDElement). # # Attributes are contained in the hash `attributes`. # Keys are symbols (downcased, with spaces substituted by underscores) # # For example, if you write in the source document. # # Title: test document # My property: value # # content content # # You can access `value` by writing: # # @doc.attributes[:my_property] # => 'value' # # from whichever MDElement in the hierarchy. # class MDElement # See helpers.rb for the list of allowed #node_type values safe_attr_accessor :node_type, Symbol # Children are either Strings or MDElement safe_attr_accessor :children, Array # An attribute list, may not be nil safe_attr_accessor :al, Array #Maruku::AttributeList # These are the processed attributes safe_attr_accessor :attributes, Hash # Reference of the document (which is of class Maruku) attr_accessor :doc def initialize(node_type=:unset, children=[], meta={}, al=MaRuKu::AttributeList.new ) super(); self.children = children self.node_type = node_type @attributes = {} meta.each do |symbol, value| self.instance_eval " def #{symbol}; @#{symbol}; end def #{symbol}=(val); @#{symbol}=val; end" self.send "#{symbol}=", value end self.al = al || AttributeList.new self.meta_priv = meta end attr_accessor :meta_priv def ==(o) ok = o.kind_of?(MDElement) && (self.node_type == o.node_type) && (self.meta_priv == o.meta_priv) && (self.children == o.children) if not ok # puts "This:\n"+self.inspect+"\nis different from\n"+o.inspect+"\n\n" end ok end end # This represents the whole document and holds global data. class MDDocument safe_attr_accessor :refs, Hash safe_attr_accessor :footnotes, Hash # This is an hash. The key might be nil. safe_attr_accessor :abbreviations, Hash # Attribute lists definition safe_attr_accessor :ald, Hash # The order in which footnotes are used. Contains the id. safe_attr_accessor :footnotes_order, Array safe_attr_accessor :latex_required_packages, Array safe_attr_accessor :refid2ref, Hash def initialize(s=nil) super(:document) @doc = self self.refs = {} self.footnotes = {} self.footnotes_order = [] self.abbreviations = {} self.ald = {} self.latex_required_packages = [] parse_doc(s) if s end end end # MaRuKu maruku-0.6.0/lib/maruku/structures_inspect.rb0000644000175000017500000000354711573154515021306 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ class String def inspect_more(a=nil,b=nil) inspect end end class Object def inspect_more(a=nil,b=nil) inspect end end class Array def inspect_more(compact, join_string, add_brackets=true) s = map {|x| x.kind_of?(String) ? x.inspect : x.kind_of?(MaRuKu::MDElement) ? x.inspect(compact) : (raise "WTF #{x.class} #{x.inspect}") }.join(join_string) add_brackets ? "[#{s}]" : s end end class Hash def inspect_ordered(a=nil,b=nil) "{"+keys.map{|x|x.to_s}.sort.map{|x|x.to_sym}. map{|k| k.inspect + "=>"+self[k].inspect}.join(',')+"}" end end module MaRuKu class MDElement def inspect(compact=true) if compact i2 = inspect2 return i2 if i2 end "md_el(:%s,%s,%s,%s)" % [ self.node_type, children_inspect(compact), @meta_priv.inspect_ordered, self.al.inspect ] end def children_inspect(compact=true) s = @children.inspect_more(compact,', ') if @children.empty? "[]" elsif s.size < 70 s else "[\n"+ add_tabs(@children.inspect_more(compact,",\n",false))+ "\n]" end end end end maruku-0.6.0/lib/maruku/output/0000755000175000017500000000000011573154515016340 5ustar vincentvincentmaruku-0.6.0/lib/maruku/output/to_markdown.rb0000644000175000017500000000707211573154515021217 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ class String # XXX: markdown escaping def to_md(c=nil) to_s end # " andrea censi " => [" andrea ", "censi "] def mysplit split.map{|x| x+" "} end end module MaRuKu; module Out; module Markdown DefaultLineLength = 40 def to_md(context={}) children_to_md(context) end def to_md_paragraph(context) line_length = context[:line_length] || DefaultLineLength wrap(@children, line_length, context)+"\n" end def to_md_li_span(context) len = (context[:line_length] || DefaultLineLength) - 2 s = add_tabs(wrap(@children, len-2, context), 1, ' ') s[0] = ?* s + "\n" end def to_md_abbr_def(context) "*[#{self.abbr}]: #{self.text}\n" end def to_md_ol(context) len = (context[:line_length] || DefaultLineLength) - 2 md = "" self.children.each_with_index do |li, i| s = add_tabs(w=wrap(li.children, len-2, context), 1, ' ')+"\n" s[0,4] = "#{i+1}. "[0,4] # puts w.inspect md += s end md + "\n" end def to_md_ul(context) len = (context[:line_length] || DefaultLineLength) - 2 md = "" self.children.each_with_index do |li, i| w = wrap(li.children, len-2, context) # puts "W: "+ w.inspect s = add_indent(w) # puts "S: " +s.inspect s[0,1] = "-" md += s end md + "\n" end def add_indent(s,char=" ") t = s.split("\n").map{|x| char+x }.join("\n") s << ?\n if t[-1] == ?\n s end # Convert each child to html def children_to_md(context) array_to_md(@children, context) end def wrap(array, line_length, context) out = "" line = "" array.each do |c| if c.kind_of?(MDElement) && c.node_type == :linebreak out << line.strip << " \n"; line=""; next end pieces = if c.kind_of? String c.to_md.mysplit else [c.to_md(context)].flatten end # puts "Pieces: #{pieces.inspect}" pieces.each do |p| if p.size + line.size > line_length out << line.strip << "\n"; line = "" end line << p end end out << line.strip << "\n" if line.size > 0 out << ?\n if not out[-1] == ?\n out end def array_to_md(array, context, join_char='') e = [] array.each do |c| method = c.kind_of?(MDElement) ? "to_md_#{c.node_type}" : "to_md" if not c.respond_to?(method) #raise "Object does not answer to #{method}: #{c.class} #{c.inspect[0,100]}" # tell_user "Using default for #{c.node_type}" method = 'to_md' end # puts "#{c.inspect} created with method #{method}" h = c.send(method, context) if h.nil? raise "Nil md for #{c.inspect} created with method #{method}" end if h.kind_of?Array e = e + h else e << h end end e.join(join_char) end end end end module MaRuKu; class MDDocument alias old_md to_md def to_md(context={}) s = old_md(context) # puts s s end end endmaruku-0.6.0/lib/maruku/output/s5/0000755000175000017500000000000011573154515016667 5ustar vincentvincentmaruku-0.6.0/lib/maruku/output/s5/to_s5.rb0000644000175000017500000000774211573154515020257 0ustar vincentvincent# This module groups all functions related to HTML export. module MaRuKu begin require 'rexml/formatters/pretty' require 'rexml/formatters/default' $rexml_new_version = true rescue LoadError $rexml_new_version = false end class MDDocument def s5_theme html_escape(self.attributes[:slide_theme] || "default") end def html_escape(string) string.gsub( /&/, "&" ). gsub( //, ">" ). gsub( /'/, "'" ). gsub( /"/, """ ) end # Render as an HTML fragment (no head, just the content of BODY). (returns a string) def to_s5(context={}) indent = context[:indent] || -1 ie_hack = !context[:ie_hack].kind_of?(FalseClass) content_only = !context[:content_only].kind_of?(FalseClass) doc = Document.new(nil,{:respect_whitespace =>:all}) if content_only body = Element.new('div', doc) else html = Element.new('html', doc) html.add_namespace('http://www.w3.org/1999/xhtml') html.add_namespace('svg', "http://www.w3.org/2000/svg" ) head = Element.new('head', html) me = Element.new 'meta', head me.attributes['http-equiv'] = 'Content-type' me.attributes['content'] = 'text/html;charset=utf-8' # Create title element doc_title = self.attributes[:title] || self.attributes[:subject] || "" title = Element.new 'title', head title << Text.new(doc_title) body = Element.new('body', html) end slide_header = self.attributes[:slide_header] slide_footer = self.attributes[:slide_footer] slide_subfooter = self.attributes[:slide_subfooter] slide_topleft = self.attributes[:slide_topleft] slide_topright = self.attributes[:slide_topright] slide_bottomleft = self.attributes[:slide_bottomleft] slide_bottomright = self.attributes[:slide_bottomright] dummy_layout_slide = "
#{slide_topleft}
#{slide_topright}
#{slide_bottomleft}
#{slide_bottomright}
" body.add_element Document.new(dummy_layout_slide, {:respect_whitespace =>:all}).root presentation = Element.new 'div', body presentation.attributes['class'] = 'presentation' first_slide="

#{self.attributes[:title] ||context[:title]}

#{self.attributes[:subtitle] ||context[:subtitle]}

#{self.attributes[:author] ||context[:author]}

#{self.attributes[:company] ||context[:company]}

" presentation.add_element Document.new(first_slide).root slide_num = 0 self.toc.section_children.each do |slide| slide_num += 1 @doc.attributes[:doc_prefix] = "s#{slide_num}" puts "Slide #{slide_num}: " + slide.header_element.to_s div = Element.new('div', presentation) div.attributes['class'] = 'slide' h1 = Element.new 'h1', div slide.header_element.children_to_html.each do |e| h1 << e; end array_to_html(slide.immediate_children).each do |e| div << e end # render footnotes if @doc.footnotes_order.size > 0 div << render_footnotes @doc.footnotes_order = [] end end xml = "" if (content_only) if $rexml_new_version formatter = REXML::Formatters::Default.new(ie_hack) formatter.write(body, xml) else body.write(xml,indent,transitive=true,ie_hack); end else doc2 = Document.new("
"+S5_external+"
",{:respect_whitespace =>:all}) doc2.root.children.each{ |child| head << child } add_css_to(head) # REXML Bug? if indent!=-1 whitespace is not respected for 'pre' elements # containing code. html.write(xml,indent,transitive=true,ie_hack); Xhtml11_mathml2_svg11 + xml end end end end maruku-0.6.0/lib/maruku/output/s5/fancy.rb0000644000175000017500000005620611573154515020325 0ustar vincentvincentmodule MaRuKu S5_external =< EOF S5_Fancy =< EOF end maruku-0.6.0/lib/maruku/output/to_html.rb0000644000175000017500000005655611573154515020354 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'rexml/document' begin require 'rexml/formatters/pretty' require 'rexml/formatters/default' $rexml_new_version = true rescue LoadError $rexml_new_version = false end class String # A string is rendered into HTML by creating # a REXML::Text node. REXML takes care of all the encoding. def to_html REXML::Text.new(self) end end # This module groups all functions related to HTML export. module MaRuKu; module Out; module HTML include REXML # Render as an HTML fragment (no head, just the content of BODY). (returns a string) def to_html(context={}) indent = context[:indent] || -1 ie_hack = context[:ie_hack] || true div = Element.new 'dummy' children_to_html.each do |e| div << e end # render footnotes if @doc.footnotes_order.size > 0 div << render_footnotes end doc = Document.new(nil,{:respect_whitespace =>:all}) doc << div # REXML Bug? if indent!=-1 whitespace is not respected for 'pre' elements # containing code. xml ="" if $rexml_new_version formatter = if indent > -1 REXML::Formatters::Pretty.new( indent, ie_hack ) else REXML::Formatters::Default.new( ie_hack ) end formatter.write( div, xml) else div.write(xml,indent,transitive=true,ie_hack) end xml.gsub!(/\A\s*/,'') xml.gsub!(/\s*<\/dummy>\Z/,'') xml.gsub!(/\A/,'') xml end # Render to a complete HTML document (returns a string) def to_html_document(context={}) indent = context[:indent] || -1 ie_hack = context[:ie_hack] ||true doc = to_html_document_tree xml = "" # REXML Bug? if indent!=-1 whitespace is not respected for 'pre' elements # containing code. doc.write(xml,indent,transitive=true,ie_hack); Xhtml11_mathml2_svg11 + xml end Xhtml10strict = " \n" Xhtml11strict_mathml2 = ' ]> ' Xhtml11_mathml2_svg11 = ' ' def xml_newline() Text.new("\n") end =begin maruku_doc Attribute: title Scope: document Sets the title of the document. If a title is not specified, the first header will be used. These should be equivalent: Title: my document Content and my document =========== Content In both cases, the title is set to "my document". =end =begin maruku_doc Attribute: doc_prefix Scope: document String to disambiguate footnote links. =end =begin maruku_doc Attribute: subject Scope: document Synonim for `title`. =end # Render to an HTML fragment (returns a REXML document tree) def to_html_tree div = Element.new 'div' div.attributes['class'] = 'maruku_wrapper_div' children_to_html.each do |e| div << e end # render footnotes if @doc.footnotes_order.size > 0 div << render_footnotes end doc = Document.new(nil,{:respect_whitespace =>:all}) doc << div end =begin maruku_doc Attribute: css Scope: document Output: HTML Summary: Activates CSS stylesheets for HTML. `css` should be a space-separated list of urls. Example: CSS: style.css math.css =end METAS = %w{description keywords author revised} # Render to a complete HTML document (returns a REXML document tree) def to_html_document_tree doc = Document.new(nil,{:respect_whitespace =>:all}) # doc << XMLDecl.new root = Element.new('html', doc) root.add_namespace('http://www.w3.org/1999/xhtml') root.add_namespace('svg', "http://www.w3.org/2000/svg" ) lang = self.attributes[:lang] || 'en' root.attributes['xml:lang'] = lang root << xml_newline head = Element.new 'head', root # me = Element.new 'meta', head me.attributes['http-equiv'] = 'Content-type' # me.attributes['content'] = 'text/html;charset=utf-8' me.attributes['content'] = 'application/xhtml+xml;charset=utf-8' METAS.each do |m| if value = self.attributes[m.to_sym] meta = Element.new 'meta', head meta.attributes['name'] = m meta.attributes['content'] = value.to_s end end self.attributes.each do |k,v| if k.to_s =~ /\Ameta-(.*)\Z/ meta = Element.new 'meta', head meta.attributes['name'] = $1 meta.attributes['content'] = v.to_s end end # Create title element doc_title = self.attributes[:title] || self.attributes[:subject] || "" title = Element.new 'title', head title << Text.new(doc_title) add_css_to(head) root << xml_newline body = Element.new 'body' children_to_html.each do |e| body << e end # render footnotes if @doc.footnotes_order.size > 0 body << render_footnotes end # When we are rendering a whole document, we add a signature # at the bottom. if get_setting(:maruku_signature) body << maruku_html_signature end root << body doc end def add_css_to(head) if css_list = self.attributes[:css] css_list.split.each do |css| # link = Element.new 'link' link.attributes['type'] = 'text/css' link.attributes['rel'] = 'stylesheet' link.attributes['href'] = css head << link head << xml_newline end end end # returns "st","nd","rd" or "th" as appropriate def day_suffix(day) s = { 1 => 'st', 2 => 'nd', 3 => 'rd', 21 => 'st', 22 => 'nd', 23 => 'rd', 31 => 'st' } return s[day] || 'th'; end # formats a nice date def nice_date t = Time.now t.strftime(" at %H:%M on ")+ t.strftime("%A, %B %d")+ day_suffix(t.day)+ t.strftime(", %Y") end def maruku_html_signature div = Element.new 'div' div.attributes['class'] = 'maruku_signature' Element.new 'hr', div span = Element.new 'span', div span.attributes['style'] = 'font-size: small; font-style: italic' span << Text.new('Created by ') a = Element.new('a', span) a.attributes['href'] = 'http://maruku.rubyforge.org' a.attributes['title'] = 'Maruku: a Markdown-superset interpreter for Ruby' a << Text.new('Maruku') span << Text.new(nice_date+".") div end def render_footnotes() div = Element.new 'div' div.attributes['class'] = 'footnotes' div << Element.new('hr') ol = Element.new 'ol' @doc.footnotes_order.each_with_index do |fid, i| num = i+1 f = self.footnotes[fid] if f li = f.wrap_as_element('li') li.attributes['id'] = "#{get_setting(:doc_prefix)}fn:#{num}" a = Element.new 'a' a.attributes['href'] = "\##{get_setting(:doc_prefix)}fnref:#{num}" a.attributes['rev'] = 'footnote' a<< Text.new('↩', true, nil, true) li.insert_after(li.children.last, a) ol << li else maruku_error "Could not find footnote id '#{fid}' among ["+ self.footnotes.keys.map{|s|"'"+s+"'"}.join(', ')+"]." end end div << ol div end def to_html_hrule; create_html_element 'hr' end def to_html_linebreak; Element.new 'br' end # renders children as html and wraps into an element of given name # # Sets 'id' if meta is set def wrap_as_element(name, attributes_to_copy=[]) m = create_html_element(name, attributes_to_copy) children_to_html.each do |e| m << e; end # m << Comment.new( "{"+self.al.to_md+"}") if not self.al.empty? # m << Comment.new( @attributes.inspect) if not @attributes.empty? m end =begin maruku_doc Attribute: id Scope: element Output: LaTeX, HTML It is copied as a standard HTML attribute. Moreover, it used as a label name for hyperlinks in both HTML and in PDF. =end =begin maruku_doc Attribute: class Scope: element Output: HTML It is copied as a standard HTML attribute. =end =begin maruku_doc Attribute: style Scope: element Output: HTML It is copied as a standard HTML attribute. =end HTML4Attributes = {} coreattrs = [:id, :class, :style, :title] i18n = [:lang, 'xml:lang'.to_sym] events = [ :onclick, :ondblclick, :onmousedown, :onmouseup, :onmouseover, :onmousemove, :onmouseout, :onkeypress, :onkeydown, :onkeyup] attrs = coreattrs + i18n + events cellhalign = [:align, :char, :charoff] cellvalign = [:valign] [ ['body', attrs + [:onload, :onunload]], ['address', attrs], ['div', attrs], ['a', attrs+[:charset, :type, :name, :rel, :rev, :accesskey, :shape, :coords, :tabindex, :onfocus,:onblur]], ['img', attrs + [:longdesc, :name, :height, :width, :alt] ], ['p', attrs], [['h1','h2','h3','h4','h5','h6'], attrs], [['pre'], attrs], [['q', 'blockquote'], attrs+[:cite]], [['ins','del'], attrs+[:cite,:datetime]], [['ol','ul','li'], attrs], ['table',attrs+[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]], ['caption',attrs], [['colgroup','col'],attrs+[:span, :width]+cellhalign+cellvalign], [['thead','tbody','tfoot'], attrs+cellhalign+cellvalign], [['td','td','th'], attrs+[:abbr, :axis, :headers, :scope, :rowspan, :colspan, :cellvalign, :cellhalign]], # altri [['em','code','strong','hr','span','dl','dd','dt'], attrs] ].each do |el, a| [*el].each do |e| HTML4Attributes[e] = a end end def create_html_element(name, attributes_to_copy=[]) m = Element.new name if atts = HTML4Attributes[name] then atts.each do |att| if v = @attributes[att] then m.attributes[att.to_s] = v.to_s end end else # puts "not atts for #{name.inspect}" end m end def to_html_ul if @attributes[:toc] # render toc html_toc = @doc.toc.to_html return html_toc else add_ws wrap_as_element('ul') end end def to_html_paragraph; add_ws wrap_as_element('p') end def to_html_ol; add_ws wrap_as_element('ol') end def to_html_li; add_ws wrap_as_element('li') end def to_html_li_span; add_ws wrap_as_element('li') end def to_html_quote; add_ws wrap_as_element('blockquote') end def to_html_strong; wrap_as_element('strong') end def to_html_emphasis; wrap_as_element('em') end =begin maruku_doc Attribute: use_numbered_headers Scope: document Summary: Activates the numbering of headers. If `true`, section headers will be numbered. In LaTeX export, the numbering of headers is managed by Maruku, to have the same results in both HTML and LaTeX. =end # nil if not applicable, else string def section_number return nil if not get_setting(:use_numbered_headers) n = @attributes[:section_number] if n && (not n.empty?) n.join('.')+". " else nil end end # nil if not applicable, else SPAN element def render_section_number # if we are bound to a section, add section number if num = section_number span = Element.new 'span' span.attributes['class'] = 'maruku_section_number' span << Text.new(section_number) span else nil end end def to_html_header element_name = "h#{self.level}" h = wrap_as_element element_name if span = render_section_number h.insert_before(h.children.first, span) end add_ws h end def source2html(source) # source = source.gsub(/&/,'&') source = Text.normalize(source) source = source.gsub(/\'/,''') # IE bug source = source.gsub(/'/,''') # IE bug Text.new(source, true, nil, true ) end =begin maruku_doc Attribute: html_use_syntax Scope: global, document, element Output: HTML Summary: Enables the use of the `syntax` package. Related: lang, code_lang Default: If true, the `syntax` package is used. It supports the `ruby` and `xml` languages. Remember to set the `lang` attribute of the code block. Examples: require 'maruku' {:lang=ruby html_use_syntax=true} and
Div
{:lang=html html_use_syntax=true} produces: require 'maruku' {:lang=ruby html_use_syntax=true} and
Div
{:lang=html html_use_syntax=true} =end $syntax_loaded = false def to_html_code; source = self.raw_code lang = self.attributes[:lang] || @doc.attributes[:code_lang] lang = 'xml' if lang=='html' use_syntax = get_setting :html_use_syntax element = if use_syntax && lang begin if not $syntax_loaded require 'rubygems' require 'syntax' require 'syntax/convertors/html' $syntax_loaded = true end convertor = Syntax::Convertors::HTML.for_syntax lang # eliminate trailing newlines otherwise Syntax crashes source = source.gsub(/\n*\Z/,'') html = convertor.convert( source ) html = html.gsub(/\'/,''') # IE bug html = html.gsub(/'/,''') # IE bug # html = html.gsub(/&/,'&') code = Document.new(html, {:respect_whitespace =>:all}).root code.name = 'code' code.attributes['class'] = lang code.attributes['lang'] = lang pre = Element.new 'pre' pre << code pre rescue LoadError => e maruku_error "Could not load package 'syntax'.\n"+ "Please install it, for example using 'gem install syntax'." to_html_code_using_pre(source) rescue Object => e maruku_error"Error while using the syntax library for code:\n#{source.inspect}"+ "Lang is #{lang} object is: \n"+ self.inspect + "\nException: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}" tell_user("Using normal PRE because the syntax library did not work.") to_html_code_using_pre(source) end else to_html_code_using_pre(source) end color = get_setting(:code_background_color) if color != Globals[:code_background_color] element.attributes['style'] = "background-color: #{color};" end add_ws element end =begin maruku_doc Attribute: code_background_color Scope: global, document, element Summary: Background color for code blocks. The format is either a named color (`green`, `red`) or a CSS color of the form `#ff00ff`. * for **HTML output**, the value is put straight in the `background-color` CSS property of the block. * for **LaTeX output**, if it is a named color, it must be a color accepted by the LaTeX `color` packages. If it is of the form `#ff00ff`, Maruku defines a color using the `\color[rgb]{r,g,b}` macro. For example, for `#0000ff`, the macro is called as: `\color[rgb]{0,0,1}`. =end def to_html_code_using_pre(source) pre = create_html_element 'pre' code = Element.new 'code', pre s = source # s = s.gsub(/&/,'&') s = Text.normalize(s) s = s.gsub(/\'/,''') # IE bug s = s.gsub(/'/,''') # IE bug if get_setting(:code_show_spaces) # 187 = raquo # 160 = nbsp # 172 = not s.gsub!(/\t/,'»'+' '*3) s.gsub!(/ /,'¬') end text = Text.new(s, respect_ws=true, parent=nil, raw=true ) if lang = self.attributes[:lang] code.attributes['lang'] = lang code.attributes['class'] = lang end code << text pre end def to_html_inline_code; pre = create_html_element 'code' source = self.raw_code pre << source2html(source) color = get_setting(:code_background_color) if color != Globals[:code_background_color] pre.attributes['style'] = "background-color: #{color};"+(pre.attributes['style']||"") end pre end def add_class_to(el, cl) el.attributes['class'] = if already = el.attributes['class'] already + " " + cl else cl end end def add_class_to_link(a) return # not ready yet # url = a.attributes['href'] # return if not url # # if url =~ /^#/ # add_class_to(a, 'maruku-link-samedoc') # elsif url =~ /^http:/ # add_class_to(a, 'maruku-link-external') # else # add_class_to(a, 'maruku-link-local') # end # # puts a.attributes['class'] end def to_html_immediate_link a = create_html_element 'a' url = self.url text = url.gsub(/^mailto:/,'') # don't show mailto a << Text.new(text) a.attributes['href'] = url add_class_to_link(a) a end def to_html_link a = wrap_as_element 'a' id = self.ref_id if ref = @doc.refs[id] url = ref[:url] title = ref[:title] a.attributes['href'] = url if url a.attributes['title'] = title if title else maruku_error "Could not find ref_id = #{id.inspect} for #{self.inspect}\n"+ "Available refs are #{@doc.refs.keys.inspect}" tell_user "Not creating a link for ref_id = #{id.inspect}." return wrap_as_element('span') end # add_class_to_link(a) return a end def to_html_im_link if url = self.url title = self.title a = wrap_as_element 'a' a.attributes['href'] = url a.attributes['title'] = title if title return a else maruku_error"Could not find url in #{self.inspect}" tell_user "Not creating a link for ref_id = #{id.inspect}." return wrap_as_element('span') end end def add_ws(e) [Text.new("\n"), e, Text.new("\n")] end ##### Email address def obfuscate(s) res = '' s.each_byte do |char| res += "&#%03d;" % char end res end def to_html_email_address email = self.email a = create_html_element 'a' #a.attributes['href'] = Text.new("mailto:"+obfuscate(email),false,nil,true) #a.attributes.add Attribute.new('href',Text.new( #"mailto:"+obfuscate(email),false,nil,true)) # Sorry, for the moment it doesn't work a.attributes['href'] = "mailto:#{email}" a << Text.new(obfuscate(email),false,nil,true) a end ##### Images def to_html_image a = create_html_element 'img' id = self.ref_id if ref = @doc.refs[id] url = ref[:url] title = ref[:title] a.attributes['src'] = url.to_s a.attributes['alt'] = children_to_s else maruku_error"Could not find id = #{id.inspect} for\n #{self.inspect}" tell_user "Could not create image with ref_id = #{id.inspect};"+ " Using SPAN element as replacement." return wrap_as_element('span') end return a end def to_html_im_image if not url = self.url maruku_error "Image with no url: #{self.inspect}" tell_user "Could not create image with ref_id = #{id.inspect};"+ " Using SPAN element as replacement." return wrap_as_element('span') end title = self.title a = create_html_element 'img' a.attributes['src'] = url.to_s a.attributes['alt'] = children_to_s return a end =begin maruku_doc Attribute: filter_html Scope: document If true, raw HTML is discarded from the output. =end def to_html_raw_html return [] if get_setting(:filter_html) raw_html = self.raw_html if rexml_doc = @parsed_html root = rexml_doc.root if root.nil? s = "Bug in REXML: root() of Document is nil: \n#{rexml_doc.inspect}\n"+ "Raw HTML:\n#{raw_html.inspect}" maruku_error s tell_user 'The REXML version you have has a bug, omitting HTML' div = Element.new 'div' #div << Text.new(s) return div end # copies the @children array (FIXME is it deep?) elements = root.to_a return elements else # invalid # Creates red box with offending HTML tell_user "Wrapping bad html in a PRE with class 'markdown-html-error'\n"+ add_tabs(raw_html,1,'|') pre = Element.new('pre') pre.attributes['style'] = 'border: solid 3px red; background-color: pink' pre.attributes['class'] = 'markdown-html-error' pre << Text.new("REXML could not parse this XML/HTML: \n#{raw_html}", true) return pre end end def to_html_abbr abbr = Element.new 'abbr' abbr << Text.new(children[0]) abbr.attributes['title'] = self.title if self.title abbr end def to_html_footnote_reference id = self.footnote_id # save the order of used footnotes order = @doc.footnotes_order if order.include? id # footnote has already been used return [] end if not @doc.footnotes[id] return [] end # take next number order << id #num = order.size; num = order.index(id) + 1 sup = Element.new 'sup' sup.attributes['id'] = "#{get_setting(:doc_prefix)}fnref:#{num}" a = Element.new 'a' a << Text.new(num.to_s) a.attributes['href'] = "\##{get_setting(:doc_prefix)}fn:#{num}" a.attributes['rel'] = 'footnote' sup << a sup end ## Definition lists ### def to_html_definition_list() add_ws wrap_as_element('dl') end def to_html_definition() children_to_html end def to_html_definition_term() add_ws wrap_as_element('dt') end def to_html_definition_data() add_ws wrap_as_element('dd') end # FIXME: Ugly code def to_html_table align = self.align num_columns = align.size head = @children.slice(0, num_columns) rows = [] i = num_columns while i<@children.size rows << @children.slice(i, num_columns) i += num_columns end table = create_html_element 'table' thead = Element.new 'thead' tr = Element.new 'tr' array_to_html(head).each do |x| tr< # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'rexml/document' module MaRuKu; module Out; module Latex include REXML def to_latex_entity MaRuKu::Out::Latex.need_entity_table entity_name = self.entity_name entity = ENTITY_TABLE[entity_name] if not entity maruku_error "I don't know how to translate entity '#{entity_name}' "+ "to LaTeX." return "" end replace = entity.latex_string entity.latex_packages.each do |p| @doc.latex_require_package p end # if replace =~ /^\\/ # replace = replace + " " # end if replace return replace + "{}" else tell_user "Cannot translate entity #{entity_name.inspect} to LaTeX." return entity_name end end class LatexEntity safe_attr_accessor :html_num, Fixnum safe_attr_accessor :html_entity, String safe_attr_accessor :latex_string, String safe_attr_accessor :latex_packages, Array end def Latex.need_entity_table Latex.init_entity_table if ENTITY_TABLE.empty? end # create hash @@entity_to_latex def Latex.init_entity_table # $stderr.write "Creating entity table.." # $stderr.flush doc = Document.new XML_TABLE doc.elements.each("//char") do |c| num = c.attributes['num'].to_i name = c.attributes['name'] package = c.attributes['package'] convert = c.attributes['convertTo'] convert.gsub!(/@DOUBLEQUOT/,'"') convert.gsub!(/@QUOT/,"'") convert.gsub!(/@GT/,">") convert.gsub!(/@LT/,"<") convert.gsub!(/@AMP/,"&") convert.freeze e = LatexEntity.new e.html_num = num e.html_entity = name e.latex_string = convert e.latex_packages = package ? package.split : [] ENTITY_TABLE[num] = e ENTITY_TABLE[name] = e end # $stderr.puts "..done." end ENTITY_TABLE = {} # The following is a conversion chart for html elements, courtesy of # text2html XML_TABLE =" " end end end maruku-0.6.0/lib/maruku/output/to_latex.rb0000644000175000017500000003106211573154515020506 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ module MaRuKu class MDDocument Latex_preamble_enc_cjk = "\\usepackage[C40]{fontenc} \\usepackage[cjkjis]{ucs} \\usepackage[utf8x]{inputenc}" Latex_preamble_enc_utf8 = "\\usepackage{ucs} \\usepackage[utf8x]{inputenc}" def latex_require_package(p) if not self.latex_required_packages.include? p self.latex_required_packages.push p end end # Render as a LaTeX fragment def to_latex children_to_latex end =begin maruku_doc Attribute: maruku_signature Scope: document Output: html, latex Summary: Enables Maruku's signature. Default: true If false, Maruku does not append a signature to the generated file. =end # Render as a complete LaTeX document def to_latex_document body = to_latex if get_setting(:maruku_signature) body += render_latex_signature end required = self.latex_required_packages.map {|p| "\\usepackage{#{p}}\n" }.join =begin maruku_doc Attribute: latex_cjk Scope: document Output: latex Summary: Support for CJK characters. If the `latex_cjk` attribute is specified, then appropriate headers are added to the LaTeX preamble to support Japanese fonts. You have to have these fonts installed -- and this can be a pain. If `latex_cjk` is specified, this is added to the preamble: while the default is to add this: =end encoding = get_setting(:latex_cjk) ? Latex_preamble_enc_cjk : Latex_preamble_enc_utf8 =begin maruku_doc Attribute: latex_preamble Scope: document Output: latex Summary: User-defined preamble. If the `latex_preamble` attribute is specified, then its value will be used as a custom preamble. For example: Title: My document Latex preamble: preamble.tex will produce: ... \input{preamble.tex} ... =end user_preamble = (file = @doc.attributes[:latex_preamble]) ? "\\input{#{file}}\n" : "" "\\documentclass{article} % Packages required to support encoding #{encoding} % Packages required by code #{required} % Packages always used \\usepackage{hyperref} \\usepackage{xspace} \\usepackage[usenames,dvipsnames]{color} \\hypersetup{colorlinks=true,urlcolor=blue} #{user_preamble} \\begin{document} #{body} \\end{document} " end def render_latex_signature "\\vfill \\hrule \\vspace{1.2mm} \\begin{tiny} Created by \\href{http://maruku.rubyforge.org}{Maruku} #{self.nice_date}. \\end{tiny}" end end end module MaRuKu; module Out; module Latex def to_latex_hrule; "\n\\vspace{.5em} \\hrule \\vspace{.5em}\n" end def to_latex_linebreak; "\\newline " end def to_latex_paragraph children_to_latex+"\n\n" end =begin maruku_doc Title: Input format for colors Output: latex, html Related: code_background_color Admissible formats: green #abc #aabbcc =end # \color[named]{name} # \color[rgb]{1,0.2,0.3} def latex_color(s, command='color') if s =~ /^\#(\w\w)(\w\w)(\w\w)$/ r = $1.hex; g = $2.hex; b=$3.hex # convert from 0-255 to 0.0-1.0 r = r / 255.0; g = g / 255.0; b = b / 255.0; "\\#{command}[rgb]{%0.2f,%0.2f,%0.2f}" % [r,g,b] elsif s =~ /^\#(\w)(\w)(\w)$/ r = $1.hex; g = $2.hex; b=$3.hex # convert from 0-15 to 0.0-1.0 r = r / 15.0; g = g / 15.0; b = b / 15.0; "\\#{command}[rgb]{%0.2f,%0.2f,%0.2f}" % [r,g,b] else "\\#{command}{#{s}}" end end =begin maruku_doc Attribute: code_show_spaces Scope: global, document, element If `true`, shows spaces and tabs in code blocks. Example: One space Two spaces Tab, space, tab Tab, tab, tab and all is green! {:code_show_spaces code_background_color=#ffeedd} {:markdown} That will produce: One space Two spaces Tab, space, tab Tab, tab, tab and all is green! {:code_show_spaces code_background_color=#ffeedd} =end =begin maruku_doc Attribute: latex_use_listings Scope: document Output: latex Summary: Support for `listings` package. Related: code_show_spaces, code_background_color, lang, code_lang If the `latex_use_listings` attribute is specified, then code block are rendered using the `listings` package. Otherwise, a standard `verbatim` environment is used. * If the `lang` attribute for the code block has been specified, it gets passed to the `listings` package using the `lstset` macro. The default lang for code blocks is specified through the `code_lang` attribute. \lstset{language=ruby} Please refer to the documentation of the `listings` package for supported languages. If a language is not supported, the `listings` package will emit a warning during the compilation. Just press enter and nothing wrong will happen. * If the `code_show_spaces` is specified, than spaces and tabs will be shown using the macro: \lstset{showspaces=true,showtabs=true} * The background color is given by `code_background_color`. =end def to_latex_code; raw_code = self.raw_code if get_setting(:latex_use_listings) @doc.latex_require_package('listings') s = "\\lstset{columns=fixed,frame=shadowbox}" if get_setting(:code_show_spaces) s+= "\\lstset{showspaces=true,showtabs=true}\n" else s+= "\\lstset{showspaces=false,showtabs=false}\n" end color = latex_color get_setting(:code_background_color) s+= "\\lstset{backgroundcolor=#{color}}\n" s+= "\\lstset{basicstyle=\\ttfamily\\footnotesize}\n" lang = self.attributes[:lang] || @doc.attributes[:code_lang] || '{}' if lang s += "\\lstset{language=#{lang}}\n" end "#{s}\n\\begin{lstlisting}\n#{raw_code}\n\\end{lstlisting}" else "\\begin{verbatim}#{raw_code}\\end{verbatim}\n" end end TexHeaders = { 1=>'section', 2=>'subsection', 3=>'subsubsection', 4=>'paragraph'} def to_latex_header h = TexHeaders[self.level] || 'paragraph' title = children_to_latex if number = section_number title = number + title end if id = self.attributes[:id] # drop '#' at the beginning if id[0,1] == '#' then id = [1,id.size] end %{\\hypertarget{%s}{}\\%s*{{%s}}\\label{%s}\n\n} % [ id, h, title, id ] else %{\\%s*{%s}\n\n} % [ h, title] end end def to_latex_ul; if self.attributes[:toc] @doc.toc.to_latex else wrap_as_environment('itemize') end end def to_latex_quote; wrap_as_environment('quote') end def to_latex_ol; wrap_as_environment('enumerate') end def to_latex_li; "\\item #{children_to_latex}\n" end def to_latex_li_span; "\\item #{children_to_latex}\n" end def to_latex_strong "\\textbf{#{children_to_latex}}" end def to_latex_emphasis "\\emph{#{children_to_latex}}" end def wrap_as_span(c) "{#{c} #{children_to_latex}}" end def wrap_as_environment(name) "\\begin{#{name}}% #{children_to_latex} \\end{#{name}}\n" end SAFE_CHARS = Set.new((?a..?z).to_a + (?A..?Z).to_a) # the ultimate escaping # (is much better than using \verb) def latex_escape(source) s=""; source.each_byte do |b| if b == ?\ s << '~' elsif SAFE_CHARS.include? b s << b else s += "\\char%d" % b end end s end def to_latex_inline_code; source = self.raw_code # Convert to printable latex chars s = latex_escape(source) color = get_setting(:code_background_color) colorspec = latex_color(color, 'colorbox') "{#{colorspec}{\\tt #{s}}}" end def to_latex_immediate_link url = self.url text = url.gsub(/^mailto:/,'') # don't show mailto # gsub('~','$\sim$') text = latex_escape(text) if url[0,1] == '#' url = url[1,url.size] return "\\hyperlink{#{url}}{#{text}}" else return "\\href{#{url}}{#{text}}" end end def to_latex_im_link url = self.url if url[0,1] == '#' url = url[1,url.size] return "\\hyperlink{#{url}}{#{children_to_latex}}" else return "\\href{#{url}}{#{children_to_latex}}" end end def to_latex_link id = self.ref_id ref = @doc.refs[id] if not ref $stderr.puts "Could not find id = '#{id}'" return children_to_latex else url = ref[:url] #title = ref[:title] || 'no title' if url[0,1] == '#' url = url[1,url.size] return "\\hyperlink{#{url}}{#{children_to_latex}}" else return "\\href{#{url}}{#{children_to_latex}}" end end end def to_latex_email_address email = self.email "\\href{mailto:#{email}}{#{latex_escape(email)}}" end def to_latex_table align = self.align num_columns = align.size head = @children.slice(0, num_columns) rows = [] i = num_columns while i<@children.size rows << @children.slice(i, num_columns) i+=num_columns end h = {:center=>'c',:left=>'l',:right=>'r'} align_string = align.map{|a| h[a]}.join('|') s = "\\begin{tabular}{#{align_string}}\n" s += array_to_latex(head, '&') + "\\\\" +"\n" s += "\\hline \n" rows.each do |row| s += array_to_latex(row, '&') + "\\\\" +"\n" end s += "\\end{tabular}" # puts table in its own paragraph s += "\n\n" s end def to_latex_head_cell; children_to_latex end def to_latex_cell; children_to_latex end def to_latex_footnote_reference id = self.footnote_id f = @doc.footnotes[id] if f "\\footnote{#{f.children_to_latex.strip}} " else $stderr.puts "Could not find footnote '#{fid}'" end end def to_latex_raw_html #'{\bf Raw HTML removed in latex version }' "" end ## Definition lists ### def to_latex_definition_list s = "\\begin{description}\n" s += children_to_latex s += "\\end{description}\n" s end def to_latex_definition terms = self.terms definitions = self.definitions s = "" terms.each do |t| s +="\n\\item[#{t.children_to_latex}] " end definitions.each do |d| s += "#{d.children_to_latex} \n" end s end def to_latex_abbr children_to_latex end def to_latex_image id = self.ref_id ref = @doc.refs[id] if not ref maruku_error "Could not find ref #{id.inspect} for image.\n"+ "Available are: #{@docs.refs.keys.inspect}" # $stderr.puts "Could not find id = '#{id}'" "" else url = ref[:url] $stderr.puts "Images not supported yet (#{url})" # "{\\bf Images not supported yet (#{latex_escape(url)})}" "" end end def to_latex_div type = self.attributes[:class] id = self.attributes[:id] case type when /^un_(\w*)/ s = "\\begin{u#{$1}}" # s += "[#{@children[0].send('children_to_latex')}]" @children.delete_at(0) s += "\n" + children_to_latex s += "\\end{u#{$1}}\n" when /^num_(\w*)/ s = "\\begin{#{$1}}" # s += "[#{@children[0].send('children_to_latex')}]" @children.delete_at(0) s += "\n\\label{#{id}}\\hypertarget{#{id}}{}\n" s += children_to_latex s += "\\end{#{$1}}\n" when /^proof/ s = "\\begin{proof}" @children.delete_at(0) s += "\n" + children_to_latex s += "\\end{proof}\n" else s = children_to_latex end s end # Convert each child to html def children_to_latex array_to_latex(@children) end def array_to_latex(array, join_char='') e = [] array.each do |c| method = c.kind_of?(MDElement) ? "to_latex_#{c.node_type}" : "to_latex" if not c.respond_to?(method) # raise "Object does not answer to #{method}: #{c.class} #{c.inspect[0,100]}" next end h = c.send(method) if h.nil? raise "Nil html for #{c.inspect} created with method #{method}" end if h.kind_of?Array e = e + h else e << h end end # puts a space after commands if needed # e.each_index do |i| # if e[i] =~ /\\\w+\s*$/ # command # if (s=e[i+1]) && s[0] == ?\ # space # e[i] = e[i] + "\\ " # end # end # end e.join(join_char) end end end end # MaRuKu::Out::Latex maruku-0.6.0/lib/maruku/output/to_latex_strings.rb0000644000175000017500000000320211573154515022252 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ class String # These are TeX's special characters LATEX_ADD_SLASH = [ ?{, ?}, ?$, ?&, ?#, ?_, ?%] # These, we transform to {\tt \char} LATEX_TO_CHARCODE = [ ?^, ?~, ?>,?<] def escape_to_latex(s) s2 = "" s.each_byte do |b| if LATEX_TO_CHARCODE.include? b s2 += "{\\tt \\char#{b}}" elsif LATEX_ADD_SLASH.include? b s2 << ?\\ << b elsif b == ?\\ # there is no backslash in cmr10 fonts s2 += "$\\backslash$" else s2 << b end end s2 end # escapes special characters def to_latex s = escape_to_latex(self) OtherGoodies.each do |k, v| s.gsub!(k, v) end s end # other things that are good on the eyes OtherGoodies = { /(\s)LaTeX/ => '\1\\LaTeX\\xspace ', # XXX not if already \LaTeX # 'HTML' => '\\textsc{html}\\xspace ', # 'PDF' => '\\textsc{pdf}\\xspace ' } endmaruku-0.6.0/lib/maruku/output/to_s.rb0000644000175000017500000000245311573154515017635 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ module MaRuKu class MDElement # Strips all formatting from the string def to_s children_to_s end def children_to_s @children.join end # Generate an id for headers. Assumes @children is set. def generate_id title = children_to_s title.gsub!(/ /,'_') title.downcase! title.gsub!(/[^\w_]/,'') title.strip! if title.size == 0 $uid ||= 0 $uid += 1 title = "id#{$uid}" end # random is a very bad idea # title << "_" + rand(10000).to_s title end end end maruku-0.6.0/lib/maruku/string_utils.rb0000644000175000017500000000772111573154515020062 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ # Boring stuff with strings. module MaRuKu; module Strings def add_tabs(s,n=1,char="\t") s.split("\n").map{|x| char*n+x }.join("\n") end TabSize = 4; def split_lines(s) s.gsub("\r","").split("\n") end # This parses email headers. Returns an hash. # # +hash['data']+ is the message. # # Keys are downcased, space becomes underscore, converted to symbols. # # My key: true # # becomes: # # {:my_key => true} # def parse_email_headers(s) keys={} match = (s =~ /\A((\w[\w\s\_\-]+: .*\n)+)\s*\n/) if match != 0 keys[:data] = s else keys[:data] = $' headers = $1 headers.split("\n").each do |l| # Fails if there are other ':' characters. # k, v = l.split(':') k, v = l.split(':', 2) k, v = normalize_key_and_value(k, v) k = k.to_sym # puts "K = #{k}, V=#{v}" keys[k] = v end end keys end # Keys are downcased, space becomes underscore, converted to symbols. def normalize_key_and_value(k,v) v = v ? v.strip : true # no value defaults to true k = k.strip # check synonyms v = true if ['yes','true'].include?(v.to_s.downcase) v = false if ['no','false'].include?(v.to_s.downcase) k = k.downcase.gsub(' ','_') return k, v end # Returns the number of leading spaces, considering that # a tab counts as `TabSize` spaces. def number_of_leading_spaces(s) n=0; i=0; while i < s.size c = s[i,1] if c == ' ' i+=1; n+=1; elsif c == "\t" i+=1; n+=TabSize; else break end end n end # This returns the position of the first real char in a list item # # For example: # '*Hello' # => 1 # '* Hello' # => 2 # ' * Hello' # => 3 # ' * Hello' # => 5 # '1.Hello' # => 2 # ' 1. Hello' # => 5 def spaces_before_first_char(s) case s.md_type when :ulist i=0; # skip whitespace if present while s[i,1] =~ /\s/; i+=1 end # skip indicator (+, -, *) i+=1 # skip optional whitespace while s[i,1] =~ /\s/; i+=1 end return i when :olist i=0; # skip whitespace while s[i,1] =~ /\s/; i+=1 end # skip digits while s[i,1] =~ /\d/; i+=1 end # skip dot i+=1 # skip whitespace while s[i,1] =~ /\s/; i+=1 end return i else tell_user "BUG (my bad): '#{s}' is not a list" 0 end end # Counts the number of leading '#' in the string def num_leading_hashes(s) i=0; while i<(s.size-1) && (s[i,1]=='#'); i+=1 end i end # Strips initial and final hashes def strip_hashes(s) s = s[num_leading_hashes(s), s.size] i = s.size-1 while i > 0 && (s[i,1] =~ /(#|\s)/); i-=1; end s[0, i+1].strip end # change space to "_" and remove any non-word character def sanitize_ref_id(x) x.strip.downcase.gsub(' ','_').gsub(/[^\w]/,'') end # removes initial quote def unquote(s) s.gsub(/^>\s?/,'') end # toglie al massimo n caratteri def strip_indent(s, n) i = 0 while i < s.size && n>0 c = s[i,1] if c == ' ' n-=1; elsif c == "\t" n-=TabSize; else break end i+=1 end s[i, s.size] end def dbg_describe_ary(a, prefix='') i = 0 a.each do |l| puts "#{prefix} (#{i+=1})# #{l.inspect}" end end def force_linebreak?(l) l =~ / $/ end end end maruku-0.6.0/lib/maruku/version.rb0000644000175000017500000000217511573154515017017 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ module MaRuKu Version = '0.6.0' MarukuURL = 'http://maruku.rubyforge.org/' # If true, use also PHP Markdown extra syntax # # Note: it is not guaranteed that if it's false # then no special features will be used. # # So please, ignore it for now. def markdown_extra? true end def new_meta_data? true end end maruku-0.6.0/lib/maruku/textile2.rb0000644000175000017500000000005111573154515017061 0ustar vincentvincentrequire 'maruku/input_textile2/t2_parser'maruku-0.6.0/lib/maruku/helpers.rb0000644000175000017500000001376711573154515017005 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ # A series of helper functions for creating elements: they hide the # particular internal representation. # # Please, always use these instead of creating MDElement. # module MaRuKu module Helpers # if the first is a md_ial, it is used as such def md_el(node_type, children=[], meta={}, al=nil) if (e=children.first).kind_of?(MDElement) and e.node_type == :ial then if al al += e.ial else al = e.ial end children.shift end e = MDElement.new(node_type, children, meta, al) e.doc = @doc return e end def md_header(level, children, al=nil) md_el(:header, children, {:level => level}, al) end # Inline code def md_code(code, al=nil) md_el(:inline_code, [], {:raw_code => code}, al) end # Code block def md_codeblock(source, al=nil) md_el(:code, [], {:raw_code => source}, al) end def md_quote(children, al=nil) md_el(:quote, children, {}, al) end def md_li(children, want_my_par, al=nil) md_el(:li, children, {:want_my_paragraph=>want_my_par}, al) end def md_footnote(footnote_id, children, al=nil) md_el(:footnote, children, {:footnote_id=>footnote_id}, al) end def md_abbr_def(abbr, text, al=nil) md_el(:abbr_def, [], {:abbr=>abbr, :text=>text}, al) end def md_abbr(abbr, title) md_el(:abbr, [abbr], {:title=>title}) end def md_html(raw_html, al=nil) e = md_el(:raw_html, [], {:raw_html=>raw_html}) begin # remove newlines and whitespace at begin # end end of string, or else REXML gets confused raw_html = raw_html.gsub(/\A\s*[\s\n]*\Z/,'>') raw_html = "#{raw_html}" e.instance_variable_set :@parsed_html, REXML::Document.new(raw_html) rescue REXML::ParseException => ex e.instance_variable_set :@parsed_html, nil maruku_recover "REXML cannot parse this block of HTML/XML:\n"+ add_tabs(raw_html,1,'|') + "\n"+ex.inspect # " #{raw_html.inspect}\n\n"+ex.inspect end e end def md_link(children, ref_id, al=nil) md_el(:link, children, {:ref_id=>ref_id.downcase}, al) end def md_im_link(children, url, title=nil, al=nil) md_el(:im_link, children, {:url=>url,:title=>title}, al) end def md_image(children, ref_id, al=nil) md_el(:image, children, {:ref_id=>ref_id}, al) end def md_im_image(children, url, title=nil, al=nil) md_el(:im_image, children, {:url=>url,:title=>title},al) end def md_em(children, al=nil) md_el(:emphasis, [children].flatten, {}, al) end def md_br() md_el(:linebreak, [], {}, nil) end def md_hrule() md_el(:hrule, [], {}, nil) end def md_strong(children, al=nil) md_el(:strong, [children].flatten, {}, al) end def md_emstrong(children, al=nil) md_strong(md_em(children), al) end # def md_url(url, al=nil) md_el(:immediate_link, [], {:url=>url}, al) end # # def md_email(email, al=nil) md_el(:email_address, [], {:email=>email}, al) end def md_entity(entity_name, al=nil) md_el(:entity, [], {:entity_name=>entity_name}, al) end # Markdown extra def md_foot_ref(ref_id, al=nil) md_el(:footnote_reference, [], {:footnote_id=>ref_id}, al) end def md_par(children, al=nil) md_el(:paragraph, children, meta={}, al) end # [1]: http://url [properties] def md_ref_def(ref_id, url, title=nil, meta={}, al=nil) meta[:url] = url meta[:ref_id] = ref_id meta[:title] = title if title md_el(:ref_definition, [], meta, al) end # inline attribute list def md_ial(al) al = Maruku::AttributeList.new(al) if not al.kind_of?Maruku::AttributeList md_el(:ial, [], {:ial=>al}) end # Attribute list definition def md_ald(id, al) md_el(:ald, [], {:ald_id=>id,:ald=>al}) end # Server directive def md_xml_instr(target, code) md_el(:xml_instr, [], {:target=>target, :code=>code}) end end end module MaRuKu class MDElement # outputs abbreviated form (this should be eval()uable to get the document) def inspect2 s = case @node_type when :paragraph "md_par(%s)" % children_inspect when :footnote_reference "md_foot_ref(%s)" % self.footnote_id.inspect when :entity "md_entity(%s)" % self.entity_name.inspect when :email_address "md_email(%s)" % self.email.inspect when :inline_code "md_code(%s)" % self.raw_code.inspect when :raw_html "md_html(%s)" % self.raw_html.inspect when :emphasis "md_em(%s)" % children_inspect when :strong "md_strong(%s)" % children_inspect when :immediate_link "md_url(%s)" % self.url.inspect when :image "md_image(%s, %s)" % [ children_inspect, self.ref_id.inspect] when :im_image "md_im_image(%s, %s, %s)" % [ children_inspect, self.url.inspect, self.title.inspect] when :link "md_link(%s,%s)" % [ children_inspect, self.ref_id.inspect] when :im_link "md_im_link(%s, %s, %s)" % [ children_inspect, self.url.inspect, self.title.inspect, ] when :ref_definition "md_ref_def(%s, %s, %s)" % [ self.ref_id.inspect, self.url.inspect, self.title.inspect ] when :ial "md_ial(%s)" % self.ial.inspect else return nil end if @al and not @al.empty? then s = s.chop + ", #{@al.inspect})" end s end end end maruku-0.6.0/lib/maruku/maruku.rb0000644000175000017500000000173711573154515016641 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ # The Maruku class is the public interface # class Maruku def initialize(s=nil, meta={}) super(nil) self.attributes.merge! meta if s parse_doc(s) end end end maruku-0.6.0/lib/maruku/input_textile2/0000755000175000017500000000000011573154515017757 5ustar vincentvincentmaruku-0.6.0/lib/maruku/input_textile2/t2_parser.rb0000644000175000017500000000646211573154515022215 0ustar vincentvincentclass String Textile2_EmptyLine = /^\s*$/ Textile2_Signature = /^(\S+\.?)\.\s(.*)/ def t2_empty? self =~ Textile2_EmptyLine end def t2_contains_signature? self =~ Textile2_Signature end # sig, rest = t2_get_signature def t2_get_signature self =~ Textile2_Signature return Textile2Signature.new($1), $2 end end class Textile2Signature Reg = %r{ ^ # block name is 1 ([A-Za-z0-9]+)? # style is 2 ( \{ # open bracket ([^\}]+) # style spec is 3 \} # close bracket )? # language is 4 (\[(\w+)\])? # value is 5 # class and id (?: \( # open par (\w+)? # optional class specification is 6 (?:\#(\w+))? # optional id is 7 \) # close par )? # alignment is 8 (\<|\>|\<\>|\=)? # padding (\(+)? # left is 9 (\)+)? # right is 10 # filters is 11 (\| (?:(?:\w+)\|)+ )? # optional final dot is 12 (\.)? $ }x def initialize(s) if m = Reg.match(s) self.block_name = m[1] self.style = m[3] self.lang = m[4] self.css_class = m[6] self.css_id = m[7] self.text_align = {nil=>nil,'>'=>'right','<'=>'left', '<>'=>'center','='=>'justified'}[m[8]] self.num_left_pad = m[9] && m[9].size self.num_right_pad = m[10] && m[10].size self.filters = m[11] && m[11].split('|') self.double_dot = m[12] && true end end attr_accessor :block_name # or nil attr_accessor :style # or nil attr_accessor :lang # or nil attr_accessor :css_class # or nil attr_accessor :css_id # or nil attr_accessor :text_align # {nil, 'left', 'right', 'center', 'justified'} attr_accessor :num_left_pad # nil or 1.. attr_accessor :num_right_pad # nil or 1.. attr_accessor :filters # nil [], array of strings attr_accessor :double_dot # nil or true end module MaRuKu def self.textile2(source, params) m = Maruku.new m.t2_parse(source, params) end class MDDocument def t2_parse(source, params) src = LineSource.new(source) output = BlockContext.new t2_parse_blocks(src, output) self.children = output.elements end Handling = Struct.new(:method, :parse_lines) T2_Handling = { nil => Handling.new(:t2_block_paragraph, true), 'p' => Handling.new(:t2_block_paragraph, true) } # Input is a LineSource def t2_parse_blocks(src, output) while src.cur_line l = src.shift_line # ignore empty line if l.t2_empty? then src.shift_line next end # TODO: lists # TODO: xml # TODO: `==` signature, l = if l.t2_contains_signature? l.t2_get_signature else [Textile2Signature.new, l] end if handling = T2_Handling.has_key?(signature.block_name) if self.responds_to? handling.method # read as many non-empty lines that you can lines = [l] if handling.parse_lines while not src.cur_line.t2_empty? lines.push src.shift_line end end self.send(handling.method, src, output, signature, lines) else maruku_error("We don't know about method #{handling.method.inspect}") next end end end end def t2_block_paragraph(src, output, signature, lines) paragraph = lines.join("\n") src2 = CharSource.new(paragraph, src) # output = end def t2_parse_span(src, output) end end # MDDocument endmaruku-0.6.0/lib/maruku/tests/0000755000175000017500000000000011573154515016142 5ustar vincentvincentmaruku-0.6.0/lib/maruku/tests/benchmark.rb0000644000175000017500000000362611573154515020430 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'maruku' #require 'bluecloth' data = $stdin.read num = 10 if ARGV.size > 0 && ((n=ARGV[0].to_i) != 0) num = n end methods = [ [Maruku, :to_html], # [BlueCloth, :to_html], [Maruku, :to_latex] ] #methods = [[Maruku, :class]] #num = 10 stats = methods .map do |c, method| puts "Computing for #{c}" start = Time.now doc = nil for i in 1..num $stdout.write "#{i} "; $stdout.flush doc = c.new(data) end stop = Time.now parsing = (stop-start)/num start = Time.now for i in 1..num $stdout.write "#{i} "; $stdout.flush s = doc.send method end stop = Time.now rendering = (stop-start)/num puts ("%s (%s): parsing %0.2f sec + rendering %0.2f sec "+ "= %0.2f sec ") % [c, method, parsing,rendering,parsing+rendering] [c, method, parsing, rendering] end puts "\n\n\n" stats.each do |x| x.push(x[2]+x[3]) end max = stats.map{|x|x[4]}.max stats.sort! { |x,y| x[4] <=> y[4] } . reverse! for c, method, parsing, rendering, tot in stats puts ("%20s: parsing %0.2f sec + rendering %0.2f sec "+ "= %0.2f sec (%0.2fx)") % ["#{c} (#{method})", parsing,rendering,tot,max/tot] end maruku-0.6.0/lib/maruku/tests/tests.rb0000644000175000017500000000554211573154515017637 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'maruku' class Maruku def Maruku.failed(test, doc, s) raise "Test failed: #{s}\n*****\n#{test}\n*****\n"+ "#{doc.inspect}\n*****\n{doc.to_html}" end def Maruku.metaTests ref = {:id => 'id1', :class => ['class1','class2'], :style=> 'Style is : important = for all } things'} tests = MetaTests.split('***') for test in tests #puts "Test: #{test.inspect}" doc = Maruku.new(test) doc.children.size == 1 || failed(test, doc, "children != 1") h = doc.children[0] h.node_type==:header || failed(test, doc, "child not header") # puts doc.inspect # puts doc.to_html end end MetaTests = < # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'maruku' require 'maruku/ext/math' module MaRuKu; module Tests # 5 accented letters in italian, encoded as UTF-8 AccIta8 = "\303\240\303\250\303\254\303\262\303\271" # Same letters, written in ISO-8859-1 (one byte per letter) AccIta1 = "\340\350\354\362\371" # The word MA-RU-KU, written in katakana using UTF-8 Maruku8 = "\343\203\236\343\203\253\343\202\257" def test_span_parser(verbose, break_on_first_error, quiet) good_cases = [ ["", [], 'Empty string gives empty list'], ["a", ["a"], 'Easy char'], [" a", ["a"], 'First space in the paragraph is ignored'], ["a\n \n", ["a"], 'Last spaces in the paragraphs are ignored'], [' ', [], 'One char => nothing'], [' ', [], 'Two chars => nothing'], ['a b', ['a b'], 'Spaces are compressed'], ['a b', ['a b'], 'Newlines are spaces'], ["a\nb", ['a b'], 'Newlines are spaces'], ["a\n b", ['a b'], 'Compress newlines 1'], ["a \nb", ['a b'], 'Compress newlines 2'], [" \nb", ['b'], 'Compress newlines 3'], ["\nb", ['b'], 'Compress newlines 4'], ["b\n", ['b'], 'Compress newlines 5'], ["\n", [], 'Compress newlines 6'], ["\n\n\n", [], 'Compress newlines 7'], [nil, :throw, "Should throw on nil input"], # Code blocks ["`" , :throw, 'Unclosed single ticks'], ["``" , :throw, 'Unclosed double ticks'], ["`a`" , [md_code('a')], 'Simple inline code'], ["`` ` ``" , [md_code('`')], ], ["`` \\` ``" , [md_code('\\`')], ], ["``a``" , [md_code('a')], ], ["`` a ``" , [md_code('a')], ], # Newlines ["a \n", ['a',md_el(:linebreak)], 'Two spaces give br.'], ["a \n", ['a'], 'Newlines 2'], [" \n", [md_el(:linebreak)], 'Newlines 3'], [" \n \n", [md_el(:linebreak),md_el(:linebreak)],'Newlines 3'], [" \na \n", [md_el(:linebreak),'a',md_el(:linebreak)],'Newlines 3'], # Inline HTML ["a < b", ['a < b'], '< can be on itself'], ["
", [md_html('
')], 'HR will be sanitized'], ["
", [md_html('
')], 'Closed tag is ok'], ["
", [md_html('
')], 'Closed tag is ok 2'], ["
a", [md_html('
'),'a'], 'Closed tag is ok 2'], ["a", [md_html(''),'a'], 'Inline HTML 1'], ["ea", [md_html('e'),'a'], 'Inline HTML 2'], ["aeb", ['a',md_html('e'),'b'], 'Inline HTML 3'], ["eaf", [md_html('e'),'a',md_html('f')], 'Inline HTML 4'], ["efa", [md_html('e'),md_html('f'),'a'], 'Inline HTML 5'], ["", [md_html("")], 'Attributes'], [""], # emphasis ["**", :throw, 'Unclosed double **'], ["\\*", ['*'], 'Escaping of *'], ["a *b* ", ['a ', md_em('b')], 'Emphasis 1'], ["a *b*", ['a ', md_em('b')], 'Emphasis 2'], ["a * b", ['a * b'], 'Emphasis 3'], ["a * b*", :throw, 'Unclosed emphasis'], # same with underscore ["__", :throw, 'Unclosed double __'], ["\\_", ['_'], 'Escaping of _'], ["a _b_ ", ['a ', md_em('b')], 'Emphasis 4'], ["a _b_", ['a ', md_em('b')], 'Emphasis 5'], ["a _ b", ['a _ b'], 'Emphasis 6'], ["a _ b_", :throw, 'Unclosed emphasis'], ["_b_", [md_em('b')], 'Emphasis 7'], ["_b_ _c_", [md_em('b'),' ',md_em('c')], 'Emphasis 8'], ["_b__c_", [md_em('b'),md_em('c')], 'Emphasis 9'], # underscores in word ["mod_ruby", ['mod_ruby'], 'Word with underscore'], # strong ["**a*", :throw, 'Unclosed double ** 2'], ["\\**a*", ['*', md_em('a')], 'Escaping of *'], ["a **b** ", ['a ', md_strong('b')], 'Emphasis 1'], ["a **b**", ['a ', md_strong('b')], 'Emphasis 2'], ["a ** b", ['a ** b'], 'Emphasis 3'], ["a ** b**", :throw, 'Unclosed emphasis'], ["**b****c**", [md_strong('b'),md_strong('c')], 'Emphasis 9'], # strong (with underscore) ["__a_", :throw, 'Unclosed double __ 2'], # ["\\__a_", ['_', md_em('a')], 'Escaping of _'], ["a __b__ ", ['a ', md_strong('b')], 'Emphasis 1'], ["a __b__", ['a ', md_strong('b')], 'Emphasis 2'], ["a __ b", ['a __ b'], 'Emphasis 3'], ["a __ b__", :throw, 'Unclosed emphasis'], ["__b____c__", [md_strong('b'),md_strong('c')], 'Emphasis 9'], # extra strong ["***a**", :throw, 'Unclosed triple *** '], ["\\***a**", ['*', md_strong('a')], 'Escaping of *'], ["a ***b*** ", ['a ', md_emstrong('b')], 'Strong elements'], ["a ***b***", ['a ', md_emstrong('b')]], ["a *** b", ['a *** b']], ["a ** * b", ['a ** * b']], ["***b******c***", [md_emstrong('b'),md_emstrong('c')]], ["a *** b***", :throw, 'Unclosed emphasis'], # same with underscores ["___a__", :throw, 'Unclosed triple *** '], # ["\\___a__", ['_', md_strong('a')], 'Escaping of _'], ["a ___b___ ", ['a ', md_emstrong('b')], 'Strong elements'], ["a ___b___", ['a ', md_emstrong('b')]], ["a ___ b", ['a ___ b']], ["a __ _ b", ['a __ _ b']], ["___b______c___", [md_emstrong('b'),md_emstrong('c')]], ["a ___ b___", :throw, 'Unclosed emphasis'], # mixing is bad ["*a_", :throw, 'Mixing is bad'], ["_a*", :throw], ["**a__", :throw], ["__a**", :throw], ["___a***", :throw], ["***a___", :throw], # links of the form [text][ref] ["\\[a]", ["[a]"], 'Escaping 1'], ["\\[a\\]", ["[a]"], 'Escaping 2'], # This is valid in the new Markdown version # ["[a]", ["a"], 'Not a link'], ["[a]", [ md_link(["a"],'a')], 'Empty link'], ["[a][]", ], ["[a][]b", [ md_link(["a"],'a'),'b'], 'Empty link'], ["[a\\]][]", [ md_link(["a]"],'a')], 'Escape inside link (throw ?] away)'], ["[a", :throw, 'Link not closed'], ["[a][", :throw, 'Ref not closed'], # links of the form [text](url) ["\\[a](b)", ["[a](b)"], 'Links'], ["[a](url)c", [md_im_link(['a'],'url'),'c'], 'url'], ["[a]( url )c" ], ["[a] ( url )c" ], ["[a] ( url)c" ], ["[a](ur:/l/ 'Title')", [md_im_link(['a'],'ur:/l/','Title')], 'url and title'], ["[a] ( ur:/l/ \"Title\")" ], ["[a] ( ur:/l/ \"Title\")" ], ["[a]( ur:/l/ Title)", :throw, "Must quote title" ], ["[a](url 'Tit\\\"l\\\\e')", [md_im_link(['a'],'url','Tit"l\\e')], 'url and title escaped'], ["[a] ( url \"Tit\\\"l\\\\e\")" ], ["[a] ( url \"Tit\\\"l\\\\e\" )" ], ['[a] ( url "Tit\\"l\\\\e" )' ], ["[a]()", [md_im_link(['a'],'')], 'No URL is OK'], ["[a](\"Title\")", :throw, "No url specified" ], ["[a](url \"Title)", :throw, "Unclosed quotes" ], ["[a](url \"Title\\\")", :throw], ["[a](url \"Title\" ", :throw], ["[a](url \'Title\")", :throw, "Mixing is bad" ], ["[a](url \"Title\')"], ["[a](/url)", [md_im_link(['a'],'/url')], 'Funny chars in url'], ["[a](#url)", [md_im_link(['a'],'#url')]], ["[a]()", [md_im_link(['a'],'/script?foo=1&bar=2')]], # Images ["\\![a](url)", ['!', md_im_link(['a'],'url') ], 'Escaping images'], ["![a](url)", [md_im_image(['a'],'url')], 'Image no title'], ["![a]( url )" ], ["![a] ( url )" ], ["![a] ( url)" ], ["![a](url 'ti\"tle')", [md_im_image(['a'],'url','ti"tle')], 'Image with title'], ['![a]( url "ti\\"tle")' ], ["![a](url", :throw, 'Invalid images'], ["![a( url )" ], ["![a] ('url )" ], ["![a][imref]", [md_image(['a'],'imref')], 'Image with ref'], ["![a][ imref]"], ["![a][ imref ]"], ["![a][\timref\t]"], ['', [md_url('http://example.com/?foo=1&bar=2')], 'Immediate link'], ['ab', ['a',md_url('http://example.com/?foo=1&bar=2'),'b'] ], ['', [md_email('andrea@censi.org')], 'Email address'], [''], ["Developmen ", ["Developmen ", md_url("http://rubyforge.org/projects/maruku/")]], ["ab", ['a',md_html(''),'b'], 'HTML Comment'], ["a ' : ' '; l = @lines[i] s += "%10s %4s|%s" % [@lines[i].md_type.to_s, prefix, l] s += "|\n" end # if @parent # s << "Parent context is: \n" # s << add_tabs(@parent.describe,1,'|') # end s end def original_line_number(index) if @parent return index + @parent.original_line_number(@parent_offset) else 1 + index end end def cur_index @lines_index end # Returns the type of next line as a string # breaks at first :definition def tell_me_the_future s = ""; num_e = 0; for i in @lines_index..@lines.size-1 c = case @lines[i].md_type when :text; "t" when :empty; num_e+=1; "e" when :definition; "d" else "o" end s += c break if c == "d" or num_e>1 end s end end # linesource end end end end # block maruku-0.6.0/lib/maruku/input/parse_span_better.rb0000644000175000017500000004543111573154515022173 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'set' module MaRuKu; module In; module Markdown; module SpanLevelParser include MaRuKu::Helpers EscapedCharInText = Set.new [?\\,?`,?*,?_,?{,?},?[,?],?(,?),?#,?.,?!,?|,?:,?+,?-,?>] EscapedCharInQuotes = Set.new [?\\,?`,?*,?_,?{,?},?[,?],?(,?),?#,?.,?!,?|,?:,?+,?-,?>,?',?"] EscapedCharInInlineCode = [?\\,?`] def parse_lines_as_span(lines, parent=nil) parse_span_better lines.join("\n"), parent end def parse_span_better(string, parent=nil) if not string.kind_of? String then error "Passed #{string.class}." end st = (string + "") st.freeze src = CharSource.new(st, parent) read_span(src, EscapedCharInText, [nil]) end # This is the main loop for reading span elements # # It's long, but not *complex* or difficult to understand. # # def read_span(src, escaped, exit_on_chars, exit_on_strings=nil) con = SpanContext.new c = d = nil while true c = src.cur_char # This is only an optimization which cuts 50% of the time used. # (but you can't use a-zA-z in exit_on_chars) if c && ((c>=?a && c<=?z) || ((c>=?A && c<=?Z))) con.cur_string << src.shift_char next end break if exit_on_chars && exit_on_chars.include?(c) break if exit_on_strings && exit_on_strings.any? {|x| src.cur_chars_are x} # check if there are extensions if check_span_extensions(src, con) next end case c = src.cur_char when ?\ # it's space (32) if src.cur_chars_are " \n" src.ignore_chars(3) con.push_element md_br() next else src.ignore_char con.push_space end when ?\n, ?\t src.ignore_char con.push_space when ?` read_inline_code(src,con) when ?< # It could be: # 1) HTML "
> case d = src.next_char when ?<; # guillemettes src.ignore_chars(2) con.push_char ?< con.push_char ?< when ?!; if src.cur_chars_are '} TO_SANITIZE = ['img','hr','br'] attr_reader :rest def my_debug(s) # puts "---"*10+"\n"+inspect+"\t>>>\t"s end def initialize @rest = "" @tag_stack = [] @m = nil @already = "" self.state = :inside_element end attr_accessor :state # = :inside_element, :inside_tag, :inside_comment, def eat_this(line) @rest = line + @rest things_read = 0 until @rest.empty? case self.state when :inside_comment if @m = CommentEnd.match(@rest) @already += @m.pre_match + @m.to_s @rest = @m.post_match self.state = :inside_element else @already += @rest @rest = "" self.state = :inside_comment end when :inside_element if @m = CommentStart.match(@rest) things_read += 1 @already += @m.pre_match + @m.to_s @rest = @m.post_match self.state = :inside_comment elsif @m = Tag.match(@rest) then my_debug "#{@state}: Tag: #{@m.to_s.inspect}" things_read += 1 handle_tag self.state = :inside_element elsif @m = PartialTag.match(@rest) then my_debug "#{@state}: PartialTag: #{@m.to_s.inspect}" @already += @m.pre_match @rest = @m.post_match @partial_tag = @m.to_s self.state = :inside_tag elsif @m = EverythingElse.match(@rest) my_debug "#{@state}: Everything: #{@m.to_s.inspect}" @already += @m.pre_match + @m.to_s @rest = @m.post_match self.state = :inside_element else error "Malformed HTML: not complete: #{@rest.inspect}" end when :inside_tag if @m = /^[^>]*>/.match(@rest) then my_debug "#{@state}: inside_tag: matched #{@m.to_s.inspect}" @partial_tag += @m.to_s my_debug "#{@state}: inside_tag: matched TOTAL: #{@partial_tag.to_s.inspect}" @rest = @partial_tag + @m.post_match @partial_tag = nil self.state = :inside_element else @partial_tag += @rest @rest = "" self.state = :inside_tag end else raise "Bug bug: state = #{self.state.inspect}" end # not inside comment # puts inspect # puts "Read: #{@tag_stack.inspect}" break if is_finished? and things_read>0 end end def handle_tag() @already += @m.pre_match @rest = @m.post_match is_closing = !!@m[1] tag = @m[2] attributes = @m[3].to_s is_single = false if attributes[-1] == ?/ # =~ /\A(.*)\/\Z/ attributes = attributes[0, attributes.size-1] is_single = true end my_debug "Attributes: #{attributes.inspect}" my_debug "READ TAG #{@m.to_s.inspect} tag = #{tag} closing? #{is_closing} single = #{is_single}" if TO_SANITIZE.include? tag attributes.strip! # puts "Attributes: #{attributes.inspect}" if attributes.size > 0 @already += '<%s %s />' % [tag, attributes] else @already += '<%s />' % [tag] end elsif is_closing @already += @m.to_s if @tag_stack.empty? error "Malformed: closing tag #{tag.inspect} "+ "in empty list" end if @tag_stack.last != tag error "Malformed: tag <#{tag}> "+ "closes <#{@tag_stack.last}>" end @tag_stack.pop else @already += @m.to_s if not is_single @tag_stack.push(tag) my_debug "Pushing #{tag.inspect} when read #{@m.to_s.inspect}" end end end def error(s) raise Exception, "Error: #{s} \n"+ inspect, caller end def inspect; "HTML READER\n state=#{self.state} "+ "match=#{@m.to_s.inspect}\n"+ "Tag stack = #{@tag_stack.inspect} \n"+ "Before:\n"+ add_tabs(@already,1,'|')+"\n"+ "After:\n"+ add_tabs(@rest,1,'|')+"\n" end def stuff_you_read @already end def rest() @rest end def is_finished? (self.state == :inside_element) and @tag_stack.empty? end end # html helper end end end end maruku-0.6.0/lib/maruku/input/type_detection.rb0000644000175000017500000001061411573154515021505 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ class String include MaRuKu::Strings def md_type() @md_type ||= line_md_type(self) end end class NilClass def md_type() nil end end # This code does the classification of lines for block-level parsing. module MaRuKu; module Strings def line_md_type(l) # The order of evaluation is important (:text is a catch-all) return :text if l =~ /^[a-zA-Z]/ return :code if number_of_leading_spaces(l)>=4 return :empty if l =~ /^\s*$/ return :footnote_text if l =~ FootnoteText return :ref_definition if l =~ LinkRegex or l=~ IncompleteLink return :abbreviation if l =~ Abbreviation return :definition if l =~ Definition # I had a bug with emails and urls at the beginning of the # line that were mistaken for raw_html return :text if l=~ /^[ ]{0,3}#{EMailAddress}/ return :text if l=~ /^[ ]{0,3}/ return :metadata if l =~ /^@/ # if @@new_meta_data? return :ald if l =~ AttributeDefinitionList return :ial if l =~ InlineAttributeList # end # return :equation_end if l =~ EquationEnd return :text # else, it's just text end # $1 = id $2 = attribute list AttributeDefinitionList = /^\s{0,3}\{([\w\d\s]+)\}:\s*(.*)\s*$/ # InlineAttributeList = /^\s{0,3}\{([:#\.].*)\}\s*$/ # Example: # ^:blah blah # ^: blah blah # ^ : blah blah Definition = %r{ ^ # begin of line [ ]{0,3} # up to 3 spaces : # colon \s* # whitespace (\S.*) # the text = $1 $ # end of line }x # Example: # *[HTML]: Hyper Text Markup Language Abbreviation = %r{ ^ # begin of line [ ]{0,3} # up to 3 spaces \* # one asterisk \[ # opening bracket ([^\]]+) # any non-closing bracket: id = $1 \] # closing bracket : # colon \s* # whitespace (\S.*\S)* # definition=$2 \s* # strip this whitespace $ # end of line }x FootnoteText = %r{ ^ # begin of line [ ]{0,3} # up to 3 spaces \[(\^.+)\]: # id = $1 (including '^') \s*(\S.*)?$ # text = $2 (not obb.) }x # This regex is taken from BlueCloth sources # Link defs are in the form: ^[id]: \n? url "optional title" LinkRegex = %r{ ^[ ]{0,3}\[([^\[\]]+)\]: # id = $1 [ ]* \s]+)>? # url = $2 [ ]* (?:# Titles are delimited by "quotes" or (parens). ["('] (.+?) # title = $3 [")'] # Matching ) or " \s*(.+)? # stuff = $4 )? # title is optional }x IncompleteLink = %r{^[ ]{0,3}\[([^\[\]]+)\]:\s*$} HeaderWithId = /^(.*)\{\#([\w_-]+)\}\s*$/ HeaderWithAttributes = /^(.*)\{(.*)\}\s*$/ # if contains a pipe, it could be a table header MightBeTableHeader = %r{\|} # -------------: Sep = /\s*(\:)?\s*-+\s*(\:)?\s*/ # | -------------:| ------------------------------ | TableSeparator = %r{^(\|?#{Sep}\|?)+\s*$} EMailAddress = /<([^:]+@[^:]+)>/ end end maruku-0.6.0/lib/maruku/toc.rb0000644000175000017500000001076011573154515016116 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ module MaRuKu class MDDocument # an instance of Section (see below) attr_accessor :toc end # This represents a section in the TOC. class Section # a Fixnum, is == header_element.level attr_accessor :section_level # An array of fixnum, like [1,2,5] for Section 1.2.5 attr_accessor :section_number # reference to header (header has h.meta[:section] to self) attr_accessor :header_element # Array of immediate children of this element attr_accessor :immediate_children # Array of Section inside this section attr_accessor :section_children def initialize @immediate_children = [] @section_children = [] end end class Section def inspect(indent=1) s = "" if @header_element s += "\_"*indent + "(#{@section_level})>\t #{@section_number.join('.')} : " s += @header_element.children_to_s + " (id: '#{@header_element.attributes[:id]}')\n" else s += "Master\n" end @section_children.each do |c| s+=c.inspect(indent+1) end s end # Numerate this section and its children def numerate(a=[]) self.section_number = a section_children.each_with_index do |c,i| c.numerate(a.clone.push(i+1)) end if h = self.header_element h.attributes[:section_number] = self.section_number end end include REXML # Creates an HTML toc. # Call this on the root def to_html div = Element.new 'div' div.attributes['class'] = 'maruku_toc' div << create_toc div end def create_toc ul = Element.new 'ul' # let's remove the bullets ul.attributes['style'] = 'list-style: none;' @section_children.each do |c| li = Element.new 'li' if span = c.header_element.render_section_number li << span end a = c.header_element.wrap_as_element('a') a.delete_attribute 'id' a.attributes['href'] = "##{c.header_element.attributes[:id]}" li << a li << c.create_toc if c.section_children.size>0 ul << li end ul end # Creates a latex toc. # Call this on the root def to_latex to_latex_rec + "\n\n" end def to_latex_rec s = "" @section_children.each do |c| s += "\\noindent" number = c.header_element.section_number s += number if number text = c.header_element.children_to_latex id = c.header_element.attributes[:id] s += "\\hyperlink{#{id}}{#{text}}" s += "\\dotfill \\pageref*{#{id}} \\linebreak\n" s += c.to_latex_rec if c.section_children.size>0 end s end end class MDDocument def create_toc each_element(:header) do |h| h.attributes[:id] ||= h.generate_id end stack = [] # the ancestor section s = Section.new s.section_level = 0 stack.push s i = 0; while i < @children.size while i < @children.size if @children[i].node_type == :header level = @children[i].level break if level <= stack.last.section_level+1 end stack.last.immediate_children.push @children[i] i += 1 end break if i>=@children.size header = @children[i] level = header.level if level > stack.last.section_level # this level is inside s2 = Section.new s2.section_level = level s2.header_element = header header.instance_variable_set :@section, s2 stack.last.section_children.push s2 stack.push s2 i+=1 elsif level == stack.last.section_level # this level is a sibling stack.pop else # this level is a parent stack.pop end end # If there is only one big header, then assume # it is the master if s.section_children.size == 1 s = s.section_children.first end # Assign section numbers s.numerate s end end endmaruku-0.6.0/lib/maruku/attributes.rb0000644000175000017500000001434111573154515017516 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ class String def quote_if_needed if /[\s\'\"]/.match self inspect else self end end end module MaRuKu; MagicChar = ':' class AttributeList < Array # An attribute list becomes # {#id .cl key="val" ref} # [ [:id, 'id'], [:class, 'id'], ['key', 'val'], [ :ref, 'ref' ]] private :push def push_key_val(key, val); raise "Bad #{key.inspect}=#{val.inspect}" if not key and val push [key, val] end def push_ref(ref_id); raise "Bad :ref #{ref_id.inspect}" if not ref_id push [:ref, ref_id+""] # p "Now ", self ######################################## end def push_class(val); raise "Bad :id #{val.inspect}" if not val push [:class, val] end def push_id(val); raise "Bad :id #{val.inspect}" if not val push [:id, val] end def to_s map do |k,v| case k when :id; "#" + v.quote_if_needed when :class; "." + v.quote_if_needed when :ref; v.quote_if_needed else k.quote_if_needed + "=" + v.quote_if_needed end end . join(' ') end alias to_md to_s end end module MaRuKu; module In; module Markdown; module SpanLevelParser def unit_tests_for_attribute_lists [ [ "", [], "Empty lists are allowed" ], [ "=", :throw, "Bad char to begin a list with." ], [ "a =b", :throw, "No whitespace before `=`." ], [ "a= b", :throw, "No whitespace after `=`." ], [ "a b", [[:ref, 'a'],[:ref, 'b']], "More than one ref" ], [ "a b c", [[:ref, 'a'],[:ref, 'b'],[:ref, 'c']], "More than one ref" ], [ "hello notfound", [[:ref, 'hello'],[:ref, 'notfound']]], [ "'a'", [[:ref, 'a']], "Quoted value." ], [ '"a"' ], [ "a=b", [['a','b']], "Simple key/val" ], [ "'a'=b" ], [ "'a'='b'" ], [ "a='b'" ], [ 'a="b\'"', [['a',"b\'"]], "Key/val with quotes" ], [ 'a=b\''], [ 'a="\\\'b\'"', [['a',"\'b\'"]], "Key/val with quotes" ], ['"', :throw, "Unclosed quotes"], ["'"], ["'a "], ['"a '], [ "#a", [[:id, 'a']], "Simple ID" ], [ "#'a'" ], [ '#"a"' ], [ "#", :throw, "Unfinished '#'." ], [ ".", :throw, "Unfinished '.'." ], [ "# a", :throw, "No white-space after '#'." ], [ ". a", :throw, "No white-space after '.' ." ], [ "a=b c=d", [['a','b'],['c','d']], "Tabbing" ], [ " \ta=b \tc='d' "], [ "\t a=b\t c='d'\t\t"], [ ".\"a'", :throw, "Mixing quotes is bad." ], ].map { |s, expected, comment| @expected = (expected ||= @expected) @comment = (comment ||= (last=@comment) ) (comment == last && (comment += (@count+=1).to_s)) || @count = 1 expected = [md_ial(expected)] if expected.kind_of? Array ["{#{MagicChar}#{s}}", expected, "Attributes: #{comment}"] } end def md_al(s=[]); AttributeList.new(s) end # returns nil or an AttributeList def read_attribute_list(src, con, break_on_chars) separators = break_on_chars + [?=,?\ ,?\t] escaped = Maruku::EscapedCharInQuotes al = AttributeList.new while true src.consume_whitespace break if break_on_chars.include? src.cur_char case src.cur_char when nil maruku_error "Attribute list terminated by EOF:\n "+ "#{al.inspect}" , src, con tell_user "I try to continue and return partial attribute list:\n"+ al.inspect break when ?= # error maruku_error "In attribute lists, cannot start identifier with `=`." tell_user "I try to continue" src.ignore_char when ?# # id definition src.ignore_char if id = read_quoted_or_unquoted(src, con, escaped, separators) al.push_id id else maruku_error 'Could not read `id` attribute.', src, con tell_user 'Trying to ignore bad `id` attribute.' end when ?. # class definition src.ignore_char if klass = read_quoted_or_unquoted(src, con, escaped, separators) al.push_class klass else maruku_error 'Could not read `class` attribute.', src, con tell_user 'Trying to ignore bad `class` attribute.' end else if key = read_quoted_or_unquoted(src, con, escaped, separators) if src.cur_char == ?= src.ignore_char # skip the = if val = read_quoted_or_unquoted(src, con, escaped, separators) al.push_key_val(key, val) else maruku_error "Could not read value for key #{key.inspect}.", src, con tell_user "Ignoring key #{key.inspect}." end else al.push_ref key end else maruku_error 'Could not read key or reference.' end end # case end # while true al end # We need a helper def is_ial(e); e.kind_of? MDElement and e.node_type == :ial end def merge_ial(elements, src, con) # Apply each IAL to the element before elements.each_with_index do |e, i| if is_ial(e) && i>= 1 then before = elements[i-1] after = elements[i+1] if before.kind_of? MDElement before.al = e.ial elsif after.kind_of? MDElement after.al = e.ial else maruku_error "It is not clear to me what element this IAL {:#{e.ial.to_md}} \n"+ "is referring to. The element before is a #{before.class.to_s}, \n"+ "the element after is a #{after.class.to_s}.\n"+ "\n before: #{before.inspect}"+ "\n after: #{after.inspect}", src, con # xxx dire se c'è empty vicino end end end if not Globals[:debug_keep_ials] elements.delete_if {|x| is_ial(x) unless x == elements.first} end end end end end end #module MaRuKu; module In; module Markdown; module SpanLevelParser maruku-0.6.0/lib/maruku.rb0000644000175000017500000000617411573154515015335 0ustar vincentvincent#-- # Copyright (C) 2006 Andrea Censi # # This file is part of Maruku. # # Maruku is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Maruku is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Maruku; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ require 'rexml/document' # :include:MaRuKu.txt module MaRuKu module In module Markdown module SpanLevelParser; end module BlockLevelParser; end end # more to come? end module Out # Functions for exporting to MarkDown. module Markdown; end # Functions for exporting to HTML. module HTML; end # Functions for exporting to Latex module Latex; end end # These are strings utilities. module Strings; end module Helpers; end module Errors; end class MDElement include REXML include MaRuKu include Out::Markdown include Out::HTML include Out::Latex include Strings include Helpers include Errors end class MDDocument < MDElement include In::Markdown include In::Markdown::SpanLevelParser include In::Markdown::BlockLevelParser end end # This is the public interface class Maruku < MaRuKu::MDDocument; end require 'rexml/document' # Structures definition require 'maruku/structures' require 'maruku/structures_inspect' require 'maruku/defaults' # Less typing require 'maruku/helpers' # Code for parsing whole Markdown documents require 'maruku/input/parse_doc' # Ugly things kept in a closet require 'maruku/string_utils' require 'maruku/input/linesource' require 'maruku/input/type_detection' # A class for reading and sanitizing inline HTML require 'maruku/input/html_helper' # Code for parsing Markdown block-level elements require 'maruku/input/parse_block' # Code for parsing Markdown span-level elements require 'maruku/input/charsource' require 'maruku/input/parse_span_better' require 'maruku/input/rubypants' require 'maruku/input/extensions' require 'maruku/attributes' require 'maruku/structures_iterators' require 'maruku/errors_management' # Code for creating a table of contents require 'maruku/toc' # Support for div Markdown extension require 'maruku/ext/div' # Version and URL require 'maruku/version' # Exporting to html require 'maruku/output/to_html' # Exporting to latex require 'maruku/output/to_latex' require 'maruku/output/to_latex_strings' require 'maruku/output/to_latex_entities' # Pretty print require 'maruku/output/to_markdown' # S5 slides require 'maruku/output/s5/to_s5' require 'maruku/output/s5/fancy' # Exporting to text: strips all formatting (not complete) require 'maruku/output/to_s' # class Maruku is the global interface require 'maruku/maruku' maruku-0.6.0/unit_test_span.sh0000644000175000017500000000014611573154515016322 0ustar vincentvincent# try ruby -Ilib lib/maruku/tests/new_parser.rb v b ruby -Ilib lib/maruku/tests/new_parser.rb $* v maruku-0.6.0/maruku_gem.rb0000644000175000017500000000164011573154515015410 0ustar vincentvincent require 'lib/maruku/version' $spec = Gem::Specification.new do |s| s.name = 'maruku' s.version = MaRuKu::Version s.summary = "Maruku is a Markdown-superset interpreter written in Ruby." s.description = %{Maruku is a Markdown interpreter in Ruby. It features native export to HTML and PDF (via Latex). The output is really beautiful! } s.files = Dir['lib/**/*.rb'] + Dir['lib/*.rb'] + Dir['docs/*.md'] + Dir['docs/*.html'] + Dir['tests/**/*.md'] + Dir['bin/*'] + Dir['*.sh'] + ['Rakefile', 'maruku_gem.rb'] s.bindir = 'bin' s.executables = ['maruku','marutex'] s.require_path = 'lib' s.autorequire = 'maruku' s.add_dependency('syntax', '>= 1.0.0') s.author = "Andrea Censi" s.email = "andrea@rubyforge.org" s.homepage = "http://maruku.rubyforge.org" end # s.has_rdoc = true # s.extra_rdoc_files = Dir['[A-Z]*'] # s.rdoc_options << '--title' << 'Builder -- Easy XML Building' maruku-0.6.0/tests/0000755000175000017500000000000011573154515014070 5ustar vincentvincentmaruku-0.6.0/tests/unittest/0000755000175000017500000000000011573154515015747 5ustar vincentvincentmaruku-0.6.0/tests/unittest/recover/0000755000175000017500000000000011573154515017414 5ustar vincentvincentmaruku-0.6.0/tests/unittest/recover/recover_links.md0000644000175000017500000000116011573154515022601 0ustar vincentvincentThis shows how Maruku recovers from parsing errors *** Parameters: *** {:on_error=>:warning} *** Markdown input: *** Search on [Google images][ GoOgle search ] *** Output of inspect *** md_el(:document,[md_par(["Search on ", md_link(["Google images"],"google_search")])],{},[]) *** Output of to_html ***

Search on Google images

*** Output of to_latex *** Search on Google images *** Output of to_md *** Search on Google images *** Output of to_s *** Search on Google images *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/red_tests/0000755000175000017500000000000011573154515017743 5ustar vincentvincentmaruku-0.6.0/tests/unittest/red_tests/lists7.md0000644000175000017500000000174211573154515021516 0ustar vincentvincentI'm not sure if this should work at all... *** Parameters: *** {} # params *** Markdown input: *** Ciao * Tab * Tab * Tab *** Output of inspect *** nil *** Output of to_html ***

Ciao

  • Tab * Tab * Tab
*** Output of to_latex *** Ciao \begin{itemize}% \item Tab * Tab * Tab \end{itemize} *** Output of to_md *** Ciao -ab * Tab * Tab *** Output of to_s *** CiaoTab * Tab * Tab *** EOF *** Failed tests: [:inspect] *** Output of inspect *** -----| WARNING | ----- md_el(:document,[ md_par(["Ciao"]), md_el(:ul,[md_el(:li_span,["Tab * Tab * Tab"],{:want_my_paragraph=>false},[])],{},[]) ],{},[]) *** Output of to_html ***

Ciao

  • Tab * Tab * Tab
*** Output of to_latex *** Ciao \begin{itemize}% \item Tab * Tab * Tab \end{itemize} *** Output of to_md *** Ciao -ab * Tab * Tab *** Output of to_s *** CiaoTab * Tab * Tab *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/red_tests/abbrev.md0000644000175000017500000030461711573154515021541 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** WebKit (Safari 3.1) and the CSS @font-face declaration ====================================================== I'm a big fan of typography in general. If you check out [my homepage](http://elliottcable.name) or my [contact elliottcable](http://elliottcable.name/contact.xhtml) page, and you're using Safari/WebKit or Opera/Kestrel, you'll notice the typefaces (fonts, as colloquialized) are *very* non-standard. (As of this writing, I'm using [Museo][] and [Diavlo][][^jos] heavily on both.) The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We've been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and... dare I invoke ye, thou my terrible overlord? Times New Roman. Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world. All hyperbole aside, I'm extremely happy to see the advent of a standard `@font-face` declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT[^eot] format to appease overly restrictive type foundries' worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it's advocates to the web. This new run at `@font-face` by an established, trusted, and open group (the [W3C][] itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds. Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it's an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the 'new' `@font-face` declaration. No, it's not really 'new', but yes, it feels like it is. To put it simply, and to be very blunt, it's broken. The [CSS spec section][spec] for `@font-face` is very specific - typefaces are to be selected based on a wide array of criteria placed in the `@font-face` declaration block itself. Various textual CSS attributes may be defined within the `@font-face` declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two `@font-face` declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a `font-family:` attribute, it should refer to the basic Diavlo font defined in the first `@font-face`. However, if I were to do the same, but also specify a heavy `font-weight:`, then it should use the heavier version of Diavlo. To place this example in code: @font-face { font-family: 'Diavlo'; src: url(./Diavlo/Diavlo_Book.otf) format("opentype"); } @font-face { font-family: 'Diavlo'; font-weight: 900; src: url(./Diavlo/Diavlo_Black.otf) format("opentype"); } h1, h2, h3, h4, h5, h6 { font-family: 'Diavlo'; font-weight: 900; } div#content { font-family: 'Diavlo'; } As you can see, my headings should use the typeface defined in `Diavlo_Black.otf`, while my body content should use `Diavlo_Book.otf`. However, in WebKit, this doesn't work - it completely ignores any attribute except `font-family:` and `src:` in a `@font-face` declaration! Completely ignores them! Not only that - not *only* that - it disregards all but the last `@font-face` for a given `font-family:` attribute string! The implication here is that, to make `@font-face` work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare *completely imaginary, non-existent type families* to satisfy WebKit alone. Here's the method I have used in the places I current implement `@font-face`: @font-face { font-family: 'Diavlo Book'; src: url(./Diavlo/Diavlo_Book.otf) format("opentype"); } @font-face { font-family: 'Diavlo Black'; src: url(./Diavlo/Diavlo_Black.otf) format("opentype"); } h1, h2, h3, h4, h5, h6 { font-family: 'Diavlo Black'; } div#content { font-family: 'Diavlo Book'; } Isn't it horrible? Seriously, my eyes, they bleed. There's lots of problems with this far beyond the lack of semanticity when it comes to the typeface names... let me see how many ways this breaks the purpose of `@font-face`: - You remove a large element our control over the display of the page. As soon as we begin to use `@font-face` in our page, we can no longer make any use of any other textual control attribute - `font-weight:`, `font-style:`, and `font-variant:` are no longer available to us, because they no longer correctly map to technical typeface variant/features. Also, many default elements are destroyed, unusable, without 'fixing' - for instance, `` would have no effect in a page styled for WebKit as above; We would have to specify something like `b {font-family: 'Diavlo Black';}` - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes? If we want to use Javascript to modify the display of the content, we can't simply adjust the mentioned textual control attributes - we have to know and change the entire `font-family:` array of strings. - You make us very wet. And by wet, I mean 'not DRY'. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typeface's bastardized name. - You remove our user's user choice, and waste bandwidth. Since the names refer to families that don't, in fact, exist, the browser can't override the declaration with a user's installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won't use that - it doesn't know to use 'Diavlo', which the user has installed, because it was told to use 'Diavlo Black', which no user in the entire world has installed on their computer. This whole thing is rather worrying - I've heard Opera has `@font-face` support, though I haven't had time to test this myself, so I don't know if it actually does - or, for that matter, if it does it 'correctly', or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support `@font-face` (Microsoft's unrelated `@font-face` declaration notwithstanding) - I really don't want to see it's early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that. In summary... come on, WebKit team, this isn't like you - you're always the ones with the closest-to-standard implementation, and the cleanest code, and... hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You're pioneering a leap into the future when it comes to the Web - this is as important, or _more_ important, than Mosiac's allowing of images was. To put it succinctly - don't fuck this up, y'all. [Museo]: (Jos Buivenga's Museo free typeface) [Diavlo]: (Jos Buivenga's free Diavlo typeface) [^jos]: These are fonts by [Jos Buivenga][jos], quite the amazing person. His (free) fonts are, uniquely, released for use on the web in `@font-face` declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you're a pioneer, and deserve recognition as such. *[CSS]: Cascading Style Sheets *[.EOT]: Embedded OpenType [^eot]: To give Microsoft a little credit, something I rarely do... Yes, I'm aware Microsoft submitted EOT to the W3C as a proposal - the problem isn't with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? *[W3C]: World Wide Web Consortium [W3C]: (World Wide Web Consortium) [spec]: () *[DRY]: Don't Repeat Yourself [jos]: jos *** Output of inspect *** md_el(:document,[ md_el(:header,["WebKit (Safari 3.1) and the CSS @font-face declaration"],{:level=>1},[]), md_par([ "I", md_entity("rsquo"), "m a big fan of typography in general. If you check out ", md_im_link(["my homepage"], "http://elliottcable.name", nil), " or my ", md_im_link(["contact elliottcable"], "http://elliottcable.name/contact.xhtml", nil), " page, and you", md_entity("rsquo"), "re using Safari/WebKit or Opera/Kestrel, you", md_entity("rsquo"), "ll notice the typefaces (fonts, as colloquialized) are ", md_em(["very"]), " non-standard. (As of this writing, I", md_entity("rsquo"), "m using ", md_link(["Museo"],"museo"), " and ", md_link(["Diavlo"],"diavlo"), md_foot_ref("^jos"), " heavily on both.)" ]), md_par([ "The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We", md_entity("rsquo"), "ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and", md_entity("hellip"), " dare I invoke ye, thou my terrible overlord? Times New Roman." ]), md_par([ "Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world." ]), md_par([ "All hyperbole aside, I", md_entity("rsquo"), "m extremely happy to see the advent of a standard ", md_code("@font-face"), " declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT", md_foot_ref("^eot"), " format to appease overly restrictive type foundries", md_entity("rsquo"), " worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it", md_entity("rsquo"), "s advocates to the web. This new run at ", md_code("@font-face"), " by an established, trusted, and open group (the ", md_link(["W3C"],"w3c"), " itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds." ]), md_par([ "Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it", md_entity("rsquo"), "s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the ", md_entity("lsquo"), "new", md_entity("rsquo"), " ", md_code("@font-face"), " declaration. No, it", md_entity("rsquo"), "s not really ", md_entity("lsquo"), "new", md_entity("rsquo"), ", but yes, it feels like it is." ]), md_par([ "To put it simply, and to be very blunt, it", md_entity("rsquo"), "s broken." ]), md_par([ "The ", md_link(["CSS spec section"],"spec"), " for ", md_code("@font-face"), " is very specific - typefaces are to be selected based on a wide array of criteria placed in the ", md_code("@font-face"), " declaration block itself. Various textual CSS attributes may be defined within the ", md_code("@font-face"), " declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two ", md_code("@font-face"), " declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a ", md_code("font-family:"), " attribute, it should refer to the basic Diavlo font defined in the first ", md_code("@font-face"), ". However, if I were to do the same, but also specify a heavy ", md_code("font-weight:"), ", then it should use the heavier version of Diavlo. To place this example in code:" ]), md_el(:code,[],{:raw_code=>"@font-face {\n font-family: 'Diavlo';\n src: url(./Diavlo/Diavlo_Book.otf) format(\"opentype\");\n}\n\n@font-face {\n font-family: 'Diavlo';\n font-weight: 900;\n src: url(./Diavlo/Diavlo_Black.otf) format(\"opentype\");\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: 'Diavlo';\n font-weight: 900;\n}\n\ndiv#content {\n font-family: 'Diavlo';\n}"},[]), md_par([ "As you can see, my headings should use the typeface defined in ", md_code("Diavlo_Black.otf"), ", while my body content should use ", md_code("Diavlo_Book.otf"), ". However, in WebKit, this doesn", md_entity("rsquo"), "t work - it completely ignores any attribute except ", md_code("font-family:"), " and ", md_code("src:"), " in a ", md_code("@font-face"), " declaration! Completely ignores them! Not only that - not ", md_em(["only"]), " that - it disregards all but the last ", md_code("@font-face"), " for a given ", md_code("font-family:"), " attribute string!" ]), md_par([ "The implication here is that, to make ", md_code("@font-face"), " work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare ", md_em(["completely imaginary, non-existent type families"]), " to satisfy WebKit alone. Here", md_entity("rsquo"), "s the method I have used in the places I current implement ", md_code("@font-face"), ":" ]), md_el(:code,[],{:raw_code=>"@font-face {\n font-family: 'Diavlo Book';\n src: url(./Diavlo/Diavlo_Book.otf) format(\"opentype\");\n}\n\n@font-face {\n font-family: 'Diavlo Black';\n src: url(./Diavlo/Diavlo_Black.otf) format(\"opentype\");\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: 'Diavlo Black';\n}\n\ndiv#content {\n font-family: 'Diavlo Book';\n}"},[]), md_par([ "Isn", md_entity("rsquo"), "t it horrible? Seriously, my eyes, they bleed. There", md_entity("rsquo"), "s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names", md_entity("hellip"), " let me see how many ways this breaks the purpose of ", md_code("@font-face"), ":" ]), md_el(:ul,[ md_el(:li,[ md_par([ "You remove a large element our control over the display of the page." ]), md_par([ "As soon as we begin to use ", md_code("@font-face"), " in our page, we can no longer make any use of any other textual control attribute - ", md_code("font-weight:"), ", ", md_code("font-style:"), ", and ", md_code("font-variant:"), " are no longer available to us, because they no longer correctly map to technical typeface variant/features." ]), md_par([ "Also, many default elements are destroyed, unusable, without ", md_entity("lsquo"), "fixing", md_entity("rsquo"), " - for instance, ", md_code(""), " would have no effect in a page styled for WebKit as above; We would have to specify something like ", md_code("b {font-family: 'Diavlo Black';}"), " - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?" ]), md_par([ "If we want to use Javascript to modify the display of the content, we can", md_entity("rsquo"), "t simply adjust the mentioned textual control attributes - we have to know and change the entire ", md_code("font-family:"), " array of strings." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par(["You make us very wet."]), md_par([ "And by wet, I mean ", md_entity("lsquo"), "not DRY", md_entity("rsquo"), ". What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typeface", md_entity("rsquo"), "s bastardized name." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par([ "You remove our user", md_entity("rsquo"), "s user choice, and waste bandwidth." ]), md_par([ "Since the names refer to families that don", md_entity("rsquo"), "t, in fact, exist, the browser can", md_entity("rsquo"), "t override the declaration with a user", md_entity("rsquo"), "s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won", md_entity("rsquo"), "t use that - it doesn", md_entity("rsquo"), "t know to use ", md_entity("lsquo"), "Diavlo", md_entity("rsquo"), ", which the user has installed, because it was told to use ", md_entity("lsquo"), "Diavlo Black", md_entity("rsquo"), ", which no user in the entire world has installed on their computer." ]) ],{:want_my_paragraph=>true},[]) ],{},[]), md_par([ "This whole thing is rather worrying - I", md_entity("rsquo"), "ve heard Opera has ", md_code("@font-face"), " support, though I haven", md_entity("rsquo"), "t had time to test this myself, so I don", md_entity("rsquo"), "t know if it actually does - or, for that matter, if it does it ", md_entity("lsquo"), "correctly", md_entity("rsquo"), ", or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support ", md_code("@font-face"), " (Microsoft", md_entity("rsquo"), "s unrelated ", md_code("@font-face"), " declaration notwithstanding) - I really don", md_entity("rsquo"), "t want to see it", md_entity("rsquo"), "s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that." ]), md_par([ "In summary", md_entity("hellip"), " come on, WebKit team, this isn", md_entity("rsquo"), "t like you - you", md_entity("rsquo"), "re always the ones with the closest-to-standard implementation, and the cleanest code, and", md_entity("hellip"), " hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You", md_entity("rsquo"), "re pioneering a leap into the future when it comes to the Web - this is as important, or ", md_em(["more"]), " important, than Mosiac", md_entity("rsquo"), "s allowing of images was." ]), md_par([ "To put it succinctly - don", md_entity("rsquo"), "t fuck this up, y", md_entity("rsquo"), "all." ]), md_ref_def("museo", "http://www.josbuivenga.demon.nl/museo.html>", {:title=>"Jos Buivenga"}), md_ref_def("diavlo", "http://www.josbuivenga.demon.nl/diavlo.html>", {:title=>"Jos Buivenga"}), md_par([ md_em([md_link(["CSS"],"css"), ": Cascading Style Sheets"]), md_link([".EOT"],"eot"), ": Embedded OpenType ", md_foot_ref("^eot"), ": To give Microsoft a little credit, something I rarely do", md_entity("hellip"), " Yes, I", md_entity("rsquo"), "m aware Microsoft submitted EOT to the W3C as a proposal - the problem isn", md_entity("rsquo"), "t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? ", md_em([md_link(["W3C"],"w3c"), ": World Wide Web Consortium"]) ]), md_ref_def("w3c", "http://w3c.org>", {:title=>"World Wide Web Consortium"}), md_ref_def("spec", "http://?>", {:title=>") *[DRY]: Don"}) ],{},[]) *** Output of to_html ***

WebKit (Safari 3.1) and the CSS @font-face declaration

I’m a big fan of typography in general. If you check out my homepage or my contact elliottcable page, and you’re using Safari/WebKit or Opera/Kestrel, you’ll notice the typefaces (fonts, as colloquialized) are very non-standard. (As of this writing, I’m using Museo and Diavlo1 heavily on both.)

The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We’ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and… dare I invoke ye, thou my terrible overlord? Times New Roman.

Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world.

All hyperbole aside, I’m extremely happy to see the advent of a standard @font-face declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT2 format to appease overly restrictive type foundries’ worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it’s advocates to the web. This new run at @font-face by an established, trusted, and open group (the W3C itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.

Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it’s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the ‘new’ @font-face declaration. No, it’s not really ‘new’, but yes, it feels like it is.

To put it simply, and to be very blunt, it’s broken.

The CSS spec section for @font-face is very specific - typefaces are to be selected based on a wide array of criteria placed in the @font-face declaration block itself. Various textual CSS attributes may be defined within the @font-face declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two @font-face declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a font-family: attribute, it should refer to the basic Diavlo font defined in the first @font-face. However, if I were to do the same, but also specify a heavy font-weight:, then it should use the heavier version of Diavlo. To place this example in code:

@font-face {
  font-family: 'Diavlo';
  src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
}

@font-face {
  font-family: 'Diavlo';
  font-weight: 900;
  src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Diavlo';
  font-weight: 900;
}

div#content {
  font-family: 'Diavlo';
}

As you can see, my headings should use the typeface defined in Diavlo_Black.otf, while my body content should use Diavlo_Book.otf. However, in WebKit, this doesn’t work - it completely ignores any attribute except font-family: and src: in a @font-face declaration! Completely ignores them! Not only that - not only that - it disregards all but the last @font-face for a given font-family: attribute string!

The implication here is that, to make @font-face work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare completely imaginary, non-existent type families to satisfy WebKit alone. Here’s the method I have used in the places I current implement @font-face:

@font-face {
  font-family: 'Diavlo Book';
  src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
}

@font-face {
  font-family: 'Diavlo Black';
  src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Diavlo Black';
}

div#content {
  font-family: 'Diavlo Book';
}

Isn’t it horrible? Seriously, my eyes, they bleed. There’s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names… let me see how many ways this breaks the purpose of @font-face:

  • You remove a large element our control over the display of the page.

    As soon as we begin to use @font-face in our page, we can no longer make any use of any other textual control attribute - font-weight:, font-style:, and font-variant: are no longer available to us, because they no longer correctly map to technical typeface variant/features.

    Also, many default elements are destroyed, unusable, without ‘fixing’ - for instance, <b> would have no effect in a page styled for WebKit as above; We would have to specify something like b {font-family: 'Diavlo Black';} - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?

    If we want to use Javascript to modify the display of the content, we can’t simply adjust the mentioned textual control attributes - we have to know and change the entire font-family: array of strings.

  • You make us very wet.

    And by wet, I mean ‘not DRY’. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typeface’s bastardized name.

  • You remove our user’s user choice, and waste bandwidth.

    Since the names refer to families that don’t, in fact, exist, the browser can’t override the declaration with a user’s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won’t use that - it doesn’t know to use ‘Diavlo’, which the user has installed, because it was told to use ‘Diavlo Black’, which no user in the entire world has installed on their computer.

This whole thing is rather worrying - I’ve heard Opera has @font-face support, though I haven’t had time to test this myself, so I don’t know if it actually does - or, for that matter, if it does it ‘correctly’, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support @font-face (Microsoft’s unrelated @font-face declaration notwithstanding) - I really don’t want to see it’s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.

In summary… come on, WebKit team, this isn’t like you - you’re always the ones with the closest-to-standard implementation, and the cleanest code, and… hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You’re pioneering a leap into the future when it comes to the Web - this is as important, or more important, than Mosiac’s allowing of images was.

To put it succinctly - don’t fuck this up, y’all.

CSS: Cascading Style Sheets.EOT: Embedded OpenType 3: To give Microsoft a little credit, something I rarely do… Yes, I’m aware Microsoft submitted EOT to the W3C as a proposal - the problem isn’t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? W3C: World Wide Web Consortium


    *** Output of to_latex *** # ./lib/maruku/output/to_latex.rb:466:in `to_latex_footnote_reference' ./lib/maruku/output/to_latex.rb:538:in `send' ./lib/maruku/output/to_latex.rb:538:in `array_to_latex' ./lib/maruku/output/to_latex.rb:529:in `each' ./lib/maruku/output/to_latex.rb:529:in `array_to_latex' ./lib/maruku/output/to_latex.rb:524:in `children_to_latex' ./lib/maruku/output/to_latex.rb:158:in `to_latex_paragraph' ./lib/maruku/output/to_latex.rb:538:in `send' ./lib/maruku/output/to_latex.rb:538:in `array_to_latex' ./lib/maruku/output/to_latex.rb:529:in `each' ./lib/maruku/output/to_latex.rb:529:in `array_to_latex' ./lib/maruku/output/to_latex.rb:524:in `children_to_latex' ./lib/maruku/output/to_latex.rb:42:in `to_latex' bin/marutest:93:in `send' bin/marutest:93:in `run_test' bin/marutest:88:in `each' bin/marutest:88:in `run_test' bin/marutest:262:in `marutest' bin/marutest:259:in `each' bin/marutest:259:in `marutest' bin/marutest:334 *** Output of to_md *** WebKit (Safari 3.1) and the CSS @font-face declarationI m a big fan of typography in general. If you check out my homepageor my contact elliottcablepage, and you re using Safari/WebKit or Opera/Kestrel, you ll notice the typefaces (fonts, as colloquialized) are verynon-standard. (As of this writing, I m using Museoand Diavloheavily on both.) The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and dare I invoke ye, thou my terrible overlord? Times New Roman. Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world. All hyperbole aside, I m extremely happy to see the advent of a standard declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT format to appease overly restrictive type foundries worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it s advocates to the web. This new run at by an established, trusted, and open group (the W3Citself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds. Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the new declaration. No, it s not really new , but yes, it feels like it is. To put it simply, and to be very blunt, it s broken. The CSS spec sectionfor is very specific - typefaces are to be selected based on a wide array of criteria placed in the declaration block itself. Various textual CSS attributes may be defined within the declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a attribute, it should refer to the basic Diavlo font defined in the first . However, if I were to do the same, but also specify a heavy , then it should use the heavier version of Diavlo. To place this example in code: As you can see, my headings should use the typeface defined in , while my body content should use . However, in WebKit, this doesn t work - it completely ignores any attribute except and in a declaration! Completely ignores them! Not only that - not only that - it disregards all but the last for a given attribute string! The implication here is that, to make work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare completely imaginary, non-existent type families to satisfy WebKit alone. Here s the method I have used in the places I current implement : Isn t it horrible? Seriously, my eyes, they bleed. There s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names let me see how many ways this breaks the purpose of : -You remove a large element our control over the display of the page. As soon as we begin to use in our page, we can no longer make any use of any other textual control attribute - , , and are no longer available to us, because they no longer correctly map to technical typeface variant/features. Also, many default elements are destroyed, unusable, without fixing - for instance, would have no effect in a page styled for WebKit as above; We would have to specify something like - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes? If we want to use Javascript to modify the display of the content, we cant simply adjust the mentioned textual control attributes - we have to know and change the entire array of strings. -ou make us very wet. And by wet, I mean not DRY. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typefaces bastardized name. -You remove our users user choice, and waste bandwidth. Since the names refer to families that dont, in fact, exist, the browser cant override the declaration with a users installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser wont use that - it doesnt know to use Diavlo, which the user has installed, because it was told to use Diavlo Black, which no user in the entire world has installed on their computer. This whole thing is rather worrying - I ve heard Opera has support, though I haven t had time to test this myself, so I don t know if it actually does - or, for that matter, if it does it correctly , or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support (Microsoft s unrelated declaration notwithstanding) - I really don t want to see it s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that. In summary come on, WebKit team, this isn t like you - you re always the ones with the closest-to-standard implementation, and the cleanest code, and hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You re pioneering a leap into the future when it comes to the Web - this is as important, or moreimportant, than Mosiac s allowing of images was. To put it succinctly - don t fuck this up, y all. CSS: Cascading Style Sheets.EOT: Embedded OpenType : To give Microsoft a little credit, something I rarely do Yes, I m aware Microsoft submitted EOT to the W3C as a proposal - the problem isn t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? W3C: World Wide Web Consortium *** Output of to_s *** WebKit (Safari 3.1) and the CSS @font-face declarationIm a big fan of typography in general. If you check out my homepage or my contact elliottcable page, and youre using Safari/WebKit or Opera/Kestrel, youll notice the typefaces (fonts, as colloquialized) are very non-standard. (As of this writing, Im using Museo and Diavlo heavily on both.)The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. Weve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and dare I invoke ye, thou my terrible overlord? Times New Roman.Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world.All hyperbole aside, Im extremely happy to see the advent of a standard declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT format to appease overly restrictive type foundries worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and its advocates to the web. This new run at by an established, trusted, and open group (the W3C itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but its an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the new declaration. No, its not really new, but yes, it feels like it is.To put it simply, and to be very blunt, its broken.The CSS spec section for is very specific - typefaces are to be selected based on a wide array of criteria placed in the declaration block itself. Various textual CSS attributes may be defined within the declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a attribute, it should refer to the basic Diavlo font defined in the first . However, if I were to do the same, but also specify a heavy , then it should use the heavier version of Diavlo. To place this example in code:As you can see, my headings should use the typeface defined in , while my body content should use . However, in WebKit, this doesnt work - it completely ignores any attribute except and in a declaration! Completely ignores them! Not only that - not only that - it disregards all but the last for a given attribute string!The implication here is that, to make work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare completely imaginary, non-existent type families to satisfy WebKit alone. Heres the method I have used in the places I current implement :Isnt it horrible? Seriously, my eyes, they bleed. Theres lots of problems with this far beyond the lack of semanticity when it comes to the typeface names let me see how many ways this breaks the purpose of :You remove a large element our control over the display of the page.As soon as we begin to use in our page, we can no longer make any use of any other textual control attribute - , , and are no longer available to us, because they no longer correctly map to technical typeface variant/features.Also, many default elements are destroyed, unusable, without fixing - for instance, would have no effect in a page styled for WebKit as above; We would have to specify something like - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?If we want to use Javascript to modify the display of the content, we cant simply adjust the mentioned textual control attributes - we have to know and change the entire array of strings.You make us very wet.And by wet, I mean not DRY. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typefaces bastardized name.You remove our users user choice, and waste bandwidth.Since the names refer to families that dont, in fact, exist, the browser cant override the declaration with a users installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser wont use that - it doesnt know to use Diavlo, which the user has installed, because it was told to use Diavlo Black, which no user in the entire world has installed on their computer.This whole thing is rather worrying - Ive heard Opera has support, though I havent had time to test this myself, so I dont know if it actually does - or, for that matter, if it does it correctly, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support (Microsofts unrelated declaration notwithstanding) - I really dont want to see its early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.In summary come on, WebKit team, this isnt like you - youre always the ones with the closest-to-standard implementation, and the cleanest code, and hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. Youre pioneering a leap into the future when it comes to the Web - this is as important, or more important, than Mosiacs allowing of images was.To put it succinctly - dont fuck this up, yall.CSS: Cascading Style Sheets.EOT: Embedded OpenType : To give Microsoft a little credit, something I rarely do Yes, Im aware Microsoft submitted EOT to the W3C as a proposal - the problem isnt with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? W3C: World Wide Web Consortium *** EOF *** Failed tests: [:inspect, :to_html, :to_latex, :to_md, :to_s] *** Output of inspect *** -----| WARNING | ----- md_el(:document,[ md_el(:header,[ "WebKit (Safari 3.1) and the ", md_el(:abbr,["CSS"],{:title=>"Cascading Style Sheets"},[]), " @font-face declaration" ],{:level=>1},[]), md_par([ "I", md_entity("rsquo"), "m a big fan of typography in general. If you check out ", md_im_link(["my homepage"], "http://elliottcable.name", nil), " or my ", md_im_link(["contact elliottcable"], "http://elliottcable.name/contact.xhtml", nil), " page, and you", md_entity("rsquo"), "re using Safari/WebKit or Opera/Kestrel, you", md_entity("rsquo"), "ll notice the typefaces (fonts, as colloquialized) are ", md_em(["very"]), " non-standard. (As of this writing, I", md_entity("rsquo"), "m using ", md_link(["Museo"],"museo"), " and ", md_link(["Diavlo"],"diavlo"), md_foot_ref("^jos"), " heavily on both.)" ]), md_par([ "The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We", md_entity("rsquo"), "ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and", md_entity("hellip"), " dare I invoke ye, thou my terrible overlord? Times New Roman." ]), md_par([ "Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world." ]), md_par([ "All hyperbole aside, I", md_entity("rsquo"), "m extremely happy to see the advent of a standard ", md_code("@font-face"), " declaration in ", md_el(:abbr,["CSS"],{:title=>"Cascading Style Sheets"},[]), ". Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary ", md_el(:abbr,[".EOT"],{:title=>"Embedded OpenType"},[]), md_foot_ref("^eot"), " format to appease overly restrictive type foundries", md_entity("rsquo"), " worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it", md_entity("rsquo"), "s advocates to the web. This new run at ", md_code("@font-face"), " by an established, trusted, and open group (the ", md_link([ "", md_el(:abbr,["W3C"],{:title=>"World Wide Web Consortium"},[]), "" ],"w3c"), " itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds." ]), md_par([ "Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it", md_entity("rsquo"), "s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the ", md_entity("lsquo"), "new", md_entity("rsquo"), " ", md_code("@font-face"), " declaration. No, it", md_entity("rsquo"), "s not really ", md_entity("lsquo"), "new", md_entity("rsquo"), ", but yes, it feels like it is." ]), md_par([ "To put it simply, and to be very blunt, it", md_entity("rsquo"), "s broken." ]), md_par([ "The ", md_link([ md_el(:abbr,["CSS"],{:title=>"Cascading Style Sheets"},[]), " spec section" ],"spec"), " for ", md_code("@font-face"), " is very specific - typefaces are to be selected based on a wide array of criteria placed in the ", md_code("@font-face"), " declaration block itself. Various textual ", md_el(:abbr,["CSS"],{:title=>"Cascading Style Sheets"},[]), " attributes may be defined within the ", md_code("@font-face"), " declaration, and then they will be checked when the typeface is referred to later in the ", md_el(:abbr,["CSS"],{:title=>"Cascading Style Sheets"},[]), ". For instance, if I have two ", md_code("@font-face"), " declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a ", md_code("font-family:"), " attribute, it should refer to the basic Diavlo font defined in the first ", md_code("@font-face"), ". However, if I were to do the same, but also specify a heavy ", md_code("font-weight:"), ", then it should use the heavier version of Diavlo. To place this example in code:" ]), md_el(:code,[],{:raw_code=>"@font-face {\n font-family: 'Diavlo';\n src: url(./Diavlo/Diavlo_Book.otf) format(\"opentype\");\n}\n\n@font-face {\n font-family: 'Diavlo';\n font-weight: 900;\n src: url(./Diavlo/Diavlo_Black.otf) format(\"opentype\");\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: 'Diavlo';\n font-weight: 900;\n}\n\ndiv#content {\n font-family: 'Diavlo';\n}"},[]), md_par([ "As you can see, my headings should use the typeface defined in ", md_code("Diavlo_Black.otf"), ", while my body content should use ", md_code("Diavlo_Book.otf"), ". However, in WebKit, this doesn", md_entity("rsquo"), "t work - it completely ignores any attribute except ", md_code("font-family:"), " and ", md_code("src:"), " in a ", md_code("@font-face"), " declaration! Completely ignores them! Not only that - not ", md_em(["only"]), " that - it disregards all but the last ", md_code("@font-face"), " for a given ", md_code("font-family:"), " attribute string!" ]), md_par([ "The implication here is that, to make ", md_code("@font-face"), " work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare ", md_em(["completely imaginary, non-existent type families"]), " to satisfy WebKit alone. Here", md_entity("rsquo"), "s the method I have used in the places I current implement ", md_code("@font-face"), ":" ]), md_el(:code,[],{:raw_code=>"@font-face {\n font-family: 'Diavlo Book';\n src: url(./Diavlo/Diavlo_Book.otf) format(\"opentype\");\n}\n\n@font-face {\n font-family: 'Diavlo Black';\n src: url(./Diavlo/Diavlo_Black.otf) format(\"opentype\");\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: 'Diavlo Black';\n}\n\ndiv#content {\n font-family: 'Diavlo Book';\n}"},[]), md_par([ "Isn", md_entity("rsquo"), "t it horrible? Seriously, my eyes, they bleed. There", md_entity("rsquo"), "s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names", md_entity("hellip"), " let me see how many ways this breaks the purpose of ", md_code("@font-face"), ":" ]), md_el(:ul,[ md_el(:li,[ md_par([ "You remove a large element our control over the display of the page." ]), md_par([ "As soon as we begin to use ", md_code("@font-face"), " in our page, we can no longer make any use of any other textual control attribute - ", md_code("font-weight:"), ", ", md_code("font-style:"), ", and ", md_code("font-variant:"), " are no longer available to us, because they no longer correctly map to technical typeface variant/features." ]), md_par([ "Also, many default elements are destroyed, unusable, without ", md_entity("lsquo"), "fixing", md_entity("rsquo"), " - for instance, ", md_code(""), " would have no effect in a page styled for WebKit as above; We would have to specify something like ", md_code("b {font-family: 'Diavlo Black';}"), " - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?" ]), md_par([ "If we want to use Javascript to modify the display of the content, we can", md_entity("rsquo"), "t simply adjust the mentioned textual control attributes - we have to know and change the entire ", md_code("font-family:"), " array of strings." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par(["You make us very wet."]), md_par([ "And by wet, I mean ", md_entity("lsquo"), "not ", md_el(:abbr,["DRY"],{:title=>"Don't Repeat Yourself"},[]), md_entity("rsquo"), ". What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our ", md_el(:abbr,["CSS"],{:title=>"Cascading Style Sheets"},[]), ", all of our Javascript, and make sure we update every occurrence of the typeface", md_entity("rsquo"), "s bastardized name." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par([ "You remove our user", md_entity("rsquo"), "s user choice, and waste bandwidth." ]), md_par([ "Since the names refer to families that don", md_entity("rsquo"), "t, in fact, exist, the browser can", md_entity("rsquo"), "t override the declaration with a user", md_entity("rsquo"), "s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won", md_entity("rsquo"), "t use that - it doesn", md_entity("rsquo"), "t know to use ", md_entity("lsquo"), "Diavlo", md_entity("rsquo"), ", which the user has installed, because it was told to use ", md_entity("lsquo"), "Diavlo Black", md_entity("rsquo"), ", which no user in the entire world has installed on their computer." ]) ],{:want_my_paragraph=>true},[]) ],{},[]), md_par([ "This whole thing is rather worrying - I", md_entity("rsquo"), "ve heard Opera has ", md_code("@font-face"), " support, though I haven", md_entity("rsquo"), "t had time to test this myself, so I don", md_entity("rsquo"), "t know if it actually does - or, for that matter, if it does it ", md_entity("lsquo"), "correctly", md_entity("rsquo"), ", or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support ", md_code("@font-face"), " (Microsoft", md_entity("rsquo"), "s unrelated ", md_code("@font-face"), " declaration notwithstanding) - I really don", md_entity("rsquo"), "t want to see it", md_entity("rsquo"), "s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that." ]), md_par([ "In summary", md_entity("hellip"), " come on, WebKit team, this isn", md_entity("rsquo"), "t like you - you", md_entity("rsquo"), "re always the ones with the closest-to-standard implementation, and the cleanest code, and", md_entity("hellip"), " hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You", md_entity("rsquo"), "re pioneering a leap into the future when it comes to the Web - this is as important, or ", md_em(["more"]), " important, than Mosiac", md_entity("rsquo"), "s allowing of images was." ]), md_par([ "To put it succinctly - don", md_entity("rsquo"), "t fuck this up, y", md_entity("rsquo"), "all." ]), md_ref_def("museo", "http://www.josbuivenga.demon.nl/museo.html", {:title=>"Jos Buivenga"}), md_ref_def("diavlo", "http://www.josbuivenga.demon.nl/diavlo.html", {:title=>"Jos Buivenga"}), md_el(:footnote,[ md_par([ "These are fonts by ", md_link(["Jos Buivenga"],"jos"), ", quite the amazing person. His (free) fonts are, uniquely, released for use on the web in ", md_code("@font-face"), " declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you", md_entity("rsquo"), "re a pioneer, and deserve recognition as such." ]) ],{:footnote_id=>"^jos"},[]), md_el(:abbr_def,[],{:abbr=>"CSS",:text=>"Cascading Style Sheets"},[]), md_el(:abbr_def,[],{:abbr=>".EOT",:text=>"Embedded OpenType"},[]), md_el(:footnote,[ md_par([ "To give Microsoft a little credit, something I rarely do", md_entity("hellip"), " Yes, I", md_entity("rsquo"), "m aware Microsoft submitted EOT to the ", md_el(:abbr,["W3C"],{:title=>"World Wide Web Consortium"},[]), " as a proposal - the problem isn", md_entity("rsquo"), "t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century?" ]) ],{:footnote_id=>"^eot"},[]), md_el(:abbr_def,[],{:abbr=>"W3C",:text=>"World Wide Web Consortium"},[]), md_ref_def("w3c", "http://w3c.org", {:title=>"World Wide Web Consortium"}), md_ref_def("spec", "http://?", {:title=>nil}), md_el(:abbr_def,[],{:abbr=>"DRY",:text=>"Don't Repeat Yourself"},[]), md_ref_def("jos", "jos", {:title=>nil}) ],{},[]) *** Output of to_html *** -----| WARNING | -----

    WebKit (Safari 3.1) and the CSS @font-face declaration

    I’m a big fan of typography in general. If you check out my homepage or my contact elliottcable page, and you’re using Safari/WebKit or Opera/Kestrel, you’ll notice the typefaces (fonts, as colloquialized) are very non-standard. (As of this writing, I’m using Museo and Diavlo1 heavily on both.)

    The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We’ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and… dare I invoke ye, thou my terrible overlord? Times New Roman.

    Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world.

    All hyperbole aside, I’m extremely happy to see the advent of a standard @font-face declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT2 format to appease overly restrictive type foundries’ worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it’s advocates to the web. This new run at @font-face by an established, trusted, and open group (the W3C itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.

    Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it’s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the ‘new’ @font-face declaration. No, it’s not really ‘new’, but yes, it feels like it is.

    To put it simply, and to be very blunt, it’s broken.

    The CSS spec section for @font-face is very specific - typefaces are to be selected based on a wide array of criteria placed in the @font-face declaration block itself. Various textual CSS attributes may be defined within the @font-face declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two @font-face declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a font-family: attribute, it should refer to the basic Diavlo font defined in the first @font-face. However, if I were to do the same, but also specify a heavy font-weight:, then it should use the heavier version of Diavlo. To place this example in code:

    @font-face {
      font-family: 'Diavlo';
      src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
    }
    
    @font-face {
      font-family: 'Diavlo';
      font-weight: 900;
      src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
    }
    
    h1, h2, h3, h4, h5, h6 {
      font-family: 'Diavlo';
      font-weight: 900;
    }
    
    div#content {
      font-family: 'Diavlo';
    }

    As you can see, my headings should use the typeface defined in Diavlo_Black.otf, while my body content should use Diavlo_Book.otf. However, in WebKit, this doesn’t work - it completely ignores any attribute except font-family: and src: in a @font-face declaration! Completely ignores them! Not only that - not only that - it disregards all but the last @font-face for a given font-family: attribute string!

    The implication here is that, to make @font-face work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare completely imaginary, non-existent type families to satisfy WebKit alone. Here’s the method I have used in the places I current implement @font-face:

    @font-face {
      font-family: 'Diavlo Book';
      src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
    }
    
    @font-face {
      font-family: 'Diavlo Black';
      src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
    }
    
    h1, h2, h3, h4, h5, h6 {
      font-family: 'Diavlo Black';
    }
    
    div#content {
      font-family: 'Diavlo Book';
    }

    Isn’t it horrible? Seriously, my eyes, they bleed. There’s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names… let me see how many ways this breaks the purpose of @font-face:

    • You remove a large element our control over the display of the page.

      As soon as we begin to use @font-face in our page, we can no longer make any use of any other textual control attribute - font-weight:, font-style:, and font-variant: are no longer available to us, because they no longer correctly map to technical typeface variant/features.

      Also, many default elements are destroyed, unusable, without ‘fixing’ - for instance, <b> would have no effect in a page styled for WebKit as above; We would have to specify something like b {font-family: 'Diavlo Black';} - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?

      If we want to use Javascript to modify the display of the content, we can’t simply adjust the mentioned textual control attributes - we have to know and change the entire font-family: array of strings.

    • You make us very wet.

      And by wet, I mean ‘not DRY’. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typeface’s bastardized name.

    • You remove our user’s user choice, and waste bandwidth.

      Since the names refer to families that don’t, in fact, exist, the browser can’t override the declaration with a user’s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won’t use that - it doesn’t know to use ‘Diavlo’, which the user has installed, because it was told to use ‘Diavlo Black’, which no user in the entire world has installed on their computer.

    This whole thing is rather worrying - I’ve heard Opera has @font-face support, though I haven’t had time to test this myself, so I don’t know if it actually does - or, for that matter, if it does it ‘correctly’, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support @font-face (Microsoft’s unrelated @font-face declaration notwithstanding) - I really don’t want to see it’s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.

    In summary… come on, WebKit team, this isn’t like you - you’re always the ones with the closest-to-standard implementation, and the cleanest code, and… hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You’re pioneering a leap into the future when it comes to the Web - this is as important, or more important, than Mosiac’s allowing of images was.

    To put it succinctly - don’t fuck this up, y’all.


    1. These are fonts by Jos Buivenga, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in @font-face declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you’re a pioneer, and deserve recognition as such.

    2. To give Microsoft a little credit, something I rarely do… Yes, I’m aware Microsoft submitted EOT to the W3C as a proposal - the problem isn’t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century?

    *** Output of to_latex *** -----| WARNING | ----- \hypertarget{webkit_safari_31_and_the_css_fontface_declaration}{}\section*{{WebKit (Safari 3.1) and the CSS @font-face declaration}}\label{webkit_safari_31_and_the_css_fontface_declaration} I'{}m a big fan of typography in general. If you check out \href{http://elliottcable.name}{my homepage} or my \href{http://elliottcable.name/contact.xhtml}{contact elliottcable} page, and you'{}re using Safari/WebKit or Opera/Kestrel, you'{}ll notice the typefaces (fonts, as colloquialized) are \emph{very} non-standard. (As of this writing, I'{}m using \href{http://www.josbuivenga.demon.nl/museo.html}{Museo} and \href{http://www.josbuivenga.demon.nl/diavlo.html}{Diavlo}\footnote{These are fonts by \href{jos}{Jos Buivenga}, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you'{}re a pioneer, and deserve recognition as such.} heavily on both.) The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We'{}ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and\ldots{} dare I invoke ye, thou my terrible overlord? Times New Roman. Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world. All hyperbole aside, I'{}m extremely happy to see the advent of a standard {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT\footnote{To give Microsoft a little credit, something I rarely do\ldots{} Yes, I'{}m aware Microsoft submitted EOT to the W3C as a proposal - the problem isn'{}t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century?} format to appease overly restrictive type foundries'{} worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it'{}s advocates to the web. This new run at {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} by an established, trusted, and open group (the \href{http://w3c.org}{W3C} itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds. Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it'{}s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the `{}new'{} {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration. No, it'{}s not really `{}new'{}, but yes, it feels like it is. To put it simply, and to be very blunt, it'{}s broken. The \href{http://?}{CSS spec section} for {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} is very specific - typefaces are to be selected based on a wide array of criteria placed in the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration block itself. Various textual CSS attributes may be defined within the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} attribute, it should refer to the basic Diavlo font defined in the first {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}}. However, if I were to do the same, but also specify a heavy {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45weight\char58}}, then it should use the heavier version of Diavlo. To place this example in code: \begin{verbatim}@font-face { font-family: 'Diavlo'; src: url(./Diavlo/Diavlo_Book.otf) format("opentype"); } @font-face { font-family: 'Diavlo'; font-weight: 900; src: url(./Diavlo/Diavlo_Black.otf) format("opentype"); } h1, h2, h3, h4, h5, h6 { font-family: 'Diavlo'; font-weight: 900; } div#content { font-family: 'Diavlo'; }\end{verbatim} As you can see, my headings should use the typeface defined in {\colorbox[rgb]{1.00,0.93,1.00}{\tt Diavlo\char95Black\char46otf}}, while my body content should use {\colorbox[rgb]{1.00,0.93,1.00}{\tt Diavlo\char95Book\char46otf}}. However, in WebKit, this doesn'{}t work - it completely ignores any attribute except {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} and {\colorbox[rgb]{1.00,0.93,1.00}{\tt src\char58}} in a {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration! Completely ignores them! Not only that - not \emph{only} that - it disregards all but the last {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} for a given {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} attribute string! The implication here is that, to make {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare \emph{completely imaginary, non-existent type families} to satisfy WebKit alone. Here'{}s the method I have used in the places I current implement {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}}: \begin{verbatim}@font-face { font-family: 'Diavlo Book'; src: url(./Diavlo/Diavlo_Book.otf) format("opentype"); } @font-face { font-family: 'Diavlo Black'; src: url(./Diavlo/Diavlo_Black.otf) format("opentype"); } h1, h2, h3, h4, h5, h6 { font-family: 'Diavlo Black'; } div#content { font-family: 'Diavlo Book'; }\end{verbatim} Isn'{}t it horrible? Seriously, my eyes, they bleed. There'{}s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names\ldots{} let me see how many ways this breaks the purpose of {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}}: \begin{itemize}% \item You remove a large element our control over the display of the page. As soon as we begin to use {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} in our page, we can no longer make any use of any other textual control attribute - {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45weight\char58}}, {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45style\char58}}, and {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45variant\char58}} are no longer available to us, because they no longer correctly map to technical typeface variant/features. Also, many default elements are destroyed, unusable, without `{}fixing'{} - for instance, {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char60b\char62}} would have no effect in a page styled for WebKit as above; We would have to specify something like {\colorbox[rgb]{1.00,0.93,1.00}{\tt b~\char123font\char45family\char58~\char39Diavlo~Black\char39\char59\char125}} - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes? If we want to use Javascript to modify the display of the content, we can'{}t simply adjust the mentioned textual control attributes - we have to know and change the entire {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} array of strings. \item You make us very wet. And by wet, I mean `{}not DRY'{}. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typeface'{}s bastardized name. \item You remove our user'{}s user choice, and waste bandwidth. Since the names refer to families that don'{}t, in fact, exist, the browser can'{}t override the declaration with a user'{}s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won'{}t use that - it doesn'{}t know to use `{}Diavlo'{}, which the user has installed, because it was told to use `{}Diavlo Black'{}, which no user in the entire world has installed on their computer. \end{itemize} This whole thing is rather worrying - I'{}ve heard Opera has {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} support, though I haven'{}t had time to test this myself, so I don'{}t know if it actually does - or, for that matter, if it does it `{}correctly'{}, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} (Microsoft'{}s unrelated {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration notwithstanding) - I really don'{}t want to see it'{}s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that. In summary\ldots{} come on, WebKit team, this isn'{}t like you - you'{}re always the ones with the closest-to-standard implementation, and the cleanest code, and\ldots{} hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You'{}re pioneering a leap into the future when it comes to the Web - this is as important, or \emph{more} important, than Mosiac'{}s allowing of images was. To put it succinctly - don'{}t fuck this up, y'{}all. *** Output of to_md *** -----| WARNING | ----- WebKit (Safari 3.1) and the CSS @font-face declarationI m a big fan of typography in general. If you check out my homepageor my contact elliottcablepage, and you re using Safari/WebKit or Opera/Kestrel, you ll notice the typefaces (fonts, as colloquialized) are verynon-standard. (As of this writing, I m using Museoand Diavloheavily on both.) The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and dare I invoke ye, thou my terrible overlord? Times New Roman. Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world. All hyperbole aside, I m extremely happy to see the advent of a standard declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOTformat to appease overly restrictive type foundries worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it s advocates to the web. This new run at by an established, trusted, and open group (the W3Citself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds. Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the new declaration. No, it s not really new , but yes, it feels like it is. To put it simply, and to be very blunt, it s broken. The CSS spec sectionfor is very specific - typefaces are to be selected based on a wide array of criteria placed in the declaration block itself. Various textual CSSattributes may be defined within the declaration, and then they will be checked when the typeface is referred to later in the CSS . For instance, if I have two declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a attribute, it should refer to the basic Diavlo font defined in the first . However, if I were to do the same, but also specify a heavy , then it should use the heavier version of Diavlo. To place this example in code: As you can see, my headings should use the typeface defined in , while my body content should use . However, in WebKit, this doesn t work - it completely ignores any attribute except and in a declaration! Completely ignores them! Not only that - not only that - it disregards all but the last for a given attribute string! The implication here is that, to make work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare completely imaginary, non-existent type families to satisfy WebKit alone. Here s the method I have used in the places I current implement : Isn t it horrible? Seriously, my eyes, they bleed. There s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names let me see how many ways this breaks the purpose of : -You remove a large element our control over the display of the page. As soon as we begin to use in our page, we can no longer make any use of any other textual control attribute - , , and are no longer available to us, because they no longer correctly map to technical typeface variant/features. Also, many default elements are destroyed, unusable, without fixing - for instance, would have no effect in a page styled for WebKit as above; We would have to specify something like - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes? If we want to use Javascript to modify the display of the content, we cant simply adjust the mentioned textual control attributes - we have to know and change the entire array of strings. -ou make us very wet. And by wet, I mean not DRY. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typefaces bastardized name. -You remove our users user choice, and waste bandwidth. Since the names refer to families that dont, in fact, exist, the browser cant override the declaration with a users installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser wont use that - it doesnt know to use Diavlo, which the user has installed, because it was told to use Diavlo Black, which no user in the entire world has installed on their computer. This whole thing is rather worrying - I ve heard Opera has support, though I haven t had time to test this myself, so I don t know if it actually does - or, for that matter, if it does it correctly , or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support (Microsoft s unrelated declaration notwithstanding) - I really don t want to see it s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that. In summary come on, WebKit team, this isn t like you - you re always the ones with the closest-to-standard implementation, and the cleanest code, and hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You re pioneering a leap into the future when it comes to the Web - this is as important, or moreimportant, than Mosiac s allowing of images was. To put it succinctly - don t fuck this up, y all. These are fonts by Jos Buivenga, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you re a pioneer, and deserve recognition as such. *[CSS]: Cascading Style Sheets *[.EOT]: Embedded OpenType To give Microsoft a little credit, something I rarely do Yes, I m aware Microsoft submitted EOT to the W3Cas a proposal - the problem isn t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? *[W3C]: World Wide Web Consortium *[DRY]: Don't Repeat Yourself *** Output of to_s *** -----| WARNING | ----- WebKit (Safari 3.1) and the CSS @font-face declarationIm a big fan of typography in general. If you check out my homepage or my contact elliottcable page, and youre using Safari/WebKit or Opera/Kestrel, youll notice the typefaces (fonts, as colloquialized) are very non-standard. (As of this writing, Im using Museo and Diavlo heavily on both.)The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. Weve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and dare I invoke ye, thou my terrible overlord? Times New Roman.Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world.All hyperbole aside, Im extremely happy to see the advent of a standard declaration in CSS. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary .EOT format to appease overly restrictive type foundries worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and its advocates to the web. This new run at by an established, trusted, and open group (the W3C itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but its an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the new declaration. No, its not really new, but yes, it feels like it is.To put it simply, and to be very blunt, its broken.The CSS spec section for is very specific - typefaces are to be selected based on a wide array of criteria placed in the declaration block itself. Various textual CSS attributes may be defined within the declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a attribute, it should refer to the basic Diavlo font defined in the first . However, if I were to do the same, but also specify a heavy , then it should use the heavier version of Diavlo. To place this example in code:As you can see, my headings should use the typeface defined in , while my body content should use . However, in WebKit, this doesnt work - it completely ignores any attribute except and in a declaration! Completely ignores them! Not only that - not only that - it disregards all but the last for a given attribute string!The implication here is that, to make work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare completely imaginary, non-existent type families to satisfy WebKit alone. Heres the method I have used in the places I current implement :Isnt it horrible? Seriously, my eyes, they bleed. Theres lots of problems with this far beyond the lack of semanticity when it comes to the typeface names let me see how many ways this breaks the purpose of :You remove a large element our control over the display of the page.As soon as we begin to use in our page, we can no longer make any use of any other textual control attribute - , , and are no longer available to us, because they no longer correctly map to technical typeface variant/features.Also, many default elements are destroyed, unusable, without fixing - for instance, would have no effect in a page styled for WebKit as above; We would have to specify something like - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?If we want to use Javascript to modify the display of the content, we cant simply adjust the mentioned textual control attributes - we have to know and change the entire array of strings.You make us very wet.And by wet, I mean not DRY. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our CSS, all of our Javascript, and make sure we update every occurrence of the typefaces bastardized name.You remove our users user choice, and waste bandwidth.Since the names refer to families that dont, in fact, exist, the browser cant override the declaration with a users installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser wont use that - it doesnt know to use Diavlo, which the user has installed, because it was told to use Diavlo Black, which no user in the entire world has installed on their computer.This whole thing is rather worrying - Ive heard Opera has support, though I havent had time to test this myself, so I dont know if it actually does - or, for that matter, if it does it correctly, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support (Microsofts unrelated declaration notwithstanding) - I really dont want to see its early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.In summary come on, WebKit team, this isnt like you - youre always the ones with the closest-to-standard implementation, and the cleanest code, and hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. Youre pioneering a leap into the future when it comes to the Web - this is as important, or more important, than Mosiacs allowing of images was.To put it succinctly - dont fuck this up, yall.These are fonts by Jos Buivenga, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - youre a pioneer, and deserve recognition as such.To give Microsoft a little credit, something I rarely do Yes, Im aware Microsoft submitted EOT to the W3C as a proposal - the problem isnt with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/red_tests/lists8.md0000644000175000017500000000266011573154515021517 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** Here is a paragraph. * Item 1 * Item 2 * Item 3 *** Output of inspect *** md_el(:document,[ md_par(["Here is a paragraph."]), md_el(:ul,[ md_el(:li_span,["Item 1"],{:want_my_paragraph=>false},[]), md_el(:li_span,["Item 2"],{:want_my_paragraph=>false},[]), md_el(:li_span,["Item 3"],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***

    Here is a paragraph.

    • Item 1
    • Item 2
    • Item 3
    *** Output of to_latex *** Here is a paragraph. * Item 1 * Item 2 * Item 3 *** Output of to_md *** Here is a paragraph. -tem 1 -tem 2 -tem 3 *** Output of to_s *** Here is a paragraph.Item 1Item 2Item 3 *** EOF *** Failed tests: [:inspect, :to_html, :to_md, :to_s] *** Output of inspect *** -----| WARNING | ----- md_el(:document,[ md_par(["Here is a paragraph."]), md_par(["* Item 1 * Item 2 * Item 3"]) ],{},[]) *** Output of to_html *** -----| WARNING | -----

    Here is a paragraph.

    * Item 1 * Item 2 * Item 3

    *** Output of to_latex *** Here is a paragraph. * Item 1 * Item 2 * Item 3 *** Output of to_md *** -----| WARNING | ----- Here is a paragraph. * Item 1 * Item 2 * Item 3 *** Output of to_s *** -----| WARNING | ----- Here is a paragraph.* Item 1 * Item 2 * Item 3 *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/red_tests/lists7b.md0000644000175000017500000000330111573154515021651 0ustar vincentvincentTest case given by Scott. http://rubyforge.org/tracker/index.php?func=detail&aid=8862&group_id=2795&atid=10735 a should not be indented. *** Parameters: *** {} # params *** Markdown input: *** * a * a1 * a2 * b *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li,[ "a", md_el(:ul,[ md_el(:li_span,["a1"],{:want_my_paragraph=>false},[]), md_el(:li_span,["a2"],{:want_my_paragraph=>false},[]) ],{},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["b"])],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    • a
      • a1
      • a2
    • b

    *** Output of to_latex *** \begin{itemize}% \item a \begin{itemize}% \item a1 \item a2 \end{itemize} \item b \end{itemize} *** Output of to_md *** -* a1 * a2 - *** Output of to_s *** aa1a2b *** EOF *** Failed tests: [:inspect, :to_html] *** Output of inspect *** -----| WARNING | ----- md_el(:document,[ md_el(:ul,[ md_el(:li,[ md_par(["a"]), md_el(:ul,[ md_el(:li_span,["a1"],{:want_my_paragraph=>false},[]), md_el(:li_span,["a2"],{:want_my_paragraph=>false},[]) ],{},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["b"])],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html *** -----| WARNING | -----
    • a

      • a1
      • a2
    • b

    *** Output of to_latex *** \begin{itemize}% \item a \begin{itemize}% \item a1 \item a2 \end{itemize} \item b \end{itemize} *** Output of to_md *** -* a1 * a2 - *** Output of to_s *** aa1a2b *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/red_tests/xml.md0000644000175000017500000000456711573154515021101 0ustar vincentvincentWrite a comment here *** Parameters: *** {:on_error=>:raise} *** Markdown input: *** *** Output of inspect *** md_el(:document,[ md_html(""), md_html("\n \n\t\n\t\n \n") ],{},[]) *** Output of to_html *** *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** Failed tests: [:inspect, :to_html] *** Output of inspect *** -----| WARNING | ----- md_el(:document,[ md_html(""), md_html(""), md_html("\n \n\t\n\t\n \n") ],{},[]) *** Output of to_html *** -----| WARNING | -----
    REXML could not parse this XML/HTML: 
    <svg:svg/>
    REXML could not parse this XML/HTML: 
    <svg:svg 
    width="600px" height="400px">
      <svg:g id="group">
    	<svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle>
    	<svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" />
      </svg:g>
    </svg:svg>
    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/attributes/0000755000175000017500000000000011573154515020135 5ustar vincentvincentmaruku-0.6.0/tests/unittest/attributes/att3.md0000644000175000017500000000115411573154515021333 0ustar vincentvincentIALs can refer to element before or after. *** Parameters: *** {} *** Markdown input: *** Paragraph1 {:#par1} {:#par2} Paragraph2 *** Output of inspect *** md_el(:document,[ md_par(["Paragraph1"], [[:id, "par1"]]), md_par(["Paragraph2"], [[:id, "par2"]]) ],{},[]) *** Output of to_html ***

    Paragraph1

    Paragraph2

    *** Output of to_latex *** Paragraph1 Paragraph2 *** Output of to_md *** Paragraph1 Paragraph2 *** Output of to_s *** Paragraph1Paragraph2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/attributes/default.md0000644000175000017500000000114111573154515022100 0ustar vincentvincentThis shows the use of default attributes list. *** Parameters: *** {} *** Markdown input: *** Paragraph2 {#2} {paragraph}: .maruku-par *** Output of inspect *** md_el(:document,[ md_par(["Paragraph2"], [[:id, "2"]]), md_el(:ald,[],{:ald=>[[:class, "maruku-par"]],:ald_id=>"paragraph"},[]) ],{},[]) *** Output of to_html ***

    Paragraph2

    *** Output of to_latex *** Paragraph2 *** Output of to_md *** Paragraph2 *** Output of to_s *** Paragraph2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/attributes/attributes.md0000644000175000017500000000343311573154515022650 0ustar vincentvincentThis is a simple test for attributes *** Parameters: *** {} *** Markdown input: *** Header with attributes {#header1} ---------------------- ### Header with attributes ### {#header2} ### Header no attributes ### {:warn2}Paragraph with a. {#par1} Paragraph with *emphasis*{:hello notfound} {#par2} {:hello: .chello} *** Output of inspect *** md_el(:document,[ md_el(:header,["Header with attributes"],{:level=>2},[[:id, "header1"]]), md_el(:header,["Header with attributes"],{:level=>3},[[:id, "header2"]]), md_el(:header,["Header no attributes"],{:level=>3},[]), md_par(["Paragraph with a."], [[:id, "par1"]]), md_par([ "Paragraph with ", md_em(["emphasis"], [[:ref, "hello"], [:ref, "notfound"]]) ], [[:id, "par2"]]), md_el(:ald,[],{:ald=>[[:class, "chello"]],:ald_id=>"hello"},[]) ],{},[]) *** Output of to_html ***

    Header with attributes

    Header with attributes

    Header no attributes

    Paragraph with a.

    Paragraph with emphasis

    *** Output of to_latex *** \hypertarget{header1}{}\subsection*{{Header with attributes}}\label{header1} \hypertarget{header2}{}\subsubsection*{{Header with attributes}}\label{header2} \hypertarget{header_no_attributes}{}\subsubsection*{{Header no attributes}}\label{header_no_attributes} Paragraph with a. Paragraph with \emph{emphasis} *** Output of to_md *** Header with attributesHeader with attributesHeader no attributesParagraph with a. Paragraph with emphasis *** Output of to_s *** Header with attributesHeader with attributesHeader no attributesParagraph with a.Paragraph with emphasis *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/attributes/att2.md0000644000175000017500000000071311573154515021332 0ustar vincentvincent *** Parameters: *** {} *** Markdown input: *** {a}: a {:b: a} *** Output of inspect *** md_el(:document,[ md_el(:ald,[],{:ald=>[[:ref, "a"]],:ald_id=>"a"},[]), md_el(:ald,[],{:ald=>[[:ref, "a"]],:ald_id=>"b"},[]) ],{},[]) *** Output of to_html *** *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/attributes/circular.md0000644000175000017500000000106011573154515022260 0ustar vincentvincent *** Parameters: *** {} *** Markdown input: *** Paragraph {:a} {:a: b} {:b: a} *** Output of inspect *** md_el(:document,[ md_par(["Paragraph"], [[:ref, "a"]]), md_el(:ald,[],{:ald=>[[:ref, "b"]],:ald_id=>"a"},[]), md_el(:ald,[],{:ald=>[[:ref, "a"]],:ald_id=>"b"},[]) ],{},[]) *** Output of to_html ***

    Paragraph

    *** Output of to_latex *** Paragraph *** Output of to_md *** Paragraph *** Output of to_s *** Paragraph *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/code3.md0000644000175000017500000000260211573154515017266 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** This is code (4 spaces): Code This is not code Code This is code (1 tab): Code This is not code Code *** Output of inspect *** md_el(:document,[ md_par(["This is code (4 spaces):"]), md_el(:code,[],{:raw_code=>"Code"},[]), md_par(["This is not code"]), md_el(:code,[],{:raw_code=>"Code"},[]), md_par(["This is code (1 tab):"]), md_el(:code,[],{:raw_code=>"Code"},[]), md_par(["This is not code"]), md_el(:code,[],{:raw_code=>"Code"},[]) ],{},[]) *** Output of to_html ***

    This is code (4 spaces):

    Code

    This is not code

    Code

    This is code (1 tab):

    Code

    This is not code

    Code
    *** Output of to_latex *** This is code (4 spaces): \begin{verbatim}Code\end{verbatim} This is not code \begin{verbatim}Code\end{verbatim} This is code (1 tab): \begin{verbatim}Code\end{verbatim} This is not code \begin{verbatim}Code\end{verbatim} *** Output of to_md *** This is code (4 spaces): This is not code This is code (1 tab): This is not code *** Output of to_s *** This is code (4 spaces):This is not codeThis is code (1 tab):This is not code *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/blank.md0000644000175000017500000000076711573154515017372 0ustar vincentvincentWrite a comment about the test here. *** Parameters: *** {} *** Markdown input: *** Linea 1 Linea 2 *** Output of inspect *** md_el(:document,[md_par(["Linea 1"]), md_par(["Linea 2"])],{},[]) *** Output of to_html ***

    Linea 1

    Linea 2

    *** Output of to_latex *** Linea 1 Linea 2 *** Output of to_md *** Linea 1 Linea 2 *** Output of to_s *** Linea 1Linea 2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/divs/0000755000175000017500000000000011573154515016714 5ustar vincentvincentmaruku-0.6.0/tests/unittest/divs/div2.md0000644000175000017500000000077511573154515020113 0ustar vincentvincentWrite a comment here *** Parameters: *** require 'maruku/ext/div'; {} # params *** Markdown input: *** +-- ciao =-- *** Output of inspect *** md_el(:document,[ md_el(:div,[md_par(["ciao"])],{:label=>nil,:num=>nil,:type=>nil},[]) ],{},[]) *** Output of to_html ***

    ciao

    *** Output of to_latex *** ciao *** Output of to_md *** ciao *** Output of to_s *** ciao *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/divs/div1.md0000644000175000017500000000377711573154515020117 0ustar vincentvincentWrite a comment here *** Parameters: *** require 'maruku/ext/div'; {} # params *** Markdown input: *** +--------- | text +---------- +--------- |text +-- text =-- +--------- | text +---------- +--------- |text +-- text =-- +--------- | text +---------- +--------- |text +-- text =-- +--------- | text +---------- +--------- |text +-- text =-- *** Output of inspect *** md_el(:document,[ md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]), md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]) ],{},[]) *** Output of to_html ***

    text

    text

    text

    text

    text

    text

    text

    text

    text

    text

    text

    text

    *** Output of to_latex *** text text text text text text text text text text text text *** Output of to_md *** text text text text text text text text text text text text *** Output of to_s *** texttexttexttexttexttexttexttexttexttexttexttext *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/divs/div3_nest.md0000644000175000017500000000251511573154515021137 0ustar vincentvincentWrite a comment here *** Parameters: *** require 'maruku/ext/div'; {} # params *** Markdown input: *** +-----------------------------------{.warning}------ | this is the last warning! | | please, go away! | | +------------------------------------- {.menace} -- | | or else terrible things will happen | +-------------------------------------------------- +--------------------------------------------------- *** Output of inspect *** md_el(:document,[ md_el(:div,[ md_par(["this is the last warning!"]), md_par(["please, go away!"]), md_el(:div,[md_par(["or else terrible things will happen"])],{:label=>nil,:num=>nil,:type=>nil},[[:class, "menace"]]) ],{:label=>nil,:num=>nil,:type=>nil},[[:class, "warning"]]) ],{},[]) *** Output of to_html ***

    this is the last warning!

    please, go away!

    or else terrible things will happen

    *** Output of to_latex *** this is the last warning! please, go away! or else terrible things will happen *** Output of to_md *** this is the last warning! please, go away! or else terrible things will happen *** Output of to_s *** this is the last warning!please, go away!or else terrible things will happen *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/code.md0000644000175000017500000000155511573154515017211 0ustar vincentvincentComment *** Parameters: *** {} *** Markdown input: *** Here is an example of AppleScript: tell application "Foo" beep end tell tab *** Output of inspect *** md_el(:document,[ md_par(["Here is an example of AppleScript:"]), md_el(:code,[],{:raw_code=>"tell application \"Foo\"\n beep\nend tell\n\ttab"},[]) ],{},[]) *** Output of to_html ***

    Here is an example of AppleScript:

    tell application "Foo"
        beep
    end tell
    	tab
    *** Output of to_latex *** Here is an example of AppleScript: \begin{verbatim}tell application "Foo" beep end tell tab\end{verbatim} *** Output of to_md *** Here is an example of AppleScript: *** Output of to_s *** Here is an example of AppleScript: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists9.md0000644000175000017500000000201011573154515017511 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** - Due 1. tre 1. tre 1. tre - Due *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li,[ md_par(["Due"]), md_el(:ol,[ md_el(:li_span,["tre"],{:want_my_paragraph=>false},[]), md_el(:li_span,["tre"],{:want_my_paragraph=>false},[]), md_el(:li_span,["tre"],{:want_my_paragraph=>false},[]) ],{},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["Due"])],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    • Due

      1. tre
      2. tre
      3. tre
    • Due

    *** Output of to_latex *** \begin{itemize}% \item Due \begin{enumerate}% \item tre \item tre \item tre \end{enumerate} \item Due \end{itemize} *** Output of to_md *** -ue* tre * tre * tre -ue *** Output of to_s *** DuetretretreDue *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists10.md0000644000175000017500000000122311573154515017566 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** List: - è`gcc` *** Output of inspect *** md_el(:document,[ md_par(["List:"]), md_el(:ul,[ md_el(:li_span,["\303\250", md_code("gcc")],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***

    List:

    • ègcc
    *** Output of to_latex *** List: \begin{itemize}% \item è{\colorbox[rgb]{1.00,0.93,1.00}{\tt gcc}} \end{itemize} *** Output of to_md *** List: - *** Output of to_s *** List:è *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/links2.md0000644000175000017500000000122511573154515017473 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** See [foo' bar] [foo' bar]: http://agorf.gr/ *** Output of inspect *** md_el(:document,[ md_par(["See ", md_link(["foo", md_entity("rsquo"), " bar"],"foo_bar")]), md_ref_def("foo_bar", "http://agorf.gr/", {:title=>nil}) ],{},[]) *** Output of to_html ***

    See foo’ bar

    *** Output of to_latex *** See \href{http://agorf.gr/}{foo'{} bar} *** Output of to_md *** See foo bar *** Output of to_s *** See foo bar *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/escaping.md0000644000175000017500000000416711573154515020072 0ustar vincentvincentThis should threat the last as a literal asterisk. *** Parameters: *** {:on_error=>:warning} *** Markdown input: *** Hello: ! \! \` \{ \} \[ \] \( \) \# \. \! * \* * Ora, *emphasis*, **bold**, * <- due asterischi-> * , un underscore-> _ , _emphasis_, incre*dible*e! This is ``Code with a special: -> ` <- ``(after) `Start ` of paragraph End of `paragraph ` *** Output of inspect *** md_el(:document,[ md_par(["Hello: ! ! ` { } [ ] ( ) # . ! * * *"]), md_par([ "Ora, ", md_em(["emphasis"]), ", ", md_strong(["bold"]), ", * <- due asterischi-> * , un underscore-> _ , ", md_em(["emphasis"]), ", incre", md_em(["dible"]), "e!" ]), md_par(["This is ", md_code("Code with a special: -> ` <-"), "(after)"]), md_par([md_code("Start "), " of paragraph"]), md_par(["End of ", md_code("paragraph ")]) ],{},[]) *** Output of to_html ***

    Hello: ! ! ` { } [ ] ( ) # . ! * * *

    Ora, emphasis, bold, * <- due asterischi-> * , un underscore-> _ , emphasis, incrediblee!

    This is Code with a special: -> ` <-(after)

    Start of paragraph

    End of paragraph

    *** Output of to_latex *** Hello: ! ! ` \{ \} [ ] ( ) \# . ! * * * Ora, \emph{emphasis}, \textbf{bold}, * {\tt \char60}- due asterischi-{\tt \char62} * , un underscore-{\tt \char62} \_ , \emph{emphasis}, incre\emph{dible}e! This is {\colorbox[rgb]{1.00,0.93,1.00}{\tt Code~with~a~special\char58~\char45\char62~\char96~\char60\char45}}(after) {\colorbox[rgb]{1.00,0.93,1.00}{\tt Start~}} of paragraph End of {\colorbox[rgb]{1.00,0.93,1.00}{\tt paragraph~}} *** Output of to_md *** Hello: ! ! ` { } [ ] ( ) # . ! * * * Ora, emphasis, bold, * <- due asterischi-> * , un underscore-> _ , emphasis, incre diblee! This is (after) of paragraph End of *** Output of to_s *** Hello: ! ! ` { } [ ] ( ) # . ! * * *Ora, emphasis, bold, * <- due asterischi-> * , un underscore-> _ , emphasis, incrediblee!This is (after) of paragraphEnd of *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/html5.md0000644000175000017500000000211211573154515017316 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: ***
    Aperitif
    *** Output of inspect *** md_el(:document,[ md_html("
    \n \"Aperitif\"\n
    ") ],{},[]) *** Output of to_html ***
    Aperitif
    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/images.md0000644000175000017500000000651511573154515017545 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** This page does not uilizes ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss) Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss 'Title ok!') I'll say it one more time: this page does not use ![Cascading Style Sheets] [css] This is double size: ![Cascading Style Sheets] [css2] [css]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" [css2]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" class=external style="border:0;width:188px;height:131px" *** Output of inspect *** md_el(:document,[ md_par([ "This page does not uilizes ", md_im_image(["Cascading Style Sheets"], "http://jigsaw.w3.org/css-validator/images/vcss", nil) ]), md_par([ "Please mouseover to see the title: ", md_im_image(["Cascading Style Sheets"], "http://jigsaw.w3.org/css-validator/images/vcss", "Title ok!") ]), md_par([ "Please mouseover to see the title: ", md_im_image(["Cascading Style Sheets"], "http://jigsaw.w3.org/css-validator/images/vcss", "Title ok!") ]), md_par([ "I", md_entity("rsquo"), "ll say it one more time: this page does not use ", md_image(["Cascading Style Sheets"], "css") ]), md_par([ "This is double size: ", md_image(["Cascading Style Sheets"], "css2") ]), md_ref_def("css", "http://jigsaw.w3.org/css-validator/images/vcss", {:title=>"Optional title attribute"}), md_ref_def("css2", "http://jigsaw.w3.org/css-validator/images/vcss", {:title=>"Optional title attribute"}) ],{},[]) *** Output of to_html ***

    This page does not uilizes Cascading Style Sheets

    Please mouseover to see the title: Cascading Style Sheets

    Please mouseover to see the title: Cascading Style Sheets

    I’ll say it one more time: this page does not use Cascading Style Sheets

    This is double size: Cascading Style Sheets

    *** Output of to_latex *** This page does not uilizes Please mouseover to see the title: Please mouseover to see the title: I'{}ll say it one more time: this page does not use This is double size: *** Output of to_md *** This page does not uilizes Cascading Style Sheets Please mouseover to see the title: Cascading Style Sheets Please mouseover to see the title: Cascading Style Sheets I ll say it one more time: this page does not use Cascading Style Sheets This is double size: Cascading Style Sheets *** Output of to_s *** This page does not uilizes Cascading Style SheetsPlease mouseover to see the title: Cascading Style SheetsPlease mouseover to see the title: Cascading Style SheetsIll say it one more time: this page does not use Cascading Style SheetsThis is double size: Cascading Style Sheets *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/ie.md0000644000175000017500000000437611573154515016700 0ustar vincentvincentWe must make sure that `'` is always written as `'`. *** Parameters: *** {} # params *** Markdown input: *** `

    here's an apostrophe & a quote "

    `

    here's an apostrophe & a quote "

    {:}

    here's an apostrophe & a quote "

    {:lang=xml}

    here's an apostrophe & a quote "

    {:html_use_syntax=true lang=not_supported}

    here's an apostrophe & a quote "

    {:html_use_syntax=true lang=xml} *** Output of inspect *** md_el(:document,[ md_par([md_code("

    here's an apostrophe & a quote \"

    ")]), md_el(:code,[],{:raw_code=>"

    here's an apostrophe & a quote \"

    "},[]), md_el(:code,[],{:raw_code=>"

    here's an apostrophe & a quote \"

    "},[["lang", "xml"]]), md_el(:code,[],{:raw_code=>"

    here's an apostrophe & a quote \"

    "},[["html_use_syntax", "true"], ["lang", "not_supported"]]), md_el(:code,[],{:raw_code=>"

    here's an apostrophe & a quote \"

    "},[["html_use_syntax", "true"], ["lang", "xml"]]) ],{},[]) *** Output of to_html ***

    <p>here's an apostrophe & a quote "</p>

    <p>here's an apostrophe & a quote "</p>
    <p>here's an apostrophe & a quote "</p>
    <p>here's an apostrophe & a quote "</p>
    <p>here's an apostrophe & a quote "</p>
    *** Output of to_latex *** {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char60p\char62here\char39s~an~apostrophe~\char38~a~quote~\char34\char60\char47p\char62}} \begin{verbatim}

    here's an apostrophe & a quote "

    \end{verbatim} \begin{verbatim}

    here's an apostrophe & a quote "

    \end{verbatim} \begin{verbatim}

    here's an apostrophe & a quote "

    \end{verbatim} \begin{verbatim}

    here's an apostrophe & a quote "

    \end{verbatim} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/xml_instruction.md0000644000175000017500000000245211573154515021535 0ustar vincentvincentDirectives should be preserved. *** Parameters: *** {} *** Markdown input: *** Targets Inside: last *** Output of inspect *** md_el(:document,[ md_el(:xml_instr,[],{:code=>" noTarget",:target=>""},[]), md_el(:xml_instr,[],{:code=>"",:target=>"php"},[]), md_el(:xml_instr,[],{:code=>"",:target=>"xml"},[]), md_el(:xml_instr,[],{:code=>"",:target=>"mrk"},[]), md_par([ "Targets ", md_el(:xml_instr,[],{:code=>"noTarget",:target=>""},[]), " ", md_el(:xml_instr,[],{:code=>"",:target=>"php"},[]), " ", md_el(:xml_instr,[],{:code=>"",:target=>"xml"},[]), " ", md_el(:xml_instr,[],{:code=>"",:target=>"mrk"},[]) ]), md_par([ "Inside: ", md_el(:xml_instr,[],{:code=>"puts \"Inside: Hello\"",:target=>"mrk"},[]), " last" ]) ],{},[]) *** Output of to_html ***

    Targets

    Inside: last

    *** Output of to_latex *** Targets Inside: last *** Output of to_md *** Targets Inside: last *** Output of to_s *** Targets Inside: last *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists_after_paragraph.md0000644000175000017500000001213711573154515022641 0ustar vincentvincentThis should not trigger the list *** Parameters: *** {} *** Markdown input: *** Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space: * ciao Paragraph (3 spaces after), list with no space: * ciao Paragraph with block quote: > Quoted Paragraph with header: ### header ### Paragraph with header on two lines: header ------ Paragraph with html after
    Paragraph with html after, indented: Emphasis Paragraph with html after, indented: Emphasis *tralla* Emph Paragraph with html after, indented: Emphasis *tralla* Emph *** Output of inspect *** md_el(:document,[ md_par(["Paragraph, list with no space: * ciao"]), md_par(["Paragraph, list with 1 space: * ciao"]), md_par(["Paragraph, list with 3 space: * ciao"]), md_par(["Paragraph, list with 4 spaces: * ciao"]), md_par(["Paragraph, list with 1 tab: * ciao"]), md_par(["Paragraph (1 space after), list with no space: * ciao"]), md_par([ "Paragraph (2 spaces after), list with no space:", md_el(:linebreak,[],{},[]), "* ciao" ]), md_par([ "Paragraph (3 spaces after), list with no space: ", md_el(:linebreak,[],{},[]), "* ciao" ]), md_par(["Paragraph with block quote:"]), md_el(:quote,[md_par(["Quoted"])],{},[]), md_par(["Paragraph with header:"]), md_el(:header,["header"],{:level=>3},[]), md_par(["Paragraph with header on two lines:"]), md_el(:header,["header"],{:level=>2},[]), md_par(["Paragraph with html after ", md_html("
    ")]), md_par([ "Paragraph with html after, indented: ", md_html("Emphasis") ]), md_par([ "Paragraph with html after, indented: ", md_html("Emphasis"), " ", md_em(["tralla"]), " ", md_html("Emph") ]), md_par([ "Paragraph with html after, indented: ", md_html("Emphasis *tralla* Emph") ]) ],{},[]) *** Output of to_html ***

    Paragraph, list with no space: * ciao

    Paragraph, list with 1 space: * ciao

    Paragraph, list with 3 space: * ciao

    Paragraph, list with 4 spaces: * ciao

    Paragraph, list with 1 tab: * ciao

    Paragraph (1 space after), list with no space: * ciao

    Paragraph (2 spaces after), list with no space:
    * ciao

    Paragraph (3 spaces after), list with no space:
    * ciao

    Paragraph with block quote:

    Quoted

    Paragraph with header:

    Paragraph with header on two lines:

    Paragraph with html after

    Paragraph with html after, indented: Emphasis

    Paragraph with html after, indented: Emphasis tralla Emph

    Paragraph with html after, indented: Emphasis *tralla* Emph

    *** Output of to_latex *** Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space:\newline * ciao Paragraph (3 spaces after), list with no space: \newline * ciao Paragraph with block quote: \begin{quote}% Quoted \end{quote} Paragraph with header: \hypertarget{header}{}\subsubsection*{{header}}\label{header} Paragraph with header on two lines: \hypertarget{header}{}\subsection*{{header}}\label{header} Paragraph with html after Paragraph with html after, indented: Paragraph with html after, indented: \emph{tralla} Paragraph with html after, indented: *** Output of to_md *** Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space: * ciao Paragraph (3 spaces after), list with no space: * ciao Paragraph with block quote: Quoted Paragraph with header: headerParagraph with header on two lines: headerParagraph with html after Paragraph with html after, indented: Paragraph with html after, indented: tralla Paragraph with html after, indented: *** Output of to_s *** Paragraph, list with no space: * ciaoParagraph, list with 1 space: * ciaoParagraph, list with 3 space: * ciaoParagraph, list with 4 spaces: * ciaoParagraph, list with 1 tab: * ciaoParagraph (1 space after), list with no space: * ciaoParagraph (2 spaces after), list with no space:* ciaoParagraph (3 spaces after), list with no space: * ciaoParagraph with block quote:QuotedParagraph with header:headerParagraph with header on two lines:headerParagraph with html after Paragraph with html after, indented: Paragraph with html after, indented: tralla Paragraph with html after, indented: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists_ol.md0000644000175000017500000002142011573154515020120 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** 1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora 1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! - Uno - Due 1. tre 1. tre 1. tre - Due 2. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Another item in the same list. *** Output of inspect *** md_el(:document,[ md_el(:ol,[ md_el(:li_span,[ "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["Ancora"]), md_el(:ol,[ md_el(:li,[ md_par([ "This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus." ]), md_par(["ATTENZIONE!"]), md_el(:ul,[ md_el(:li,[md_par(["Uno"])],{:want_my_paragraph=>false},[]), md_el(:li,[ md_par(["Due"]), md_el(:ol,[ md_el(:li_span,["tre"],{:want_my_paragraph=>false},[]), md_el(:li_span,["tre"],{:want_my_paragraph=>false},[]), md_el(:li_span,["tre"],{:want_my_paragraph=>false},[]) ],{},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["Due"])],{:want_my_paragraph=>false},[]) ],{},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par(["Suspendisse id sem consectetuer libero luctus adipiscing."]) ],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["Ancora"]), md_el(:ul,[ md_el(:li,[ md_par(["This is a list item with two paragraphs."]), md_par([ "This is the second paragraph in the list item. You", md_entity("rsquo"), "re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["Another item in the same list."])],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    5. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.

      ATTENZIONE!

      • Uno

      • Due

        1. tre
        2. tre
        3. tre
      • Due

    2. Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    • This is a list item with two paragraphs.

      This is the second paragraph in the list item. You’re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

    • Another item in the same list.

    *** Output of to_latex *** \begin{enumerate}% \item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \end{enumerate} Ancora \begin{enumerate}% \item This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! \begin{itemize}% \item Uno \item Due \begin{enumerate}% \item tre \item tre \item tre \end{enumerate} \item Due \end{itemize} \item Suspendisse id sem consectetuer libero luctus adipiscing. \end{enumerate} Ancora \begin{itemize}% \item This is a list item with two paragraphs. This is the second paragraph in the list item. You'{}re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \item Another item in the same list. \end{itemize} *** Output of to_md *** 1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 5. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora 1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! Uno Due 1. tre 2. tre 3. tre Due 2. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora -This is a list item with two paragraphs. This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -nother item in the same list. *** Output of to_s *** Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.AncoraThis is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.ATTENZIONE!UnoDuetretretreDueSuspendisse id sem consectetuer libero luctus adipiscing.AncoraThis is a list item with two paragraphs.This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Another item in the same list. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/html3.md0000644000175000017500000000302011573154515017313 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** taking part in some arcane conspirations which involve coffee, robots, sushi, *** Output of inspect *** md_el(:document,[ md_par([ "taking part in ", md_html("some arcane conspirations"), " which involve ", md_html("coffee"), ", ", md_html("robots"), ", ", md_html("sushi"), "," ]) ],{},[]) *** Output of to_html ***

    taking part in some arcane conspirations which involve coffee, robots, sushi,

    *** Output of to_latex *** taking part in which involve , , , *** Output of to_md *** taking part in which involve , , , *** Output of to_s *** taking part in which involve , , , *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/entities.md0000644000175000017500000000717711573154515020131 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** Maruku translates HTML entities to the equivalent in LaTeX: Entity | Result ------------|---------- `©` | © `£` | £ `a b` | a b `λ` | λ `—` | — Entity-substitution does not happen in code blocks or inline code. The following should not be translated: © It should read just like this: `©`. *** Output of inspect *** md_el(:document,[ md_par(["Maruku translates HTML entities to the equivalent in LaTeX:"]), md_el(:table,[ md_el(:head_cell,["Entity"],{},[]), md_el(:head_cell,["Result"],{},[]), md_el(:cell,[md_code("©")],{},[]), md_el(:cell,[md_entity("copy")],{},[]), md_el(:cell,[md_code("£")],{},[]), md_el(:cell,[md_entity("pound")],{},[]), md_el(:cell,[md_code("a b")],{},[]), md_el(:cell,["a", md_entity("nbsp"), "b"],{},[]), md_el(:cell,[md_code("λ")],{},[]), md_el(:cell,[md_entity("lambda")],{},[]), md_el(:cell,[md_code("—")],{},[]), md_el(:cell,[md_entity("mdash")],{},[]) ],{:align=>[:left, :left]},[]), md_par([ "Entity-substitution does not happen in code blocks or inline code." ]), md_par(["The following should not be translated:"]), md_el(:code,[],{:raw_code=>"©"},[]), md_par(["It should read just like this: ", md_code("©"), "."]) ],{},[]) *** Output of to_html ***

    Maruku translates HTML entities to the equivalent in LaTeX:

    EntityResult
    &copy;©
    &pound;£
    a&nbsp;ba b
    &lambda;λ
    &mdash;

    Entity-substitution does not happen in code blocks or inline code.

    The following should not be translated:

    &copy;

    It should read just like this: &copy;.

    *** Output of to_latex *** Maruku translates HTML entities to the equivalent in \LaTeX\xspace : \begin{tabular}{l|l} Entity&Result\\ \hline {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38copy\char59}}&\copyright{}\\ {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38pound\char59}}&\pounds{}\\ {\colorbox[rgb]{1.00,0.93,1.00}{\tt a\char38nbsp\char59b}}&a~{}b\\ {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38lambda\char59}}&$\lambda${}\\ {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38mdash\char59}}&---{}\\ \end{tabular} Entity-substitution does not happen in code blocks or inline code. The following should not be translated: \begin{verbatim}©\end{verbatim} It should read just like this: {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38copy\char59}}. *** Output of to_md *** Maruku translates HTML entities to the equivalent in LaTeX: EntityResultabEntity-substitution does not happen in code blocks or inline code. The following should not be translated: It should read just like this: . *** Output of to_s *** Maruku translates HTML entities to the equivalent in LaTeX:EntityResultabEntity-substitution does not happen in code blocks or inline code.The following should not be translated:It should read just like this: . *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/list4.md0000644000175000017500000000305011573154515017326 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** This is a list: * one * two This is not a list: * one ciao This is a list: 1. one 1. two This is not a list: 1987. one ciao *** Output of inspect *** md_el(:document,[ md_par(["This is a list:"]), md_el(:ul,[ md_el(:li_span,["one"],{:want_my_paragraph=>false},[]), md_el(:li_span,["two"],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["This is not a list: * one ciao"]), md_par(["This is a list:"]), md_el(:ol,[ md_el(:li_span,["one"],{:want_my_paragraph=>false},[]), md_el(:li_span,["two"],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["This is not a list: 1987. one ciao"]) ],{},[]) *** Output of to_html ***

    This is a list:

    • one
    • two

    This is not a list: * one ciao

    This is a list:

    1. one
    2. two

    This is not a list: 1987. one ciao

    *** Output of to_latex *** This is a list: \begin{itemize}% \item one \item two \end{itemize} This is not a list: * one ciao This is a list: \begin{enumerate}% \item one \item two \end{enumerate} This is not a list: 1987. one ciao *** Output of to_md *** This is a list: -ne -wo This is not a list: * one ciao This is a list: 1. one 2. two This is not a list: 1987. one ciao *** Output of to_s *** This is a list:onetwoThis is not a list: * one ciaoThis is a list:onetwoThis is not a list: 1987. one ciao *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/bug_def.md0000644000175000017500000000070511573154515017666 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** [test][]: *** Output of inspect *** md_el(:document,[md_par([md_link(["test"],"test"), ":"])],{},[]) *** Output of to_html ***

    test:

    *** Output of to_latex *** test: *** Output of to_md *** test: *** Output of to_s *** test: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/paragraph_rules/0000755000175000017500000000000011573154515021126 5ustar vincentvincentmaruku-0.6.0/tests/unittest/paragraph_rules/dont_merge_ref.md0000644000175000017500000000144611573154515024434 0ustar vincentvincentParagraphs eats everything, but not link definitions. *** Parameters: *** {} *** Markdown input: *** Paragraph [google1]: # Paragraph [google2]: # Paragraph [google3]: # *** Output of inspect *** md_el(:document,[ md_par(["Paragraph"]), md_ref_def("google1", "#", {:title=>nil}), md_par(["Paragraph"]), md_ref_def("google2", "#", {:title=>nil}), md_par(["Paragraph"]), md_ref_def("google3", "#", {:title=>nil}) ],{},[]) *** Output of to_html ***

    Paragraph

    Paragraph

    Paragraph

    *** Output of to_latex *** Paragraph Paragraph Paragraph *** Output of to_md *** Paragraph Paragraph Paragraph *** Output of to_s *** ParagraphParagraphParagraph *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/paragraph_rules/tab_is_blank.md0000644000175000017500000000106411573154515024061 0ustar vincentvincentParagraphs eat blank lines. The following are two paragraphs: *** Parameters: *** {} *** Markdown input: *** Paragraph1 Paragraph2 *** Output of inspect *** md_el(:document,[md_par(["Paragraph1"]), md_par(["Paragraph2"])],{},[]) *** Output of to_html ***

    Paragraph1

    Paragraph2

    *** Output of to_latex *** Paragraph1 Paragraph2 *** Output of to_md *** Paragraph1 Paragraph2 *** Output of to_s *** Paragraph1Paragraph2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/abbreviations.md0000644000175000017500000000314011573154515021117 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Operation Tigra Genesis is going well. *[Tigra Genesis]: *** Output of inspect *** md_el(:document,[ md_par([ "The ", md_el(:abbr,["HTML"],{:title=>"Hyper Text Markup Language"},[]), " specification is maintained by the ", md_el(:abbr,["W3C"],{:title=>"World Wide Web Consortium"},[]), "." ]), md_el(:abbr_def,[],{:abbr=>"HTML",:text=>"Hyper Text Markup Language"},[]), md_el(:abbr_def,[],{:abbr=>"W3C",:text=>"World Wide Web Consortium"},[]), md_par([ "Operation ", md_el(:abbr,["Tigra Genesis"],{:title=>nil},[]), " is going well." ]), md_el(:abbr_def,[],{:abbr=>"Tigra Genesis",:text=>nil},[]) ],{},[]) *** Output of to_html ***

    The HTML specification is maintained by the W3C.

    Operation Tigra Genesis is going well.

    *** Output of to_latex *** The HTML specification is maintained by the W3C. Operation Tigra Genesis is going well. *** Output of to_md *** The HTMLspecification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Operation Tigra Genesisis going well. *[Tigra Genesis]: *** Output of to_s *** The HTML specification is maintained by the W3C.Operation Tigra Genesis is going well. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/xml2.md0000644000175000017500000000061511573154515017155 0ustar vincentvincentWrite a comment here *** Parameters: *** {} *** Markdown input: *** *** Output of inspect *** md_el(:document,[md_html("")],{},[]) *** Output of to_html *** *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/hang.md0000644000175000017500000000067311573154515017214 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** deded {.num_defn #IsbellDuality *** Output of inspect *** md_el(:document,[md_par(["deded"])],{},[]) *** Output of to_html ***

    deded

    *** Output of to_latex *** deded *** Output of to_md *** deded *** Output of to_s *** deded *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/list1.md0000644000175000017500000000206211573154515017325 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** * A list item with a blockquote: > This is a blockquote > inside a list item. *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li,[ md_par(["A list item with a blockquote:"]), md_el(:quote,[md_par(["This is a blockquote inside a list item."])],{},[]) ],{:want_my_paragraph=>true},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    • A list item with a blockquote:

      This is a blockquote inside a list item.

    *** Output of to_latex *** \begin{itemize}% \item A list item with a blockquote: \begin{quote}% This is a blockquote inside a list item. \end{quote} \end{itemize} *** Output of to_md *** - list item with a blockquote: This is a blockquote inside a list item. *** Output of to_s *** A list item with a blockquote:This is a blockquote inside a list item. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/paragraphs.md0000644000175000017500000000167711573154515020434 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Paragraph Br-> Paragraph 5 *** Output of inspect *** md_el(:document,[ md_par(["Paragraph 1"]), md_par(["Paragraph 2"]), md_par([ "Paragraph 3 Paragraph 4 Paragraph Br->", md_el(:linebreak,[],{},[]), "Paragraph 5" ]) ],{},[]) *** Output of to_html ***

    Paragraph 1

    Paragraph 2

    Paragraph 3 Paragraph 4 Paragraph Br->
    Paragraph 5

    *** Output of to_latex *** Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Paragraph Br-{\tt \char62}\newline Paragraph 5 *** Output of to_md *** Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Paragraph Br-> Paragraph 5 *** Output of to_s *** Paragraph 1Paragraph 2Paragraph 3 Paragraph 4 Paragraph Br->Paragraph 5 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/html2.md0000644000175000017500000000101311573154515017312 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** One
    123
    123 *** Output of inspect *** md_el(:document,[ md_par(["One ", md_html("
    "), "123"]), md_html("
    ") ],{},[]) *** Output of to_html ***

    One

    123

    *** Output of to_latex *** One 123 *** Output of to_md *** One 123 *** Output of to_s *** One 123 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/code2.md0000644000175000017500000000114711573154515017270 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** > Code > > Ciao *** Output of inspect *** md_el(:document,[ md_el(:quote,[md_par(["Code"]), md_el(:code,[],{:raw_code=>"Ciao"},[])],{},[]) ],{},[]) *** Output of to_html ***

    Code

    Ciao
    *** Output of to_latex *** \begin{quote}% Code \begin{verbatim}Ciao\end{verbatim} \end{quote} *** Output of to_md *** Code *** Output of to_s *** Code *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/references/0000755000175000017500000000000011573154515020070 5ustar vincentvincentmaruku-0.6.0/tests/unittest/references/long_example.md0000644000175000017500000000677411573154515023102 0ustar vincentvincentTaken from the syntax document *** Parameters: *** {} *** Markdown input: *** filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], [Grutatext] [5], and [EtText] [6] -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email. [1]: http://docutils.sourceforge.net/mirror/setext.html [2]: http://www.aaronsw.com/2002/atx/ [3]: http://textism.com/tools/textile/ [4]: http://docutils.sourceforge.net/rst.html [5]: http://www.triptico.com/software/grutatxt.html [6]: http://ettext.taint.org/doc/ To this end, Markdown's syntax is comprised entirely of punctuation *** Output of inspect *** md_el(:document,[ md_par([ "filters ", md_entity("ndash"), " including ", md_link(["Setext"],"1"), ", ", md_link(["atx"],"2"), ", ", md_link(["Textile"],"3"), ", ", md_link(["reStructuredText"],"4"), ", ", md_link(["Grutatext"],"5"), ", and ", md_link(["EtText"],"6"), " ", md_entity("ndash"), " the single biggest source of inspiration for Markdown", md_entity("rsquo"), "s syntax is the format of plain text email." ]), md_ref_def("1", "http://docutils.sourceforge.net/mirror/setext.html", {:title=>nil}), md_ref_def("2", "http://www.aaronsw.com/2002/atx/", {:title=>nil}), md_ref_def("3", "http://textism.com/tools/textile/", {:title=>nil}), md_ref_def("4", "http://docutils.sourceforge.net/rst.html", {:title=>nil}), md_ref_def("5", "http://www.triptico.com/software/grutatxt.html", {:title=>nil}), md_ref_def("6", "http://ettext.taint.org/doc/", {:title=>nil}), md_par([ "To this end, Markdown", md_entity("rsquo"), "s syntax is comprised entirely of punctuation" ]) ],{},[]) *** Output of to_html ***

    filters – including Setext, atx, Textile, reStructuredText, Grutatext, and EtText – the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.

    To this end, Markdown’s syntax is comprised entirely of punctuation

    *** Output of to_latex *** filters --{} including \href{http://docutils.sourceforge.net/mirror/setext.html}{Setext}, \href{http://www.aaronsw.com/2002/atx/}{atx}, \href{http://textism.com/tools/textile/}{Textile}, \href{http://docutils.sourceforge.net/rst.html}{reStructuredText}, \href{http://www.triptico.com/software/grutatxt.html}{Grutatext}, and \href{http://ettext.taint.org/doc/}{EtText} --{} the single biggest source of inspiration for Markdown'{}s syntax is the format of plain text email. To this end, Markdown'{}s syntax is comprised entirely of punctuation *** Output of to_md *** filters including Setext, atx, Textile, reStructuredText, Grutatext, and EtText the single biggest source of inspiration for Markdown s syntax is the format of plain text email. To this end, Markdown s syntax is comprised entirely of punctuation *** Output of to_s *** filters including Setext, atx, Textile, reStructuredText, Grutatext, and EtText the single biggest source of inspiration for Markdowns syntax is the format of plain text email.To this end, Markdowns syntax is comprised entirely of punctuation *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/references/spaces_and_numbers.md0000644000175000017500000000073311573154515024250 0ustar vincentvincentSpaces can be put before. ID can be a number *** Parameters: *** {} *** Markdown input: *** [6]: http://ettext.taint.org/doc/ *** Output of inspect *** md_el(:document,[md_ref_def("6", "http://ettext.taint.org/doc/", {:title=>nil})],{},[]) *** Output of to_html *** *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/email.md0000644000175000017500000000144411573154515017363 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** This is an email address: *** Output of inspect *** md_el(:document,[ md_par(["This is an email address: ", md_email("andrea@invalid.it")]) ],{},[]) *** Output of to_html ***

    This is an email address: andrea@invalid.it

    *** Output of to_latex *** This is an email address: \href{mailto:andrea@invalid.it}{andrea\char64invalid\char46it} *** Output of to_md *** This is an email address: *** Output of to_s *** This is an email address: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/html4.md0000644000175000017500000000175111573154515017325 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: ***
    *** Output of inspect *** md_el(:document,[ md_html("
    \n\t\"\"\n\n
    ") ],{},[]) *** Output of to_html ***
    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/data_loss.md0000644000175000017500000000111711573154515020242 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** 1. abcd efgh ijkl *** Output of inspect *** md_el(:document,[ md_el(:ol,[md_el(:li_span,["abcd efgh ijkl"],{:want_my_paragraph=>false},[])],{},[]) ],{},[]) *** Output of to_html ***
    1. abcd efgh ijkl
    *** Output of to_latex *** \begin{enumerate}% \item abcd efgh ijkl \end{enumerate} *** Output of to_md *** 1. abcd efgh ijkl *** Output of to_s *** abcd efgh ijkl *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/notyet/0000755000175000017500000000000011573154515017271 5ustar vincentvincentmaruku-0.6.0/tests/unittest/notyet/header_after_par.md0000644000175000017500000000212511573154515023066 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:title=>"header"} *** Markdown input: *** Paragraph ### header ### Paragraph header ------ Paragraph header ====== *** Output of inspect *** md_el(:document,[ md_par(["Paragraph"]), md_el(:header,["header"],{:level=>3},[]), md_par(["Paragraph"]), md_el(:header,["header"],{:level=>2},[]), md_par(["Paragraph"]), md_el(:header,["header"],{:level=>1},[]) ],{},[]) *** Output of to_html ***

    Paragraph

    Paragraph

    Paragraph

    header

    *** Output of to_latex *** Paragraph \hypertarget{header}{}\subsubsection*{{header}}\label{header} Paragraph \hypertarget{header}{}\subsection*{{header}}\label{header} Paragraph \hypertarget{header}{}\section*{{header}}\label{header} *** Output of to_md *** Paragraph headerParagraph headerParagraph header *** Output of to_s *** ParagraphheaderParagraphheaderParagraphheader *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/notyet/triggering.md0000644000175000017500000000737511573154515021770 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space: * ciao Paragraph (3 spaces after), list with no space: * ciao Paragraph with block quote: > Quoted Paragraph with header: ### header ### Paragraph with header on two lines: header ------ *** Output of inspect *** md_el(:document,[ md_par(["Paragraph, list with no space: * ciao"]), md_par(["Paragraph, list with 1 space: * ciao"]), md_par(["Paragraph, list with 3 space: * ciao"]), md_par(["Paragraph, list with 4 spaces: * ciao"]), md_par(["Paragraph, list with 1 tab: * ciao"]), md_par(["Paragraph (1 space after), list with no space: * ciao"]), md_par([ "Paragraph (2 spaces after), list with no space:", md_el(:linebreak,[],{},[]), "* ciao" ]), md_par([ "Paragraph (3 spaces after), list with no space: ", md_el(:linebreak,[],{},[]), "* ciao" ]), md_par(["Paragraph with block quote:"]), md_el(:quote,[md_par(["Quoted"])],{},[]), md_par(["Paragraph with header:"]), md_el(:header,["header"],{:level=>3},[]), md_par(["Paragraph with header on two lines:"]), md_el(:header,["header"],{:level=>2},[]) ],{},[]) *** Output of to_html ***

    Paragraph, list with no space: * ciao

    Paragraph, list with 1 space: * ciao

    Paragraph, list with 3 space: * ciao

    Paragraph, list with 4 spaces: * ciao

    Paragraph, list with 1 tab: * ciao

    Paragraph (1 space after), list with no space: * ciao

    Paragraph (2 spaces after), list with no space:
    * ciao

    Paragraph (3 spaces after), list with no space:
    * ciao

    Paragraph with block quote:

    Quoted

    Paragraph with header:

    Paragraph with header on two lines:

    *** Output of to_latex *** Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space:\newline * ciao Paragraph (3 spaces after), list with no space: \newline * ciao Paragraph with block quote: \begin{quote}% Quoted \end{quote} Paragraph with header: \hypertarget{header}{}\subsubsection*{{header}}\label{header} Paragraph with header on two lines: \hypertarget{header}{}\subsection*{{header}}\label{header} *** Output of to_md *** Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space: * ciao Paragraph (3 spaces after), list with no space: * ciao Paragraph with block quote: Quoted Paragraph with header: headerParagraph with header on two lines: header *** Output of to_s *** Paragraph, list with no space: * ciaoParagraph, list with 1 space: * ciaoParagraph, list with 3 space: * ciaoParagraph, list with 4 spaces: * ciaoParagraph, list with 1 tab: * ciaoParagraph (1 space after), list with no space: * ciaoParagraph (2 spaces after), list with no space:* ciaoParagraph (3 spaces after), list with no space: * ciaoParagraph with block quote:QuotedParagraph with header:headerParagraph with header on two lines:header *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/notyet/ticks.md0000644000175000017500000000116511573154515020733 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** ``There is a literal backtick (`) here.`` *** Output of inspect *** md_el(:document,[md_par([md_code("There is a literal backtick (`) here.")])],{},[]) *** Output of to_html ***

    There is a literal backtick (`) here.

    *** Output of to_latex *** {\colorbox[rgb]{1.00,0.93,1.00}{\tt There~is~a~literal~backtick~\char40\char96\char41~here\char46}} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/notyet/escape.md0000644000175000017500000000107611573154515021057 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** `\\` `\` *** Output of inspect *** md_el(:document,[md_par([md_code("\\\\")]), md_par([md_code("\\")])],{},[]) *** Output of to_html ***

    \\

    \

    *** Output of to_latex *** {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char92\char92}} {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char92}} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/bug_table.md0000644000175000017500000000245011573154515020216 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** hello {: summary="Table summary" .class1 style="color:red"} h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1 style="color:red"} {:t: scope="row"} *** Output of inspect *** md_el(:document,[ md_par(["hello"], [["summary", "Table summary"], [:class, "class1"], ["style", "color:red"]]), md_el(:table,[ md_el(:head_cell,["h"],{},[]), md_el(:head_cell,["h"],{},[]), md_el(:cell,[" c1"],{},[[:ref, "t"]]), md_el(:cell,["c2"],{},[]) ],{:align=>[:left, :left]},[["summary", "Table summary"], [:class, "class1"], ["style", "color:red"]]), md_el(:ald,[],{:ald=>[["scope", "row"]],:ald_id=>"t"},[]) ],{},[]) *** Output of to_html ***

    hello

    hh
    c1c2
    *** Output of to_latex *** hello \begin{tabular}{l|l} h&h\\ \hline c1&c2\\ \end{tabular} *** Output of to_md *** hello hh c1c2 *** Output of to_s *** hellohh c1c2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/misc_sw.md0000644000175000017500000006056011573154515017744 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:archive=>false, :date=>"Nov 20 2006", :inmenu=>true, :subject_short=>"painless software", :subject=>"Software not painful to use", :topic=>"/misc/coolsw", :order=>"-9.5"} *** Markdown input: *** Subject: Software not painful to use Subject_short: painless software Topic: /misc/coolsw Archive: no Date: Nov 20 2006 Order: -9.5 inMenu: true ### General ### * *Operating System* : [Mac OS X][switch]: heaven, after the purgatory of Linux and the hell of Windows. * *Browser*: [Firefox][firefox]. On a Mac, [Camino][camino]. * *Email*: [GMail][gmail], "search, don't sort" really works. * *Text Editor*: [TextMate][textmate], you have to buy it, but it's worth every penny. There are rumours that it's been converting (recovering) Emacs users (addicts). Unfortunately, it's Mac only. An alternative is [jedit][jedit] (GPL, Java). ### Development ### * *Build system*: [cmake][cmake], throw the [autotools][autotools] away. * *Source code control system*: ditch CVS for [subversion][subversion]. * *Project management*: [Trac][trac] tracks everything. * *Scripting language*: [Ruby][ruby] is Japanese pragmatism (and has a [poignant][poignant] guide). Python, you say? Python is too academic and snob: $ python Python 2.4.1 (\#1, Jun 4 2005, 00:54:33) Type "help", "copyright", "credits" or "license" for more information. >>> exit 'Use Ctrl-D (i.e. EOF) to exit.' >>> quit 'Use Ctrl-D (i.e. EOF) to exit.' * *Java IDE*: [JBuilder][jbuilder] is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained [generics][java-generics] and got opensourced. * *Mark-up language*: HTML is so 2001, why don't you take at look at [Markdown][markdown]? [Look at the source of this page](data/misc_markdown.png). * *C++ libraries*: * [QT][qt] for GUIs. * [GSL][gsl] for math. * [Magick++][magick] for manipulating images. * [Cairo][cairo] for creating PDFs. * [Boost][boost] for just about everything else. ### Research ### * *Writing papers*: [LaTeX][latex] * *Writing papers & enjoying the process*: [LyX][lyx] * *Handsome figures in your papers*: [xfig][xfig] or, better, [jfig][jfig]. * *The occasional presentation with many graphical content*: [OpenOffice Impress][impress] (using the [OOOlatex plugin][ooolatex]); the alternative is PowerPoint with the [TexPoint][texpoint] plugin. * *Managing BibTeX*: [jabref][jabref]: multi-platform, for all your bibtex needs. * *IEEExplore and BibTeX*: convert citations using [BibConverter][bibconverter]. ### Cool websites ### * *Best site in the wwworld*: [Wikipedia][wikipedia] * [Mutopia][mutopia] for sheet music; [the Gutenberg Project][gutenberg] for books; [LiberLiber][liberliber] for books in italian. * *Blogs*: [Bloglines][bloglines] * *Sharing photos*: [flickr][flickr] exposes an API you can use. [firefox]: http://getfirefox.com/ [gmail]: http://gmail.com/ [bloglines]: http://bloglines.com/ [wikipedia]: http://en.wikipedia.org/ [ruby]: http://www.ruby-lang.org/ [poignant]: http://poignantguide.net/ruby/ [webgen]: http://webgen.rubyforge.org/ [markdown]: http://daringfireball.net/projects/markdown/ [latex]: http://en.wikipedia.org/wiki/LaTeX [lyx]: http://www.lyx.org [impress]: http://www.openoffice.org/product/impress.html [ooolatex]: http://ooolatex.sourceforge.net/ [texpoint]: http://texpoint.necula.org/ [jabref]: http://jabref.sourceforge.net/ [camino]: http://www.caminobrowser.org/ [switch]: http://www.apple.com/getamac/ [textmate]: http://www.apple.com/getamac/ [cmake]: http://www.cmake.org/ [xfig]: http://www.xfig.org/ [jfig]: http://tams-www.informatik.uni-hamburg.de/applets/jfig/ [subversion]: http://subversion.tigris.org [jbuilder]: http://www.borland.com/us/products/jbuilder/index.html [flickr]: http://www.flickr.com/ [myflickr]: http://www.flickr.com/photos/censi [bibconverter]: http://www.bibconverter.net/ieeexplore/ [autotools]: http://sources.redhat.com/autobook/ [jedit]: http://www.jedit.org/ [qt]: http://www.trolltech.no/ [gsl]: http://www.gnu.org/software/gsl/ [magick]: http://www.imagemagick.org/Magick++/ [cairo]: http://cairographics.org/ [boost]: http://www.boost.org/ [markdown]: http://en.wikipedia.org/wiki/Markdown [trac]: http://trac.edgewall.org/ [mutopia]: http://www.mutopiaproject.org/ [liberliber]: http://www.liberliber.it/ [gutenberg]: http://www.gutenberg.org/ [java-generics]: http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html *** Output of inspect *** md_el(:document,[ md_el(:header,["General"],{:level=>3},[]), md_el(:ul,[ md_el(:li_span,[ md_em(["Operating System"]), " : ", md_link(["Mac OS X"],"switch"), ": heaven, after the purgatory of Linux and the hell of Windows." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Browser"]), ": ", md_link(["Firefox"],"firefox"), ". On a Mac, ", md_link(["Camino"],"camino"), "." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Email"]), ": ", md_link(["GMail"],"gmail"), ", ", md_entity("ldquo"), "search, don", md_entity("rsquo"), "t sort", md_entity("rdquo"), " really works." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Text Editor"]), ": ", md_link(["TextMate"],"textmate"), ", you have to buy it, but it", md_entity("rsquo"), "s worth every penny. There are rumours that it", md_entity("rsquo"), "s been converting (recovering) Emacs users (addicts). Unfortunately, it", md_entity("rsquo"), "s Mac only. An alternative is ", md_link(["jedit"],"jedit"), " (GPL, Java)." ],{:want_my_paragraph=>false},[]) ],{},[]), md_el(:header,["Development"],{:level=>3},[]), md_el(:ul,[ md_el(:li,[ md_par([ md_em(["Build system"]), ": ", md_link(["cmake"],"cmake"), ", throw the ", md_link(["autotools"],"autotools"), " away." ]) ],{:want_my_paragraph=>false},[]), md_el(:li,[ md_par([ md_em(["Source code control system"]), ": ditch CVS for ", md_link(["subversion"],"subversion"), "." ]) ],{:want_my_paragraph=>false},[]), md_el(:li,[ md_par([ md_em(["Project management"]), ": ", md_link(["Trac"],"trac"), " tracks everything." ]) ],{:want_my_paragraph=>false},[]), md_el(:li,[ md_par([ md_em(["Scripting language"]), ": ", md_link(["Ruby"],"ruby"), " is Japanese pragmatism (and has a ", md_link(["poignant"],"poignant"), " guide). Python, you say? Python is too academic and snob:" ]), md_el(:code,[],{:raw_code=>"$ python \nPython 2.4.1 (\\#1, Jun 4 2005, 00:54:33) \nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> exit\n'Use Ctrl-D (i.e. EOF) to exit.'\n>>> quit\n'Use Ctrl-D (i.e. EOF) to exit.'"},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par([ md_em(["Java IDE"]), ": ", md_link(["JBuilder"],"jbuilder"), " is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained ", md_link(["generics"],"javagenerics"), " and got opensourced." ]) ],{:want_my_paragraph=>false},[]), md_el(:li,[ md_par([ md_em(["Mark-up language"]), ": HTML is so 2001, why don", md_entity("rsquo"), "t you take at look at ", md_link(["Markdown"],"markdown"), "? ", md_im_link(["Look at the source of this page"], "data/misc_markdown.png", nil), "." ]) ],{:want_my_paragraph=>false},[]), md_el(:li,[ md_par([ md_em(["C++ libraries"]), ": * ", md_link(["QT"],"qt"), " for GUIs. * ", md_link(["GSL"],"gsl"), " for math. * ", md_link(["Magick++"],"magick"), " for manipulating images. * ", md_link(["Cairo"],"cairo"), " for creating PDFs. * ", md_link(["Boost"],"boost"), " for just about everything else." ]) ],{:want_my_paragraph=>false},[]) ],{},[]), md_el(:header,["Research"],{:level=>3},[]), md_el(:ul,[ md_el(:li_span,[md_em(["Writing papers"]), ": ", md_link(["LaTeX"],"latex")],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Writing papers & enjoying the process"]), ": ", md_link(["LyX"],"lyx") ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Handsome figures in your papers"]), ": ", md_link(["xfig"],"xfig"), " or, better, ", md_link(["jfig"],"jfig"), "." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["The occasional presentation with many graphical content"]), ": ", md_link(["OpenOffice Impress"],"impress"), " (using the ", md_link(["OOOlatex plugin"],"ooolatex"), "); the alternative is PowerPoint with the ", md_link(["TexPoint"],"texpoint"), " plugin." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Managing BibTeX"]), ": ", md_link(["jabref"],"jabref"), ": multi-platform, for all your bibtex needs." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["IEEExplore and BibTeX"]), ": convert citations using ", md_link(["BibConverter"],"bibconverter"), "." ],{:want_my_paragraph=>false},[]) ],{},[]), md_el(:header,["Cool websites"],{:level=>3},[]), md_el(:ul,[ md_el(:li_span,[ md_em(["Best site in the wwworld"]), ": ", md_link(["Wikipedia"],"wikipedia") ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_link(["Mutopia"],"mutopia"), " for sheet music; ", md_link(["the Gutenberg Project"],"gutenberg"), " for books; ", md_link(["LiberLiber"],"liberliber"), " for books in italian." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[md_em(["Blogs"]), ": ", md_link(["Bloglines"],"bloglines")],{:want_my_paragraph=>false},[]), md_el(:li_span,[ md_em(["Sharing photos"]), ": ", md_link(["flickr"],"flickr"), " exposes an API you can use." ],{:want_my_paragraph=>false},[]) ],{},[]), md_ref_def("firefox", "http://getfirefox.com/", {:title=>nil}), md_ref_def("gmail", "http://gmail.com/", {:title=>nil}), md_ref_def("bloglines", "http://bloglines.com/", {:title=>nil}), md_ref_def("wikipedia", "http://en.wikipedia.org/", {:title=>nil}), md_ref_def("ruby", "http://www.ruby-lang.org/", {:title=>nil}), md_ref_def("poignant", "http://poignantguide.net/ruby/", {:title=>nil}), md_ref_def("webgen", "http://webgen.rubyforge.org/", {:title=>nil}), md_ref_def("markdown", "http://daringfireball.net/projects/markdown/", {:title=>nil}), md_ref_def("latex", "http://en.wikipedia.org/wiki/LaTeX", {:title=>nil}), md_ref_def("lyx", "http://www.lyx.org", {:title=>nil}), md_ref_def("impress", "http://www.openoffice.org/product/impress.html", {:title=>nil}), md_ref_def("ooolatex", "http://ooolatex.sourceforge.net/", {:title=>nil}), md_ref_def("texpoint", "http://texpoint.necula.org/", {:title=>nil}), md_ref_def("jabref", "http://jabref.sourceforge.net/", {:title=>nil}), md_ref_def("camino", "http://www.caminobrowser.org/", {:title=>nil}), md_ref_def("switch", "http://www.apple.com/getamac/", {:title=>nil}), md_ref_def("textmate", "http://www.apple.com/getamac/", {:title=>nil}), md_ref_def("cmake", "http://www.cmake.org/", {:title=>nil}), md_ref_def("xfig", "http://www.xfig.org/", {:title=>nil}), md_ref_def("jfig", "http://tams-www.informatik.uni-hamburg.de/applets/jfig/", {:title=>nil}), md_ref_def("subversion", "http://subversion.tigris.org", {:title=>nil}), md_ref_def("jbuilder", "http://www.borland.com/us/products/jbuilder/index.html", {:title=>nil}), md_ref_def("flickr", "http://www.flickr.com/", {:title=>nil}), md_ref_def("myflickr", "http://www.flickr.com/photos/censi", {:title=>nil}), md_ref_def("bibconverter", "http://www.bibconverter.net/ieeexplore/", {:title=>nil}), md_ref_def("autotools", "http://sources.redhat.com/autobook/", {:title=>nil}), md_ref_def("jedit", "http://www.jedit.org/", {:title=>nil}), md_ref_def("qt", "http://www.trolltech.no/", {:title=>nil}), md_ref_def("gsl", "http://www.gnu.org/software/gsl/", {:title=>nil}), md_ref_def("magick", "http://www.imagemagick.org/Magick++/", {:title=>nil}), md_ref_def("cairo", "http://cairographics.org/", {:title=>nil}), md_ref_def("boost", "http://www.boost.org/", {:title=>nil}), md_ref_def("markdown", "http://en.wikipedia.org/wiki/Markdown", {:title=>nil}), md_ref_def("trac", "http://trac.edgewall.org/", {:title=>nil}), md_ref_def("mutopia", "http://www.mutopiaproject.org/", {:title=>nil}), md_ref_def("liberliber", "http://www.liberliber.it/", {:title=>nil}), md_ref_def("gutenberg", "http://www.gutenberg.org/", {:title=>nil}), md_ref_def("javagenerics", "http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html", {:title=>nil}) ],{},[]) *** Output of to_html ***

    General

    • Operating System : Mac OS X: heaven, after the purgatory of Linux and the hell of Windows.
    • Browser: Firefox. On a Mac, Camino.
    • Email: GMail, “search, don’t sort” really works.
    • Text Editor: TextMate, you have to buy it, but it’s worth every penny. There are rumours that it’s been converting (recovering) Emacs users (addicts). Unfortunately, it’s Mac only. An alternative is jedit (GPL, Java).

    Development

    • Build system: cmake, throw the autotools away.

    • Source code control system: ditch CVS for subversion.

    • Project management: Trac tracks everything.

    • Scripting language: Ruby is Japanese pragmatism (and has a poignant guide). Python, you say? Python is too academic and snob:

      $ python       
      Python 2.4.1 (\#1, Jun  4 2005, 00:54:33) 
      Type "help", "copyright", "credits" or "license" for more information.
      >>> exit
      'Use Ctrl-D (i.e. EOF) to exit.'
      >>> quit
      'Use Ctrl-D (i.e. EOF) to exit.'
    • Java IDE: JBuilder is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained generics and got opensourced.

    • Mark-up language: HTML is so 2001, why don’t you take at look at Markdown? Look at the source of this page.

    • C++ libraries: * QT for GUIs. * GSL for math. * Magick++ for manipulating images. * Cairo for creating PDFs. * Boost for just about everything else.

    Research

    • Writing papers: LaTeX
    • Writing papers & enjoying the process: LyX
    • Handsome figures in your papers: xfig or, better, jfig.
    • The occasional presentation with many graphical content: OpenOffice Impress (using the OOOlatex plugin); the alternative is PowerPoint with the TexPoint plugin.
    • Managing BibTeX: jabref: multi-platform, for all your bibtex needs.
    • IEEExplore and BibTeX: convert citations using BibConverter.

    Cool websites

    *** Output of to_latex *** \hypertarget{general}{}\subsubsection*{{General}}\label{general} \begin{itemize}% \item \emph{Operating System} : \href{http://www.apple.com/getamac/}{Mac OS X}: heaven, after the purgatory of Linux and the hell of Windows. \item \emph{Browser}: \href{http://getfirefox.com/}{Firefox}. On a Mac, \href{http://www.caminobrowser.org/}{Camino}. \item \emph{Email}: \href{http://gmail.com/}{GMail}, ``{}search, don'{}t sort''{} really works. \item \emph{Text Editor}: \href{http://www.apple.com/getamac/}{TextMate}, you have to buy it, but it'{}s worth every penny. There are rumours that it'{}s been converting (recovering) Emacs users (addicts). Unfortunately, it'{}s Mac only. An alternative is \href{http://www.jedit.org/}{jedit} (GPL, Java). \end{itemize} \hypertarget{development}{}\subsubsection*{{Development}}\label{development} \begin{itemize}% \item \emph{Build system}: \href{http://www.cmake.org/}{cmake}, throw the \href{http://sources.redhat.com/autobook/}{autotools} away. \item \emph{Source code control system}: ditch CVS for \href{http://subversion.tigris.org}{subversion}. \item \emph{Project management}: \href{http://trac.edgewall.org/}{Trac} tracks everything. \item \emph{Scripting language}: \href{http://www.ruby-lang.org/}{Ruby} is Japanese pragmatism (and has a \href{http://poignantguide.net/ruby/}{poignant} guide). Python, you say? Python is too academic and snob: \begin{verbatim}$ python Python 2.4.1 (\#1, Jun 4 2005, 00:54:33) Type "help", "copyright", "credits" or "license" for more information. >>> exit 'Use Ctrl-D (i.e. EOF) to exit.' >>> quit 'Use Ctrl-D (i.e. EOF) to exit.'\end{verbatim} \item \emph{Java IDE}: \href{http://www.borland.com/us/products/jbuilder/index.html}{JBuilder} is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained \href{http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html}{generics} and got opensourced. \item \emph{Mark-up language}: HTML is so 2001, why don'{}t you take at look at \href{http://en.wikipedia.org/wiki/Markdown}{Markdown}? \href{data/misc_markdown.png}{Look at the source of this page}. \item \emph{C++ libraries}: * \href{http://www.trolltech.no/}{QT} for GUIs. * \href{http://www.gnu.org/software/gsl/}{GSL} for math. * \href{http://www.imagemagick.org/Magick++/}{Magick++} for manipulating images. * \href{http://cairographics.org/}{Cairo} for creating PDFs. * \href{http://www.boost.org/}{Boost} for just about everything else. \end{itemize} \hypertarget{research}{}\subsubsection*{{Research}}\label{research} \begin{itemize}% \item \emph{Writing papers}: \href{http://en.wikipedia.org/wiki/LaTeX}{LaTeX} \item \emph{Writing papers \& enjoying the process}: \href{http://www.lyx.org}{LyX} \item \emph{Handsome figures in your papers}: \href{http://www.xfig.org/}{xfig} or, better, \href{http://tams-www.informatik.uni-hamburg.de/applets/jfig/}{jfig}. \item \emph{The occasional presentation with many graphical content}: \href{http://www.openoffice.org/product/impress.html}{OpenOffice Impress} (using the \href{http://ooolatex.sourceforge.net/}{OOOlatex plugin}); the alternative is PowerPoint with the \href{http://texpoint.necula.org/}{TexPoint} plugin. \item \emph{Managing BibTeX}: \href{http://jabref.sourceforge.net/}{jabref}: multi-platform, for all your bibtex needs. \item \emph{IEEExplore and BibTeX}: convert citations using \href{http://www.bibconverter.net/ieeexplore/}{BibConverter}. \end{itemize} \hypertarget{cool_websites}{}\subsubsection*{{Cool websites}}\label{cool_websites} \begin{itemize}% \item \emph{Best site in the wwworld}: \href{http://en.wikipedia.org/}{Wikipedia} \item \href{http://www.mutopiaproject.org/}{Mutopia} for sheet music; \href{http://www.gutenberg.org/}{the Gutenberg Project} for books; \href{http://www.liberliber.it/}{LiberLiber} for books in italian. \item \emph{Blogs}: \href{http://bloglines.com/}{Bloglines} \item \emph{Sharing photos}: \href{http://www.flickr.com/}{flickr} exposes an API you can use. \end{itemize} *** Output of to_md *** General-perating System: Mac OS X: heaven, after the purgatory of Linux and the hell of Windows. -rowser: Firefox. On a Mac, Camino. -mail: GMail, search, don t sort really works. -ext Editor: TextMate, you have to buy it, but it s worth every penny. There are rumours that it s been converting (recovering) Emacs users (addicts). Unfortunately, it s Mac only. An alternative is jedit(GPL, Java). Development-Build system: cmake, throw the autotools away. -Source code control system: ditch CVS for subversion. -Project management: Trac tracks everything. -Scripting language: Ruby is Japanese pragmatism (and has a poignant guide). Python, you say? Python is too academic and snob: -Java IDE: JBuilder is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained generics and got opensourced. -Mark-up language: HTML is so 2001, why dont you take at look at Markdown? Look at the source of this page. -C++ libraries: * QT for GUIs. * GSL for math. * Magick++ for manipulating images. * Cairo for creating PDFs. * Boost for just about everything else. Research-riting papers: LaTeX -Writing papers & enjoying the process : LyX -andsome figures in your papers: xfigor, better, jfig. -The occasional presentation with many graphical content : OpenOffice Impress(using the OOOlatex plugin); the alternative is PowerPoint with the TexPoint plugin. -anaging BibTeX: jabref: multi-platform, for all your bibtex needs. -EEExplore and BibTeX: convert citations using BibConverter. Cool websites-est site in the wwworld: Wikipedia -utopiafor sheet music; the Gutenberg Projectfor books; LiberLiberfor books in italian. -logs: Bloglines -haring photos: flickrexposes an API you can use. *** Output of to_s *** GeneralOperating System : Mac OS X: heaven, after the purgatory of Linux and the hell of Windows.Browser: Firefox. On a Mac, Camino.Email: GMail, search, dont sort really works.Text Editor: TextMate, you have to buy it, but its worth every penny. There are rumours that its been converting (recovering) Emacs users (addicts). Unfortunately, its Mac only. An alternative is jedit (GPL, Java).DevelopmentBuild system: cmake, throw the autotools away.Source code control system: ditch CVS for subversion.Project management: Trac tracks everything.Scripting language: Ruby is Japanese pragmatism (and has a poignant guide). Python, you say? Python is too academic and snob:Java IDE: JBuilder is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained generics and got opensourced.Mark-up language: HTML is so 2001, why dont you take at look at Markdown? Look at the source of this page.C++ libraries: * QT for GUIs. * GSL for math. * Magick++ for manipulating images. * Cairo for creating PDFs. * Boost for just about everything else.ResearchWriting papers: LaTeXWriting papers & enjoying the process: LyXHandsome figures in your papers: xfig or, better, jfig.The occasional presentation with many graphical content: OpenOffice Impress (using the OOOlatex plugin); the alternative is PowerPoint with the TexPoint plugin.Managing BibTeX: jabref: multi-platform, for all your bibtex needs.IEEExplore and BibTeX: convert citations using BibConverter.Cool websitesBest site in the wwworld: WikipediaMutopia for sheet music; the Gutenberg Project for books; LiberLiber for books in italian.Blogs: BloglinesSharing photos: flickr exposes an API you can use. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/syntax_hl.md0000644000175000017500000000300711573154515020302 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** This is ruby code: require 'maruku' puts Maruku.new($stdin).to_html This is ruby code: require 'maruku' {: lang=ruby html_use_syntax} puts Maruku.new($stdin).to_html *** Output of inspect *** md_el(:document,[ md_par(["This is ruby code:"]), md_el(:code,[],{:raw_code=>"require 'maruku'\n\nputs Maruku.new($stdin).to_html"},[]), md_par(["This is ruby code:"]), md_el(:code,[],{:raw_code=>"require 'maruku'"},[["lang", "ruby"], [:ref, "html_use_syntax"]]), md_el(:code,[],{:raw_code=>"puts Maruku.new($stdin).to_html"},[]) ],{},[]) *** Output of to_html ***

    This is ruby code:

    require 'maruku'
    
    puts Maruku.new($stdin).to_html

    This is ruby code:

    require 'maruku'
    puts Maruku.new($stdin).to_html
    *** Output of to_latex *** This is ruby code: \begin{verbatim}require 'maruku' puts Maruku.new($stdin).to_html\end{verbatim} This is ruby code: \begin{verbatim}require 'maruku'\end{verbatim} \begin{verbatim}puts Maruku.new($stdin).to_html\end{verbatim} *** Output of to_md *** This is ruby code: This is ruby code: *** Output of to_s *** This is ruby code:This is ruby code: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/list3.md0000644000175000017500000000277311573154515017340 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** * A list item with a blockquote: > This is a blockquote > inside a list item. * A list item with a code block: *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li,[ md_par(["A list item with a blockquote:"]), md_el(:quote,[md_par(["This is a blockquote inside a list item."])],{},[]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par(["A list item with a code block:"]), md_el(:code,[],{:raw_code=>""},[]) ],{:want_my_paragraph=>true},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    • A list item with a blockquote:

      This is a blockquote inside a list item.

    • A list item with a code block:

      <code goes here>
    *** Output of to_latex *** \begin{itemize}% \item A list item with a blockquote: \begin{quote}% This is a blockquote inside a list item. \end{quote} \item A list item with a code block: \begin{verbatim}\end{verbatim} \end{itemize} *** Output of to_md *** - list item with a blockquote: This is a blockquote inside a list item. - list item with a code block: *** Output of to_s *** A list item with a blockquote:This is a blockquote inside a list item.A list item with a code block: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/footnotes.md0000644000175000017500000000607711573154515020323 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:footnotes_used=>["^b", "^c", "^a"]} *** Markdown input: *** That's some text with a footnote [^b] and another [^c] and another [^a]. [^a]: And that's the footnote. That's the second paragraph of the footnote. [^b]: And that's the footnote. This is second sentence (same paragraph). [^c]: This is the very long one. That's the second paragraph. This is not a footnote. *** Output of inspect *** md_el(:document,[ md_par([ "That", md_entity("rsquo"), "s some text with a footnote ", md_foot_ref("^b"), " and another ", md_foot_ref("^c"), " and another ", md_foot_ref("^a"), "." ]), md_el(:footnote,[ md_par(["And that", md_entity("rsquo"), "s the footnote."]), md_par([ "That", md_entity("rsquo"), "s the second paragraph of the footnote." ]) ],{:footnote_id=>"^a"},[]), md_el(:footnote,[ md_par([ "And that", md_entity("rsquo"), "s the footnote. This is second sentence (same paragraph)." ]) ],{:footnote_id=>"^b"},[]), md_el(:footnote,[ md_par(["This is the very long one."]), md_par(["That", md_entity("rsquo"), "s the second paragraph."]) ],{:footnote_id=>"^c"},[]), md_par(["This is not a footnote."]) ],{},[]) *** Output of to_html ***

    That’s some text with a footnote 1 and another 2 and another 3.

    This is not a footnote.


    1. And that’s the footnote. This is second sentence (same paragraph).

    2. This is the very long one.

      That’s the second paragraph.

    3. And that’s the footnote.

      That’s the second paragraph of the footnote.

    *** Output of to_latex *** That'{}s some text with a footnote \footnote{And that'{}s the footnote. This is second sentence (same paragraph).} and another \footnote{This is the very long one. That'{}s the second paragraph.} and another \footnote{And that'{}s the footnote. That'{}s the second paragraph of the footnote.} . This is not a footnote. *** Output of to_md *** That s some text with a footnote and another and another . And that s the footnote. That s the second paragraph of the footnote. And that s the footnote. This is second sentence (same paragraph). This is the very long one. That s the second paragraph. This is not a footnote. *** Output of to_s *** Thats some text with a footnote and another and another .And thats the footnote.Thats the second paragraph of the footnote.And thats the footnote. This is second sentence (same paragraph).This is the very long one.Thats the second paragraph.This is not a footnote. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/list2.md0000644000175000017500000000354011573154515017330 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** * This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * other *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li,[ md_par(["This is a list item with two paragraphs."]), md_par([ "This is the second paragraph in the list item. You", md_entity("rsquo"), "re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["other"])],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    • This is a list item with two paragraphs.

      This is the second paragraph in the list item. You’re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

    • other

    *** Output of to_latex *** \begin{itemize}% \item This is a list item with two paragraphs. This is the second paragraph in the list item. You'{}re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \item other \end{itemize} *** Output of to_md *** -This is a list item with two paragraphs. This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -ther *** Output of to_s *** This is a list item with two paragraphs.This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.other *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/extra_dl.md0000644000175000017500000000365111573154515020100 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:css=>"style.css"} *** Markdown input: *** CSS: style.css Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. *** Output of inspect *** md_el(:document,[ md_el(:definition_list,[ md_el(:definition,[ md_el(:definition_term,["Apple"],{},[]), md_el(:definition_data,[ "Pomaceous fruit of plants of the genus Malus in the family Rosaceae." ],{},[]) ],{:definitions=>[md_el(:definition_data,[ "Pomaceous fruit of plants of the genus Malus in the family Rosaceae." ],{},[])],:terms=>[md_el(:definition_term,["Apple"],{},[])],:want_my_paragraph=>false},[]), md_el(:definition,[ md_el(:definition_term,["Orange"],{},[]), md_el(:definition_data,["The fruit of an evergreen tree of the genus Citrus."],{},[]) ],{:definitions=>[md_el(:definition_data,["The fruit of an evergreen tree of the genus Citrus."],{},[])],:terms=>[md_el(:definition_term,["Orange"],{},[])],:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    Apple
    Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
    Orange
    The fruit of an evergreen tree of the genus Citrus.
    *** Output of to_latex *** \begin{description} \item[Apple] Pomaceous fruit of plants of the genus Malus in the family Rosaceae. \item[Orange] The fruit of an evergreen tree of the genus Citrus. \end{description} *** Output of to_md *** ApplePomaceous fruit of plants of the genus Malus in the family Rosaceae.OrangeThe fruit of an evergreen tree of the genus Citrus. *** Output of to_s *** ApplePomaceous fruit of plants of the genus Malus in the family Rosaceae.OrangeThe fruit of an evergreen tree of the genus Citrus. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/alt.md0000644000175000017500000000073311573154515017054 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** ![bar](/foo.jpg) *** Output of inspect *** md_el(:document,[md_par([md_im_image(["bar"], "/foo.jpg", nil)])],{},[]) *** Output of to_html ***

    bar

    *** Output of to_latex *** *** Output of to_md *** bar *** Output of to_s *** bar *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/one.md0000644000175000017500000000066611573154515017062 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** One line *** Output of inspect *** md_el(:document,[md_par(["One line"])],{},[]) *** Output of to_html ***

    One line

    *** Output of to_latex *** One line *** Output of to_md *** One line *** Output of to_s *** One line *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/easy.md0000644000175000017500000000107511573154515017235 0ustar vincentvincentSimple test for emphasis. *** Parameters: *** {} *** Markdown input: *** *Hello!* how are **you**? *** Output of inspect *** md_el(:document,[md_par([md_em(["Hello!"]), " how are ", md_strong(["you"]), "?"])],{},[]) *** Output of to_html ***

    Hello! how are you?

    *** Output of to_latex *** \emph{Hello!} how are \textbf{you}? *** Output of to_md *** Hello!how are you? *** Output of to_s *** Hello! how are you? *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/wrapping.md0000644000175000017500000000770111573154515020125 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break: Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. * Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break: Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet * Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet *** Output of inspect *** md_el(:document,[ md_par([ "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:", md_el(:linebreak,[],{},[]), "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet." ]), md_el(:ul,[ md_el(:li_span,[ "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:", md_el(:linebreak,[],{},[]), "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet" ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet" ],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***

    Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:
    Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet.

    • Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:
      Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet
    • Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet
    *** Output of to_latex *** Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:\newline Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. \begin{itemize}% \item Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:\newline Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet \item Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet \end{itemize} *** Output of to_md *** Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break: Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. -orem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break: Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet -orem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet *** Output of to_s *** Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet.Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor ametLorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists6.md0000644000175000017500000000101111573154515017506 0ustar vincentvincent## Nested * Tab * Tab * Tab Here's another: 1. First 2. Second: * Fee * Fie * Foe 3. Third Same thing but with paragraphs: 1. First 2. Second: * Fee * Fie * Foe 3. Third *** Parameters: *** {} *** Markdown input: *** *** Output of inspect *** md_el(:document,[],{},[]) *** Output of to_html *** *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/hrule.md0000644000175000017500000000140311573154515017406 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** * * * *** ***** - - - --------------------------------------- *** Output of inspect *** md_el(:document,[ md_el(:hrule,[],{},[]), md_el(:hrule,[],{},[]), md_el(:hrule,[],{},[]), md_el(:hrule,[],{},[]), md_el(:hrule,[],{},[]) ],{},[]) *** Output of to_html ***




    *** Output of to_latex *** \vspace{.5em} \hrule \vspace{.5em} \vspace{.5em} \hrule \vspace{.5em} \vspace{.5em} \hrule \vspace{.5em} \vspace{.5em} \hrule \vspace{.5em} \vspace{.5em} \hrule \vspace{.5em} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/xml3.md0000644000175000017500000000110311573154515017147 0ustar vincentvincentWrite a comment here *** Parameters: *** {} *** Markdown input: *** Blah
    *em*
    *** Output of inspect *** md_el(:document,[ md_html("\n\tBlah\n\t\n\t\t\n\t\n
    *em*
    ") ],{},[]) *** Output of to_html *** Blah
    em
    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/inline_html2.md0000644000175000017500000000111211573154515020650 0ustar vincentvincent *** Parameters: *** {} *** Markdown input: ***
    Test **bold**

    Test **bold**

    *** Output of inspect *** md_el(:document,[ md_html("
    Test **bold**
    "), md_html("

    Test **bold**

    ") ],{},[]) *** Output of to_html ***

    Test bold

    Test bold

    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/encoding/0000755000175000017500000000000011573154515017535 5ustar vincentvincentmaruku-0.6.0/tests/unittest/encoding/iso-8859-1.md0000644000175000017500000000127411573154515021426 0ustar vincentvincentEncoding: iso-8859-1 *** Parameters: *** {} *** Markdown input: *** Encoding: iso-8859-1 This is iso-8859-1: àèìàù. *** Output of inspect *** md_el(:document,[ md_par([ "This is iso-8859-1: \303\203\302\240\303\203\302\250\303\203\302\254\303\203\302\240\303\203\302\271." ]) ],{},[]) *** Output of to_html ***

    This is iso-8859-1: àèìàù.

    *** Output of to_latex *** This is iso-8859-1: àèìàù. *** Output of to_md *** This is iso-8859-1: àèìàù. *** Output of to_s *** This is iso-8859-1: àèìàù. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/encoding/utf-8.md0000644000175000017500000000113711573154515021024 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:italian=>"\303\240\303\250\303\254\303\262\303\271."} *** Markdown input: *** Italian: àèìòù. Japanese: マルク *** Output of inspect *** md_el(:document,[md_par(["Japanese: \343\203\236\343\203\253\343\202\257"])],{},[]) *** Output of to_html ***

    Japanese: マルク

    *** Output of to_latex *** Japanese: マルク *** Output of to_md *** Japanese: マルク *** Output of to_s *** Japanese: マルク *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists.md0000644000175000017500000001744611573154515017443 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! * Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Another item in the same list. *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li_span,[ "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]), md_el(:li_span,[ "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing." ],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["Ancora"]), md_el(:ul,[ md_el(:li,[ md_par([ "This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus." ]), md_par(["ATTENZIONE!"]) ],{:want_my_paragraph=>true},[]), md_el(:li,[ md_par(["Suspendisse id sem consectetuer libero luctus adipiscing."]) ],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["Ancora"]), md_el(:ul,[ md_el(:li,[ md_par(["This is a list item with two paragraphs."]), md_par([ "This is the second paragraph in the list item. You", md_entity("rsquo"), "re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit." ]) ],{:want_my_paragraph=>true},[]), md_el(:li,[md_par(["Another item in the same list."])],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***
    • Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    • This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.

      ATTENZIONE!

    • Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    • This is a list item with two paragraphs.

      This is the second paragraph in the list item. You’re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

    • Another item in the same list.

    *** Output of to_latex *** \begin{itemize}% \item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \item Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. \end{itemize} Ancora \begin{itemize}% \item This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! \item Suspendisse id sem consectetuer libero luctus adipiscing. \end{itemize} Ancora \begin{itemize}% \item This is a list item with two paragraphs. This is the second paragraph in the list item. You'{}re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \item Another item in the same list. \end{itemize} *** Output of to_md *** -orem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. -onec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. -onec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. -onec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. -onec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora -This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! -Suspendisse id sem consectetuer libero luctus adipiscing. Ancora -This is a list item with two paragraphs. This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -nother item in the same list. *** Output of to_s *** Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.AncoraThis is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.ATTENZIONE!Suspendisse id sem consectetuer libero luctus adipiscing.AncoraThis is a list item with two paragraphs.This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Another item in the same list. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/headers.md0000644000175000017500000000260011573154515017702 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:title=>"A title with emphasis"} *** Markdown input: *** A title with *emphasis* ======================= A title with *emphasis* ----------------------- #### A title with *emphasis* #### *** Output of inspect *** md_el(:document,[ md_el(:header,["A title with ", md_em(["emphasis"])],{:level=>1},[]), md_el(:header,["A title with ", md_em(["emphasis"])],{:level=>2},[]), md_el(:header,["A title with ", md_em(["emphasis"])],{:level=>4},[]) ],{},[]) *** Output of to_html ***

    A title with emphasis

    A title with emphasis

    A title with emphasis

    *** Output of to_latex *** \hypertarget{a_title_with_emphasis}{}\section*{{A title with \emph{emphasis}}}\label{a_title_with_emphasis} \hypertarget{a_title_with_emphasis}{}\subsection*{{A title with \emph{emphasis}}}\label{a_title_with_emphasis} \hypertarget{a_title_with_emphasis}{}\paragraph*{{A title with \emph{emphasis}}}\label{a_title_with_emphasis} *** Output of to_md *** A title with emphasisA title with emphasisA title with emphasis *** Output of to_s *** A title with emphasisA title with emphasisA title with emphasis *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/hex_entities.md0000644000175000017500000000306211573154515020762 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef. *** Output of inspect *** md_el(:document,[ md_par([ "Examples of numeric character references include ", md_entity(169), " or ", md_entity(169), " for the copyright symbol, ", md_entity(913), " or ", md_entity(913), " for the Greek capital letter alpha, and ", md_entity(1575), " or ", md_entity(1575), " for the Arabic letter alef." ]) ],{},[]) *** Output of to_html ***

    Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef.

    *** Output of to_latex *** Examples of numeric character references include \copyright{} or \copyright{} for the copyright symbol, $A${} or $A${} for the Greek capital letter alpha, and or for the Arabic letter alef. *** Output of to_md *** Examples of numeric character references include or for the copyright symbol, or for the Greek capital letter alpha, and or for the Arabic letter alef. *** Output of to_s *** Examples of numeric character references include or for the copyright symbol, or for the Greek capital letter alpha, and or for the Arabic letter alef. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/lists11.md0000644000175000017500000000070211573154515017570 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** - ένα *** Output of inspect *** md_el(:document,[md_par(["- \316\255\316\275\316\261"])],{},[]) *** Output of to_html ***

    - ένα

    *** Output of to_latex *** - ένα *** Output of to_md *** - ένα *** Output of to_s *** - ένα *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/underscore_in_words.md0000644000175000017500000000111611573154515022345 0ustar vincentvincentNote that Markdown.pl gives incorrect result here. *** Parameters: *** {} # params *** Markdown input: *** Ok, this_was a_really_old bug *** Output of inspect *** md_el(:document,[md_par(["Ok, this_was a_really_old bug"])],{},[]) *** Output of to_html ***

    Ok, this_was a_really_old bug

    *** Output of to_latex *** Ok, this\_was a\_really\_old bug *** Output of to_md *** Ok, this_was a_really_old bug *** Output of to_s *** Ok, this_was a_really_old bug *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/smartypants.md0000644000175000017500000000633511573154515020665 0ustar vincentvincent *** Parameters: *** {} *** Markdown input: *** 'Twas a "test" to 'remember' in the '90s. 'Twas a "test" to 'remember' in the '90s. It was --- in a sense --- really... interesting. It was --- in a sense --- really... interesting. I -- too -- met << some curly quotes >> there or <>No space. I -- too -- met << some curly quotes >> there or <>No space. She was 6\"12\'. > She was 6\"12\'. *** Output of inspect *** md_el(:document,[ md_el(:code,[],{:raw_code=>"'Twas a \"test\" to 'remember' in the '90s."},[]), md_par([ md_entity("lsquo"), "Twas a ", md_entity("ldquo"), "test", md_entity("rdquo"), " to ", md_entity("lsquo"), "remember", md_entity("rsquo"), " in the ", md_entity("rsquo"), "90s." ]), md_el(:code,[],{:raw_code=>"It was --- in a sense --- really... interesting."},[]), md_par([ "It was ", md_entity("mdash"), " in a sense ", md_entity("mdash"), " really", md_entity("hellip"), " interesting." ]), md_el(:code,[],{:raw_code=>"I -- too -- met << some curly quotes >> there or <>No space."},[]), md_par([ "I ", md_entity("ndash"), " too ", md_entity("ndash"), " met ", md_entity("laquo"), md_entity("nbsp"), "some curly quotes", md_entity("nbsp"), md_entity("raquo"), " there or ", md_entity("laquo"), "here", md_entity("raquo"), "No space." ]), md_el(:code,[],{:raw_code=>"She was 6\\\"12\\'."},[]), md_el(:quote,[ md_par(["She was 6", md_entity("quot"), "12", md_entity("apos"), "."]) ],{},[]) ],{},[]) *** Output of to_html ***
    'Twas a "test" to 'remember' in the '90s.

    ‘Twas a “test” to ‘remember’ in the ’90s.

    It was --- in a sense --- really... interesting.

    It was — in a sense — really… interesting.

    I -- too -- met << some curly quotes >> there or <<here>>No space.

    I – too – met « some curly quotes » there or «here»No space.

    She was 6\"12\'.

    She was 6"12'.

    *** Output of to_latex *** \begin{verbatim}'Twas a "test" to 'remember' in the '90s.\end{verbatim} `{}Twas a ``{}test''{} to `{}remember'{} in the '{}90s. \begin{verbatim}It was --- in a sense --- really... interesting.\end{verbatim} It was ---{} in a sense ---{} really\ldots{} interesting. \begin{verbatim}I -- too -- met << some curly quotes >> there or <>No space.\end{verbatim} I --{} too --{} met \guillemotleft{}~{}some curly quotes~{}\guillemotright{} there or \guillemotleft{}here\guillemotright{}No space. \begin{verbatim}She was 6\"12\'.\end{verbatim} \begin{quote}% She was 6"{}12'{}. \end{quote} *** Output of to_md *** Twas a test to remember in the 90s. It was in a sense really interesting. I too met some curly quotes there or here No space. She was 6 12 . *** Output of to_s *** Twas a test to remember in the 90s.It was in a sense really interesting.I too met some curly quotes there or hereNo space.She was 612. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/images2.md0000644000175000017500000000145011573154515017620 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** This is an ![image][]. This is an ![image]. [image]: image.jpg *** Output of inspect *** md_el(:document,[ md_par(["This is an ", md_image(["image"], "image"), "."]), md_par(["This is an ", md_image(["image"], "image"), "."]), md_ref_def("image", "image.jpg", {:title=>nil}) ],{},[]) *** Output of to_html ***

    This is an image.

    This is an image.

    *** Output of to_latex *** This is an . This is an . *** Output of to_md *** This is an image. This is an image. *** Output of to_s *** This is an image.This is an image. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/math/0000755000175000017500000000000011573154515016700 5ustar vincentvincentmaruku-0.6.0/tests/unittest/math/table2.md0000644000175000017500000000321111573154515020370 0ustar vincentvincentWrite a comment here *** Parameters: *** {} *** Markdown input: *** Symbol | Meaning | comments ------------|---------|--------- {:r} α | The first | I like it. {:r} ℵ | The first | I like it. {:r: scope='row'} *** Output of inspect *** md_el(:document,[ md_el(:table,[ md_el(:head_cell,["Symbol"],{},[]), md_el(:head_cell,["Meaning"],{},[]), md_el(:head_cell,["comments"],{},[]), md_el(:cell,[" ", md_entity("alpha")],{},[[:ref, "r"]]), md_el(:cell,["The first"],{},[]), md_el(:cell,["I like it."],{},[]), md_el(:cell,[" ", md_entity("aleph")],{},[[:ref, "r"]]), md_el(:cell,["The first"],{},[]), md_el(:cell,["I like it."],{},[]) ],{:align=>[:left, :left, :left]},[]), md_el(:ald,[],{:ald=>[["scope", "row"]],:ald_id=>"r"},[]) ],{},[]) *** Output of to_html ***
    SymbolMeaningcomments
    αThe firstI like it.
    The firstI like it.
    *** Output of to_latex *** \begin{tabular}{l|l|l} Symbol&Meaning&comments\\ \hline $\alpha${}&The first&I like it.\\ &The first&I like it.\\ \end{tabular} *** Output of to_md *** SymbolMeaningcomments The firstI like it. The firstI like it. *** Output of to_s *** SymbolMeaningcomments The firstI like it. The firstI like it. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/math/equations.md0000644000175000017500000000526411573154515021241 0ustar vincentvincentWrite a comment here *** Parameters: *** require 'maruku/ext/math';{} *** Markdown input: *** $$ x = y $$ $$ x = y $$ $$ x = y $$ $$ x = y $$ *** Output of inspect *** md_el(:document,[ md_el(:equation,[],{:label=>nil,:math=>" x = y ",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]) ],{},[]) *** Output of to_html ***
    x = y
    x = y
    x = y
    x = y
    x = y
    x = y
    x = y
    x = y
    *** Output of to_latex *** \begin{displaymath} x = y \end{displaymath} \begin{displaymath} x = y \end{displaymath} \begin{displaymath} x = y \end{displaymath} \begin{displaymath} x = y \end{displaymath} *** Output of to_md *** *** Output of to_s *** *** EOF *** Failed tests: [:to_html] *** Output of inspect *** md_el(:document,[ md_el(:equation,[],{:label=>nil,:math=>" x = y ",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]) ],{},[]) *** Output of to_html *** -----| WARNING | -----
    x = y x = y
    x = y x = y
    x = y x = y
    x = y x = y
    *** Output of to_latex *** \begin{displaymath} x = y \end{displaymath} \begin{displaymath} x = y \end{displaymath} \begin{displaymath} x = y \end{displaymath} \begin{displaymath} x = y \end{displaymath} *** Output of to_md *** *** Output of to_s *** *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/math/table.md0000644000175000017500000000153211573154515020312 0ustar vincentvincentWrite a comment here *** Parameters: *** require 'maruku/ext/math';{:html_math_engine => 'itex2mml' } *** Markdown input: *** $\alpha$
    $\beta$
    *** Output of inspect *** md_el(:document,[ md_html("\n\t$\\alpha$\n\t\n\t\t\n\t\n
    $\\beta$
    ") ],{},[]) *** Output of to_html *** α
    β
    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/math/inline.md0000644000175000017500000000241011573154515020475 0ustar vincentvincent *** Parameters: *** require 'maruku/ext/math'; {} *** Markdown input: *** Here are some formulas: * $\alpha$ * $x^{n}+y^{n} \neq z^{n}$ That's it, nothing else is supported. *** Output of inspect *** md_el(:document,[ md_par(["Here are some formulas:"]), md_el(:ul,[ md_el(:li_span,[md_el(:inline_math,[],{:math=>"\\alpha"},[])],{:want_my_paragraph=>false},[]), md_el(:li_span,[md_el(:inline_math,[],{:math=>"x^{n}+y^{n} \\neq z^{n}"},[])],{:want_my_paragraph=>false},[]) ],{},[]), md_par(["That", md_entity("rsquo"), "s it, nothing else is supported."]) ],{},[]) *** Output of to_html ***

    Here are some formulas:

    • \alpha
    • x^{n}+y^{n} \neq z^{n}

    That’s it, nothing else is supported.

    *** Output of to_latex *** Here are some formulas: \begin{itemize}% \item $\alpha$ \item $x^{n}+y^{n} \neq z^{n}$ \end{itemize} That'{}s it, nothing else is supported. *** Output of to_md *** Here are some formulas: -- That s it, nothing else is supported. *** Output of to_s *** Here are some formulas:Thats it, nothing else is supported. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/math/math2.md0000644000175000017500000000364011573154515020240 0ustar vincentvincent *** Parameters: *** require 'maruku/ext/math' {:math_numbered => ['\\['], :html_math_engine => 'itex2mml' } *** Markdown input: *** \[ \alpha \] \begin{equation} \alpha \end{equation} \begin{equation} \beta \end{equation} \begin{equation} \gamma \end{equation} *** Output of inspect *** md_el(:document,[ md_el(:equation,[],{:label=>"eq1",:math=>"\t\\alpha\n\n",:num=>1},[]), md_el(:equation,[],{:label=>nil,:math=>"\t\\alpha\n\n",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" \\beta\n",:num=>nil},[]), md_el(:equation,[],{:label=>nil,:math=>" \\gamma ",:num=>nil},[]) ],{},[]) *** Output of to_html ***
    α\alpha(1)
    α\alpha
    β\beta
    γ\gamma
    *** Output of to_latex *** \begin{equation} \alpha \label{eq1}\end{equation} \begin{displaymath} \alpha \end{displaymath} \begin{displaymath} \beta \end{displaymath} \begin{displaymath} \gamma \end{displaymath} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/math/notmath.md0000644000175000017500000000115711573154515020700 0ustar vincentvincent *** Parameters: *** require 'maruku/ext/math'; {:math_enabled => false} *** Markdown input: *** This is not $math$. \[ \alpha \] *** Output of inspect *** md_el(:document,[md_par(["This is not $math$."]), md_par(["[ \\alpha ]"])],{},[]) *** Output of to_html ***

    This is not $math$.

    [ \alpha ]

    *** Output of to_latex *** This is not \$math\$. [ $\backslash$alpha ] *** Output of to_md *** This is not $math$. [ \alpha ] *** Output of to_s *** This is not $math$.[ \alpha ] *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/links.md0000644000175000017500000001201711573154515017412 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:on_error=>:warning} *** Markdown input: *** Search on [Google][] Search on [Google] [] Search on [Google] [google] Search on [Google] [Google] Search on [Google images][] Inline: [Google images](http://google.com) Inline with title: [Google images](http://google.com "Title") Inline with title: [Google images]( http://google.com "Title" ) Search on or or ask or you might ask bill@google.com. If all else fails, ask [Google](http://www.google.com) And now [reference-style link ID with spaces] [Google Images] [google]: http://www.google.com [google2]: http://www.google.com 'Single quotes' [google3]: http://www.google.com "Double quotes" [google4]: http://www.google.com (Parenthesis) [Google Search]: http://www.google.com "Google search" [Google Images]: http://images.google.com (Google images) *** Output of inspect *** md_el(:document,[ md_par(["Search on ", md_link(["Google"],"google")]), md_par(["Search on ", md_link(["Google"],"google")]), md_par(["Search on ", md_link(["Google"],"google")]), md_par(["Search on ", md_link(["Google"],"google")]), md_par(["Search on ", md_link(["Google images"],"google_images")]), md_par(["Inline: ", md_im_link(["Google images"], "http://google.com", nil)]), md_par([ "Inline with title: ", md_im_link(["Google images"], "http://google.com", "Title") ]), md_par([ "Inline with title: ", md_im_link(["Google images"], "http://google.com", "Title") ]), md_par([ "Search on ", md_url("http://www.gogole.com"), " or ", md_url("http://Here.com"), " or ask ", md_email("bill@google.com"), " or you might ask bill@google.com." ]), md_par([ "If all else fails, ask ", md_im_link(["Google"], "http://www.google.com", nil) ]), md_par([ "And now ", md_link(["reference-style link ID with spaces"],"google_images") ]), md_ref_def("google", "http://www.google.com", {:title=>nil}), md_ref_def("google2", "http://www.google.com", {:title=>"Single quotes"}), md_ref_def("google3", "http://www.google.com", {:title=>"Double quotes"}), md_ref_def("google4", "http://www.google.com", {:title=>"Parenthesis"}), md_ref_def("google_search", "http://www.google.com", {:title=>"Google search"}), md_ref_def("google_images", "http://images.google.com", {:title=>"Google images"}) ],{},[]) *** Output of to_html ***

    Search on Google

    Search on Google

    Search on Google

    Search on Google

    Search on Google images

    Inline: Google images

    Inline with title: Google images

    Inline with title: Google images

    Search on http://www.gogole.com or http://Here.com or ask bill@google.com or you might ask bill@google.com.

    If all else fails, ask Google

    And now reference-style link ID with spaces

    *** Output of to_latex *** Search on \href{http://www.google.com}{Google} Search on \href{http://www.google.com}{Google} Search on \href{http://www.google.com}{Google} Search on \href{http://www.google.com}{Google} Search on \href{http://images.google.com}{Google images} Inline: \href{http://google.com}{Google images} Inline with title: \href{http://google.com}{Google images} Inline with title: \href{http://google.com}{Google images} Search on \href{http://www.gogole.com}{http\char58\char47\char47www\char46gogole\char46com} or \href{http://Here.com}{http\char58\char47\char47Here\char46com} or ask \href{mailto:bill@google.com}{bill\char64google\char46com} or you might ask bill@google.com. If all else fails, ask \href{http://www.google.com}{Google} And now \href{http://images.google.com}{reference-style link ID with spaces} *** Output of to_md *** Search on Google Search on Google Search on Google Search on Google Search on Google images Inline: Google images Inline with title: Google images Inline with title: Google images Search on or or ask or you might ask bill@google.com. If all else fails, ask Google And now reference-style link ID with spaces *** Output of to_s *** Search on GoogleSearch on GoogleSearch on GoogleSearch on GoogleSearch on Google imagesInline: Google imagesInline with title: Google imagesInline with title: Google imagesSearch on or or ask or you might ask bill@google.com.If all else fails, ask GoogleAnd now reference-style link ID with spaces *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/extra_table1.md0000644000175000017500000000256111573154515020650 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:css=>"style.css"} *** Markdown input: *** CSS: style.css First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell *** Output of inspect *** md_el(:document,[ md_el(:table,[ md_el(:head_cell,["First Header"],{},[]), md_el(:head_cell,["Second Header"],{},[]), md_el(:cell,["Content Cell"],{},[]), md_el(:cell,["Content Cell"],{},[]), md_el(:cell,["Content Cell"],{},[]), md_el(:cell,["Content Cell"],{},[]) ],{:align=>[:left, :left]},[]) ],{},[]) *** Output of to_html ***
    First HeaderSecond Header
    Content CellContent Cell
    Content CellContent Cell
    *** Output of to_latex *** \begin{tabular}{l|l} First Header&Second Header\\ \hline Content Cell&Content Cell\\ Content Cell&Content Cell\\ \end{tabular} *** Output of to_md *** First HeaderSecond HeaderContent CellContent CellContent CellContent Cell *** Output of to_s *** First HeaderSecond HeaderContent CellContent CellContent CellContent Cell *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/inline_html.md0000644000175000017500000000653411573154515020603 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:css=>"style.css"} *** Markdown input: *** CSS: style.css Input: Emphasis Result: Emphasis Input: Result on span: Result alone: Without closing:
    This is *true* markdown text (paragraph)

    This is *true* markdown text (no paragraph)

    This is *true* markdown text (block paragraph)

    This is a *true* markdown text. (no par) This is *true* markdown text. (par)
    *** Output of inspect *** md_el(:document,[ md_par(["Input:"]), md_el(:code,[],{:raw_code=>"Emphasis"},[]), md_par(["Result: ", md_html("Emphasis")]), md_par(["Input:"]), md_el(:code,[],{:raw_code=>""},[]), md_par([ "Result on span: ", md_html("") ]), md_par(["Result alone:"]), md_html(""), md_par(["Without closing:"]), md_html(""), md_html("
    \n\tThis is *true* markdown text (paragraph)\n\n\t

    \n\t\tThis is *true* markdown text (no paragraph)\n\t

    \n\t

    \n\t\tThis is *true* markdown text (block paragraph)\n\t

    \n
    "), md_html("\n\n\n\n\n
    This is a *true* markdown text. (no par)This is *true* markdown text. (par)
    ") ],{},[]) *** Output of to_html ***

    Input:

    <em>Emphasis</em>

    Result: Emphasis

    Input:

    <img src="http://jigsaw.w3.org/css-validator/images/vcss"/>

    Result on span:

    Result alone:

    Without closing:

    This is

    true

    markdown text (paragraph)

    This is

    true

    markdown text (no paragraph)

    This is

    true

    markdown text (block paragraph)

    This is a

    true

    markdown text. (no par)

    This is

    true

    markdown text. (par)

    *** Output of to_latex *** Input: \begin{verbatim}Emphasis\end{verbatim} Result: Input: \begin{verbatim}\end{verbatim} Result on span: Result alone: Without closing: *** Output of to_md *** Input: Result: Input: Result on span: Result alone: Without closing: *** Output of to_s *** Input:Result: Input:Result on span: Result alone:Without closing: *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/olist.md0000644000175000017500000000147711573154515017434 0ustar vincentvincent *** Parameters: *** {} *** Markdown input: *** This is a list: 2. one 2. two 3. three *** Output of inspect *** md_el(:document,[ md_par(["This is a list:"]), md_el(:ol,[ md_el(:li_span,["one"],{:want_my_paragraph=>false},[]), md_el(:li_span,["two"],{:want_my_paragraph=>false},[]), md_el(:li_span,["three"],{:want_my_paragraph=>false},[]) ],{},[]) ],{},[]) *** Output of to_html ***

    This is a list:

    1. one
    2. two
    3. three
    *** Output of to_latex *** This is a list: \begin{enumerate}% \item one \item two \item three \end{enumerate} *** Output of to_md *** This is a list: 1. one 2. two 3. three *** Output of to_s *** This is a list:onetwothree *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/blanks_in_code.md0000644000175000017500000000260111573154515021222 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** This block is composed of three lines: one three This block is composed of 5 one four This block is composed of 2 two *** Output of inspect *** md_el(:document,[ md_par(["This block is composed of three lines:"]), md_el(:code,[],{:raw_code=>"one\n\nthree"},[]), md_par(["This block is composed of 5"]), md_el(:code,[],{:raw_code=>"one\n\n\nfour"},[]), md_par(["This block is composed of 2"]), md_el(:code,[],{:raw_code=>"two"},[]) ],{},[]) *** Output of to_html ***

    This block is composed of three lines:

    one
    
    three

    This block is composed of 5

    one
    
    
    four

    This block is composed of 2

    two
    *** Output of to_latex *** This block is composed of three lines: \begin{verbatim}one three\end{verbatim} This block is composed of 5 \begin{verbatim}one four\end{verbatim} This block is composed of 2 \begin{verbatim}two\end{verbatim} *** Output of to_md *** This block is composed of three lines: This block is composed of 5 This block is composed of 2 *** Output of to_s *** This block is composed of three lines:This block is composed of 5This block is composed of 2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/list12.md0000644000175000017500000000136511573154515017414 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** * [Maruku]: good. [maruku]: http://maruku.org/ *** Output of inspect *** md_el(:document,[ md_el(:ul,[ md_el(:li_span,[md_link(["Maruku"],"maruku"), ": good."],{:want_my_paragraph=>false},[]) ],{},[]), md_ref_def("maruku", "http://maruku.org/", {:title=>nil}) ],{},[]) *** Output of to_html *** *** Output of to_latex *** \begin{itemize}% \item \href{http://maruku.org/}{Maruku}: good. \end{itemize} *** Output of to_md *** -aruku: good. *** Output of to_s *** Maruku: good. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/table_attributes.md0000644000175000017500000000253611573154515021634 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1 style="color:red" border=3 width="50%" frame=lhs rules=cols cellspacing=2em cellpadding=4px} {:t: scope="row"} *** Output of inspect *** md_el(:document,[ md_el(:table,[ md_el(:head_cell,["h"],{},[]), md_el(:head_cell,["h"],{},[]), md_el(:cell,[" c1"],{},[[:ref, "t"]]), md_el(:cell,["c2"],{},[]) ],{:align=>[:left, :left]},[["summary", "Table summary"], [:class, "class1"], ["style", "color:red"], ["border", "3"], ["width", "50%"], ["frame", "lhs"], ["rules", "cols"], ["cellspacing", "2em"], ["cellpadding", "4px"]]), md_el(:ald,[],{:ald=>[["scope", "row"]],:ald_id=>"t"},[]) ],{},[]) *** Output of to_html ***
    hh
    c1c2
    *** Output of to_latex *** \begin{tabular}{l|l} h&h\\ \hline c1&c2\\ \end{tabular} *** Output of to_md *** hh c1c2 *** Output of to_s *** hh c1c2 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/loss.md0000644000175000017500000000061411573154515017252 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: ***
    123 *** Output of inspect *** md_el(:document,[md_html("
    ")],{},[]) *** Output of to_html ***
    *** Output of to_latex *** *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/extra_header_id.md0000644000175000017500000000426611573154515021410 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {:title=>"Header 1"} *** Markdown input: *** Header 1 {#header1} ======== Header 2 {#header2} -------- ### Header 3 ### {#header3} Then you can create links to different parts of the same document like this: [Link back to header 1](#header1), [Link back to header 2](#header2), [Link back to header 3](#header3) *** Output of inspect *** md_el(:document,[ md_el(:header,["Header 1"],{:level=>1},[[:id, "header1"]]), md_el(:header,["Header 2"],{:level=>2},[[:id, "header2"]]), md_el(:header,["Header 3"],{:level=>3},[[:id, "header3"]]), md_par([ "Then you can create links to different parts of the same document like this:" ]), md_par([ md_im_link(["Link back to header 1"], "#header1", nil), ", ", md_im_link(["Link back to header 2"], "#header2", nil), ", ", md_im_link(["Link back to header 3"], "#header3", nil) ]) ],{},[]) *** Output of to_html ***

    Header 1

    Header 2

    Header 3

    Then you can create links to different parts of the same document like this:

    Link back to header 1, Link back to header 2, Link back to header 3

    *** Output of to_latex *** \hypertarget{header1}{}\section*{{Header 1}}\label{header1} \hypertarget{header2}{}\subsection*{{Header 2}}\label{header2} \hypertarget{header3}{}\subsubsection*{{Header 3}}\label{header3} Then you can create links to different parts of the same document like this: \hyperlink{header1}{Link back to header 1}, \hyperlink{header2}{Link back to header 2}, \hyperlink{header3}{Link back to header 3} *** Output of to_md *** Header 1Header 2Header 3Then you can create links to different parts of the same document like this: Link back to header 1, Link back to header 2, Link back to header 3 *** Output of to_s *** Header 1Header 2Header 3Then you can create links to different parts of the same document like this:Link back to header 1, Link back to header 2, Link back to header 3 *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/pending/0000755000175000017500000000000011573154515017373 5ustar vincentvincentmaruku-0.6.0/tests/unittest/pending/empty_cells.md0000644000175000017500000000215111573154515022234 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** | | 1 | 2 | |----|----|----| | A | X | | | B | | X | *** Output of inspect *** md_el(:document,[ md_el(:table,[ md_el(:head_cell,[],{},[]), md_el(:head_cell,["1"],{},[]), md_el(:head_cell,["2"],{},[]), md_el(:cell,["A"],{},[]), md_el(:cell,["X"],{},[]), md_el(:cell,[],{},[]), md_el(:cell,["B"],{},[]), md_el(:cell,[],{},[]), md_el(:cell,["X"],{},[]) ],{:align=>[:left, :left, :left]},[]) ],{},[]) *** Output of to_html ***
    12
    AX
    BX
    *** Output of to_latex *** \begin{tabular}{l|l|l} &1&2\\ \hline A&X&\\ B&&X\\ \end{tabular} *** Output of to_md *** 12AXBX *** Output of to_s *** 12AXBX *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/pending/ref.md0000644000175000017500000000117411573154515020474 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** [a. b] is a link. [a. b]: http://site.com/ *** Output of inspect *** md_el(:document,[ md_par([md_link(["a. b"],"a_b"), " is a link."]), md_ref_def("a_b", "http://site.com/", {:title=>nil}) ],{},[]) *** Output of to_html ***

    a. b is a link.

    *** Output of to_latex *** \href{http://site.com/}{a. b} is a link. *** Output of to_md *** a. bis a link. *** Output of to_s *** a. b is a link. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/pending/amps.md0000644000175000017500000000104111573154515020651 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** @articles.map(&:title) *** Output of inspect *** md_el(:document,[md_el(:code,[],{:raw_code=>"@articles.map(&:title)"},[])],{},[]) *** Output of to_html ***
    @articles.map(&:title)
    *** Output of to_latex *** \begin{verbatim}@articles.map(&:title)\end{verbatim} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/pending/link.md0000644000175000017500000000415311573154515020655 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** *** Output of inspect *** md_el(:document,[ md_par([md_url("http://www.aa.com")]), md_par([md_url("http://www.bb.com")]), md_par([md_url("http://www.cc.com")]), md_par([md_url("http://www.dd.com")]), md_el(:code,[],{:raw_code=>""},[]), md_par([md_email("a@invalid.it")]), md_par([md_email("a@invalid.it")]), md_par([md_email("a@invalid.it")]), md_el(:code,[],{:raw_code=>""},[]) ],{},[]) *** Output of to_html ***

    http://www.aa.com

    http://www.bb.com

    http://www.cc.com

    http://www.dd.com

    <http://www.dd.com>

    a@invalid.it

    a@invalid.it

    a@invalid.it

    <a@invalid.it>
    *** Output of to_latex *** \href{http://www.aa.com}{http\char58\char47\char47www\char46aa\char46com} \href{http://www.bb.com}{http\char58\char47\char47www\char46bb\char46com} \href{http://www.cc.com}{http\char58\char47\char47www\char46cc\char46com} \href{http://www.dd.com}{http\char58\char47\char47www\char46dd\char46com} \begin{verbatim}\end{verbatim} \href{mailto:a@invalid.it}{a\char64invalid\char46it} \href{mailto:a@invalid.it}{a\char64invalid\char46it} \href{mailto:a@invalid.it}{a\char64invalid\char46it} \begin{verbatim}\end{verbatim} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/paragraph.md0000644000175000017500000000067511573154515020246 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** Paragraph *** Output of inspect *** md_el(:document,[md_par(["Paragraph"])],{},[]) *** Output of to_html ***

    Paragraph

    *** Output of to_latex *** Paragraph *** Output of to_md *** Paragraph *** Output of to_s *** Paragraph *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/unittest/test.md0000644000175000017500000000105311573154515017247 0ustar vincentvincentWrite a comment abouth the test here. *** Parameters: *** {} *** Markdown input: *** $ python *** Output of inspect *** md_el(:document,[md_el(:code,[],{:raw_code=>" $ python "},[])],{},[]) *** Output of to_html ***
           $ python       
    *** Output of to_latex *** \begin{verbatim} $ python \end{verbatim} *** Output of to_md *** *** Output of to_s *** *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/s5/0000755000175000017500000000000011573154515014417 5ustar vincentvincentmaruku-0.6.0/tests/s5/s5profiling.md0000644000175000017500000000223711573154515017206 0ustar vincentvincentsubtitle: news author: Andrea Censi company: Università La Sapienza css: math.css RDK news ======== Profiling --------------------------------------------------------- 1. `ragent2` writes profiling information on a pipe. 2. `rdk-profiler` reads the pipe and creates graphs in HTML+Javascript. 3. The user reads the data on a browser. Things logged ----------------------------------------------------------- 17288397 1730000 0 16384 END pantiltClient 17288439 1730000 0 16384 START pantiltClient 17288564 1730000 0 16384 LOCK pantiltClient:tilt 17288622 1730000 0 16384 UNLOCK pantiltClient:tilt * `START/END`: how much does it take to ...? Footnotes 1/2 --------------------------------------------------- You can use footnotes [^1] [^1]: And they work. Footnotes 2/2 --------------------------------------------------- Each footnote on its page [^2] [^2]: alone. And now: math! --------------------------------------------------- Consider, for example the group $\int_{a}^{b} x^{a} db$ of \[ \alpha_{\beta}^{\gamma} \] Unfortunately S5 and MathML are mutually exclusive. See for explanations.maruku-0.6.0/tests/math_usage/0000755000175000017500000000000011573154515016205 5ustar vincentvincentmaruku-0.6.0/tests/math_usage/document.md0000644000175000017500000000052211573154515020344 0ustar vincentvincentcss: math.css This is an example document. Inline: $a$, $b$, $q$ and stop. $$ \int_a^b f(x) dx $$ (1) See for example (eq:1). Equation inline: $ \int_a^b f(x) dx $ and that's it. Spacing: Maruku outputs sizes and alignment for images in `ex`. An `ex` is one `x`: x, $\textrm{x}$, $x$ should have the same height. maruku-0.6.0/tests/utf8-files/0000755000175000017500000000000011573154515016056 5ustar vincentvincentmaruku-0.6.0/tests/utf8-files/simple.md0000644000175000017500000000000311573154515017662 0ustar vincentvincent‡maruku-0.6.0/tests/bugs/0000755000175000017500000000000011573154515015030 5ustar vincentvincentmaruku-0.6.0/tests/bugs/complex_escaping.md0000644000175000017500000000144211573154515020673 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** What do you see here? `\\` it should be two backslashes. *** Output of inspect *** md_el(:document,[ md_par([ "What do you see here? ", md_code("\\\\"), " it should be two backslashes." ]) ],{},[]) *** Output of to_html ***

    What do you see here? \\ it should be two backslashes.

    *** Output of to_latex *** What do you see here? {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char92\char92}} it should be two backslashes. *** Output of to_md *** What do you see here? it should be two backslashes. *** Output of to_s *** What do you see here? it should be two backslashes. *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/bugs/code_in_links.md0000644000175000017500000000471611573154515020162 0ustar vincentvincentWrite a comment here *** Parameters: *** {} # params *** Markdown input: *** **This bug is now solved** Previously, a bug would not let you use `code` inside links text. So this: Use the [`syntax`][syntax] produces: > Use the [`syntax`][syntax] And this: Use the `[syntax][syntax]` produces: > Use the `[syntax][syntax]` [syntax]: http://gogole.com *** Output of inspect *** md_el(:document,[ md_par([md_strong(["This bug is now solved"])]), md_par([ "Previously, a bug would not let you use ", md_code("code"), " inside links text." ]), md_par([ "So this: Use the ", md_link([md_code("syntax")],"syntax"), " produces:" ]), md_el(:quote,[md_par(["Use the ", md_link([md_code("syntax")],"syntax")])],{},[]), md_par(["And this: Use the ", md_code("[syntax][syntax]"), " produces:"]), md_el(:quote,[md_par(["Use the ", md_code("[syntax][syntax]")])],{},[]), md_ref_def("syntax", "http://gogole.com", {:title=>nil}) ],{},[]) *** Output of to_html ***

    This bug is now solved

    Previously, a bug would not let you use code inside links text.

    So this: Use the syntax produces:

    Use the syntax

    And this: Use the [syntax][syntax] produces:

    Use the [syntax][syntax]

    *** Output of to_latex *** \textbf{This bug is now solved} Previously, a bug would not let you use {\colorbox[rgb]{1.00,0.93,1.00}{\tt code}} inside links text. So this: Use the \href{http://gogole.com}{{\colorbox[rgb]{1.00,0.93,1.00}{\tt syntax}}} produces: \begin{quote}% Use the \href{http://gogole.com}{{\colorbox[rgb]{1.00,0.93,1.00}{\tt syntax}}} \end{quote} And this: Use the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char91syntax\char93\char91syntax\char93}} produces: \begin{quote}% Use the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char91syntax\char93\char91syntax\char93}} \end{quote} *** Output of to_md *** This bug is now solved Previously, a bug would not let you use inside links text. So this: Use the produces: Use the And this: Use the produces: Use the *** Output of to_s *** This bug is now solvedPreviously, a bug would not let you use inside links text.So this: Use the produces:Use the And this: Use the produces:Use the *** EOF *** OK! *** Output of Markdown.pl *** (not used anymore) *** Output of Markdown.pl (parsed) *** (not used anymore)maruku-0.6.0/tests/others/0000755000175000017500000000000011573154515015374 5ustar vincentvincentmaruku-0.6.0/tests/others/code3.md0000644000175000017500000000017311573154515016714 0ustar vincentvincent This is code (4 spaces): Code This is not code Code This is code (1 tab): Code This is not code Code maruku-0.6.0/tests/others/blank.md0000644000175000017500000000002111573154515016776 0ustar vincentvincent Linea 1 Linea 2maruku-0.6.0/tests/others/code.md0000644000175000017500000000013111573154515016623 0ustar vincentvincentHere is an example of AppleScript: tell application "Foo" beep end tell maruku-0.6.0/tests/others/escaping.md0000644000175000017500000000053411573154515017511 0ustar vincentvincent Hello: ! \! \` \{ \} \[ \] \( \) \# \. \! * \* Ora, *emphasis*, **bold**, * <- due asterischi-> * , un underscore-> _ , _emphasis_, incre*dible*e! This is ``Code with an escape: -> ` <- `` (after) This is ```Code with a special: -> ` <- ```(after) `Start ` of paragraph End of `paragraph ` Exactly one space: ` ` and also here: `` ``maruku-0.6.0/tests/others/images.md0000644000175000017500000000131311573154515017161 0ustar vincentvincent This page does not utilizes ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss) Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss 'Title ok!') I'll say it one more time: this page does not use ![Cascading Style Sheets] [css] This is double size: ![Cascading Style Sheets] [css2] [css]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" [css2]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" class=external style="border:0;width:188px;height:131px" maruku-0.6.0/tests/others/sss06.md0000644000175000017500000004044311573154515016701 0ustar vincentvincentCategory: sss06 Date: Sep 10 2006 From: "Andrea Censi" Subject: A report about Oxford and the 2006 SLAM Summer School Encoding: BlueCloth FlickrHTML format: bluecloth> inMenu: true Let me quote the words of a renowned Oxford scholar: > "Life is too important to be taken seriously." If you do not wholeheartedly agree with this statement, please stop reading this. ---------------------- I stayed three weeks in Oxford: one week for the SLAM school and, before that, two weeks for an English course. You might ask: why? A very good question indeed - "Why I am not on a sunny beach?" - I kept asking myself as I walked down the misty alleys of the old town, wearing a scarf on August, 16th, and realizing that - maybe - I would not need the three pairs of shorts and the swimsuit I had brought. Summary: 1. The Queen's English 2. The Harry Potter experience 3. Parsnip, Marmite and the tea conspiracy 4. The Summer School 5. Minor open issues in SLAM > Appendix: How to offend seven nationalities at once `I`. The Queen's English ---------------------- It turns out that a course of English at an advanced level is mostly about vocabulary and idioms: by the end of the first week I knew seven different ways to address a "promiscuous" woman, and I can tell which ones are applicable to American and which to British English. It remains to be seen how this will benefit my academic writing. It was a lot of fun to learn the differences (or, as the teacher put it, "to purify my English after years of prolonged unhealthy exposure to American media"), which are not only linguistic, but above all in attitude and social norms. For example, in the US the first question that people ask you is "What do you do?" (meaning: "How much do you earn?"), while in England such a question would be felt as unnecessary direct and impolite. As a rule, it is compulsory to exchange comments about the weather, and there is a lot of specialized vocabulary for this; the following table might prove handy to understand your acquaintance: - "It's a lovely day!" = "It doesn't rain" - "It's a nice day!" = "It doesn't rain heavily" - "What a wonderful day!"="This morning, at 10:13, I caught a glimpse of the sun" (the correct answer to any of these is "isn't it?") `II`. The Harry Potter experience ------------------------- flickr: http://www.flickr.com/photos/censi/232006603/ During my three-week stay I tried my best to immerse myself in the English atmosphere. I went to a place called Oxford Story [3], where we paid £7 to go through a painfully slow indoor ride, sat on a mobile school-desk in the dark for 25 minutes. It is the claustrophobic equivalent of the American Epcot center in Disney World. At Epcot, I learned that the final goal of all the scientific progress in the last three millennia was to let Walt Disney broadcast Snow White using Siemens equipment (Siemens sponsored the ride). In Oxford, I learned that the glorious University is the repository of all human knowledge, and that the English understatement is a legend. At the end of the ride, I was amazed that in Italy I had managed to learn to read and write. flickr: http://www.flickr.com/photos/censi/232023681/ Still, one thing the ride did not explain is how the well-educated, smart elite students of Oxford can possibly find rowing fun -- (probably it IS fun, compared to cricket). flickr: http://www.flickr.com/photos/censi/232529032/ I went to a candle-light baroque concert in the Exeter college chapel. The ensemble was 75% Asian, all Oxford researchers, and we were given a twenty minute speech about the effort they put in the historical research of this obscure composer, that they had a microfilm of the original manuscript delivered from a German library, that the viola would be played in the original style, blah blah blah. Only in Oxford! flickr: http://www.flickr.com/photos/censi/232031895/ I read "The Hobbit" (Tolkien was a fellow of Exeter college) - I discovered that the only two peoples in the known and invented universes to have the concept of a "second breakfast" are Hobbits and Italians. I watched a performance of MacBeth at an open-air theatre. I couldn't understand but one sentence, which is worth mentioning: "Alcohol provokes the desire, but it takes away the performance" Regarding alcohol, England is one of the places where you can't drink if you are under 21 (in Italy, at 18 you have decided to quit). Young people have their ID checked at the entrance of pubs and in liquor stores: that's only a minor annoyance, as they just need to wait outside the store for the first Spanish guy passing by that will buy the wine for them (and be compensated with just the change - did you keep the penny, Felix?). Anyway the guys at the door use the ID checking mostly as a form of flattery: "You are 32? I thought you were 20!" is probably the best pick-up line that the English can come up with. The other characteristic thing is that in English pubs there is no table service: you have to walk to the bar and ask by yourself. The first time can be confusing: and you can spend quite some time waiting at the table whining about the "poor service". `III`. Parsnip, Marmite & the tea conspiracy --------------------------------------------- During the first week I was a guest of a lovely 79-year-old lady. Working at the University, she made a point of speaking very posh English. And she made a point of cooking traditional English food. The typical English dish is some meat with two vegetables aside. For the vegetables, pick any two in {parsnip, carrot, potato}. Don't look in your dictionary for a translation of "parsnip" as probably there isn't one. The lady would tell me that in the next-to-last century, this famous professor spent years raising the finest crossbreed of Parsnip as to finally obtain what is best described as a big white carrot with no taste whatsoever [4]. Nevertheless, the many regional variants give spectacular variety to the English cuisine: the two vegetables can be boiled, fried, baked, microwaved, or roasted. There exist also exotic twists, in which the vegetables are put on top of the meat, or underneath, or even inside. In important occasions, the recipes stay the same but gain a French name. flickr: http://www.flickr.com/photos/censi/232526897/ I tried a thing called Marmite, which the teacher sold to me as "the British answer to Nutella". It has the aspect and consistency of engine grease, and, as far as I know, also the taste is similar (I've never tasted the grease, but next time, presented with choice, I'd give it a go). The austerity of English food can be explained by the pitiless weather; but how can you explain Marmite, if not with alimentary masochism? But... there's one thing that is much better in England: tea. Wherever I tried it (at the old lady's, at tearooms, at coffee breaks) it was sooo delicious. In Italy we don't get the real thing. Why is that? Is this some sort of conspiracy orchestrated by the Italian coffee producers? And is it the tea cartello which does not allow good coffee to be imported in England? `IV`. The Summer School --------------------- If you go for a career in research, in general you don't get much money, or fame, and you don't get to rescue the princess either. The two benefits that you do get are: playing with very expensive toys and the occasional trip in which you meet all sort of people. And when you talk with them, it's sort of strange to realize that your interlocutor is one of the 5 people - worldwide - that actually care about your research theme, and yet the things you have in common end there, as he has different culture, race, religion, and while you two happen to agree that Lie brackets are an indispensable tool to characterize the propagation of errors on the Euclidean group, you have very different answers to the important questions about life, the universe and everything. (In these cases I have anecdotal proof that it is much better to stick to research talk, and to avoid at all costs the kind of jokes that you can find in the Appendix). Instead, at this particular school, I would say that the European character was clearly perceived, and I enjoyed it -- but whether England is in Europe is a delicate matter. Here are some impressions of the people. * Juan Domingo Tardos (aka Mingo) is the funniest of the bunch, the man you want to go partying with. He taught us two deep truths about SLAM and life: 1. The size of your banana matters. 2. Never under-estimate the size of your lemons. I thought: wow, I want to write a paper with "banana" in the title - finally some inspiration from the school! I already had big projects for Fig. 1,2 and a full-page Fig. 3, but after a little googling I found: "Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire"[5] "Dealing with large bananas" [6]. I gave up: I cannot beat this last one. And the existence of [6] proves once again that SLAM is a solved problem. * Paul Newman, the organizer, told us, more than once, that the future of SLAM is in long term operation if we want the systems to be reliable. (Personally, I disagree: I think that it is possible to build anything at the desired level of reliability, given reasonable funding, time, and an appropriate number of German engineers) * One of the lessons learned in the school is that almost everything has already been done by someone else. More specifically, most of the things have already been done by Durrant-Whyte some twenty years ago, when men were men, CS was electrical engineering, master students knew calculus, and Kalman filters ran free in the wild lands of Australia. * Frank Dellaert is a jolly chap as well, and he does interesting things with graphs. As he introduced three different formalisms in the first three slides, I regretted not to have put more CS in my curriculum, then shut my eyes. Interestingly, at summer schools and conferences, if you close your eyes people assume that you are very smart and that you are thinking about some new impressive algorithm -- I was just dreaming of a sunny beach. * Henrik Christensen has implemented SLAM on the cleaning robot for $45 in sensors and electronics. It puts things in perspective, especially if you consider that I paid £16 for a one-hour coach trip from Heathrow to Oxford. * Andy Davison is a wonderful person, he tutored the practicals with infinite patience. Never did I meet such a knowledgeable, affable, and humble person. (Probably he is the kind of person that some day will show up at work with automatic guns) * Wolfram Burgard - he wins my "best robot" award for the photo of our beloved Albert [7]. * Dieter Fox wins "most nostalgic slide from the 90s": and every time we feel the same emotion as the first time. * Kurt Konolige reminded me why I bought a Mac. * Simon Lacroix - Once we sat at the same table during lunch. While he talked with Dellaert, he would send me alarmed glances, the kind of glances that you would reserve to a relative returning from death. I wanted to ask him why, but then I decided I'd better not to (was I so wasted from the night before?). * Simon Julier -- he seems very smart, but he lost me between slide #3 and #4. I started to be seasick from all those covariance matrices - so I muttered to my neighbours: "I wonder whether it still holds in higher-dimensional spaces...", then I closed my eyes and was back again on the sunny beach. * But all in all, the most interesting presentation was the magical show that Davide Scaramuzza (who at daytime pretends to work at ETHZ) gave to a selected audience after the banquet ([8]). It was another confirmation that all the time spent in front of a monitor is, in fact, wasted, and all of us should have studied card tricks instead: you have NO IDEA of how a girl's face brightens up and her eyes expand when she watches a magician. `V`. Other minor issues in SLAM -------------------------------- We all know that the most important open problem in SLAM is that there are not enough women doing research in the area and coming at summer schools. As for the other minor issues, this is the result of asking "What is the future of SLAM?" to a random sampling of the participants. (the list does not include answers given after 10:00 PM) - For 30% of the respondents, SLAM is a solved problem, and we just need some German engineers to work out the details of the implementations. - Long term operation: make filters that reconsider their decisions at a a later time (so not delaying decisions, but explicitly reconsider). - Make it robust for real applications: or, your method should work in more than one experiment and possibly also outside of your lab. - Put more knowledge in SLAM about the environment. Teach your filter what is a tree, a road, a mirror so that it can make smarter decisions. - Active SLAM and SLAM-guided exploration (once we figure out good acronyms). - Some boring work is to be done for taking into account linearization errors in the already existing results about consistency, sparsity, etc. - "Where can I get some real coffee?" (2 people) - Methods and representations for real sensor fusion (laser, camera, etc). - Do robust stuff with a single camera. Omnidirectional cameras are cool. Mix different techniques at different time-scales: visual odometry between frames, then stable features, then databases of places to close the loop (or don't close the loop at all). Appendix. How to offend seven nationalities at once -------------------------------------------------- In Oxford I learned the ultimate rude stereotypical joke -- I think it's worth sharing. > **Heaven & Hell** > > *In Heaven*: the policemen are British, mechanics are German, chefs are French, > wives are Japanese, neighbours are Dutch, lovers are Italian, > and the Swiss organize it all. > > *In Hell*: the policemen are German, mechanics are French, chefs are British, > neighbours are Japanese, wives are Dutch, lovers are Swiss, > and the Italians organize it all. For related work, see for example [9], [10]. And here's the research version: > **The BEST international research project** > > - The French do the overall math analysis, > - a Chinese refines a ten-line proof of the main Theorem, > - the Germans design the implementation, > - Japanese undergrads do the actual work, > - the British write the paper, > - an American gives the presentation, > - the Spanish organize the social events, > - and the Italians organize the banquet. > > **The WORST international research project** > > - The Germans do the overall math analysis, > - an American PhD student spends 10 CPU year on his department's 48-node > cluster and proves with a Monte Carlo simulation in Matlab that > Theorem 1 indeed holds for some values of the parameters, > - the French design the implementation, > - one Spanish undergrad does the actual work, > - the Italians write the papers, > - a Chinese gives the presentation, > - the Japanese organize the social events, > - and the British organize the banquet. `:-)` Flickr: References ---------- \[1\] [http://www.spellingsociety.org/news/media/poems.php](http://www.spellingsociety.org/news/media/poems.php) \[2\] dde [http://www.flickr.com/photos/censi/236722418/](http://www.flickr.com/photos/censi/236722418/) \[3\] [http://www.oxfordstory.co.uk](http://www.oxfordstory.co.uk) \[4\] [http://www.botanical.com/botanical/mgmh/p/parsni12.html](http://www.botanical.com/botanical/mgmh/p/parsni12.html ) \[5\] E. Meijer, M. Fokkinga, R. Paterson. "Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire" (1991) [http://citeseer.ist.psu.edu/meijer91functional.html](http://citeseer.ist.psu.edu/meijer91functional.html) \[6\] R. Lammel, J. Visser, J. Kort. "Dealing with large bananas" (2000) \[7\] [http://www.informatik.uni-freiburg.de/~burgard/](http://citeseer.ist.psu.edu/lammel00dealing.html) \[8\] [http://asl.epfl.ch/~scaramuz/cabaret/cabaret.wmv](http://asl.epfl.ch/~scaramuz/cabaret/cabaret.wmv) \[9\] [http://www.anth.uconn.edu/faculty/boster/cultvar/euweb/](http://www.anth.uconn.edu/faculty/boster/cultvar/euweb/) \[10\] [http://www.infonegocio.com/xeron/bruno/italy.html](http://www.infonegocio.com/xeron/bruno/italy.html) maruku-0.6.0/tests/others/lists_after_paragraph.md0000644000175000017500000000135511573154515022266 0ustar vincentvincentParagraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space: * ciao Paragraph (3 spaces after), list with no space: * ciao Paragraph with block quote: > Quoted Paragraph with header: ### header ### Paragraph with header on two lines: header ------ Paragraph with html after
    Paragraph with html after, indented: Emphasis Paragraph with html after, indented: Emphasis *tralla* Emph Paragraph with html after, indented: Emphasis *tralla* Emph maruku-0.6.0/tests/others/lists_ol.md0000644000175000017500000000230711573154515017550 0ustar vincentvincent1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora 1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! - Uno - Due 1. tre 1. tre 1. tre - Due 2. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Another item in the same list.maruku-0.6.0/tests/others/entities.md0000644000175000017500000000060011573154515017536 0ustar vincentvincentMaruku translates HTML entities to the equivalent in LaTeX: Entity | Result ------------|---------- `©` | © `£` | £ `a b` | a b `λ` | λ `—` | — Entity-substitution does not happen in code blocks or inline code. The following should not be translated: © It should read just like this: `©`. maruku-0.6.0/tests/others/abbreviations.md0000644000175000017500000000026611573154515020552 0ustar vincentvincent The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Operation Tigra Genesis is going well. *[Tigra Genesis]:maruku-0.6.0/tests/others/list1.md0000644000175000017500000000013111573154515016745 0ustar vincentvincent* A list item with a blockquote: > This is a blockquote > inside a list item. maruku-0.6.0/tests/others/paragraphs.md0000644000175000017500000000015211573154515020044 0ustar vincentvincentParagraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Paragraph Br-> Paragraph 5 Escaping: & { } [ ] ! maruku-0.6.0/tests/others/code2.md0000644000175000017500000000027711573154515016720 0ustar vincentvincent> ## This is a header. > > 1. This is the first list item. > 2. This is the second list item. > > Here's some example code: > > return shell_exec("echo $input | $markdown_script");maruku-0.6.0/tests/others/email.md0000644000175000017500000000006111573154515017002 0ustar vincentvincent This is an email address: maruku-0.6.0/tests/others/misc_sw.md0000644000175000017500000001054311573154515017365 0ustar vincentvincentSubject: Software not painful to use Subject_short: painless software Topic: /misc/coolsw Archive: no Date: Nov 20 2006 Order: -9.5 inMenu: true ### General ### * *Operating System* : [Mac OS X][switch]: heaven, after the purgatory of Linux and the hell of Windows. * *Browser*: [Firefox][firefox]. On a Mac, [Camino][camino]. * *Email*: [GMail][gmail], "search, don't sort" really works. * *Text Editor*: [TextMate][textmate], you have to buy it, but it's worth every penny. There are rumours that it's been converting (recovering) Emacs users (addicts). Unfortunately, it's Mac only. An alternative is [jedit][jedit] (GPL, Java). ### Development ### * *Build system*: [cmake][cmake], throw the [autotools][autotools] away. * *Source code control system*: ditch CVS for [subversion][subversion]. * *Project management*: [Trac][trac] tracks everything. * *Scripting language*: [Ruby][ruby] is Japanese pragmatism (and has a [poignant][poignant] guide). Python, you say? Python is too academic and snob: $ python Python 2.4.1 (\#1, Jun 4 2005, 00:54:33) Type "help", "copyright", "credits" or "license" for more information. >>> exit 'Use Ctrl-D (i.e. EOF) to exit.' >>> quit 'Use Ctrl-D (i.e. EOF) to exit.' * *Java IDE*: [JBuilder][jbuilder] is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained [generics][java-generics] and got opensourced. * *Mark-up language*: HTML is so 2001, why don't you take at look at [Markdown][markdown]? [Look at the source of this page](data/misc_markdown.png). * *C++ libraries*: * [QT][qt] for GUIs. * [GSL][gsl] for math. * [Magick++][magick] for manipulating images. * [Cairo][cairo] for creating PDFs. * [Boost][boost] for just about everything else. ### Research ### * *Writing papers*: [LaTeX][latex] * *Writing papers & enjoying the process*: [LyX][lyx] * *Handsome figures in your papers*: [xfig][xfig] or, better, [jfig][jfig]. * *The occasional presentation with many graphical content*: [OpenOffice Impress][impress] (using the [OOOlatex plugin][ooolatex]); the alternative is PowerPoint with the [TexPoint][texpoint] plugin. * *Managing BibTeX*: [jabref][jabref]: multi-platform, for all your bibtex needs. * *IEEExplore and BibTeX*: convert citations using [BibConverter][bibconverter]. ### Cool websites ### * *Best site in the wwworld*: [Wikipedia][wikipedia] * [Mutopia][mutopia] for sheet music; [the Gutenberg Project][gutenberg] for books; [LiberLiber][liberliber] for books in italian. * *Blogs*: [Bloglines][bloglines] * *Sharing photos*: [flickr][flickr] exposes an API you can use. [firefox]: http://getfirefox.com/ [gmail]: http://gmail.com/ [bloglines]: http://bloglines.com/ [wikipedia]: http://en.wikipedia.org/ [ruby]: http://www.ruby-lang.org/ [poignant]: http://poignantguide.net/ruby/ [webgen]: http://webgen.rubyforge.org/ [markdown]: http://daringfireball.net/projects/markdown/ [latex]: http://en.wikipedia.org/wiki/LaTeX [lyx]: http://www.lyx.org [impress]: http://www.openoffice.org/product/impress.html [ooolatex]: http://ooolatex.sourceforge.net/ [texpoint]: http://texpoint.necula.org/ [jabref]: http://jabref.sourceforge.net/ [camino]: http://www.caminobrowser.org/ [switch]: http://www.apple.com/getamac/ [textmate]: http://www.apple.com/getamac/ [cmake]: http://www.cmake.org/ [xfig]: http://www.xfig.org/ [jfig]: http://tams-www.informatik.uni-hamburg.de/applets/jfig/ [subversion]: http://subversion.tigris.org [jbuilder]: http://www.borland.com/us/products/jbuilder/index.html [flickr]: http://www.flickr.com/ [myflickr]: http://www.flickr.com/photos/censi [bibconverter]: http://www.bibconverter.net/ieeexplore/ [autotools]: http://sources.redhat.com/autobook/ [jedit]: http://www.jedit.org/ [qt]: http://www.trolltech.no/ [gsl]: http://www.gnu.org/software/gsl/ [magick]: http://www.imagemagick.org/Magick++/ [cairo]: http://cairographics.org/ [boost]: http://www.boost.org/ [markdown]: http://en.wikipedia.org/wiki/Markdown [trac]: http://trac.edgewall.org/ [mutopia]: http://www.mutopiaproject.org/ [liberliber]: http://www.liberliber.it/ [gutenberg]: http://www.gutenberg.org/ [java-generics]: http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html maruku-0.6.0/tests/others/list3.md0000644000175000017500000000022611573154515016754 0ustar vincentvincent* A list item with a blockquote: > This is a blockquote > inside a list item. * A list item with a code block: maruku-0.6.0/tests/others/footnotes.md0000644000175000017500000000050711573154515017740 0ustar vincentvincentThat's some text with a footnote [^b] and another [^c] and another [^a]. [^a]: And that's the footnote. That's the second paragraph of the footnote. [^b]: And that's the footnote. This is second sentence (same paragraph). [^c]: This is the very long one. That's the second paragraph. This is not a footnote.maruku-0.6.0/tests/others/list2.md0000644000175000017500000000031211573154515016747 0ustar vincentvincent* This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. maruku-0.6.0/tests/others/extra_dl.md0000644000175000017500000000263711573154515017530 0ustar vincentvincentCSS: style.css Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. *** Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. *** Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. : An american computer company. Orange : The fruit of an evergreen tree of the genus Citrus. *** Term 1 Term 2 : Definition a Term 3 : Definition b *** Term 1 Term 2 Term 2a Term 2b : Definition a Term 3 : Definition b *** Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. *** Term 1 : This is a definition with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. : Second definition for term 1, also wrapped in a paragraph because of the blank line preceding it. Term 2 : This definition has a code block, a blockquote and a list. code block. > block quote > on two lines. 1. first list item 2. second list item *** Term 1 Term 2 Term 2a Term 2b : Definition a This is a paragraph This is a term : definitionmaruku-0.6.0/tests/others/one.md0000644000175000017500000000001011573154515016466 0ustar vincentvincentOne linemaruku-0.6.0/tests/others/hrule.md0000644000175000017500000000010311573154515017027 0ustar vincentvincent* * * *** ***** - - - --------------------------------------- maruku-0.6.0/tests/others/lists.md0000644000175000017500000000217211573154515017056 0ustar vincentvincent* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! * Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Another item in the same list.maruku-0.6.0/tests/others/headers.md0000644000175000017500000000020711573154515017330 0ustar vincentvincentA title with *emphasis* ======================= A title with *emphasis* ----------------------- #### A title with *emphasis* #### maruku-0.6.0/tests/others/links.md0000644000175000017500000000147611573154515017046 0ustar vincentvincent Search on [Google][] Search on [Google] [] Search on [Google] [google] Search on [Google] [Google] Search on [Google images][] Search on [Google images][ GoOgle_search ] Inline: [Google images](http://google.com) Inline with title: [Google images](http://google.com "Title") Inline with title: [Google images]( http://google.com "Title" ) Search on or or ask or you might ask bill@google.com. If all else fails, ask [Google](http://www.google.com) [google]: http://www.google.com [google2]: http://www.google.com 'Single quotes' [google3]: http://www.google.com "Double quotes" [google4]: http://www.google.com (Parenthesis) [Google Search]: http://www.google.com "Google search" [Google Images]: http://images.google.com (Google images)maruku-0.6.0/tests/others/extra_table1.md0000644000175000017500000000130611573154515020271 0ustar vincentvincentCSS: style.css First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell *** | Item | Value | | --------- | -----:| | Computer | $1600 | | Phone | $12 | | Pipe | $1 | *** | Function name | Description | | ------------- | ------------------------------ | | `help()` | Display the help window. | | `destroy()` | **Destroy your computer!** | *** | Very long long head | | :------------ | | left | *** | Very long long head | | -------------------: | | right | *** | Very long long head | | :------------------: | | center |maruku-0.6.0/tests/others/inline_html.md0000644000175000017500000000155111573154515020222 0ustar vincentvincentCSS: style.css Input: Emphasis Result: Emphasis Input: Result on span: Result alone: Without closing:
    This is *true* markdown text (paragraph)

    This is *true* markdown text (no paragraph)

    This is *true* markdown text. (no par) This is *true* markdown text. (par)
    The following is invalid HTML, and will generate an error:
    This is *true* markdown text. (no par) This is *true* markdown text. (par)
    maruku-0.6.0/tests/others/extra_header_id.md0000644000175000017500000000045211573154515021026 0ustar vincentvincentHeader 1 {#header1} ======== Header 2 {#header2} -------- ### Header 3 ### {#header3} Then you can create links to different parts of the same document like this: [Link back to header 1](#header1), [Link back to header 2](#header2), [Link back to header 3](#header3) maruku-0.6.0/tests/others/test.md0000644000175000017500000000003611573154515016674 0ustar vincentvincent $ python maruku-0.6.0/tests/math/0000755000175000017500000000000011573154515015021 5ustar vincentvincentmaruku-0.6.0/tests/math/syntax.md0000644000175000017500000000170111573154515016670 0ustar vincentvincentLaTeX preamble: preamble.tex CSS: math.css Here are some formulas: * $\alpha$ * $x^{n}+y^{n} \neq z^{n}$ Some inline maths: $\sum_{n=1}^\infty \frac{(-1)^n}{n} = \ln 2$. Some display maths: \[ \sum_{n=1}^\infty \frac{1}{n} \] \[ \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{ exists.} \] (a) Some random AMSTeX symbols - thanks to Robin Snader for adding these: $$ \beth \Subset \bigtriangleup \smallsmile \bumpeq \ggg \pitchfork $$ Note that $\hat g$ , $J$, and $\gamma_1\gamma_2$ all restrict to $x_1 \overline{x_2} \oplus x_2 \overline{x_1}$ and that this module is linear in $x_1$ and $x_2$. See label \eqref{a}. $$ \href{#hello}{\alpha+\beta} $$ ## Cross references ## The following are 4 equations, labeled A,B,C,D: $$ \alpha $$ (A) \[ \beta \] (B) $$ \gamma \label{C} $$ \[ \delta \label{D} \] You can now refer to (eq:A), (eq:B), \eqref{C}, \eqref{D}. maruku-0.6.0/metadata.yml0000644000175000017500000001554211573154515015240 0ustar vincentvincent--- !ruby/object:Gem::Specification name: maruku version: !ruby/object:Gem::Version version: 0.6.0 platform: ruby authors: - Andrea Censi autorequire: maruku bindir: bin cert_chain: [] date: 2009-05-04 00:00:00 -07:00 default_executable: dependencies: - !ruby/object:Gem::Dependency name: syntax version_requirement: version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.0.0 version: description: Maruku is a Markdown interpreter in Ruby. It features native export to HTML and PDF (via Latex). The output is really beautiful! email: andrea@rubyforge.org executables: - maruku - marutex extensions: [] extra_rdoc_files: [] files: - lib/maruku/attributes.rb - lib/maruku/defaults.rb - lib/maruku/errors_management.rb - lib/maruku/ext/div.rb - lib/maruku/ext/math/elements.rb - lib/maruku/ext/math/latex_fix.rb - lib/maruku/ext/math/mathml_engines/blahtex.rb - lib/maruku/ext/math/mathml_engines/itex2mml.rb - lib/maruku/ext/math/mathml_engines/none.rb - lib/maruku/ext/math/mathml_engines/ritex.rb - lib/maruku/ext/math/parsing.rb - lib/maruku/ext/math/to_html.rb - lib/maruku/ext/math/to_latex.rb - lib/maruku/ext/math.rb - lib/maruku/helpers.rb - lib/maruku/input/charsource.rb - lib/maruku/input/extensions.rb - lib/maruku/input/html_helper.rb - lib/maruku/input/linesource.rb - lib/maruku/input/parse_block.rb - lib/maruku/input/parse_doc.rb - lib/maruku/input/parse_span_better.rb - lib/maruku/input/rubypants.rb - lib/maruku/input/type_detection.rb - lib/maruku/input_textile2/t2_parser.rb - lib/maruku/maruku.rb - lib/maruku/output/s5/fancy.rb - lib/maruku/output/s5/to_s5.rb - lib/maruku/output/to_html.rb - lib/maruku/output/to_latex.rb - lib/maruku/output/to_latex_entities.rb - lib/maruku/output/to_latex_strings.rb - lib/maruku/output/to_markdown.rb - lib/maruku/output/to_s.rb - lib/maruku/string_utils.rb - lib/maruku/structures.rb - lib/maruku/structures_inspect.rb - lib/maruku/structures_iterators.rb - lib/maruku/tests/benchmark.rb - lib/maruku/tests/new_parser.rb - lib/maruku/tests/tests.rb - lib/maruku/textile2.rb - lib/maruku/toc.rb - lib/maruku/usage/example1.rb - lib/maruku/version.rb - lib/maruku.rb - docs/changelog.md - docs/div_syntax.md - docs/entity_test.md - docs/markdown_syntax.md - docs/maruku.md - docs/math.md - docs/other_stuff.md - docs/proposal.md - tests/bugs/code_in_links.md - tests/bugs/complex_escaping.md - tests/math/syntax.md - tests/math_usage/document.md - tests/others/abbreviations.md - tests/others/blank.md - tests/others/code.md - tests/others/code2.md - tests/others/code3.md - tests/others/email.md - tests/others/entities.md - tests/others/escaping.md - tests/others/extra_dl.md - tests/others/extra_header_id.md - tests/others/extra_table1.md - tests/others/footnotes.md - tests/others/headers.md - tests/others/hrule.md - tests/others/images.md - tests/others/inline_html.md - tests/others/links.md - tests/others/list1.md - tests/others/list2.md - tests/others/list3.md - tests/others/lists.md - tests/others/lists_after_paragraph.md - tests/others/lists_ol.md - tests/others/misc_sw.md - tests/others/one.md - tests/others/paragraphs.md - tests/others/sss06.md - tests/others/test.md - tests/s5/s5profiling.md - tests/unittest/abbreviations.md - tests/unittest/alt.md - tests/unittest/attributes/att2.md - tests/unittest/attributes/att3.md - tests/unittest/attributes/attributes.md - tests/unittest/attributes/circular.md - tests/unittest/attributes/default.md - tests/unittest/blank.md - tests/unittest/blanks_in_code.md - tests/unittest/bug_def.md - tests/unittest/bug_table.md - tests/unittest/code.md - tests/unittest/code2.md - tests/unittest/code3.md - tests/unittest/data_loss.md - tests/unittest/divs/div1.md - tests/unittest/divs/div2.md - tests/unittest/divs/div3_nest.md - tests/unittest/easy.md - tests/unittest/email.md - tests/unittest/encoding/iso-8859-1.md - tests/unittest/encoding/utf-8.md - tests/unittest/entities.md - tests/unittest/escaping.md - tests/unittest/extra_dl.md - tests/unittest/extra_header_id.md - tests/unittest/extra_table1.md - tests/unittest/footnotes.md - tests/unittest/hang.md - tests/unittest/headers.md - tests/unittest/hex_entities.md - tests/unittest/hrule.md - tests/unittest/html2.md - tests/unittest/html3.md - tests/unittest/html4.md - tests/unittest/html5.md - tests/unittest/ie.md - tests/unittest/images.md - tests/unittest/images2.md - tests/unittest/inline_html.md - tests/unittest/inline_html2.md - tests/unittest/links.md - tests/unittest/links2.md - tests/unittest/list1.md - tests/unittest/list12.md - tests/unittest/list2.md - tests/unittest/list3.md - tests/unittest/list4.md - tests/unittest/lists.md - tests/unittest/lists10.md - tests/unittest/lists11.md - tests/unittest/lists6.md - tests/unittest/lists9.md - tests/unittest/lists_after_paragraph.md - tests/unittest/lists_ol.md - tests/unittest/loss.md - tests/unittest/math/equations.md - tests/unittest/math/inline.md - tests/unittest/math/math2.md - tests/unittest/math/notmath.md - tests/unittest/math/table.md - tests/unittest/math/table2.md - tests/unittest/misc_sw.md - tests/unittest/notyet/escape.md - tests/unittest/notyet/header_after_par.md - tests/unittest/notyet/ticks.md - tests/unittest/notyet/triggering.md - tests/unittest/olist.md - tests/unittest/one.md - tests/unittest/paragraph.md - tests/unittest/paragraph_rules/dont_merge_ref.md - tests/unittest/paragraph_rules/tab_is_blank.md - tests/unittest/paragraphs.md - tests/unittest/pending/amps.md - tests/unittest/pending/empty_cells.md - tests/unittest/pending/link.md - tests/unittest/pending/ref.md - tests/unittest/recover/recover_links.md - tests/unittest/red_tests/abbrev.md - tests/unittest/red_tests/lists7.md - tests/unittest/red_tests/lists7b.md - tests/unittest/red_tests/lists8.md - tests/unittest/red_tests/xml.md - tests/unittest/references/long_example.md - tests/unittest/references/spaces_and_numbers.md - tests/unittest/smartypants.md - tests/unittest/syntax_hl.md - tests/unittest/table_attributes.md - tests/unittest/test.md - tests/unittest/underscore_in_words.md - tests/unittest/wrapping.md - tests/unittest/xml2.md - tests/unittest/xml3.md - tests/unittest/xml_instruction.md - tests/utf8-files/simple.md - bin/marudown - bin/maruku - bin/marutest - bin/marutex - unit_test_block.sh - unit_test_span.sh - Rakefile - maruku_gem.rb has_rdoc: false homepage: http://maruku.rubyforge.org post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: "0" version: required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: "0" version: requirements: [] rubyforge_project: rubygems_version: 1.0.1 signing_key: specification_version: 2 summary: Maruku is a Markdown-superset interpreter written in Ruby. test_files: [] maruku-0.6.0/Rakefile0000644000175000017500000000343611573154515014401 0ustar vincentvincentrequire 'rubygems' Gem::manage_gems require 'rake/gempackagetask' require 'maruku_gem' task :default => [:package] Rake::GemPackageTask.new($spec) do |pkg| pkg.need_zip = true pkg.need_tar = true end PKG_NAME = 'maruku' PKG_FILE_NAME = "#{PKG_NAME}-#{MaRuKu::Version}" RUBY_FORGE_PROJECT = PKG_NAME RUBY_FORGE_USER = 'andrea' RELEASE_NAME = MaRuKu::Version RUBY_FORGE_GROUPID = '2795' RUBY_FORGE_PACKAGEID = '3292' desc "Publish the release files to RubyForge." task :release => [:gem, :package] do system("rubyforge login --username #{RUBY_FORGE_USER}") gem = "pkg/#{PKG_FILE_NAME}.gem" # -n notes/#{Maruku::Version}.txt cmd = "rubyforge add_release %s %s \"%s\" %s" % [RUBY_FORGE_GROUPID, RUBY_FORGE_PACKAGEID, RELEASE_NAME, gem] puts cmd system(cmd) files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } files.each do |file| # system("rubyforge add_file %s %s %s %s" % # [RUBY_FORGE_GROUPID, RUBY_FORGE_PACKAGEID, RELEASE_NAME, file]) end end task :test => [:markdown_span_tests, :markdown_block_tests] task :markdown_block_tests do tests = Dir['tests/unittest/**/*.md'].join(' ') puts "Executing tests #{tests}" # ok = marutest(tests) ok = system "ruby -Ilib bin/marutest #{tests}" raise "Failed block unittest" if not ok end task :markdown_span_tests do ok = system( "ruby -Ilib lib/maruku/tests/new_parser.rb v b") raise "Failed span unittest" if not ok end require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| files = [#'README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'rdoc/*.rdoc'#, 'test/*.rb' ] rdoc.rdoc_files.add(files) rdoc.main = "rdoc/main.rdoc" # page to start on rdoc.title = "Maruku Documentation" rdoc.template = "jamis.rb" rdoc.rdoc_dir = 'doc' # rdoc output folder rdoc.options << '--line-numbers' << '--inline-source' end maruku-0.6.0/unit_test_block.sh0000644000175000017500000000011311573154515016445 0ustar vincentvincent files=`find tests/unittest -name '*.md'` ruby -Ilib bin/marutest $files maruku-0.6.0/bin/0000755000175000017500000000000011573154515013476 5ustar vincentvincentmaruku-0.6.0/bin/marutex0000644000175000017500000000125111573154515015105 0ustar vincentvincent#!/usr/bin/env ruby require 'maruku' if File.basename($0) =~ /^marutex/ # Convert each file ARGV.each do |f| puts "Opening #{f}" # read file content input = File.open(f,'r').read # create Maruku doc = Maruku.new(input) # convert to a complete html document latex = doc.to_latex_document # write to file dir = File.dirname(f) job = File.join(dir, File.basename(f, File.extname(f))) filename = job + ".tex" File.open(filename,'w') do |f| f.puts latex end # run twice for cross references system "pdflatex '#{job}' '-output-directory=#{dir}' " system "pdflatex '#{job}' '-output-directory=#{dir}' " # system "open #{job}.pdf" end endmaruku-0.6.0/bin/maruku0000644000175000017500000001041411573154515014725 0ustar vincentvincent#!/usr/bin/env ruby require 'maruku' require 'optparse' def cli_puts(s) $stderr.puts(s) if MaRuKu::Globals[:verbose] end export = :html break_on_error = false using_math = false using_mathml = false output_file = nil opt = OptionParser.new do |opts| opts.banner = "Usage: maruku [options] [file1.md [file2.md ..." opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| MaRuKu::Globals[:verbose] = v end opts.on("-u", "--[no-]unsafe", "Use unsafe features") do |v| MaRuKu::Globals[:unsafe_features] = v end opts.on("-b", "Break on error") do |v| break_on_error = true end opts.on("-i", "--math-images ENGINE", "Uses ENGINE to render TeX to PNG.") do |s| using_math = true MaRuKu::Globals[:html_math_output_png] = true MaRuKu::Globals[:html_math_output_mathml] = false MaRuKu::Globals[:html_png_engine] = s cli_puts "Using png engine #{s}." end opts.on("-m", "--math-engine ENGINE", "Uses ENGINE to render MathML") do |s| MaRuKu::Globals[:html_math_output_png] = false MaRuKu::Globals[:html_math_output_mathml] = true using_math = true using_mathml = true MaRuKu::Globals[:html_math_engine] = s end opts.on("-o", "--output FILE", "Output filename") do |s| output_file = s end opts.on_tail("--pdf", "Write PDF","First writes LaTeX, then calls pdflatex." ) do export = :pdf end opts.on_tail("--s5", "Write S5 slideshow") do export = :s5 end opts.on_tail("--html", "Write HTML") do export = :html end opts.on_tail("--html-frag", "Write the contents of the BODY.") do export = :html_frag end opts.on_tail("--tex", "Write LaTeX" ) do export = :tex end opts.on_tail("--inspect", "Shows the parsing result" ) do export = :inspect end opts.on_tail("--version", "Show version") do puts "Maruku #{MaRuKu::Version}"; exit end opts.on_tail("--ext EXTENSIONS", "Use maruku extensions (comma separated)" ) do |s| s.split(",").each do |e| require "maruku/ext/#{e}"; end end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end begin opt.parse! rescue OptionParser::InvalidOption=>e $stderr.puts e $stderr.puts opt exit end if using_math cli_puts "Using Math extensions." require 'maruku/ext/math' end #p ARGV #p MaRuKu::Globals inputs = # If we are given filenames, convert each file if not ARGV.empty? ARGV.map do |f| # read file content cli_puts "Reading from file #{f.inspect}." [f, File.open(f,'r').read] end else export = :html_frag if export == :html export = :tex_frag if export == :tex cli_puts "Reading from standard input." [[nil, $stdin.read]] end inputs.each do |f, input| # create Maruku params = {} params[:on_error] = break_on_error ? :raise : :warning t = Time.now doc = Maruku.new(input, params) cli_puts ("Parsing in %.2f seconds." % (Time.now-t)) out=""; suffix = "?" t = Time.now case export when :html suffix = using_mathml ? '.xhtml' : '.html' out = doc.to_html_document( {:indent => -1}) when :html_frag suffix='.html_frag' out = doc.to_html( {:indent => -1}) when :pdf, :tex suffix='.tex' out = doc.to_latex_document when :tex_frag suffix='.tex_frag' out = doc.to_latex when :inspect suffix='.txt' out = doc.inspect when :markdown suffix='.pretty_md' out = doc.to_markdown when :s5 suffix='_s5slides.html' out = doc.to_s5({:content_only => false}) end cli_puts("Rendering in %.2f seconds." % (Time.now-t)) # write to file or stdout if f if not output_file dir = File.dirname(f) job = File.join(dir, File.basename(f, File.extname(f))) output_file = job + suffix else job = File.basename(output_file, File.extname(output_file)) end if output_file == "-" cli_puts "Writing to standard output" $stdout.puts out else if not (export == :pdf) cli_puts "Writing to #{output_file}" File.open(output_file,'w') do |f| f.puts out end else cli_puts "Writing to #{job}.tex" File.open("#{job}.tex",'w') do |f| f.puts out end cmd = "pdflatex '#{job}.tex' -interaction=nonstopmode "+ "'-output-directory=#{dir}' " cli_puts "maruku: executing $ #{cmd}" # run twice for cross references system cmd system cmd end end else # write to stdout cli_puts "Writing to standard output" $stdout.puts out end end maruku-0.6.0/bin/marudown0000644000175000017500000000121311573154515015252 0ustar vincentvincent#!/usr/bin/env ruby require 'maruku' # If we are given filenames, convert each file if not ARGV.empty? ARGV.each do |f| puts "Opening #{f}" # read file content input = File.open(f,'r').read # create Maruku doc = Maruku.new(input, {:on_error=>:warning}) # convert to a complete html document output = doc.to_md # write to file dir = File.dirname(f) filename = File.basename(f, File.extname(f)) + ".txt" output = File.join(dir, filename) File.open(output,'w') do |f| f.puts html end end else # else, act as a filter data = $stdin.read puts Maruku.new(data, {:on_error=>:warning}).to_md end maruku-0.6.0/bin/marutest0000644000175000017500000001467611573154515015303 0ustar vincentvincent#!/usr/bin/env ruby require 'maruku' require 'maruku/textile2' $marutest_language = :markdown #MARKER = "\n***EOF***\n" SPLIT = %r{\n\*\*\*[^\*]+\*\*\*\n}m def marker(x) "\n*** Output of #{x} ***\n" end def write_lines(i, j, lines, prefix, i_star) i = [i, 0].max j = [j, lines.size-1].min for a in i..j l = lines[a].gsub(/\t/,' ') puts( ("%s %3d" % [prefix, a]) + (a==i_star ? " -->" : " ")+lines[a]) end end # a = expected b = found def equals(a, b) a = a.split("\n") b = b.split("\n") for i in 0..([a.size-1,b.size-1].max) la = a[i] lb = b[i] if la != lb puts "\n" write_lines(i-3, i+3, a, "expected", i ) write_lines(i-3, i+3, b, " found", i ) return false end end return true end TOTEST = [:inspect,:to_html,:to_latex,:to_md,:to_s] def run_test(filename, its_ok, verbose=true) # read file content input = (f=File.open(filename,'r')).read; f.close output_html = File.join(File.dirname(filename), File.basename(filename, File.extname(filename)) + ".html") # split the input in sections stuff = input.split(SPLIT) if stuff.size == 1 stuff[2] = stuff[0] stuff[0] = "Write a comment here" stuff[1] = "{} # params " end comment = stuff.shift params_s = stuff.shift params = eval(params_s||'{}') if params == nil raise "Null params? #{params_s.inspect}" end markdown = stuff.shift # puts "comment: #{markdown.inspect}" # puts "markdown: #{markdown.inspect}" failed = [] relaxed = [] crashed = [] actual = {} doc = if $marutest_language == :markdown Maruku.new(markdown, params) else MaRuKu.textile2(markdown, params) end for s in TOTEST begin if s==:to_html actual[s] = doc.to_html else actual[s] = doc.send s raise "Methods #{s} gave nil" if not actual[s] end rescue Exception => e crashed << s actual[s] = e.inspect+ "\n"+ e.backtrace.join("\n") puts actual[s] end end File.open(output_html, 'w') do |f| f.write doc.to_html_document end begin m = Maruku.new d = m.instance_eval(actual[:inspect]) rescue Exception => e s = e.inspect + e.backtrace.join("\n") raise "Inspect is not correct:\n ========\n#{actual[:inspect]}"+ "============\n #{s}" end expected = {} if (stuff.size < TOTEST.size) $stdout.write " (first time!) " TOTEST.each do |x| expected[x] = actual[x] end else TOTEST.each_index do |i| symbol = TOTEST[i] expected[symbol] = stuff[i] # puts "symbol: #{symbol.inspect} = #{stuff[i].inspect}" end end m = Maruku.new if not its_ok.include? :inspect begin d = m.instance_eval(expected[:inspect]) # puts "Eval: #{d.inspect}" expected[:inspect] = d.inspect rescue Exception => e s = e.inspect + e.backtrace.join("\n") raise "Cannot eval user-provided string:\n #{expected[:inspect].to_s}"+ "\n #{s}" end end # m.instance_eval(actual[:inspect]) != m.instance_eval(expected[:inspect]) # actual[:inspect] = m.instance_eval(actual[:inspect]) # expected[:inspect] = m.instance_eval(expected[:inspect]) TOTEST.each do |x| expected[x].strip! actual[x].strip! if not equals(expected[x], actual[x]) if its_ok.include? x expected[x] = actual[x] $stdout.write " relax:#{x} " relaxed << x else actual[x] = "-----| WARNING | -----\n" + actual[x].to_s failed << x end end end f = File.open(filename, 'w') f.write comment f.write "\n*** Parameters: ***\n" f.write params_s f.write "\n*** Markdown input: ***\n" f.write markdown TOTEST.each do |x| f.write marker(x) f.write expected[x] end f.write "\n*** EOF ***\n" if not failed.empty? or not crashed.empty? f.puts "\n\n\n\nFailed tests: #{failed.inspect} \n" TOTEST.each do |x| f.write marker(x) f.write actual[x] end else f.puts "\n\n\n\tOK!\n\n\n" end if false md_pl = markdown_pl(markdown) f.write "\n*** Output of Markdown.pl ***\n" f.write md_pl f.write "\n*** Output of Markdown.pl (parsed) ***\n" begin doc = REXML::Document.new("
    #{md_pl}
    ",{ :compress_whitespace=>['div','p'], :ignore_whitespace_nodes=>['div','p'], :respect_whitespace=>['pre','code'] }) div = doc.root xml ="" div.write_children(xml,indent=1,transitive=true,ie_hack=false) f.write xml rescue Exception=>e f.puts "Error: #{e.inspect}" end f.close else f.write "\n*** Output of Markdown.pl ***\n" f.write "(not used anymore)" f.write "\n*** Output of Markdown.pl (parsed) ***\n" f.write "(not used anymore)" end return failed, relaxed, crashed end def markdown_pl(markdown) tmp1 = "/tmp/marutest1" tmp2 = "/tmp/marutest2" File.open(tmp1,'w') do |f| f.puts markdown end system "Markdown.pl < #{tmp1} > #{tmp2}" f = File.open(tmp2,'r') s = f.read f.close s end def passed?(args, arg) if args.include? arg args.delete arg true else false end end def marutest(args) dont_worry = [] TOTEST.each do |x| arg = "ok:#{x}" # puts arg if passed?(args, arg) dont_worry << x end end if passed?(args, 'ok') dont_worry = TOTEST.clone end if dont_worry.size > 0 puts "Relaxed on #{dont_worry.inspect}" end failed = {} relaxed = {} args.each do |f| $stdout.write f + ' '*(50-f.size) + " " $stdout.flush tf, tr, tcrashed = run_test(f, dont_worry) tf = tf + tcrashed if tr.size > 0 $stdout.write " relax #{tr.inspect} " end if tf.size>0 $stdout.write " failed on #{tf.inspect} " else $stdout.write " OK " end if tcrashed.size > 0 $stdout.write " CRASHED on #{tcrashed.inspect}" end $stdout.write "\n" failed[f] = tf relaxed[f] = tr end num_failed = 0 failed_cat = {} puts "\n\n\n**** FINAL REPORT ****\n\n" if failed.size > 0 failed.each do |file, fl| num_failed += fl.size if fl.size > 0 puts "\t#{file}\tfailed on #{fl.inspect}" end fl.each do |x| failed_cat[x] = failed_cat[x] || 0 failed_cat[x] = failed_cat[x] + 1 end end end if dont_worry.size > 0 puts "Relaxed on #{dont_worry.inspect}" end if relaxed.size > 0 relaxed.each do |file, r| if r.size > 0 puts "\t#{file}\t\trelaxed on #{r.inspect}" end end end if failed_cat.size > 0 puts "\nCategories:\n" failed_cat.each do |x, num| puts "\t#{x.inspect} \tfailed #{num}/#{args.size}" end end return num_failed == 0 end if File.basename(__FILE__) == 'marutest' if ARGV.empty? puts "marutest is a tool for running Maruku's unittest." exit 1 end ok = marutest(ARGV.clone) exit ok ? 0 : -1 end