Support for \tooltip{}{} and \statusline{}{}

itex2MML 1.3.16 add a \tooltip{}{} command which,
like \statusline{}{}, produces an <maction> element.

Neither of these is natively supported by Mozilla/Firefox.
Add some Javascript to work around that weakness.
This commit is contained in:
Jacques Distler 2009-11-06 14:32:45 -06:00
parent c99ca26a8d
commit 977da29f68
4 changed files with 27 additions and 3 deletions

View file

@ -17,7 +17,7 @@
<%= javascript_include_tag 'page_helper' %> <%= javascript_include_tag 'page_helper' %>
<style type="text/css"> <style type="text/css">
h1#pageName, div.info, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, #TextileHelp h3 { h1#pageName, div.info, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, [actiontype="toggle"]:hover, #TextileHelp h3 {
color: #<%= @web ? @web.color : "393" %>; color: #<%= @web ? @web.color : "393" %>;
} }
<%= File.read(RAILS_ROOT + '/public/stylesheets/instiki.css') if @inline_style %> <%= File.read(RAILS_ROOT + '/public/stylesheets/instiki.css') if @inline_style %>

View file

@ -41,7 +41,22 @@ function fixRunIn() {
}); });
} }
function mactionWorkarounds() {
$$('maction[actiontype="tooltip"]').each( function(mtool){
Element.writeAttribute(mtool, 'title', mtool.lastChild.firstChild.data);
});
$$('maction[actiontype="statusline"]').each( function(mstatus){
Event.observe(mstatus, 'mouseover', function(){
window.status = mstatus.lastChild.firstChild.data;
});
Event.observe(mstatus, 'mouseout', function(){
window.status = '';
});
});
}
window.onload = function (){ window.onload = function (){
extractBlockquoteCitations(); extractBlockquoteCitations();
fixRunIn(); fixRunIn();
mactionWorkarounds();
}; };

View file

@ -1,7 +1,7 @@
body { body {
background-color:#FFF; background-color:#FFF;
color:#333; color:#333;
font-family:Verdana, Arial, Helvetica, sans-serif; font-family:TeX Gyre Termes, Times New Roman,Verdana, Arial, Helvetica, sans-serif;
font-size:1em; font-size:1em;
line-height:1.3em; line-height:1.3em;
} }
@ -512,3 +512,4 @@ pre.xml .attribute { color: #771; }
font-variant: normal; font-variant: normal;
font-weight: bold; font-weight: bold;
} }
[actiontype="toggle"]:hover {text-shadow: #ccc 2px 2px 5px;}

View file

@ -212,6 +212,14 @@ END_THM
def test_have_latest_itex2mml def test_have_latest_itex2mml
assert_markup_parsed_as(
%{<p>equation <math class='maruku-mathml' displa} +
%{y='inline' xmlns='http://www.w3.org/1998/Math/} +
%{MathML'><mi>A</mi><mo>=</mo><maction actiontyp} +
%{e='tooltip'><mi>B</mi><mtext>Spoons!</mtext></} +
%{maction></math></p>},
"equation $A=\\tooltip{Spoons!}{B}$")
assert_markup_parsed_as( assert_markup_parsed_as(
%{<p>equation <math class='maruku-mathml' displa} + %{<p>equation <math class='maruku-mathml' displa} +
%{y='inline' xmlns='http://www.w3.org/1998/Math/} + %{y='inline' xmlns='http://www.w3.org/1998/Math/} +