You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/06/13 16:27:19 UTC

zeppelin git commit: [ZEPPELIN-990] Add header anchor for Zeppelin documentation site

Repository: zeppelin
Updated Branches:
  refs/heads/master c5a7c77a0 -> 1826c7458


[ZEPPELIN-990] Add header anchor for Zeppelin documentation site

### What is this PR for?
Sometimes we want to share some docs title link as github markdown page does. This PR enables this feature also in Zeppelin documentation site.

### What type of PR is it?
Improvement

### Todos
* [x] - Add `anchor.min.js` under `docs/assets/themes/zeppelin/js/`
* [x] - Add integration js code to `docs.js`
* [x] - Disable default decoration below anchor icon

### What is the Jira issue?
[ZEPPELIN-990](https://issues.apache.org/jira/browse/ZEPPELIN-990)

### How should this be tested?
1. Apply this patch
2.  [Build docs site using jekyll](https://github.com/apache/zeppelin/tree/master/docs#build-documentation) and browse [localhost:4000](http://localhost:4000/)
3. Hover any titles in any docs

### Screenshots (if appropriate)
![anchor](https://cloud.githubusercontent.com/assets/10060731/15981499/2fbfcf04-2f2b-11e6-8115-f1596adfb6ea.gif)

### Questions:
* Does the licenses files need update? Yes
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: AhyoungRyu <fb...@hanmail.net>

Closes #995 from AhyoungRyu/ZEPPELIN-990 and squashes the following commits:

14625c8 [AhyoungRyu] Revert LICENSE file
06a2edd [AhyoungRyu] Change license location
8fa7fd6 [AhyoungRyu] Remove useless white space in docs.js
ff614a2 [AhyoungRyu] Add anchor.min.js to rat plugin exclude list
0d218a2 [AhyoungRyu] Add anchor.js license
05e0f36 [AhyoungRyu] Change anchor placement right->left
21be556 [AhyoungRyu] Disable decoration below the anchor
475d0d8 [AhyoungRyu] Enable anchor.min.js in Zeppelin docs site
94b38cd [AhyoungRyu] Add anchor.min.js


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/1826c745
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/1826c745
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/1826c745

Branch: refs/heads/master
Commit: 1826c74584e1633378649481b1f27ed9d5a89510
Parents: c5a7c77
Author: AhyoungRyu <fb...@hanmail.net>
Authored: Mon Jun 13 00:24:09 2016 -0700
Committer: Lee moon soo <mo...@apache.org>
Committed: Mon Jun 13 09:28:51 2016 -0700

----------------------------------------------------------------------
 docs/_includes/themes/zeppelin/default.html   | 1 +
 docs/assets/themes/zeppelin/css/style.css     | 2 ++
 docs/assets/themes/zeppelin/js/anchor.min.js  | 6 ++++++
 docs/assets/themes/zeppelin/js/docs.js        | 7 ++++++-
 pom.xml                                       | 3 +++
 zeppelin-distribution/src/bin_license/LICENSE | 3 ++-
 6 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1826c745/docs/_includes/themes/zeppelin/default.html
----------------------------------------------------------------------
diff --git a/docs/_includes/themes/zeppelin/default.html b/docs/_includes/themes/zeppelin/default.html
index ff9c0d6..eb99b9b 100644
--- a/docs/_includes/themes/zeppelin/default.html
+++ b/docs/_includes/themes/zeppelin/default.html
@@ -32,6 +32,7 @@
     <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
     <script src="{{ ASSET_PATH }}/bootstrap/js/bootstrap.min.js"></script>
     <script src="{{ ASSET_PATH }}/js/docs.js"></script>
+    <script src="{{ ASSET_PATH }}/js/anchor.min.js"></script>
 
     <!-- atom & rss feed -->
     <link href="{{ BASE_PATH }}{{ site.JB.atom_path }}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1826c745/docs/assets/themes/zeppelin/css/style.css
----------------------------------------------------------------------
diff --git a/docs/assets/themes/zeppelin/css/style.css b/docs/assets/themes/zeppelin/css/style.css
index e318805..9c6c64c 100644
--- a/docs/assets/themes/zeppelin/css/style.css
+++ b/docs/assets/themes/zeppelin/css/style.css
@@ -523,6 +523,8 @@ a.anchor {
   background: #286090;
 }
 
+a.anchorjs-link:hover { text-decoration: none; }
+
 /* Custom, iPhone Retina */
 @media only screen and (max-width: 480px) {
   .jumbotron h1 {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1826c745/docs/assets/themes/zeppelin/js/anchor.min.js
----------------------------------------------------------------------
diff --git a/docs/assets/themes/zeppelin/js/anchor.min.js b/docs/assets/themes/zeppelin/js/anchor.min.js
new file mode 100755
index 0000000..68c3cb7
--- /dev/null
+++ b/docs/assets/themes/zeppelin/js/anchor.min.js
@@ -0,0 +1,6 @@
+/*!
+ * AnchorJS - v1.1.1 - 2015-05-23
+ * https://github.com/bryanbraun/anchorjs
+ * Copyright (c) 2015 Bryan Braun; Licensed MIT
+ */
+function AnchorJS(A){"use strict";this.options=A||{},this._applyRemainingDefaultOptions=function(A){this.options.icon=this.options.hasOwnProperty("icon")?A.icon:"&#xe9cb",this.options.visible=this.options.hasOwnProperty("visible")?A.visible:"hover",this.options.placement=this.options.hasOwnProperty("placement")?A.placement:"right",this.options.class=this.options.hasOwnProperty("class")?A.class:""},this._applyRemainingDefaultOptions(A),this.add=function(A){var e,t,o,n,i,s,a,l,c,r,h,g,B,Q;if(this._applyRemainingDefaultOptions(this.options),A){if("string"!=typeof A)throw new Error("The selector provided to AnchorJS was invalid.")}else A="h1, h2, h3, h4, h5, h6";if(e=document.querySelectorAll(A),0===e.length)return!1;for(this._addBaselineStyles(),t=document.querySelectorAll("[id]"),o=[].map.call(t,function(A){return A.id}),i=0;i<e.length;i++){if(e[i].hasAttribute("id"))n=e[i].getAttribute("id");else{s=e[i].textContent,a=s.replace(/[^\w\s-]/gi,"").replace(/\s+/g,"-").replace(/-{2,}/g,"-"
 ).substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase(),r=a,c=0;do void 0!==l&&(r=a+"-"+c),l=o.indexOf(r),c+=1;while(-1!==l);l=void 0,o.push(r),e[i].setAttribute("id",r),n=r}h=n.replace(/-/g," "),g='<a class="anchorjs-link '+this.options.class+'" href="#'+n+'" aria-label="Anchor link for: '+h+'" data-anchorjs-icon="'+this.options.icon+'"></a>',B=document.createElement("div"),B.innerHTML=g,Q=B.childNodes,"always"===this.options.visible&&(Q[0].style.opacity="1"),"&#xe9cb"===this.options.icon&&(Q[0].style.fontFamily="anchorjs-icons",Q[0].style.fontStyle="normal",Q[0].style.fontVariant="normal",Q[0].style.fontWeight="normal"),"left"===this.options.placement?(Q[0].style.position="absolute",Q[0].style.marginLeft="-1em",Q[0].style.paddingRight="0.5em",e[i].insertBefore(Q[0],e[i].firstChild)):(Q[0].style.paddingLeft="0.375em",e[i].appendChild(Q[0]))}return this},this.remove=function(A){for(var e,t=document.querySelectorAll(A),o=0;o<t.length;o++)e=t[o].querySelector(".anchorjs-link"),e&&t[o]
 .removeChild(e);return this},this._addBaselineStyles=function(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style"),t=" .anchorjs-link {   opacity: 0;   text-decoration: none;   -webkit-font-smoothing: antialiased;   -moz-osx-font-smoothing: grayscale; }",o=" *:hover > .anchorjs-link, .anchorjs-link:focus  {   opacity: 1; }",n=' @font-face {   font-family: "anchorjs-icons";   font-style: normal;   font-weight: normal;   src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAA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GMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype"); }',i=" [data-anchorjs-icon]::after {   content: attr(data-anchorjs-icon); }";e.className="anchorjs",e.appendChild(document.createTextNode("")),A=document.head.querySelector('[rel="stylesheet"], style'),void 0===A?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(t,e.sheet.cssRules.length),e.sheet.insertRule(o,e.sheet.cssRules.length),e.sheet.insertRule(i,e.sheet.cssRules.length),e.sheet.insertRule(n,e.sheet.cssRules.length)}}}var anchors=new AnchorJS;

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1826c745/docs/assets/themes/zeppelin/js/docs.js
----------------------------------------------------------------------
diff --git a/docs/assets/themes/zeppelin/js/docs.js b/docs/assets/themes/zeppelin/js/docs.js
index d687727..1d2d002 100644
--- a/docs/assets/themes/zeppelin/js/docs.js
+++ b/docs/assets/themes/zeppelin/js/docs.js
@@ -107,7 +107,12 @@ function maybeScrollToHash() {
 
 $(function() {
   codeTabs();
-  viewSolution();
+  // Display anchor links when hovering over headers. For documentation of the
+  // configuration options, see the AnchorJS documentation.
+  anchors.options = {
+    placement: 'left'
+  };
+  anchors.add();
 
   $(window).bind('hashchange', function() {
     maybeScrollToHash();

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1826c745/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bad623d..d971d9a 100755
--- a/pom.xml
+++ b/pom.xml
@@ -495,6 +495,9 @@
               <exclude>docs/sitemap.txt</exclude>
               <exclude>**/dependency-reduced-pom.xml</exclude>
 
+              <!-- bundled from anchor -->
+              <exclude>docs/assets/themes/zeppelin/js/anchor.min.js</exclude>
+
               <!-- bundled from jekyll -->
               <exclude>docs/assets/themes/zeppelin/css/syntax.css</exclude>
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1826c745/zeppelin-distribution/src/bin_license/LICENSE
----------------------------------------------------------------------
diff --git a/zeppelin-distribution/src/bin_license/LICENSE b/zeppelin-distribution/src/bin_license/LICENSE
index 1d54008..9fbaccc 100644
--- a/zeppelin-distribution/src/bin_license/LICENSE
+++ b/zeppelin-distribution/src/bin_license/LICENSE
@@ -137,7 +137,8 @@ The text of each license is also included at licenses/LICENSE-[project]-[version
     (The MIT License) slf4j v1.7.10 (org.slf4j:slf4j-api:jar:1.7.10 - http://www.slf4j.org) - http://www.slf4j.org/license.html
     (The MIT License) slf4j-log4j12 v1.7.10 (org.slf4j:slf4j-log4j12:jar:1.7.10 - http://www.slf4j.org) - http://www.slf4j.org/license.html
     (The MIT License) bcprov-jdk15on v1.51 (org.bouncycastle:bcprov-jdk15on:jar:1.51 - http://www.bouncycastle.org/java.html) - http://www.bouncycastle.org/licence.html
-
+    (The MIT License) AnchorJS (https://github.com/bryanbraun/anchorjs) - https://github.com/bryanbraun/anchorjs/blob/master/README.md#license
+    
 The following components are provided under the MIT License.
 
     (The MIT License) Objenesis (org.objenesis:objenesis:2.1 - https://github.com/easymock/objenesis) - Copyright (c) 2006-2015 the original author and authors