]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Added anchors for SCL data types and classes in HTML documentation 85/3085/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 9 Aug 2019 11:12:04 +0000 (14:12 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 9 Aug 2019 19:25:59 +0000 (22:25 +0300)
* data Foo anchor: `data-Foo`
* class Bar anchor: `class-Bar`

Also changed data types, classes and values to have different background
coloring in the SCL HTML documentation for better readability.

gitlab #337

Change-Id: I731489cbb1a972dd6e2bc95645b66f41877e843d

bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SclDoc.css

index d9e65e28c39208b575234aae41e3a94000702912..e719aaf8cd47e6993311d7f6b970851430087497 100644 (file)
@@ -178,7 +178,7 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle
         StringBuilder signature = new StringBuilder();
         signature.append("<div id=\"")
         .append(HtmlEscape.escape(name))
-        .append("\" class=\"code-doc-box\"><div class=\"code\">");
+        .append("\" class=\"code-doc-box\"><div class=\"code value\">");
         char firstChar = name.charAt(0);
         if(!Character.isAlphabetic(firstChar) && firstChar != '_')
             name = "(" + name + ")";
@@ -231,7 +231,9 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle
         
         TypeUnparsingContext tuc = new TypeUnparsingContext();
         StringBuilder signature = new StringBuilder();
-        signature.append("<div class=\"code-doc-box\"><div class=\"code\">");
+        signature.append("<div id=\"class-")
+        .append(HtmlEscape.escape(name))
+        .append("\" class=\"code-doc-box\"><div class=\"code class\">");
         signature.append("class ");
         if(typeClass.context.length > 0) {
             signature.append('(');
@@ -293,7 +295,9 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle
         
         TypeUnparsingContext tuc = new TypeUnparsingContext();
         StringBuilder signature = new StringBuilder();
-        signature.append("<div class=\"code-doc-box\"><div class=\"code\">");
+        signature.append("<div id=\"data-")
+        .append(HtmlEscape.escape(name))
+        .append("\" class=\"code-doc-box\"><div class=\"code data\">");
         signature.append("data ");
         signature.append(typeDescriptor.name.name);
         if(typeDescriptor instanceof TypeConstructor) {
index 27ecb48ebeb4af1ff48f18fbfc3e18f088b8fe59..7dd20434848b27777af13e2d6af193b0b8558cd3 100644 (file)
@@ -491,7 +491,6 @@ vertical-align:1px;
 .code-doc-box>.code {
   font-size: 12px;
   font-family: Consolas, "Liberation Mono", Courier, monospace;
-  background-color: #f0f0ff;
   white-space: pre;
   padding: 10px 15px;
   border-bottom: 1px solid;
@@ -500,7 +499,19 @@ vertical-align:1px;
   display: block;
 }
 
-.code-doc-box>.doc {display: block;
+.code-doc-box>.value {
+  background-color: #f0f0ff;
+}
+
+.code-doc-box>.data {
+  background-color: #f0fff0;
+}
+
+.code-doc-box>.class {
+  background-color: #fff0f0;
+}
+
+.code-doc-box>.doc {
   padding: 0px 15px ;
   display: block;
 }