Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Fix for invalid tag syntax from previous commit
Browse files Browse the repository at this point in the history
The previous commit broke some things with how tags work, so ignore
the notes in that commit. Inline tags are now supported like so:

    #{markdown inline:true}...{/markdown}

Updated the readme to reflect this.
  • Loading branch information
jagregory committed Dec 7, 2011
1 parent c52e932 commit 0ce947b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 31 deletions.
10 changes: 10 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ To disable this behaviour, you'd write:
This content will be dedented.
#{/markdown}</code></pre>

h3. Inline mode

If you only need to output a single paragraph of text and would rather markdown didn't produce the paragraph tag for you, then you can use the @inline:true@ switch or the @markdownInline@ extension.

<pre><code>#{markdown inline:true}
This text won't produce a paragraph tag.
#{/markdown}

${"This text won't produce a paragraph tag.".markdownInline()}</code></pre>

h2. Configuration

For basic use, simply add the module to your @dependencies.yml@; for use of the "pegdown extensions":https://github.com/sirthias/pegdown/blob/master/README.markdown refer to the configuration options below.
Expand Down
2 changes: 1 addition & 1 deletion app/exts/Markdown.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static String toHtml(String markdown, Map<Object, Object> options) {
String html = new PegDownProcessor(extensions)
.markdownToHtml(markdown);

if (enabled("inlineSingleParagraph", overriddenConfigOptions)) {
if (enabled("inline", overriddenConfigOptions)) {
html = inlineSingleParagraph(html);
}

Expand Down
3 changes: 1 addition & 2 deletions app/exts/MarkdownExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public static BaseTemplate.RawData markdown(String markdown) {

public static BaseTemplate.RawData markdownInline(String markdown) {
Map<Object, Object> opts = new HashMap<Object, Object>();

opts.put("inlineSingleParagraph", "true");
opts.put("inline", "true");

return JavaExtensions.raw(Markdown.toHtml(markdown, opts));
}
Expand Down
19 changes: 0 additions & 19 deletions app/exts/MarkdownFastTag.java

This file was deleted.

11 changes: 2 additions & 9 deletions app/exts/MarkdownFastTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@
import play.templates.JavaExtensions;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

@FastTags.Namespace("markdown")
public class MarkdownFastTags extends FastTags {
@SuppressWarnings("unchecked")
public static void _inline(Map args, Closure body, PrintWriter out, GroovyTemplate.ExecutableTemplate template, int fromLine) {
public static void _markdown(Map args, Closure body, PrintWriter out, GroovyTemplate.ExecutableTemplate template, int fromLine) {
String markdown = JavaExtensions.toString(body);

Map<Object, Object> opts = new HashMap<Object, Object>();
opts.put("inlineSingleParagraph", "true");
opts.putAll(args);

String html = Markdown.toHtml(markdown, opts);
String html = Markdown.toHtml(markdown, args);

out.print(html);
}
Expand Down
10 changes: 10 additions & 0 deletions documentation/manual/home.textile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ To disable this behaviour, you'd write:
This content will be dedented.
#{/markdown}</code></pre>

h3. Inline mode

If you only need to output a single paragraph of text and would rather markdown didn't produce the paragraph tag for you, then you can use the @inline:true@ switch or the @markdownInline@ extension.

<pre><code>#{markdown inline:true}
This text won't produce a paragraph tag.
#{/markdown}

${"This text won't produce a paragraph tag.".markdownInline()}</code></pre>

h2. Configuration

For basic use, simply add the module to your @dependencies.yml@; for use of the "pegdown extensions":https://github.com/sirthias/pegdown/blob/master/README.markdown refer to the configuration options below.
Expand Down

0 comments on commit 0ce947b

Please sign in to comment.