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-var-element"><var></a> 023 * element. 024 * 025 * <p> 026 * The var element represents a variable. It is used to mark up variables in mathematical 027 * expressions, programming code, or other contexts where a variable name needs to be 028 * distinguished from regular text. The var element is typically rendered in italics and 029 * is commonly used in documentation, tutorials, and technical writing to identify 030 * variable names, function parameters, or mathematical variables. 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>// Simple variable</jc> 037 * Var <jv>simple</jv> = <jsm>var</jsm>(<js>"x"</js>); 038 * 039 * <jc>// Var with styling</jc> 040 * Var <jv>styled</jv> = <jsm>var</jsm>(<js>"userName"</js>) 041 * .class_(<js>"variable"</js>); 042 * 043 * <jc>// Var with complex content</jc> 044 * Var <jv>complex</jv> = <jsm>var</jsm>( 045 * <js>"The variable "</js>, 046 * <jsm>strong</jsm>(<js>"count"</js>), 047 * <js>" represents the number of items."</js> 048 * ); 049 * 050 * <jc>// Var with ID</jc> 051 * Var <jv>withId</jv> = <jsm>var</jsm>(<js>"totalCount"</js>) 052 * .id(<js>"variable-name"</js>); 053 * 054 * <jc>// Var with styling</jc> 055 * Var <jv>styled2</jv> = <jsm>var</jsm>(<js>"customVariable"</js>) 056 * .style(<js>"color: #0066cc; font-style: italic;"</js>) 057 * .children("maxValue"); 058 * 059 * // Var with multiple elements 060 * Var multiple = var() 061 * .children( 062 * "The ", 063 * var().children("x"), 064 * " and ", 065 * var().children("y"), 066 * " variables are used in the equation." 067 * ); 068 * 069 * // Var with links 070 * Var withLinks = var() 071 * .children( 072 * "See ", 073 * a().href("/docs/variables").children("variable documentation"), 074 * " for more information." 075 * ); 076 * </p> 077 * 078 * <p> 079 * The following convenience methods are provided for constructing instances of this bean: 080 * <ul class='javatree'> 081 * <li class='jc'>{@link HtmlBuilder} 082 * <ul class='javatree'> 083 * <li class='jm'>{@link HtmlBuilder#var() var()} 084 * <li class='jm'>{@link HtmlBuilder#var(Object...) var(Object...)} 085 * </ul> 086 * </ul> 087 * </p> 088 * 089 * <h5 class='section'>See Also:</h5><ul> 090 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 091 * </ul> 092 */ 093@Marshalled(typeName = "var") 094public class Var extends HtmlElementMixed<Var> { 095 096 /** 097 * Creates an empty {@link Var} element. 098 */ 099 public Var() {} 100 101 /** 102 * Creates a {@link Var} element with the specified child nodes. 103 * 104 * @param children The child nodes. Must not be <jk>null</jk>. 105 */ 106 public Var(Object...children) { 107 children(children); 108 } 109}