sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1794742 - in /sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book: Assembler.java CodeColorizer.java
Date Wed, 10 May 2017 17:01:39 GMT
Author: desruisseaux
Date: Wed May 10 17:01:39 2017
New Revision: 1794742

URL: http://svn.apache.org/viewvc?rev=1794742&view=rev
Log:
Code provenance (GeoAPI, OGC or SIS) specified in the <code> element instead than in
the <pre> element.

Modified:
    sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
    sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java

Modified: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java?rev=1794742&r1=1794741&r2=1794742&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
[UTF-8] Wed May 10 17:01:39 2017
@@ -142,7 +142,7 @@ public final class Assembler {
     private final ResourceBundle resources;
 
     /**
-     * Helper class for applying colors on content of {@code <pre>} and {@code <code>}
elements.
+     * Helper class for applying colors on content of {@code <code>} and {@code <samp>}
elements.
      */
     private final CodeColorizer colorizer;
 
@@ -223,7 +223,7 @@ public final class Assembler {
                 CharSequence  text    = node.getTextContent();
                 for (int i=0; i<text.length(); i++) {
                     switch (text.charAt(i)) {
-                        case '\r': break;  // Delete all occurrences of '\r'.
+                        case '\r': break;                       // Delete all occurrences
of '\r'.
                         case '\n': newLine = true;  continue;
                         default  : newLine = false; continue;
                         case ' ' : if (newLine) break; else continue;
@@ -351,12 +351,19 @@ public final class Assembler {
                         processAbbreviation((Element) node);
                         break;
                     }
-                    case "pre": {
-                        colorizer.highlight(node, ((Element) node).getAttribute("class"));
+                    case "samp": {
+                        final String cl = ((Element) node).getAttribute("class");
+                        if (cl != null) {
+                            colorizer.highlight(node, cl);
+                        }
                         break;
                     }
                     case "code": {
                         if (!((Element) node).hasAttribute("class")) {
+                            if ("pre".equals(node.getParentNode().getNodeName())) {
+                                colorizer.highlight(node, ((Element) node).getAttribute("class"));
+                                break;
+                            }
                             final String style = colorizer.styleForSingleIdentifier(node.getTextContent());
                             if (style != null) {
                                 ((Element) node).setAttribute("class", style);

Modified: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java?rev=1794742&r1=1794741&r2=1794742&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
[UTF-8] Wed May 10 17:01:39 2017
@@ -78,7 +78,7 @@ public final class CodeColorizer {
     private enum Specifier {
         OGC("OGC"), GEOAPI("GeoAPI"), SIS("SIS"), XML_PREFIX(null);
 
-        /** The value to put in the {@code class} attribute of {@code <code>} or elements,
or {@code null} if none. */
+        /** The value to put in the {@code class} attribute of {@code <code>} or other
elements, or {@code null} if none. */
         final String style;
 
         /** Creates a new enum to be rendered with the given style. */
@@ -245,7 +245,7 @@ public final class CodeColorizer {
      * Applies emphasing on the words found in all text node of the given node.
      *
      * @param  parent  the root element where to put Java keywords in bold characters.
-     *                 This is typically a {@code <pre>} or {@code <code>} element.
+     *                 This is typically a {@code <samp>} or {@code <code>} element.
      * @param  type    {@code "xml"} if the element to process is XML rather than Java code.
      * @throws BookException if an element can not be processed.
      */
@@ -309,7 +309,7 @@ public final class CodeColorizer {
                                 syntaticElement.setAttribute("class", "comment");
                             } else {
                                 lower += Character.charCount(c);
-                                continue;  // "Ordinary" character: scan next characters.
+                                continue;                       // "Ordinary" character:
scan next characters.
                             }
                             /*
                              * Found the begining of a comment block or a string. Search
where that block ends



Mime
View raw message