You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/06/25 14:38:14 UTC

incubator-juneau git commit: JUNEAU-58 Embed HTML in @HtmlDoc.description

Repository: incubator-juneau
Updated Branches:
  refs/heads/master addeb00ed -> e71a83b9d


JUNEAU-58 Embed HTML in @HtmlDoc.description

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/e71a83b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/e71a83b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/e71a83b9

Branch: refs/heads/master
Commit: e71a83b9d26beda93f25753ff845bf2d8c4c46d1
Parents: addeb00
Author: JamesBognar <ja...@apache.org>
Authored: Sun Jun 25 10:38:13 2017 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Sun Jun 25 10:38:13 2017 -0400

----------------------------------------------------------------------
 .../juneau/html/HtmlDocTemplateBasic.java       |  6 ++--
 .../org/apache/juneau/internal/StringUtils.java |  2 +-
 juneau-core/src/main/javadoc/overview.html      |  4 +++
 .../apache/juneau/rest/annotation/HtmlDoc.java  | 16 +++++++++--
 .../org/apache/juneau/rest/styles/devops.css    | 30 ++++++--------------
 5 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e71a83b9/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocTemplateBasic.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocTemplateBasic.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocTemplateBasic.java
index 3088e9c..67fb799 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocTemplateBasic.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocTemplateBasic.java
@@ -42,7 +42,7 @@ public class HtmlDocTemplateBasic implements HtmlDocTemplate {
 
 		w.append(2, "@import ").q().append(cssUrl).q().appendln(";");
 		if (session.isNoWrap())
-			w.appendln("\n* {white-space:nowrap;}");
+			w.appendln("\ndiv.data * {white-space:nowrap;}");
 		if (session.getCss() != null)
 			for (String css : session.getCss())
 				w.appendln(css);
@@ -96,9 +96,9 @@ public class HtmlDocTemplateBasic implements HtmlDocTemplate {
 			String description = session.getDescription();
 			String branding = session.getBranding();
 			if (exists(title))
-				w.oTag(3, "h3").attr("class", "title").append('>').text(title).eTag("h3").nl(3);
+				w.oTag(3, "h3").attr("class", "title").append('>').append(title).eTag("h3").nl(3);
 			if (exists(description))
-				w.oTag(3, "h5").attr("class", "description").append('>').text(description).eTag("h5").nl(3);
+				w.oTag(3, "h5").attr("class", "description").append('>').append(description).eTag("h5").nl(3);
 			if (exists(branding))
 				w.append(3, branding).nl(3);
 		}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e71a83b9/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
index b63875f..f7f1462 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -1585,7 +1585,7 @@ public final class StringUtils {
 	 * @return The formatted string.
 	 */
 	public static String format(String pattern, Object...args) {
-		if (args.length == 0)
+		if (args == null || args.length == 0)
 			return pattern;
 		for (int i = 0; i < args.length; i++)
 			args[i] = convertToReadable(args[i]);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e71a83b9/juneau-core/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/overview.html b/juneau-core/src/main/javadoc/overview.html
index 3f17bc7..310cd26 100644
--- a/juneau-core/src/main/javadoc/overview.html
+++ b/juneau-core/src/main/javadoc/overview.html
@@ -6190,6 +6190,8 @@
 		<ul class='spaced-list'>
 			<li>{@link org.apache.juneau.rest.widget.QueryWidget} improvements.
 				<br>Fields are prefilled with current search arguments.
+			<li>Bug fix with {@link org.apache.juneau.rest.annotation.HtmlDoc#nowrap()} so that the setting only applies
+				to the data contents, not the whole page.
 			<li>Two convenience methods added to {@link org.apache.juneau.rest.RestRequest}:
 				<ul>
 					<li>{@link org.apache.juneau.rest.RestRequest#attr(String,Object) attr(String,Object)}
@@ -6200,6 +6202,8 @@
 					<li>{@link org.apache.juneau.rest.annotation.RestResource#flags()}
 					<li>{@link org.apache.juneau.rest.annotation.RestMethod#flags()}
 				</ul>
+			<li>{@link org.apache.juneau.rest.annotation.HtmlDoc#title()} and {@link org.apache.juneau.rest.annotation.HtmlDoc#description()}
+				can now take HTML (phrasing content only since it's still inside H3 and H5 tags).
 		</ul>
 	</div>
 	

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e71a83b9/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
index ed84224..83d50b8 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
@@ -51,7 +51,9 @@ import org.apache.juneau.rest.*;
  * 		&lt;/head&gt;
  * 		&lt;body&gt;
  * 			&lt;header&gt;
- * 				<xv>Page title and description</xv>
+ * 				&lt;h3 <xa>class</xa>=<xs>'title'</xs>&gt;<xv>Page title</xv>&lt;/h3&gt;
+ * 				&lt;h5 <xa>class</xa>=<xs>'description'</xs>&gt;<xv>Page description</xv>&lt;/h5&gt;
+ * 				<xv>Arbitrary page branding</xv>
  * 			&lt;/header&gt;
  * 			&lt;nav&gt;
  * 				<xv>Page links</xv>
@@ -74,7 +76,7 @@ public @interface HtmlDoc {
 	/**
 	 * Sets the HTML page title in the header section of the page generated by the default HTML doc template.
 	 * <p>
-	 * The format of this value is plain text.
+	 * The format of this value is HTML (phrasing content only).
 	 * <p>
 	 * It gets wrapped in a <code><xt>&lt;h3&gt; <xa>class</xa>=<xs>'title'</xs>&gt;</xt></code> element and then added
 	 * 	to the <code><xt>&lt;header&gt;</code> section on the page.
@@ -98,6 +100,9 @@ public @interface HtmlDoc {
 	 * 		page title.
 	 * 		However, this annotation is provided in cases where you want the page title to be different that the one
 	 * 		shown in the swagger document.
+	 * 	<li class='info'>
+	 * 		The entire header section can be rendered with arbitrary HTML using {@link #header()}.
+	 * 		This annotation is ignored when the {@link #header()} annotation is specified.
 	 * </ul>
 	 * <p>
 	 * The programmatic equivalent to this annotation are the {@link RestConfig#setHtmlTitle(String)}/{@link RestResponse#setHtmlTitle(Object)} methods.
@@ -107,7 +112,7 @@ public @interface HtmlDoc {
 	/**
 	 * Sets the HTML page subtitle in the header section of the page generated by the default HTML doc template.
 	 * <p>
-	 * The format of this value is plain text.
+	 * The format of this value is HTML (phrasing content only).
 	 * <p>
 	 * It gets wrapped in a <code><xt>&lt;h5&gt; <xa>class</xa>=<xs>'description'</xs>&gt;</xt></code> element and then
 	 * 	added to the <code><xt>&lt;header&gt;</code> section on the page.
@@ -133,6 +138,9 @@ public @interface HtmlDoc {
 	 * 		<code>@RestMethod(summary)</code> annotations to specify the page text.
 	 * 		However, this annotation is provided in cases where you want the text to be different that the values shown
 	 * 		in the swagger document.
+	 * 	<li class='info'>
+	 * 		The entire header section can be rendered with arbitrary HTML using {@link #header()}.
+	 * 		This annotation is ignored when the {@link #header()} annotation is specified.
 	 * </ul>
 	 * <p>
 	 * The programmatic equivalent to this annotation are the {@link RestConfig#setHtmlDescription(String)}/{@link RestResponse#setHtmlDescription(Object)} methods.
@@ -333,6 +341,8 @@ public @interface HtmlDoc {
 
 	/**
 	 * Shorthand method for forcing the rendered HTML content to be no-wrap.
+	 * <p>
+	 * This only applies to the rendered data portion of the page.
 	 */
 	boolean nowrap() default false;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e71a83b9/juneau-rest/src/main/resources/org/apache/juneau/rest/styles/devops.css
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/resources/org/apache/juneau/rest/styles/devops.css b/juneau-rest/src/main/resources/org/apache/juneau/rest/styles/devops.css
index 4f43617..c0e5b52 100644
--- a/juneau-rest/src/main/resources/org/apache/juneau/rest/styles/devops.css
+++ b/juneau-rest/src/main/resources/org/apache/juneau/rest/styles/devops.css
@@ -72,22 +72,26 @@ footer {
 
 /* Title */
 h3.title {
-	color: white;
 	margin: 0px;
 	padding: 10px 20px;
+	border-bottom: 2px solid #34534B;
+}
+h3.title, h3.title * {
+	color: white;
 	text-decoration: none;
 	font-weight: normal;
-	border-bottom: 2px solid #34534B;
 }
 
 /* Description */
 h5.description {
-	color: #B3B3B3;
 	margin: 0;
 	padding: 10px 20px;
+	border-bottom: 2px solid #34534B;
+}
+h5.description, h5.description * {
+	color: #B3B3B3;
 	text-decoration: none;
 	font-weight: normal;
-	border-bottom: 2px solid #34534B;
 }
 
 /************************************************************************************/
@@ -146,24 +150,6 @@ div.data th, .header {
 	background-color: #F4F6F9;
 }
 
-button {
-	border-left:1px solid #A1AFAC;
-	border-top:1px solid #A1AFAC;
-	color: white;
-	font-size: 9pt;
-	background: #00B299;
-    font-weight: bold;
-    padding: 5px 20px;	
-	border-radius: 5px;
-	text-transform: uppercase;
-	margin-left: 10px;
-}
-
-button:hover {
-	background-image: none;
-	background-color: #66D1C2;
-}
-
 div.data ul {
 	margin:0px;
 	padding-left:20px;