Class Rp<T extends Rp<T>>


public class Rp<T extends Rp<T>> extends PhrasingContentElement<T>
Represents an HTML <rp> (ruby parentheses) element that provides fallback text for ruby annotations.

The <rp> element is used within a <ruby> element to provide parentheses or other fallback content for browsers that don't support ruby annotations. When ruby annotations are supported, the content of <rp> elements is not displayed. When not supported, the parentheses are shown around the pronunciation guide.

Features:

  • Provides fallback parentheses for ruby annotations
  • Hidden in browsers that support ruby annotations
  • Visible in browsers without ruby support
  • Used to wrap <rt> (ruby text) elements
  • Ensures graceful degradation of ruby annotations
  • Typically contains opening or closing parentheses

Usage:


 // Japanese kanji with furigana pronunciation guide
 Ruby kanji = new Ruby();
 kanji.addText("漢字");  // The kanji characters

 Rp openParen = new Rp();
 openParen.addText("(");
 kanji.addElement(openParen);

 Rt pronunciation = new Rt();
 pronunciation.addText("かんじ");  // Hiragana pronunciation
 kanji.addElement(pronunciation);

 Rp closeParen = new Rp();
 closeParen.addText(")");
 kanji.addElement(closeParen);

 // Result in ruby-capable browsers: 漢字 with かんじ above
 // Result in non-ruby browsers: 漢字(かんじ)

 // Chinese character with pinyin
 Ruby chinese = new Ruby();
 chinese.addText("北京");
 chinese.addElement(new Rp("("));
 Rt pinyin = new Rt();
 pinyin.addText("Běijīng");
 chinese.addElement(pinyin);
 chinese.addElement(new Rp(")"));
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Rp

      public Rp()
      Constructs a new Rp element.

      Creates an HTML <rp> element for ruby annotation fallback content. Typically used to add opening "(" or closing ")" parentheses around ruby text for browsers that don't support ruby annotations.