Fixed rendering, added a Mixed option (Textile + Markdown), default is Textile-only

This commit is contained in:
Alexey Verkhovsky 2005-04-08 05:02:48 +00:00
parent 1c40b5e570
commit b3aefba07a
7 changed files with 56 additions and 59 deletions

View file

@ -1,9 +1,8 @@
* 0.10.0: * 0.10.0:
Ported to ActionPack Ported to ActionPack
RedCloth 3.0.3 RedCloth 3.0.3
BlueCloth is phased out BlueCloth is phased out, Markdown is rendered by RedCloth
Default markup remains Textile-only, but Markdown wikis now understand Textile Mix markup option understands both Textile and Markdown on the same page
syntax on the same page
Instiki can serve static content (such as HTML or plain-text files) from ./public Instiki can serve static content (such as HTML or plain-text files) from ./public
directory directory
Much friendlier admin interface Much friendlier admin interface

View file

@ -27,11 +27,17 @@ module Engines
class Textile < AbstractEngine class Textile < AbstractEngine
def mask def mask
RedCloth.new(@content, @content.options[:engine_opts]).to_html([:textile]) RedCloth.new(@content, @content.options[:engine_opts]).to_html(:textile)
end end
end end
class Markdown < AbstractEngine class Markdown < AbstractEngine
def mask
RedCloth.new(@content, @content.options[:engine_opts]).to_html(:markdown)
end
end
class Mixed < AbstractEngine
def mask def mask
RedCloth.new(@content, @content.options[:engine_opts]).to_html RedCloth.new(@content, @content.options[:engine_opts]).to_html
end end
@ -43,6 +49,6 @@ module Engines
end end
end end
MAP = { :textile => Textile, :markdown => Markdown, :rdoc => RDoc } MAP = { :textile => Textile, :markdown => Markdown, :mixed => Mixed, :rdoc => RDoc, }
MAP.default = Textile MAP.default = Textile
end end

View file

@ -21,16 +21,16 @@
<div class="inputBox, disableAutoComplete"> <div class="inputBox, disableAutoComplete">
Markup: Markup:
<select name="markup"> <select name="markup">
<%= html_options({"Textile" => :textile, "Markdown" => :markdown, "RDoc" => :rdoc }, <%= html_options({'Textile' => :textile, 'Markdown' => :markdown, 'Mixed' => :mixed,
@web.markup) %> 'RDoc' => :rdoc }, @web.markup) %>
</select> </select>
&nbsp;&nbsp; &nbsp;&nbsp;
Color: Color:
<select name="color"> <select name="color">
<%= html_options({ "Green" => "008B26", "Purple" => "504685", "Red" => "DA0006", <%= html_options({ 'Green' => '008B26', 'Purple' => '504685', 'Red' => 'DA0006',
"Orange" => "FA6F00", "Grey" => "8BA2B0" }, @web.color) %> 'Orange' => 'FA6F00', 'Grey' => '8BA2B0' }, @web.color) %>
</select> </select>
<br/> <br/>
<p> <p>

View file

@ -1,4 +1,3 @@
<div id="TextileHelp" style="float: right; width: 250px; margin-top: 5px">
<h3>Markdown formatting tips (<a target="_new" href="http://daringfireball.net/projects/markdown/syntax">advanced</a>)</h3> <h3>Markdown formatting tips (<a target="_new" href="http://daringfireball.net/projects/markdown/syntax">advanced</a>)</h3>
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr> <tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr>
@ -11,6 +10,3 @@
<tr><td>&lt;http://url><br />&lt;email@add.com></td><td class="arrow">&rarr;</td><td>Auto-linked</td></tr> <tr><td>&lt;http://url><br />&lt;email@add.com></td><td class="arrow">&rarr;</td><td>Auto-linked</td></tr>
<tr><td>![Alt text](URL)</td><td class="arrow">&rarr;</td><td>Image</td></tr> <tr><td>![Alt text](URL)</td><td class="arrow">&rarr;</td><td>Image</td></tr>
</table> </table>
<%= render 'wiki_words_help' %>
</div>

View file

@ -1,4 +1,3 @@
<div id="TextileHelp" style="float: right; width: 250px; margin-top: 5px">
<h3>RDoc formatting tips (<a target="_new" href="http://rdoc.sourceforge.net/doc/files/markup/simple_markup_rb.html">advanced</a>)</h3> <h3>RDoc formatting tips (<a target="_new" href="http://rdoc.sourceforge.net/doc/files/markup/simple_markup_rb.html">advanced</a>)</h3>
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr> <tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr>
@ -11,6 +10,3 @@
<tr><td>http://url<br />mailto:e@add.com</td><td class="arrow">&rarr;</td><td>Auto-linked</td></tr> <tr><td>http://url<br />mailto:e@add.com</td><td class="arrow">&rarr;</td><td>Auto-linked</td></tr>
<tr><td>imageURL</td><td class="arrow">&rarr;</td><td>Image</td></tr> <tr><td>imageURL</td><td class="arrow">&rarr;</td><td>Image</td></tr>
</table> </table>
<%= render 'wiki_words_help' %>
</div>

View file

@ -1,4 +1,3 @@
<div id="TextileHelp" style="float: right; width: 250px; margin-top: 5px">
<h3>Textile formatting tips (<a href="#" onClick="quickRedReference(); return false;">advanced</a>)</h3> <h3>Textile formatting tips (<a href="#" onClick="quickRedReference(); return false;">advanced</a>)</h3>
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr> <tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr>
@ -12,9 +11,6 @@
<tr><td>!imageURL!</td><td class="arrow">&rarr;</td><td>Image</td></tr> <tr><td>!imageURL!</td><td class="arrow">&rarr;</td><td>Image</td></tr>
</table> </table>
<%= render 'wiki_words_help' %>
</div>
<script language="JavaScript"> <script language="JavaScript">
function quickRedReference() { function quickRedReference() {
window.open( window.open(

View file

@ -6,7 +6,11 @@
<%= "<p style='color:red'>Please correct the error that caused this error in rendering:<br/><small>#{@params["msg"]}</small></p>" if @params["msg"] %> <%= "<p style='color:red'>Please correct the error that caused this error in rendering:<br/><small>#{@params["msg"]}</small></p>" if @params["msg"] %>
<%= render("#{@web.markup}_help") if @web %> <div id="MarkupHelp" style="float: right; width: 250px; margin-top: 5px">
<%= render("#{@web.markup}_help") %>
<%= render 'wiki_words_help' %>
</div>
<%= form_tag({ :action => 'save', :web => @web.address, :id => @page.name}, <%= form_tag({ :action => 'save', :web => @web.address, :id => @page.name},
{'id' => 'editForm', 'method' => 'post', 'onSubmit' => 'cleanAuthorName();'}) {'id' => 'editForm', 'method' => 'post', 'onSubmit' => 'cleanAuthorName();'})