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-bdi-element"><bdi></a> 023 * element. 024 * 025 * <p> 026 * The bdi element represents a span of text that is to be isolated from its surroundings for the 027 * purposes of bidirectional text formatting. It is used to handle text that might be in a different 028 * direction than the surrounding text, such as user-generated content in a different language or 029 * script. The bdi element ensures that the text inside it is formatted correctly regardless of the 030 * directionality of the surrounding content. 031 * 032 * <h5 class='section'>Examples:</h5> 033 * <p class='bcode w800'> 034 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 035 * 036 * <jc>// User comment in Arabic</jc> 037 * Bdi <jv>arabic</jv> = <jsm>bdi</jsm>(<js>"مرحبا بالعالم"</js>); 038 * 039 * <jc>// Hebrew text in English context</jc> 040 * Bdi <jv>hebrew</jv> = <jsm>bdi</jsm>(<js>"שלום עולם"</js>); 041 * 042 * <jc>// Mixed direction text</jc> 043 * Bdi <jv>mixed</jv> = <jsm>bdi</jsm>(<js>"Hello "</js>, <jsm>bdi</jsm>(<js>"مرحبا"</js>), <js>" World"</js>); 044 * 045 * <jc>// User-generated content</jc> 046 * Bdi <jv>userContent</jv> = <jsm>bdi</jsm>(<js>"This is a comment in Arabic: مرحبا"</js>) 047 * .class_(<js>"user-comment"</js>); 048 * 049 * <jc>// Names in different scripts</jc> 050 * Bdi <jv>name</jv> = <jsm>bdi</jsm>(<js>"محمد أحمد"</js>); 051 * 052 * <jc>// Numbers in different scripts</jc> 053 * Bdi <jv>numbers</jv> = <jsm>bdi</jsm>(<js>"١٢٣٤٥"</js>); 054 * 055 * <jc>// Styled bidirectional text</jc> 056 * Bdi <jv>styled</jv> = <jsm>bdi</jsm>(<js>"نص باللغة العربية"</js>) 057 * .class_(<js>"bidi-text"</js>) 058 * .style(<js>"direction: rtl;"</js>); 059 * </p> 060 * 061 * <p> 062 * The following convenience methods are provided for constructing instances of this bean: 063 * <ul class='javatree'> 064 * <li class='jc'>{@link HtmlBuilder} 065 * <ul class='javatree'> 066 * <li class='jm'>{@link HtmlBuilder#bdi() bdi()} 067 * <li class='jm'>{@link HtmlBuilder#bdi(Object) bdi(Object)} 068 * </ul> 069 * </ul> 070 * </p> 071 * 072 * <h5 class='section'>See Also:</h5><ul> 073 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 074 * </ul> 075 */ 076@Marshalled(typeName = "bdi") 077public class Bdi extends HtmlElementText<Bdi> { 078 079 /** 080 * Creates an empty {@link Bdi} element. 081 */ 082 public Bdi() {} 083 084 /** 085 * Creates a {@link Bdi} element with the specified {@link Bdi#text(Object)} node. 086 * 087 * @param text The {@link Bdi#text(Object)} node. 088 */ 089 public Bdi(Object text) { 090 text(text); 091 } 092}