1 /* |
1 /* |
2 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
130 * @param body content for the anchor tag |
130 * @param body content for the anchor tag |
131 * @return an HtmlTree object |
131 * @return an HtmlTree object |
132 */ |
132 */ |
133 public static HtmlTree A(String ref, Content body) { |
133 public static HtmlTree A(String ref, Content body) { |
134 HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body)); |
134 HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body)); |
135 htmltree.addAttr(HtmlAttr.HREF, nullCheck(ref)); |
135 htmltree.addAttr(HtmlAttr.HREF, Util.escapeHtmlChars(nullCheck(ref))); |
136 return htmltree; |
136 return htmltree; |
137 } |
137 } |
138 |
138 |
139 /** |
139 /** |
140 * Generates an HTML anchor tag with name attribute and content. |
140 * Generates an HTML anchor tag with name attribute and content. |