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-q-element"><q></a> 023 * element. 024 * 025 * <p> 026 * The q element represents a short inline quotation. It is used for short quotes that are part 027 * of the surrounding text, as opposed to blockquote which is used for longer, standalone quotations. 028 * The cite attribute can be used to provide a link to the source of the quotation. 029 * 030 * <h5 class='section'>Examples:</h5> 031 * <p class='bcode w800'> 032 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 033 * 034 * <jc>// Simple inline quotation</jc> 035 * Q <jv>q1</jv> = <jsm>q</jsm>(<js>"To be or not to be, that is the question."</js>); 036 * 037 * <jc>// Quotation with citation</jc> 038 * Q <jv>q2</jv> = <jsm>q</jsm>(<js>"The only way to do great work is to love what you do."</js>) 039 * .cite(<js>"https://example.com/source"</js>); 040 * 041 * <jc>// Quotation in a paragraph</jc> 042 * P <jv>p1</jv> = <jsm>p</jsm>( 043 * <js>"As Shakespeare once said, "</js>, 044 * <jsm>q</jsm>(<js>"All the world's a stage"</js>), 045 * <js>" and we are merely players."</js> 046 * ); 047 * 048 * <jc>// Quotation with styling</jc> 049 * Q <jv>q3</jv> = <jsm>q</jsm>(<js>"Innovation distinguishes between a leader and a follower."</js>) 050 * .class_(<js>"highlighted-quote"</js>) 051 * .cite(<js>"https://example.com/author"</js>); 052 * </p> 053 * 054 * <p> 055 * The following convenience methods are provided for constructing instances of this bean: 056 * <ul class='javatree'> 057 * <li class='jc'>{@link HtmlBuilder} 058 * <ul class='javatree'> 059 * <li class='jm'>{@link HtmlBuilder#q() q()} 060 * <li class='jm'>{@link HtmlBuilder#q(Object...) q(Object...)} 061 * </ul> 062 * </ul> 063 * </p> 064 * 065 * <h5 class='section'>See Also:</h5><ul> 066 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 067 * </ul> 068 */ 069@Marshalled(typeName = "q") 070public class Q extends HtmlElementMixed<Q> { 071 072 /** 073 * Creates an empty {@link Q} element. 074 */ 075 public Q() {} 076 077 /** 078 * Creates a {@link Q} element with the specified child nodes. 079 * 080 * @param children The child nodes. Must not be <jk>null</jk>. 081 */ 082 public Q(Object...children) { 083 children(children); 084 } 085 086 /** 087 * <a class="doclink" href="https://www.w3.org/TR/html5/text-level-semantics.html#attr-q-cite">cite</a> attribute. 088 * 089 * <p> 090 * Specifies the URL of the source document or message from which the quotation was taken. 091 * This provides context and attribution for the quoted content. 092 * 093 * <p> 094 * The URL should point to the original source of the quoted material. 095 * 096 * @param value The URL of the source document for the quotation. Can be <jk>null</jk> to unset the attribute. 097 * @return This object. 098 */ 099 public Q cite(String value) { 100 attr("cite", value); 101 return this; 102 } 103}