You need to be logged in to post in the forums. If you do not have an account, please sign up first.
UserJS for XHTML 1.1 Ruby module
To celebrate glorious victory of vikings from Osland in fierce battle with army of vertical alignment bugs, I decided to write UserJS 'implementation' of XHTML 1.1 Ruby module.Those who have Opera 9TP2 can install ruby.js and try this page or this one.
If you'll notice bugs please post them here.
Note that Ruby module is part of XHTML 1.1 and documents with Ruby should be served as application/xhtml+xml, application/xml or text/xml (and not text/html), ruby elements should be in XHTML namespace http://www.w3.org/1999/xhtml
N.B. In Opera 9 TP2 you can set up UserJS directory from
-[Tools]
--[Preferences]
---[Sites]
----[Default settings]
-----[Scripting]
------[My javascript files]
(then place ruby.js in directory specified there).
P.S. Don't expect too much from ruby.js it just transforms ruby into XHTML + CSS tagsoup.
do you provide the enormous pice of code needed for fallback in older versions ? you should
For a collection of user scripts visit
http://my.opera.com/xErath/blog/
http://my.opera.com/xErath/blog/
No. There is no fallback code, it works in 9TP2 only, the reason for heavy markup is attempt to support complex ruby with rbspan attributes and base that may contain extra stuff, like sub/superscripts. In fact only the following part of script is responsible for simple ruby:
The rest deals with complex one. I will post annotated version later, so it will be easier to read/modify code.
element.insertBefore(element.getElementsByTagNameNS('http://www.w3.org/1999/xhtml','rt')[0].cloneNode('true'),element.firstChild);
The rest deals with complex one. I will post annotated version later, so it will be easier to read/modify code.
This page doesn't work because of its content type as text/html, does it?
http://jesus2099.free.fr/fichiers/faq/J2_SRTalpha_seishin.htm
I don't remember why but I think I had a reason for putting text/html rather than application/...
Could you tell ?
http://jesus2099.free.fr/fichiers/faq/J2_SRTalpha_seishin.htm
I don't remember why but I think I had a reason for putting text/html rather than application/...
Could you tell ?
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
Yes, the reason is content type, one can change the script to handle text/html too, but since Ruby is not supposed to be used in text/html, script only runs on application/xhtml+xml, application/xml and text/xml pages.
I changed the Content-type to application/xhtml+xml but the userjs doesn't trigger yet. Could you have a look at my page and tell me what is it that you see is wrong please? 
Is it the <html> tag ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>Les magies de Super robot taisen α (jesus2099)</title> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/> ...
Is it the <html> tag ?
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
Thanks Undertow, but I don't understand which one ?
And, White lynx, is it mandatory to use the following line (as in your samples) ?
And, White lynx, is it mandatory to use the following line (as in your samples) ?
<?xml version="1.0" encoding="utf-8"?>
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
Thanks Undertow, but I don't understand which one?
If your server is configured appropriately, then just change file extension from .htm to .xhtml or .xml and then it will served as application/xhtml+xml or application/xml respectively.
is it mandatory to use the following line (as in your samples)?
No, it is optional.
16. August 2006, 14:24:16 (edited)
Thanks White Lynx, I made a new file with xhtml extension.
And maybe, there is something interesting for you here.
Each time I used complex ruby, both rbc and rtc take the border settings of my surrounding table.
Please have a look : http://jesus2099.free.fr/fichiers/faq/J2_SRTalpha_seishin.xhtml
I don't know bu maybe you mught add some border: 0; somewhere in your great ruby.js.
Edit: It seems that it also takes the other properties such as the padding and margin. The complex ruby on my page have their characters spaced where my simple ruby don't. Maybe then border: 0; margin: 0; padding: 0; etc.
Edit 2: You might also press SHIFT+P to see print preview. There are other issues, still concerning table, rows and such (the row border it seems ; the light grey line), that may be of some interest for your userjs dev.
And maybe, there is something interesting for you here.
Each time I used complex ruby, both rbc and rtc take the border settings of my surrounding table.
Please have a look : http://jesus2099.free.fr/fichiers/faq/J2_SRTalpha_seishin.xhtml
I don't know bu maybe you mught add some border: 0; somewhere in your great ruby.js.
Edit: It seems that it also takes the other properties such as the padding and margin. The complex ruby on my page have their characters spaced where my simple ruby don't. Maybe then border: 0; margin: 0; padding: 0; etc.
Edit 2: You might also press SHIFT+P to see print preview. There are other issues, still concerning table, rows and such (the row border it seems ; the light grey line), that may be of some interest for your userjs dev.
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
Each time I used complex ruby, both rbc and rtc take the border settings of my surrounding table.
This is because complex ruby is formatted as table, I changed UserJS, new one resets margins,
borders and other CSS properties, this should partly solve the problem but will not fully protect ruby from CSS applied to tables.
You might also press SHIFT+P to see print preview.
Known bug with inline-tables http://www.geocities.com/csssite/opera/bug13.xhtml
How great !
Thank you
Is it the inlay-table bug causing this 1cm vertical spacing between ruby base and ruby text of complex ruby in print preview ?
Thank you

Is it the inlay-table bug causing this 1cm vertical spacing between ruby base and ruby text of complex ruby in print preview ?
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
Is it the inlay-table bug causing this 1cm vertical spacing between ruby base and ruby text of complex ruby in print preview ?
Yes, it does not affect simple Ruby which is formatted as inline-block, but complex Ruby which is formatted as inline-table is affected by that bug.
In near future UserJS for Ruby will be moved to the following address
http://xml-maiden.com/userjs/ruby/ruby.js
Examples will be located at
http://xml-maiden.com/userjs/ruby/ruby.xml
http://xml-maiden.com/userjs/ruby/ruby.xhtml
http://xml-maiden.com/userjs/ruby/ruby.js
Examples will be located at
http://xml-maiden.com/userjs/ruby/ruby.xml
http://xml-maiden.com/userjs/ruby/ruby.xhtml
Hi Lynx,
Why not in userjs.org too / instead ?
Why not in userjs.org too / instead ?
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
http://en.wikipedia.org/wiki/Chinese_grammar doesn't work, but your examples do
Well, Ruby module is part of XHTML 1.1 and documents with Ruby should be served as application/xhtml+xml, application/xml or text/xml, per specs it is nor expected to be used in text/html documents like Wikipedia article above, but if necessary it is possible to modify UserJS to allow ruby in text/html too.
Hi Lynx,
There is Kai Lapis, coding something similar : http://my.opera.com/userjs/forums/topic.dml?id=163010
She (he?) is true that your script is not easy to find. Maybe you should cooperate in some way, exchange secret techniques ... Make a coproduction in some way for the better of us all ruby fanatics.
There is Kai Lapis, coding something similar : http://my.opera.com/userjs/forums/topic.dml?id=163010
She (he?) is true that your script is not easy to find. Maybe you should cooperate in some way, exchange secret techniques ... Make a coproduction in some way for the better of us all ruby fanatics.

jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
There are no secret techniques
script is in public domain and anyone can copy/modify/redistribute it without any restrictions. One can enable it in HTML too, like this
http://xml-maiden.com/userjs/ruby/html/ruby.js
but Ruby is not part of HTML, so original script does not run on text/html pages by design.
Kai Lapis's script uses more simple approach, that does not take care of baseline alignement in cases when height of base and/or annotations differes from expected (for example base carries some complex inline content), but this issue is not important as usually ruby contains only simple text.
script is in public domain and anyone can copy/modify/redistribute it without any restrictions. One can enable it in HTML too, like thishttp://xml-maiden.com/userjs/ruby/html/ruby.js
but Ruby is not part of HTML, so original script does not run on text/html pages by design.
Kai Lapis's script uses more simple approach, that does not take care of baseline alignement in cases when height of base and/or annotations differes from expected (for example base carries some complex inline content), but this issue is not important as usually ruby contains only simple text.
In fact, I just learned that XHTML documents should be written into ".xhtml. extension files. Because the two files I linked up contain identical code but only the ".xhtml" one triggers with your code.
document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "ruby")
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
Okay, thanx for the update.
See ya, Darken
Opera useful/related links
Opera useful/related links
Hey you two, since userjs is dead, you could upload your scripts into http://userscripts.org (it's a nice repository) and tag them accordingly (like tag:opera friendly because the website is for any browser and tag:<ruby>.
jesus2099 × Ti = Tristan + patate12 ÷ saucisson7 éditer bug report
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP
※ My bugs and whishlist for Opera
Using latest stable version on Windows XP