From ca92b2264272709e1223ad117d37ec93153dd62e Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Thu, 02 Apr 2015 15:16:00 +0000
Subject: [PATCH] CR-6565 OPENDJ-1806 Workaround usage() formatting in docs

---
 opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
index 3168041..5e69c18 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -763,7 +763,7 @@
         map.put("shortDesc", getShortToolDescription());
         map.put("descTitle", REF_TITLE_DESCRIPTION.get());
         map.put("args", synopsisArgs);
-        map.put("description", getToolDescription());
+        map.put("description", eolToNewPara(getToolDescription()));
         map.put("info", getDocToolDescriptionSupplement());
         if (!argList.isEmpty()) {
             map.put("optionSection", getOptionsRefSect1(scriptName));
@@ -773,6 +773,14 @@
         applyTemplate(builder, "refEntry.ftl", map);
     }
 
+    /**
+     * Returns a String with line separators replaced by {@code &lt;/para>&lt;para>}.
+     * @param input String in which to replace line separators.
+     * @return A String with line separators replaced by {@code &lt;/para>&lt;para>}.
+     */
+    String eolToNewPara(final LocalizableMessage input) {
+        return input.toString().replaceAll(EOL, "</para><para>");
+    }
 
     /**
      * Returns a generated DocBook XML RefSect1 element for all command options.
@@ -795,7 +803,7 @@
             if (argGroup.containsArguments() && printHeaders) {
                 LocalizableMessage description = argGroup.getDescription();
                 if (description != LocalizableMessage.EMPTY) {
-                    group.put("description", argGroup.getDescription());
+                    group.put("description", eolToNewPara(description));
                 } else {
                     group.put("description", INFO_SUBCMDPARSER_WHERE_OPTIONS_INCLUDE.get());
                 }
@@ -844,7 +852,7 @@
     private Map<String, Object> getArgumentMap(final Argument a) {
         Map<String, Object> option = new HashMap<String, Object>();
         option.put("synopsis", getOptionSynopsis(a));
-        option.put("description", a.getDescription());
+        option.put("description", eolToNewPara(a.getDescription()));
         String dv = a.getDefaultValue();
         option.put("default", dv != null ? REF_DEFAULT.get(dv) : null);
         option.put("info", a.getDocDescriptionSupplement());

--
Gitblit v1.10.0