plugin:xhtmlruby
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:xhtmlruby [2009-11-08 14:42] – 77.167.120.32 | plugin:xhtmlruby [2023-10-30 23:26] (current) – Klap-in | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : pomax@nihongoresources.com | email : pomax@nihongoresources.com | ||
type : Action | type : Action | ||
- | lastupdate : 2009-10-26 | + | lastupdate : 2010-10-14 |
- | compatible : 2009-02-14b (not tested on earlier versions) | + | compatible : 2009-02-14 |
tags : ruby, furigana | tags : ruby, furigana | ||
+ | |||
+ | downloadurl: | ||
---- | ---- | ||
===== Download and Installation ===== | ===== Download and Installation ===== | ||
- | Download | + | Search |
- | + | ||
- | * [[http:// | + | |
- | + | ||
- | To install | + | |
- | * style.css - CSS styling for the ruby markup | + | * [[http:// |
- | * conf.ini - an ini file for setting whether to parse wiki text or not, and ToC text or not. | + | * [[http:// |
- | * script.js - a script that ensures the CSS styling is correct for the browser that's loading the page | + | |
- | * action.php - the plugin | + | |
- | The plugin is now installed. | ||
===== Important installation note ===== | ===== Important installation note ===== | ||
Line 96: | Line 91: | ||
===== Bugs ===== | ===== Bugs ===== | ||
- | None known at the time of writing. | + | <del>None known at the time of writing.</ |
+ | |||
+ | Unfortunately, | ||
+ | ReferenceError: | ||
+ | addInitEvent(function(){ fixRubyAlignment(); | ||
+ | js.php? | ||
+ | |||
+ | I have changed '' | ||
+ | |||
+ | So finally I decided to: | ||
+ | - remove script.js in the plugin folder | ||
+ | - disable the plugin | ||
+ | - re-enable it again | ||
+ | -> seems no problem so far, the action.php and the CSS file still do their jobs. I know that script.js can deal some compatibility problems across browsers, but I don't have the ability to debug it. --- [[user> | ||
===== Source ===== | ===== Source ===== | ||
Line 147: | Line 155: | ||
* XHTML 1.1 Ruby markup suffers from the " | * XHTML 1.1 Ruby markup suffers from the " | ||
* The standard way to visualise ruby is by making the ruby code an inline table, and bottom | * The standard way to visualise ruby is by making the ruby code an inline table, and bottom | ||
- | * aligning it. However, not all browsers understand " | + | * aligning it. However, not all browsers understand " |
* will try to make sure the ruby placement is correct for all major browsers by detecting the | * will try to make sure the ruby placement is correct for all major browsers by detecting the | ||
* browser, and modifying the ruby CSS rules accordingly. | * browser, and modifying the ruby CSS rules accordingly. | ||
Line 154: | Line 162: | ||
*/ | */ | ||
- | // --------------------------------------------------------------------- | + | // ---------------------------------------------------------------------------------------------------------------------- |
// CSS MANIPULATION | // CSS MANIPULATION | ||
// | // | ||
// based on http:// | // based on http:// | ||
- | // --------------------------------------------------------------------- | + | // ---------------------------------------------------------------------------------------------------------------------- |
- | /** | + | function getCSSRule(ruleName, |
- | * returns an associated object with stylesheet -> rule entries. The reason for this is | + | |
- | * that returned rules alone are not enough; the user may need to perform actions based on | + | |
- | * the stylesheet media type or href for instance. | + | |
- | * | + | |
- | * If no matching rules were found at all, ' | + | |
- | */ | + | |
- | function getCSSRule(ruleName, | + | |
- | { | + | |
ruleName=ruleName.toLowerCase(); | ruleName=ruleName.toLowerCase(); | ||
if (document.styleSheets) { | if (document.styleSheets) { | ||
- | // iterate through all stylesheets | + | for (var i=0; i< |
- | for (var sheet=0; sheet< | + | var styleSheet=document.styleSheets[i]; |
- | { | + | var |
- | var styleSheet=document.styleSheets[sheet]; | + | |
- | var | + | |
var cssRule=false; | var cssRule=false; | ||
- | do | + | do { |
- | { | + | if (styleSheet.cssRules) { cssRule = styleSheet.cssRules[ii]; } |
- | if(styleSheet.cssRules) { cssRule = styleSheet.cssRules[rule]; } | + | else { cssRule = styleSheet.rules[ii]; } |
- | else | + | if (cssRule) { |
- | if (cssRule | + | if (cssRule.selectorText.toLowerCase()==ruleName) |
- | rule++; | + | if (deleteFlag==' |
- | } while (cssRule); | + | if (styleSheet.cssRules) { styleSheet.deleteRule(ii); |
- | } | + | else { styleSheet.removeRule(ii); |
- | } | + | return true; } |
- | return | + | else |
- | } | + | ii++; |
+ | } | ||
+ | while (cssRule) | ||
+ | return false;} | ||
+ | |||
+ | function killCSSRule(ruleName) { return getCSSRule(ruleName,' | ||
+ | |||
+ | function addCSSRule(ruleName) { | ||
+ | if (document.styleSheets) { | ||
+ | if (!getCSSRule(ruleName)) { | ||
+ | if (document.styleSheets[0].addRule) { document.styleSheets[0].addRule(ruleName, | ||
+ | else { document.styleSheets[0].insertRule(ruleName+' | ||
+ | return | ||
- | // ------------------- | + | // ---------------------------------------------------------------------------------------------------------------------- |
// Ruby alignment code | // Ruby alignment code | ||
- | // ------------------- | + | // ---------------------------------------------------------------------------------------------------------------------- |
/** | /** | ||
Line 198: | Line 208: | ||
function getBrowser() | function getBrowser() | ||
{ | { | ||
- | var opera=" | + | var opera=" |
if (window.opera) { browser = opera; } | if (window.opera) { browser = opera; } | ||
else if (Array.every) { browser = gecko; } | else if (Array.every) { browser = gecko; } | ||
else if (document.all) { browser = ie; } | else if (document.all) { browser = ie; } | ||
+ | else if (window.chrome) { browser = chrome; } | ||
return browser; | return browser; | ||
} | } | ||
Line 219: | Line 230: | ||
// Opera (9.5x) is even more annoying. Neither " | // Opera (9.5x) is even more annoying. Neither " | ||
else if(browser==" | else if(browser==" | ||
+ | |||
// if we don't know what browser this is, assume " | // if we don't know what browser this is, assume " | ||
else { rubyrule.style.verticalAlign = " | else { rubyrule.style.verticalAlign = " | ||
Line 224: | Line 236: | ||
- | // ------------- | + | // ---------------------------------------------------------------------------------------------------------------------- |
// DokuWiki code | // DokuWiki code | ||
- | // ------------- | + | // ---------------------------------------------------------------------------------------------------------------------- |
/** | /** | ||
- | * lets DokuWiki | + | * lets dokuwiki |
*/ | */ | ||
addInitEvent(function(){ fixRubyAlignment(); | addInitEvent(function(){ fixRubyAlignment(); | ||
Line 278: | Line 290: | ||
* Postprocesses the HTML that was built from that, to rubify kanji that have associated furigana. | * Postprocesses the HTML that was built from that, to rubify kanji that have associated furigana. | ||
*/ | */ | ||
- | function register(&$controller) | + | function register(Doku_Event_Handler |
{ | { | ||
// initialise variables | // initialise variables |
plugin/xhtmlruby.1257687747.txt.gz · Last modified: 2009-11-08 14:42 by 77.167.120.32