001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.html5; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element"><ruby></a> 023 * element. 024 * 025 * <p> 026 * The ruby element represents a ruby annotation. It is used to provide pronunciation or 027 * translation information for text in languages that use complex writing systems, such as 028 * Japanese, Chinese, or Korean. The ruby element typically contains rb (ruby base) elements 029 * for the base text and rt (ruby text) elements for the annotations. It can also contain 030 * rp (ruby parenthesis) elements for fallback display when ruby annotations are not supported. 031 * Ruby annotations are commonly used to provide furigana (pronunciation guides) for Japanese text. 032 * 033 * <h5 class='section'>Examples:</h5> 034 * <p class='bcode w800'> 035 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 036 * 037 * <jc>// Simple ruby annotation</jc> 038 * Ruby <jv>simple</jv> = <jsm>ruby</jsm>( 039 * <jsm>rb</jsm>(<js>"漢字"</js>), 040 * <jsm>rt</jsm>(<js>"かんじ"</js>) 041 * ); 042 * 043 * <jc>// Ruby with styling</jc> 044 * Ruby <jv>styled</jv> = <jsm>ruby</jsm>( 045 * <jsm>rb</jsm>(<js>"日本語"</js>), 046 * <jsm>rt</jsm>(<js>"にほんご"</js>) 047 * ).class_(<js>"ruby-annotation"</js>); 048 * 049 * <jc>// Ruby with complex content</jc> 050 * Ruby <jv>complex</jv> = <jsm>ruby</jsm>( 051 * <jsm>rb</jsm>(<js>"複雑な漢字"</js>), 052 * <jsm>rt</jsm>(<js>"ふくざつなかんじ"</js>), 053 * <jsm>rp</jsm>(<js>"("</js>), 054 * <jsm>rp</jsm>(<js>")"</js>) 055 * ); 056 * 057 * <jc>// Ruby with ID</jc> 058 * Ruby <jv>withId</jv> = <jsm>ruby</jsm>( 059 * <jsm>rb</jsm>(<js>"漢字"</js>), 060 * <jsm>rt</jsm>(<js>"かんじ"</js>) 061 * ).id(<js>"ruby-annotation-1"</js>); 062 * 063 * <jc>// Ruby with styling</jc> 064 * Ruby <jv>styled2</jv> = <jsm>ruby</jsm>( 065 * .style("font-size: 1.2em; line-height: 1.5;") 066 * .children( 067 * new Rb().children("漢字"), 068 * new Rt().children("かんじ") 069 * ); 070 * 071 * // Ruby with multiple elements 072 * Ruby multiple = new Ruby() 073 * .children( 074 * new Rb().children("複雑な"), 075 * new Rt().children("ふくざつな"), 076 * new Rb().children("漢字"), 077 * new Rt().children("かんじ") 078 * ); 079 * 080 * // Ruby with links 081 * Ruby withLinks = new Ruby() 082 * .children( 083 * new Rb().children("漢字"), 084 * new Rt().children( 085 * new A().href("/dictionary/kanji").children("かんじ") 086 * ) 087 * ); 088 * </p> 089 * 090 * <h5 class='section'>See Also:</h5><ul> 091 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 092 * </ul> 093 */ 094@Marshalled(typeName = "ruby") 095public class Ruby extends HtmlElementMixed<Ruby> { 096 097 /** 098 * Creates an empty {@link Ruby} element. 099 */ 100 public Ruby() {} 101 102 /** 103 * Creates a {@link Ruby} element with the specified child nodes. 104 * 105 * @param children The child nodes. Must not be <jk>null</jk>. 106 */ 107 public Ruby(Object...children) { 108 children(children); 109 } 110}