Added support for @xml:lang and blockquote@cite to Maruku.

Added Javascript styling for blockquote@cite.
master
Jacques Distler 2007-02-13 03:25:05 -06:00
parent d4b947462b
commit f896f8fbdc
4 changed files with 29 additions and 3 deletions

View File

@ -15,6 +15,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="<%= @robots_metatag_value %>" />
<%= javascript_include_tag 'page_helper' %>
<style type="text/css">
h1#pageName, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, #TextileHelp h3 {
color: #<%= @web ? @web.color : "393" %>;

View File

@ -0,0 +1,23 @@
/*
* Based on Simon Willison's blockquotes.js
* http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations
*/
function extractBlockquoteCitations() {
var quotes = document.getElementsByTagName('blockquote');
for (i = 0; i < quotes.length; i++) {
var cite = quotes[i].getAttribute('cite');
if (cite && cite != '') {
var newlink = document.createElement('a');
newlink.setAttribute('href', cite);
newlink.setAttribute('title', cite);
newlink.appendChild(document.createTextNode('#'));
var newspan = document.createElement('span');
newspan.setAttribute('class','blockquotesource');
newspan.appendChild(newlink);
quotes[i].lastChild.previousSibling.appendChild(newspan);
}
}
}
window.onload = function (){
extractBlockquoteCitations();
};

View File

@ -336,3 +336,4 @@ merror {display:inline;font-size:1em;}
math[display=block] {overflow:auto;}
math { white-space: nowrap }
.maruku-eq-number {float:right}
.blockquotesource {margin-left:1em;}

View File

@ -337,11 +337,11 @@ It is copied as a standard HTML attribute.
end
def to_html_paragraph; add_ws wrap_as_element('p') end
def to_html_paragraph; add_ws wrap_as_element('p', [:'xml:lang']) 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_quote; add_ws wrap_as_element('blockquote', [:cite, :'xml:lang']) end
def to_html_strong; wrap_as_element('strong') end
def to_html_emphasis; wrap_as_element('em') end
@ -383,7 +383,7 @@ by Maruku, to have the same results in both HTML and LaTeX.
def to_html_header
element_name = "h#{self.level}"
h = wrap_as_element element_name
h = wrap_as_element(element_name, [:title, :'xml:lang'])
if span = render_section_number
h.insert_before(h.children.first, span)