Bring up to current.

This commit is contained in:
Jacques Distler 2007-01-22 08:36:51 -06:00
parent 69b62b6f33
commit b19e1e4f47
71 changed files with 8305 additions and 39 deletions

View file

@ -48,6 +48,7 @@ class ApplicationController < ActionController::Base
'.pdf' => 'application/pdf',
'.png' => 'image/png',
'.txt' => 'text/plain',
'.tex' => 'text/plain',
'.zip' => 'application/zip'
} unless defined? FILE_TYPES
@ -114,7 +115,7 @@ class ApplicationController < ActionController::Base
def rescue_action_in_public(exception)
render :status => 500, :text => <<-EOL
<html><body>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<h2>Internal Error</h2>
<p>An application error occurred while processing your request.</p>
<!-- \n#{exception}\n#{exception.backtrace.join("\n")}\n -->
@ -145,8 +146,10 @@ class ApplicationController < ActionController::Base
def set_content_type_header
if %w(rss_with_content rss_with_headlines).include?(action_name)
@response.headers['Content-Type'] = 'text/xml; charset=UTF-8'
elsif %w(tex).include?(action_name)
@response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
else
@response.headers['Content-Type'] = 'text/html; charset=UTF-8'
@response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
end
end

View file

@ -9,7 +9,7 @@ class WikiController < ApplicationController
caches_action :show, :published, :authors, :recently_revised, :list
cache_sweeper :revision_sweeper
layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex, :export_tex, :export_html]
layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex, :pdf, :export_tex, :export_html]
def index
if @web_name
@ -280,8 +280,12 @@ class WikiController < ApplicationController
end
def tex
if @web.markup == :markdownMML
@tex_content = Maruku.new(@page.content).to_latex
else
@tex_content = RedClothForTex.new(@page.content).to_tex
end
end
protected
@ -305,8 +309,12 @@ class WikiController < ApplicationController
end
def export_page_to_tex(file_path)
tex
File.open(file_path, 'w') { |f| f.write(render_to_string(:template => 'wiki/tex', :layout => false)) }
if @web.markup == :markdownMML
@tex_content = Maruku.new(@page.content).to_latex
else
@tex_content = RedClothForTex.new(@page.content).to_tex
end
File.open(file_path, 'w') { |f| f.write(render_to_string(:template => 'wiki/tex', :layout => 'tex')) }
end
def export_pages_as_zip(file_type, &block)
@ -396,7 +404,11 @@ class WikiController < ApplicationController
def render_tex_web
@web.select.by_name.inject({}) do |tex_web, page|
if @web.markup == :markdownMML
tex_web[page.name] = Maruku.new(page.content).to_latex
else
tex_web[page.name] = RedClothForTex.new(page.content).to_tex
end
tex_web
end
end

View file

@ -23,7 +23,7 @@ module ApplicationHelper
if element.last != selected
options << "<option value=\"#{element.last}\">#{element.first}</option>"
else
options << "<option value=\"#{element.last}\" selected>#{element.first}</option>"
options << "<option value=\"#{element.last}\" selected=\"selected\">#{element.first}</option>"
end
else
options << ((element != selected) ? "<option>#{element}</option>" : "<option selected>#{element}</option>")

View file

@ -7,7 +7,7 @@
</p>
<%= form_tag({ :controller => 'admin', :action => 'create_system' },
{ 'id' => 'setup', 'method' => 'post', 'onSubmit' => 'return validateSetup()',
{ 'id' => 'setup', 'method' => 'post', 'onsubmit' => 'return validateSetup()',
'accept-charset' => 'utf-8' })
%>
<ol class="setup">
@ -22,9 +22,9 @@
</div>
<div class="inputBox">
Name: <input type="text" id="web_name" name="web_name" value="Wiki"
onChange="proposeAddress();" onClick="this.value == 'Wiki' ? this.value = '' : true" />
onchange="proposeAddress();" onclick="this.value == 'Wiki' ? this.value = '' : true" />
&nbsp;&nbsp;
Address: <input type="text" id="web_address" name="web_address" onChange="cleanAddress();"
Address: <input type="text" id="web_address" name="web_address" onchange="cleanAddress();"
value="wiki" />
</div>
</li>

View file

@ -7,7 +7,7 @@
<%= form_tag({ :controller => 'admin', :action => 'create_web' },
{ 'id' => 'setup', 'method' => 'post',
'onSubmit' => 'cleanAddress(); return validateSetup()',
'onsubmit' => 'cleanAddress(); return validateSetup()',
'accept-charset' => 'utf-8' })
%>
@ -21,9 +21,9 @@
The address can only consist of letters and digits.
</div>
<div class="inputBox">
Name: <input type="text" id="web_name" name="name" onChange="proposeAddress();" />
Name: <input type="text" id="web_name" name="name" onchange="proposeAddress();" />
&nbsp;&nbsp;
Address: <input type="text" id="web_address" name="address" onChange="cleanAddress();" />
Address: <input type="text" id="web_address" name="address" onchange="cleanAddress();" />
</div>
</li>
</ol>

View file

@ -2,7 +2,7 @@
<%= form_tag({ :controller => 'admin', :action => 'edit_web', :web => @web.address },
{ 'id' => 'setup', 'method' => 'post',
'onSubmit' => 'cleanAddress(); return validateSetup()',
'onsubmit' => 'cleanAddress(); return validateSetup()',
'accept-charset' => 'utf-8' })
%>
@ -15,9 +15,9 @@
<div class="inputBox">
Name: <input type="text" id="name" name="name" class="disableAutoComplete" value="<%= @web.name %>"
onChange="proposeAddress();" /> &nbsp;&nbsp;
onchange="proposeAddress();" /> &nbsp;&nbsp;
Address: <input type="text" class="disableAutoComplete" id="address" name="address" value="<%= @web.address %>"
onChange="cleanAddress();" />
onchange="cleanAddress();" />
<small><em>(Letters and digits only)</em></small>
</div>
@ -25,7 +25,7 @@
<div class="inputBox">
Markup:
<select name="markup">
<%= html_options({'Textile' => :textile, 'Markdown' => :markdown, 'Mixed' => :mixed,
<%= html_options({'Textile' => :textile, 'Markdown' => :markdown, 'Markdown+itex2MML' => :markdownMML, 'Mixed' => :mixed,
'RDoc' => :rdoc }, @web.markup) %>
</select>
@ -64,7 +64,7 @@
</p>
<a href="#"
onClick="document.getElementById('additionalStyle').style.display='block';return false;">
onclick="document.getElementById('additionalStyle').style.display='block';return false;">
Stylesheet tweaks &gt;&gt;</a>
<small><em>
- add or change styles used by this web; styles defined here take precedence over
@ -120,7 +120,7 @@
<%= form_tag({:controller => 'admin', :web => @web.address, :action => 'remove_orphaned_pages'},
{ :id => 'remove_orphaned_pages',
:onSubmit => "return checkSystemPassword(document.getElementById('system_password_orphaned').value)",
:onsubmit => "return checkSystemPassword(document.getElementById('system_password_orphaned').value)",
'accept-charset' => 'utf-8' })
%>
<p align="right">

View file

@ -13,7 +13,7 @@
<p>
<input type="submit" value="Update" /> as
<input type="text" name="author" id="authorName" value="<%= @author %>"
onClick="this.value == 'AnonymousCoward' ? this.value = '' : true" />
onclick="this.value == 'AnonymousCoward' ? this.value = '' : true" />
<% if @page %>
| <%= link_to 'Cancel', :web => @web.address, :action => 'file'%> <small>(unlocks page)</small>
<% end %>

View file

@ -1,6 +1,4 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>

View file

@ -0,0 +1 @@
<%= @content_for_layout %>

View file

@ -0,0 +1,13 @@
<h3>Markdown + itex2MML formatting tips (<a target="_new" href="http://daringfireball.net/projects/markdown/syntax">advanced</a>)</h3>
<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><strong>your text</strong></td></tr>
<tr><td>`my code`</td><td class="arrow">&rarr;</td><td><code>my code</code></td></tr>
<tr><td>* Bulleted list<br />* Second item</td><td class="arrow">&rarr;</td><td>&#8226; Bulleted list<br />&#8226; Second item</td></tr>
<tr><td>1. Numbered list<br />1. Second item</td><td class="arrow">&rarr;</td><td>1. Numbered list<br />2. Second item</td></tr>
<tr><td>[link name](URL)</td><td class="arrow">&rarr;</td><td><a href="URL">link name</a></td></tr>
<tr><td>***</td><td class="arrow">&rarr;</td><td>Horizontal ruler</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>
</table>
<p>For a complete list of LaTeX commands supported here, see the <a href="http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html">itex2MML Commands Summary</a>.</p>

View file

@ -1,4 +1,4 @@
<h3>Textile formatting tips (<a href="http://hobix.com/textile/quick.html" onClick="quickRedReference(); return false;">advanced</a>)</h3>
<h3>Textile formatting tips (<a href="http://hobix.com/textile/quick.html" onclick="quickRedReference(); return false;">advanced</a>)</h3>
<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><strong>your text</strong></td></tr>

View file

@ -11,7 +11,7 @@
<div id="editForm">
<%= form_tag({ :action => 'save', :web => @web.address, :id => @page.name },
{ 'id' => 'editForm', 'method' => 'post', 'onSubmit' => 'cleanAuthorName()',
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
'accept-charset' => 'utf-8' }) %>
<textarea name="content" id="content"><%= h(@flash[:content] || @page.content) %></textarea>

View file

@ -11,7 +11,7 @@
<div id="editForm">
<%= form_tag({ :action => 'save', :web => @web.address, :id => @page_name },
{ 'id' => 'editForm', 'method' => 'post', 'onSubmit' => 'cleanAuthorName();', 'accept-charset' => 'utf-8' }) %>
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName();', 'accept-charset' => 'utf-8' }) %>
<textarea name="content" id="content"><%= h(@flash[:content] || '') %></textarea>
<div id="editFormButtons">

View file

@ -37,7 +37,7 @@
<%= link_to('Print',
{ :web => @web.address, :action => 'print', :id => @page.name },
{ :accesskey => 'p', :name => 'view_print' }) %>
<% if defined? RedClothForTex and RedClothForTex.available? and @web.markup == :textile %>
<% if defined? RedClothForTex and RedClothForTex.available? and @web.markup == :textile or @web.markup == :markdownMML %>
|
<%= link_to 'TeX', {:web => @web.address, :action => 'tex', :id => @page.name},
{:name => 'view_tex'} %>

View file

@ -13,13 +13,13 @@
<div id="editForm">
<%= form_tag({:web => @web.address, :action => 'save', :id => @page.name},
{ :id => 'editForm', :method => 'post', :onSubmit => 'cleanAuthorName();',
{ :id => 'editForm', :method => 'post', :onsubmit => 'cleanAuthorName();',
'accept-charset' => 'utf-8' }) %>
<textarea name="content" id="content"><%= @revision.content %></textarea>
<div id="editFormButtons">
<input type="submit" value="Update" accesskey="u" /> as
<input type="text" name="author" id="authorName" value="<%= @author %>"
onClick="this.value == 'AnonymousCoward' ? this.value = '' : true" />
onclick="this.value == 'AnonymousCoward' ? this.value = '' : true" />
|
<span>
<%= link_to('Cancel', {:web => @web.address, :action => 'cancel_edit', :id => @page.name},

View file

@ -1,12 +1,12 @@
\documentclass[12pt,titlepage]{article}
\usepackage[danish]{babel} %danske tekster
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[OT1]{fontenc} %rigtige danske bogstaver...
\usepackage{a4}
\usepackage{graphicx}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\input epsf
\usepackage{hyperref}
%-------------------------------------------------------------------