Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Java REST client to Asciidoctor #780

Merged
merged 2 commits into from
Apr 10, 2019

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Apr 3, 2019

Switches the Elasticsearch Java REST client's docs from being generated
by the no-longer-maintained AsciiDoc project to the maintained
Asciidoctor project. It is much faster:

AsciiDoc   : 0m48.358s
Asciidoctor: 0m10.436s

Switches the Elasticsearch Java REST client's docs from being generated
by the no-longer-maintained AsciiDoc project to the maintained
Asciidoctor project. It is *much* faster:

AsciiDoc   : 0m48.358s
Asciidoctor: 0m10.436s
@nik9000 nik9000 requested a review from lcawl April 3, 2019 16:34
@nik9000
Copy link
Member Author

nik9000 commented Apr 3, 2019

We'll need elastic/elasticsearch#40785 before merging this.

@nik9000
Copy link
Member Author

nik9000 commented Apr 3, 2019

Here are the differences after elastic/elasticsearch#40785

index.html:

- Asciidoc
+ Asciidoctor
--- /dev/fd/63
+++ html/en/elasticsearch/client/java-rest/master/index.html
@@ -2503,6 +2503,13 @@
                 </li>
                </ul>
               </li>
+              <li>
+               <span class="chapter">
+                <a href="_license_2.html">
+                 License
+                </a>
+               </span>
+              </li>
              </ul>
             </li>
            </ul>

The license page isn't included in AsciiDoc due to a mistake. Asciidoctor fixes it!

java-rest-high-rollup-x-pack-rollup-get-rollup-caps.html:

- AsciiDoc
+ Asciidoctor
@@ -725,15 +725,15 @@
 // indexName will be "docs" in this case... the index pattern that we rolled up
 String indexName = docsPattern.getIndexName();
 
-// Each index pattern can have multiple jobs that rolled it up, so `getJobCaps()`
+// Each index pattern can have multiple jobs that rolled it up, so <code class="literal">getJobCaps()</code>
 // returns a list of jobs that rolled up the pattern
 List&lt;RollupJobCaps&gt; rollupJobs = docsPattern.getJobCaps();
 RollupJobCaps jobCaps = rollupJobs.get(0);
 
-// jobID is the identifier we used when we created the job (e.g. `job1`)
+// jobID is the identifier we used when we created the job (e.g. <code class="literal">job1</code>)
 String jobID = jobCaps.getJobID();
 
-// rollupIndex is the location that the job stored it's rollup docs (e.g. `rollup`)
+// rollupIndex is the location that the job stored it's rollup docs (e.g. <code class="literal">rollup</code>)
 String rollupIndex = jobCaps.getRollupIndex();
 
 // indexPattern is the same as the indexName that we retrieved earlier, redundant info

These seem like a small improvement.

java-rest-high-field-caps.html:

-AsciiDoc
+Asciidoctor
@@ -861,7 +861,7 @@
 
 String[] indices = textCapabilities.indices(); <a id="CO230-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
 String[] nonSearchableIndices = textCapabilities.nonSearchableIndices(); <a id="CO230-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span>
-String[] nonAggregatableIndices = textCapabilities.nonAggregatableIndices();//<a id="CO230-4"></a><span><img alt="" src="images/icons/callouts/4.png"/></span></pre>
+String[] nonAggregatableIndices = textCapabilities.nonAggregatableIndices();<a id="CO230-4"></a><span><img alt="" src="images/icons/callouts/4.png"/></span></pre>
            </div>
            <div class="calloutlist">
             <table border="0" summary="Callout list">

This also seems like a net positive.

java-rest-high-x-pack-ml-delete-filter.html:

-AsciiDoc
+Asciidoctor
@@ -779,7 +779,7 @@
             can also be done in an asynchronous fashion so that the client can return directly. Users need to specify how the response or potential failures will be handled by passing the request and a listener to the asynchronous delete-filter method:
            </p>
            <div class="pre_wrapper">
-            <pre class="programlisting prettyprint lang-java">client.machineLearning().deleteFilterAsync(request, RequestOptions.DEFAULT, listener); //<a id="CO870-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span></pre>
+            <pre class="programlisting prettyprint lang-java">client.machineLearning().deleteFilterAsync(request, RequestOptions.DEFAULT, listener); <a id="CO870-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span></pre>
            </div>
            <div class="calloutlist">
             <table border="0" summary="Callout list">

This also seems like a net positive.

java-rest-high-rollup-x-pack-rollup-get-rollup-index-caps.html:

-AsciiDoc
+Asciidoctor
@@ -722,15 +722,15 @@
 // indexName will be "rollup", the target index we requested
 String indexName = docsPattern.getIndexName();
 
-// Each index pattern can have multiple jobs that rolled it up, so `getJobCaps()`
+// Each index pattern can have multiple jobs that rolled it up, so <code class="literal">getJobCaps()</code>
 // returns a list of jobs that rolled up the pattern
 List&lt;RollupJobCaps&gt; rollupJobs = docsPattern.getJobCaps();
 RollupJobCaps jobCaps = rollupJobs.get(0);
 
-// jobID is the identifier we used when we created the job (e.g. `job1`)
+// jobID is the identifier we used when we created the job (e.g. <code class="literal">job1</code>)
 String jobID = jobCaps.getJobID();
 
-// rollupIndex is the location that the job stored it's rollup docs (e.g. `rollup`)
+// rollupIndex is the location that the job stored it's rollup docs (e.g. <code class="literal">rollup</code>)
 String rollupIndex = jobCaps.getRollupIndex();
 
 // Finally, fieldCaps are the capabilities of individual fields in the config

Also a net positive!

_license_2.html: Didn't exist in AsciiDoc and Asciidoctor adds it. This is also
a net positive.

_provide_feedback.html:

-AsciiDoc
+Asciidoctor
@@ -9,6 +9,7 @@
   <link href="index.html" rel="home" title="Java REST Client [master]"/>
   <link href="java-rest-high-level-migration.html" rel="up" title="Migration Guide"/>
   <link href="_changing_the_application_8217_s_code.html" rel="prev" title="Changing the application’s code"/>
+  <link href="_license_2.html" rel="next" title="License"/>
   <meta content="Get started with the documentation for Elasticsearch, Kibana, Logstash, Beats, X-Pack, Elastic Cloud, Elasticsearch for Apache Hadoop, and our language clients." name="description"/>
   <meta content="Learn/Docs/Clients/JavaREST/master" name="DC.type"/>
   <meta content="Clients" name="DC.subject"/>
@@ -569,6 +570,9 @@
            </a>
           </span>
           <span class="next">
+           <a href="_license_2.html">
+            License »
+           </a>
           </span>
          </div>
          <div class="section">
@@ -591,17 +595,7 @@
            <a class="ulink" href="https://discuss.elastic.co/" target="_top">
             our forum
            </a>
-           . == License
-          </p>
-          <p>
-           Copyright 2013-2018 Elasticsearch
-          </p>
-          <p>
-           Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
-          </p>
-          <pre class="literallayout">http://www.apache.org/licenses/LICENSE-2.0</pre>
-          <p>
-           Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+           .
           </p>
          </div>
          <div class="navfooter">
@@ -611,6 +605,9 @@
            </a>
           </span>
           <span class="next">
+           <a href="_license_2.html">
+            License »
+           </a>
           </span>
          </div>
          <!-- end body -->

This is also a good thing because it includes a page we had accidentally left out.

toc.html:

-AsciiDoc
+Asciidoctor
@@ -1942,6 +1942,13 @@
         </li>
        </ul>
       </li>
+      <li>
+       <span class="chapter">
+        <a href="_license_2.html">
+         License
+        </a>
+       </span>
+      </li>
      </ul>
     </li>
    </ul>

Another case of fixing the missing file!

java-rest-high-supported-apis.html:

-AsciiDoc
+Asciidoctor
@@ -632,6 +632,12 @@
               </ul>
              </div>
             </dd>
+           </dl>
+          </div>
+          <div class="variablelist">
+           <a id="multi-doc">
+           </a>
+           <dl class="variablelist">
             <dt>
              <span class="term">
               Multi-document APIs
@@ -639,8 +645,6 @@
             </dt>
             <dd>
              <div class="itemizedlist">
-              <a id="multi-doc">
-              </a>
               <ul class="itemizedlist" type="disc">
                <li class="listitem">
                 <a class="xref" href="java-rest-high-document-bulk.html" title="Bulk API">

The ID is still on the page, we just move it to a slightly more obvious spot.

_changing_the_application_8217_s_code.html:

-AsciiDoc
+Asciidoctor
@@ -743,9 +743,9 @@
              methods. Here are some examples:
             </p>
             <div class="pre_wrapper">
-             <pre class="programlisting prettyprint lang-java">IndexRequestBuilder indexRequestBuilder   = transportClient.prepareIndex();  // <a id="CO1153-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
-DeleteRequestBuilder deleteRequestBuilder = transportClient.prepareDelete(); // <a id="CO1153-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
-SearchRequestBuilder searchRequestBuilder = transportClient.prepareSearch(); // <a id="CO1153-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span></pre>
+             <pre class="programlisting prettyprint lang-java">IndexRequestBuilder indexRequestBuilder   = transportClient.prepareIndex();  <a id="CO1153-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
+DeleteRequestBuilder deleteRequestBuilder = transportClient.prepareDelete(); <a id="CO1153-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
+SearchRequestBuilder searchRequestBuilder = transportClient.prepareSearch(); <a id="CO1153-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span></pre>
             </div>
             <div class="calloutlist">
              <table border="0" summary="Callout list">
@@ -927,8 +927,8 @@
              :
             </p>
             <div class="pre_wrapper">
-             <pre class="programlisting prettyprint lang-java">DeleteRequest request = new DeleteRequest("index", "doc", "id"); // <a id="CO1154-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
-DeleteResponse response = transportClient.delete(request).actionGet(); // <a id="CO1154-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span></pre>
+             <pre class="programlisting prettyprint lang-java">DeleteRequest request = new DeleteRequest("index", "doc", "id"); <a id="CO1154-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
+DeleteResponse response = transportClient.delete(request).actionGet(); <a id="CO1154-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span></pre>
             </div>
             <div class="calloutlist">
              <table border="0" summary="Callout list">
@@ -1041,16 +1041,16 @@
              :
             </p>
             <div class="pre_wrapper">
-             <pre class="programlisting prettyprint lang-java">DeleteRequest request = new DeleteRequest("index", "doc", "id"); // <a id="CO1156-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
-transportClient.delete(request, new ActionListener&lt;DeleteResponse&gt;() { // <a id="CO1156-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
+             <pre class="programlisting prettyprint lang-java">DeleteRequest request = new DeleteRequest("index", "doc", "id"); <a id="CO1156-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
+transportClient.delete(request, new ActionListener&lt;DeleteResponse&gt;() { <a id="CO1156-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
     @Override
     public void onResponse(DeleteResponse deleteResponse) {
-        // <a id="CO1156-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span>
+        <a id="CO1156-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span>
     }
 
     @Override
     public void onFailure(Exception e) {
-        // <a id="CO1156-4"></a><span><img alt="" src="images/icons/callouts/4.png"/></span>
+        <a id="CO1156-4"></a><span><img alt="" src="images/icons/callouts/4.png"/></span>
     }
 });</pre>
             </div>
@@ -1272,11 +1272,11 @@
             it can be done this way:
            </p>
            <div class="pre_wrapper">
-            <pre class="programlisting prettyprint lang-java">ClusterHealthResponse response = client.admin().cluster().prepareHealth().get(); // <a id="CO1158-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
-
-ClusterHealthStatus healthStatus = response.getStatus(); // <a id="CO1158-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
+            <pre class="programlisting prettyprint lang-java">ClusterHealthResponse response = client.admin().cluster().prepareHealth().get(); <a id="CO1158-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
+
+ClusterHealthStatus healthStatus = response.getStatus(); <a id="CO1158-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
 if (healthStatus != ClusterHealthStatus.GREEN) {
-    // <a id="CO1158-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span>
+    <a id="CO1158-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span>
 }</pre>
            </div>
            <div class="calloutlist">
@@ -1346,7 +1346,7 @@
 ClusterHealthStatus healthStatus;
 try (InputStream is = response.getEntity().getContent()) { <a id="CO1159-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span>
     Map&lt;String, Object&gt; map = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true); <a id="CO1159-4"></a><span><img alt="" src="images/icons/callouts/4.png"/></span>
-    healthStatus = ClusterHealthStatus.fromString((String) map.get("status")); <a id="CO1159-5"></a><span><img alt="" src="images/icons/callouts/5.png"/></span>
+    healthStatus = ClusterHealthStatus.fromString&lt;indexterm&gt;&lt;primary&gt;String) map.get("status"&lt;/primary&gt;&lt;/indexterm&gt;String) map.get("status"; <a id="CO1159-5"></a><span><img alt="" src="images/icons/callouts/5.png"/></span>
 }
 
 if (healthStatus != ClusterHealthStatus.GREEN) {

These seem good actually.

java-rest-high-cluster-cancel-tasks.html:

-AsciiDoc
+Asciidoctor
@@ -638,7 +638,7 @@
             </div>
            </div>
            <div class="pre_wrapper">
-            <pre class="programlisting prettyprint lang-java">request.setTaskId(new TaskId("nodeId1", 42)); //<a id="CO620-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
+            <pre class="programlisting prettyprint lang-java">request.setTaskId(new TaskId("nodeId1", 42)); <a id="CO620-1"></a><span><img alt="" src="images/icons/callouts/1.png"/></span>
 request.setActions("cluster:*"); <a id="CO620-2"></a><span><img alt="" src="images/icons/callouts/2.png"/></span>
 request.setNodes("nodeId1", "nodeId2"); <a id="CO620-3"></a><span><img alt="" src="images/icons/callouts/3.png"/></span></pre>
            </div>

Also good!

@hub-cap
Copy link
Contributor

hub-cap commented Apr 3, 2019

<3 for doing this @nik9000 you have my full support!

@nik9000 nik9000 mentioned this pull request Apr 3, 2019
@nik9000 nik9000 marked this pull request as ready for review April 4, 2019 16:32
@nik9000
Copy link
Member Author

nik9000 commented Apr 4, 2019

elastic/elasticsearch#40785 is in. I'll see if there is more diff.

@nik9000
Copy link
Member Author

nik9000 commented Apr 4, 2019

The only additional change that switching to asciidoctor will pick up is that in 6.4 we had a page named _timeouts.html but we didn't actually mean to call it that. We meant to call it _common_configuration.html but there was a spacing problem. Asciidoctor automatically fixes that spacing problem so we get the right page name. Because this looks to only be in 6.4 I'm fine ignoring it.

@nik9000
Copy link
Member Author

nik9000 commented Apr 4, 2019

@elaticmachine, retest this please

doc_build_aliases.sh Outdated Show resolved Hide resolved
@lcawl
Copy link
Contributor

lcawl commented Apr 10, 2019

I think this is good to go after the suggestion is integrated. Thanks for the detailed diff!

Co-Authored-By: nik9000 <nik9000@gmail.com>
@nik9000 nik9000 merged commit e31fc56 into elastic:master Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants