sdoc 1.0.0.rc2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -1
- data/.travis.yml +12 -11
- data/CHANGELOG.md +31 -0
- data/Gemfile +1 -1
- data/README.md +15 -5
- data/Rakefile +1 -2
- data/bin/sdoc +1 -1
- data/bin/sdoc-merge +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc/generator/template/rails/_context.rhtml +216 -0
- data/lib/rdoc/generator/template/rails/_head.rhtml +39 -0
- data/lib/rdoc/generator/template/rails/_panel.rhtml +14 -0
- data/lib/rdoc/generator/template/rails/class.rhtml +51 -0
- data/lib/rdoc/generator/template/rails/file.rhtml +38 -0
- data/lib/rdoc/generator/template/rails/index.rhtml +33 -0
- data/lib/rdoc/generator/template/rails/resources/apple-touch-icon.png +0 -0
- data/lib/rdoc/generator/template/rails/resources/css/github.css +123 -0
- data/lib/rdoc/generator/template/rails/resources/css/main.css +378 -0
- data/lib/rdoc/generator/template/rails/resources/css/panel.css +365 -0
- data/lib/rdoc/generator/template/rails/resources/css/reset.css +48 -0
- data/lib/rdoc/generator/template/rails/resources/favicon.ico +0 -0
- data/lib/rdoc/generator/template/rails/resources/i/arrow-down.svg +8 -0
- data/lib/rdoc/generator/template/rails/resources/i/arrow-right.svg +8 -0
- data/lib/rdoc/generator/template/rails/resources/i/search.svg +12 -0
- data/lib/rdoc/generator/template/rails/resources/i/tree_bg.svg +8 -0
- data/lib/rdoc/generator/template/rails/resources/js/highlight.pack.js +1 -0
- data/lib/rdoc/generator/template/rails/resources/js/jquery-3.5.1.min.js +2 -0
- data/lib/rdoc/generator/template/rails/resources/js/main.js +41 -0
- data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +493 -0
- data/lib/rdoc/generator/template/rails/resources/js/turbolinks.js +6 -0
- data/lib/rdoc/generator/template/rails/search_index.rhtml +8 -0
- data/lib/rdoc/generator/template/sdoc/_context.rhtml +5 -5
- data/lib/rdoc/generator/template/sdoc/_head.rhtml +0 -1
- data/lib/rdoc/generator/template/sdoc/class.rhtml +13 -0
- data/lib/rdoc/generator/template/sdoc/file.rhtml +0 -0
- data/lib/rdoc/generator/template/sdoc/index.rhtml +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/css/main.css +11 -1
- data/lib/rdoc/generator/template/sdoc/resources/css/panel.css +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/css/reset.css +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/i/arrows.png +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/i/results_bg.png +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/i/tree_bg.png +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/highlight.pack.js +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/jquery-1.3.2.min.js +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/main.js +7 -1
- data/lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js +21 -2
- data/lib/rdoc/generator/template/sdoc/resources/panel/index.html +0 -0
- data/lib/sdoc.rb +0 -2
- data/lib/sdoc/generator.rb +19 -80
- data/lib/sdoc/github.rb +13 -14
- data/lib/sdoc/helpers.rb +22 -0
- data/lib/sdoc/templatable.rb +5 -1
- data/lib/sdoc/version.rb +1 -1
- data/sdoc.gemspec +2 -1
- data/spec/helpers_spec.rb +32 -0
- data/spec/rdoc_generator_spec.rb +8 -0
- metadata +27 -13
- data/lib/rdoc/generator/template/sdoc/resources/js/jquery-effect.js +0 -593
@@ -0,0 +1,6 @@
|
|
1
|
+
/*
|
2
|
+
Turbolinks 5.1.1
|
3
|
+
Copyright © 2018 Basecamp, LLC
|
4
|
+
*/
|
5
|
+
(function(){var t=this;(function(){(function(){this.Turbolinks={supported:function(){return null!=window.history.pushState&&null!=window.requestAnimationFrame&&null!=window.addEventListener}(),visit:function(t,r){return e.controller.visit(t,r)},clearCache:function(){return e.controller.clearCache()},setProgressBarDelay:function(t){return e.controller.setProgressBarDelay(t)}}}).call(this)}).call(t);var e=t.Turbolinks;(function(){(function(){var t,r,n,o=[].slice;e.copyObject=function(t){var e,r,n;r={};for(e in t)n=t[e],r[e]=n;return r},e.closest=function(e,r){return t.call(e,r)},t=function(){var t,e;return t=document.documentElement,null!=(e=t.closest)?e:function(t){var e;for(e=this;e;){if(e.nodeType===Node.ELEMENT_NODE&&r.call(e,t))return e;e=e.parentNode}}}(),e.defer=function(t){return setTimeout(t,1)},e.throttle=function(t){var e;return e=null,function(){var r;return r=1<=arguments.length?o.call(arguments,0):[],null!=e?e:e=requestAnimationFrame(function(n){return function(){return e=null,t.apply(n,r)}}(this))}},e.dispatch=function(t,e){var r,o,i,s,a,u;return a=null!=e?e:{},u=a.target,r=a.cancelable,o=a.data,i=document.createEvent("Events"),i.initEvent(t,!0,r===!0),i.data=null!=o?o:{},i.cancelable&&!n&&(s=i.preventDefault,i.preventDefault=function(){return this.defaultPrevented||Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),s.call(this)}),(null!=u?u:document).dispatchEvent(i),i},n=function(){var t;return t=document.createEvent("Events"),t.initEvent("test",!0,!0),t.preventDefault(),t.defaultPrevented}(),e.match=function(t,e){return r.call(t,e)},r=function(){var t,e,r,n;return t=document.documentElement,null!=(e=null!=(r=null!=(n=t.matchesSelector)?n:t.webkitMatchesSelector)?r:t.msMatchesSelector)?e:t.mozMatchesSelector}(),e.uuid=function(){var t,e,r;for(r="",t=e=1;36>=e;t=++e)r+=9===t||14===t||19===t||24===t?"-":15===t?"4":20===t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16);return r}}).call(this),function(){e.Location=function(){function t(t){var e,r;null==t&&(t=""),r=document.createElement("a"),r.href=t.toString(),this.absoluteURL=r.href,e=r.hash.length,2>e?this.requestURL=this.absoluteURL:(this.requestURL=this.absoluteURL.slice(0,-e),this.anchor=r.hash.slice(1))}var e,r,n,o;return t.wrap=function(t){return t instanceof this?t:new this(t)},t.prototype.getOrigin=function(){return this.absoluteURL.split("/",3).join("/")},t.prototype.getPath=function(){var t,e;return null!=(t=null!=(e=this.requestURL.match(/\/\/[^\/]*(\/[^?;]*)/))?e[1]:void 0)?t:"/"},t.prototype.getPathComponents=function(){return this.getPath().split("/").slice(1)},t.prototype.getLastPathComponent=function(){return this.getPathComponents().slice(-1)[0]},t.prototype.getExtension=function(){var t,e;return null!=(t=null!=(e=this.getLastPathComponent().match(/\.[^.]*$/))?e[0]:void 0)?t:""},t.prototype.isHTML=function(){return this.getExtension().match(/^(?:|\.(?:htm|html|xhtml))$/)},t.prototype.isPrefixedBy=function(t){var e;return e=r(t),this.isEqualTo(t)||o(this.absoluteURL,e)},t.prototype.isEqualTo=function(t){return this.absoluteURL===(null!=t?t.absoluteURL:void 0)},t.prototype.toCacheKey=function(){return this.requestURL},t.prototype.toJSON=function(){return this.absoluteURL},t.prototype.toString=function(){return this.absoluteURL},t.prototype.valueOf=function(){return this.absoluteURL},r=function(t){return e(t.getOrigin()+t.getPath())},e=function(t){return n(t,"/")?t:t+"/"},o=function(t,e){return t.slice(0,e.length)===e},n=function(t,e){return t.slice(-e.length)===e},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.HttpRequest=function(){function r(r,n,o){this.delegate=r,this.requestCanceled=t(this.requestCanceled,this),this.requestTimedOut=t(this.requestTimedOut,this),this.requestFailed=t(this.requestFailed,this),this.requestLoaded=t(this.requestLoaded,this),this.requestProgressed=t(this.requestProgressed,this),this.url=e.Location.wrap(n).requestURL,this.referrer=e.Location.wrap(o).absoluteURL,this.createXHR()}return r.NETWORK_FAILURE=0,r.TIMEOUT_FAILURE=-1,r.timeout=60,r.prototype.send=function(){var t;return this.xhr&&!this.sent?(this.notifyApplicationBeforeRequestStart(),this.setProgress(0),this.xhr.send(),this.sent=!0,"function"==typeof(t=this.delegate).requestStarted?t.requestStarted():void 0):void 0},r.prototype.cancel=function(){return this.xhr&&this.sent?this.xhr.abort():void 0},r.prototype.requestProgressed=function(t){return t.lengthComputable?this.setProgress(t.loaded/t.total):void 0},r.prototype.requestLoaded=function(){return this.endRequest(function(t){return function(){var e;return 200<=(e=t.xhr.status)&&300>e?t.delegate.requestCompletedWithResponse(t.xhr.responseText,t.xhr.getResponseHeader("Turbolinks-Location")):(t.failed=!0,t.delegate.requestFailedWithStatusCode(t.xhr.status,t.xhr.responseText))}}(this))},r.prototype.requestFailed=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE)}}(this))},r.prototype.requestTimedOut=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE)}}(this))},r.prototype.requestCanceled=function(){return this.endRequest()},r.prototype.notifyApplicationBeforeRequestStart=function(){return e.dispatch("turbolinks:request-start",{data:{url:this.url,xhr:this.xhr}})},r.prototype.notifyApplicationAfterRequestEnd=function(){return e.dispatch("turbolinks:request-end",{data:{url:this.url,xhr:this.xhr}})},r.prototype.createXHR=function(){return this.xhr=new XMLHttpRequest,this.xhr.open("GET",this.url,!0),this.xhr.timeout=1e3*this.constructor.timeout,this.xhr.setRequestHeader("Accept","text/html, application/xhtml+xml"),this.xhr.setRequestHeader("Turbolinks-Referrer",this.referrer),this.xhr.onprogress=this.requestProgressed,this.xhr.onload=this.requestLoaded,this.xhr.onerror=this.requestFailed,this.xhr.ontimeout=this.requestTimedOut,this.xhr.onabort=this.requestCanceled},r.prototype.endRequest=function(t){return this.xhr?(this.notifyApplicationAfterRequestEnd(),null!=t&&t.call(this),this.destroy()):void 0},r.prototype.setProgress=function(t){var e;return this.progress=t,"function"==typeof(e=this.delegate).requestProgressed?e.requestProgressed(this.progress):void 0},r.prototype.destroy=function(){var t;return this.setProgress(1),"function"==typeof(t=this.delegate).requestFinished&&t.requestFinished(),this.delegate=null,this.xhr=null},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ProgressBar=function(){function e(){this.trickle=t(this.trickle,this),this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement()}var r;return r=300,e.defaultCSS=".turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition: width "+r+"ms ease-out, opacity "+r/2+"ms "+r/2+"ms ease-in;\n transform: translate3d(0, 0, 0);\n}",e.prototype.show=function(){return this.visible?void 0:(this.visible=!0,this.installStylesheetElement(),this.installProgressElement(),this.startTrickling())},e.prototype.hide=function(){return this.visible&&!this.hiding?(this.hiding=!0,this.fadeProgressElement(function(t){return function(){return t.uninstallProgressElement(),t.stopTrickling(),t.visible=!1,t.hiding=!1}}(this))):void 0},e.prototype.setValue=function(t){return this.value=t,this.refresh()},e.prototype.installStylesheetElement=function(){return document.head.insertBefore(this.stylesheetElement,document.head.firstChild)},e.prototype.installProgressElement=function(){return this.progressElement.style.width=0,this.progressElement.style.opacity=1,document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()},e.prototype.fadeProgressElement=function(t){return this.progressElement.style.opacity=0,setTimeout(t,1.5*r)},e.prototype.uninstallProgressElement=function(){return this.progressElement.parentNode?document.documentElement.removeChild(this.progressElement):void 0},e.prototype.startTrickling=function(){return null!=this.trickleInterval?this.trickleInterval:this.trickleInterval=setInterval(this.trickle,r)},e.prototype.stopTrickling=function(){return clearInterval(this.trickleInterval),this.trickleInterval=null},e.prototype.trickle=function(){return this.setValue(this.value+Math.random()/100)},e.prototype.refresh=function(){return requestAnimationFrame(function(t){return function(){return t.progressElement.style.width=10+90*t.value+"%"}}(this))},e.prototype.createStylesheetElement=function(){var t;return t=document.createElement("style"),t.type="text/css",t.textContent=this.constructor.defaultCSS,t},e.prototype.createProgressElement=function(){var t;return t=document.createElement("div"),t.className="turbolinks-progress-bar",t},e}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.BrowserAdapter=function(){function r(r){this.controller=r,this.showProgressBar=t(this.showProgressBar,this),this.progressBar=new e.ProgressBar}var n,o,i;return i=e.HttpRequest,n=i.NETWORK_FAILURE,o=i.TIMEOUT_FAILURE,r.prototype.visitProposedToLocationWithAction=function(t,e){return this.controller.startVisitToLocationWithAction(t,e)},r.prototype.visitStarted=function(t){return t.issueRequest(),t.changeHistory(),t.loadCachedSnapshot()},r.prototype.visitRequestStarted=function(t){return this.progressBar.setValue(0),t.hasCachedSnapshot()||"restore"!==t.action?this.showProgressBarAfterDelay():this.showProgressBar()},r.prototype.visitRequestProgressed=function(t){return this.progressBar.setValue(t.progress)},r.prototype.visitRequestCompleted=function(t){return t.loadResponse()},r.prototype.visitRequestFailedWithStatusCode=function(t,e){switch(e){case n:case o:return this.reload();default:return t.loadResponse()}},r.prototype.visitRequestFinished=function(t){return this.hideProgressBar()},r.prototype.visitCompleted=function(t){return t.followRedirect()},r.prototype.pageInvalidated=function(){return this.reload()},r.prototype.showProgressBarAfterDelay=function(){return this.progressBarTimeout=setTimeout(this.showProgressBar,this.controller.progressBarDelay)},r.prototype.showProgressBar=function(){return this.progressBar.show()},r.prototype.hideProgressBar=function(){return this.progressBar.hide(),clearTimeout(this.progressBarTimeout)},r.prototype.reload=function(){return window.location.reload()},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.History=function(){function r(e){this.delegate=e,this.onPageLoad=t(this.onPageLoad,this),this.onPopState=t(this.onPopState,this)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1):void 0},r.prototype.push=function(t,r){return t=e.Location.wrap(t),this.update("push",t,r)},r.prototype.replace=function(t,r){return t=e.Location.wrap(t),this.update("replace",t,r)},r.prototype.onPopState=function(t){var r,n,o,i;return this.shouldHandlePopState()&&(i=null!=(n=t.state)?n.turbolinks:void 0)?(r=e.Location.wrap(window.location),o=i.restorationIdentifier,this.delegate.historyPoppedToLocationWithRestorationIdentifier(r,o)):void 0},r.prototype.onPageLoad=function(t){return e.defer(function(t){return function(){return t.pageLoaded=!0}}(this))},r.prototype.shouldHandlePopState=function(){return this.pageIsLoaded()},r.prototype.pageIsLoaded=function(){return this.pageLoaded||"complete"===document.readyState},r.prototype.update=function(t,e,r){var n;return n={turbolinks:{restorationIdentifier:r}},history[t+"State"](n,null,e)},r}()}.call(this),function(){e.Snapshot=function(){function t(t){var e,r;r=t.head,e=t.body,this.head=null!=r?r:document.createElement("head"),this.body=null!=e?e:document.createElement("body")}return t.wrap=function(t){return t instanceof this?t:this.fromHTML(t)},t.fromHTML=function(t){var e;return e=document.createElement("html"),e.innerHTML=t,this.fromElement(e)},t.fromElement=function(t){return new this({head:t.querySelector("head"),body:t.querySelector("body")})},t.prototype.clone=function(){return new t({head:this.head.cloneNode(!0),body:this.body.cloneNode(!0)})},t.prototype.getRootLocation=function(){var t,r;return r=null!=(t=this.getSetting("root"))?t:"/",new e.Location(r)},t.prototype.getCacheControlValue=function(){return this.getSetting("cache-control")},t.prototype.getElementForAnchor=function(t){try{return this.body.querySelector("[id='"+t+"'], a[name='"+t+"']")}catch(e){}},t.prototype.hasAnchor=function(t){return null!=this.getElementForAnchor(t)},t.prototype.isPreviewable=function(){return"no-preview"!==this.getCacheControlValue()},t.prototype.isCacheable=function(){return"no-cache"!==this.getCacheControlValue()},t.prototype.isVisitable=function(){return"reload"!==this.getSetting("visit-control")},t.prototype.getSetting=function(t){var e,r;return r=this.head.querySelectorAll("meta[name='turbolinks-"+t+"']"),e=r[r.length-1],null!=e?e.getAttribute("content"):void 0},t}()}.call(this),function(){var t=[].slice;e.Renderer=function(){function e(){}var r;return e.render=function(){var e,r,n,o;return n=arguments[0],r=arguments[1],e=3<=arguments.length?t.call(arguments,2):[],o=function(t,e,r){r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return Object(o)===o?o:n}(this,e,function(){}),o.delegate=n,o.render(r),o},e.prototype.renderView=function(t){return this.delegate.viewWillRender(this.newBody),t(),this.delegate.viewRendered(this.newBody)},e.prototype.invalidateView=function(){return this.delegate.viewInvalidated()},e.prototype.createScriptElement=function(t){var e;return"false"===t.getAttribute("data-turbolinks-eval")?t:(e=document.createElement("script"),e.textContent=t.textContent,e.async=!1,r(e,t),e)},r=function(t,e){var r,n,o,i,s,a,u;for(i=e.attributes,a=[],r=0,n=i.length;n>r;r++)s=i[r],o=s.name,u=s.value,a.push(t.setAttribute(o,u));return a},e}()}.call(this),function(){e.HeadDetails=function(){function t(t){var e,r,i,s,a,u,l;for(this.element=t,this.elements={},l=this.element.childNodes,s=0,u=l.length;u>s;s++)i=l[s],i.nodeType===Node.ELEMENT_NODE&&(a=i.outerHTML,r=null!=(e=this.elements)[a]?e[a]:e[a]={type:o(i),tracked:n(i),elements:[]},r.elements.push(i))}var e,r,n,o;return t.prototype.hasElementWithKey=function(t){return t in this.elements},t.prototype.getTrackedElementSignature=function(){var t,e;return function(){var r,n;r=this.elements,n=[];for(t in r)e=r[t].tracked,e&&n.push(t);return n}.call(this).join("")},t.prototype.getScriptElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("script",t)},t.prototype.getStylesheetElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("stylesheet",t)},t.prototype.getElementsMatchingTypeNotInDetails=function(t,e){var r,n,o,i,s,a;o=this.elements,s=[];for(n in o)i=o[n],a=i.type,r=i.elements,a!==t||e.hasElementWithKey(n)||s.push(r[0]);return s},t.prototype.getProvisionalElements=function(){var t,e,r,n,o,i,s;r=[],n=this.elements;for(e in n)o=n[e],s=o.type,i=o.tracked,t=o.elements,null!=s||i?t.length>1&&r.push.apply(r,t.slice(1)):r.push.apply(r,t);return r},o=function(t){return e(t)?"script":r(t)?"stylesheet":void 0},n=function(t){return"reload"===t.getAttribute("data-turbolinks-track")},e=function(t){var e;return e=t.tagName.toLowerCase(),"script"===e},r=function(t){var e;return e=t.tagName.toLowerCase(),"style"===e||"link"===e&&"stylesheet"===t.getAttribute("rel")},t}()}.call(this),function(){var t=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e.SnapshotRenderer=function(r){function n(t,r,n){this.currentSnapshot=t,this.newSnapshot=r,this.isPreview=n,this.currentHeadDetails=new e.HeadDetails(this.currentSnapshot.head),this.newHeadDetails=new e.HeadDetails(this.newSnapshot.head),this.newBody=this.newSnapshot.body}return t(n,r),n.prototype.render=function(t){return this.shouldRender()?(this.mergeHead(),this.renderView(function(e){return function(){return e.replaceBody(),e.isPreview||e.focusFirstAutofocusableElement(),t()}}(this))):this.invalidateView()},n.prototype.mergeHead=function(){return this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()},n.prototype.replaceBody=function(){return this.activateBodyScriptElements(),this.importBodyPermanentElements(),this.assignNewBody()},n.prototype.shouldRender=function(){return this.newSnapshot.isVisitable()&&this.trackedElementsAreIdentical()},n.prototype.trackedElementsAreIdentical=function(){return this.currentHeadDetails.getTrackedElementSignature()===this.newHeadDetails.getTrackedElementSignature()},n.prototype.copyNewHeadStylesheetElements=function(){var t,e,r,n,o;for(n=this.getNewHeadStylesheetElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},n.prototype.copyNewHeadScriptElements=function(){var t,e,r,n,o;for(n=this.getNewHeadScriptElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(this.createScriptElement(t)));return o},n.prototype.removeCurrentHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getCurrentHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.removeChild(t));return o},n.prototype.copyNewHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getNewHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},n.prototype.importBodyPermanentElements=function(){var t,e,r,n,o,i;for(n=this.getNewBodyPermanentElements(),i=[],e=0,r=n.length;r>e;e++)o=n[e],(t=this.findCurrentBodyPermanentElement(o))?i.push(o.parentNode.replaceChild(t,o)):i.push(void 0);return i},n.prototype.activateBodyScriptElements=function(){var t,e,r,n,o,i;for(n=this.getNewBodyScriptElements(),i=[],e=0,r=n.length;r>e;e++)o=n[e],t=this.createScriptElement(o),i.push(o.parentNode.replaceChild(t,o));return i},n.prototype.assignNewBody=function(){return document.body=this.newBody},n.prototype.focusFirstAutofocusableElement=function(){var t;return null!=(t=this.findFirstAutofocusableElement())?t.focus():void 0},n.prototype.getNewHeadStylesheetElements=function(){return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails)},n.prototype.getNewHeadScriptElements=function(){return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails)},n.prototype.getCurrentHeadProvisionalElements=function(){return this.currentHeadDetails.getProvisionalElements()},n.prototype.getNewHeadProvisionalElements=function(){return this.newHeadDetails.getProvisionalElements()},n.prototype.getNewBodyPermanentElements=function(){return this.newBody.querySelectorAll("[id][data-turbolinks-permanent]")},n.prototype.findCurrentBodyPermanentElement=function(t){return document.body.querySelector("#"+t.id+"[data-turbolinks-permanent]")},n.prototype.getNewBodyScriptElements=function(){return this.newBody.querySelectorAll("script")},n.prototype.findFirstAutofocusableElement=function(){return document.body.querySelector("[autofocus]")},n}(e.Renderer)}.call(this),function(){var t=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e.ErrorRenderer=function(e){function r(t){this.html=t}return t(r,e),r.prototype.render=function(t){return this.renderView(function(e){return function(){return e.replaceDocumentHTML(),e.activateBodyScriptElements(),t()}}(this))},r.prototype.replaceDocumentHTML=function(){return document.documentElement.innerHTML=this.html},r.prototype.activateBodyScriptElements=function(){var t,e,r,n,o,i;for(n=this.getScriptElements(),i=[],e=0,r=n.length;r>e;e++)o=n[e],t=this.createScriptElement(o),i.push(o.parentNode.replaceChild(t,o));return i},r.prototype.getScriptElements=function(){return document.documentElement.querySelectorAll("script")},r}(e.Renderer)}.call(this),function(){e.View=function(){function t(t){this.delegate=t,this.element=document.documentElement}return t.prototype.getRootLocation=function(){return this.getSnapshot().getRootLocation()},t.prototype.getElementForAnchor=function(t){return this.getSnapshot().getElementForAnchor(t)},t.prototype.getSnapshot=function(){return e.Snapshot.fromElement(this.element)},t.prototype.render=function(t,e){var r,n,o;return o=t.snapshot,r=t.error,n=t.isPreview,this.markAsPreview(n),null!=o?this.renderSnapshot(o,n,e):this.renderError(r,e)},t.prototype.markAsPreview=function(t){return t?this.element.setAttribute("data-turbolinks-preview",""):this.element.removeAttribute("data-turbolinks-preview")},t.prototype.renderSnapshot=function(t,r,n){return e.SnapshotRenderer.render(this.delegate,n,this.getSnapshot(),e.Snapshot.wrap(t),r)},t.prototype.renderError=function(t,r){return e.ErrorRenderer.render(this.delegate,r,t)},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ScrollManager=function(){function r(r){this.delegate=r,this.onScroll=t(this.onScroll,this),this.onScroll=e.throttle(this.onScroll)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("scroll",this.onScroll,!1),this.started=!1):void 0},r.prototype.scrollToElement=function(t){return t.scrollIntoView()},r.prototype.scrollToPosition=function(t){var e,r;return e=t.x,r=t.y,window.scrollTo(e,r)},r.prototype.onScroll=function(t){return this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},r.prototype.updatePosition=function(t){var e;return this.position=t,null!=(e=this.delegate)?e.scrollPositionChanged(this.position):void 0},r}()}.call(this),function(){e.SnapshotCache=function(){function t(t){this.size=t,this.keys=[],this.snapshots={}}var r;return t.prototype.has=function(t){var e;return e=r(t),e in this.snapshots},t.prototype.get=function(t){var e;if(this.has(t))return e=this.read(t),this.touch(t),e},t.prototype.put=function(t,e){return this.write(t,e),this.touch(t),e},t.prototype.read=function(t){var e;return e=r(t),this.snapshots[e]},t.prototype.write=function(t,e){var n;return n=r(t),this.snapshots[n]=e},t.prototype.touch=function(t){var e,n;return n=r(t),e=this.keys.indexOf(n),e>-1&&this.keys.splice(e,1),this.keys.unshift(n),this.trim()},t.prototype.trim=function(){var t,e,r,n,o;for(n=this.keys.splice(this.size),o=[],t=0,r=n.length;r>t;t++)e=n[t],o.push(delete this.snapshots[e]);return o},r=function(t){return e.Location.wrap(t).toCacheKey()},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Visit=function(){function r(r,n,o){this.controller=r,this.action=o,this.performScroll=t(this.performScroll,this),this.identifier=e.uuid(),this.location=e.Location.wrap(n),this.adapter=this.controller.adapter,this.state="initialized",this.timingMetrics={}}var n;return r.prototype.start=function(){return"initialized"===this.state?(this.recordTimingMetric("visitStart"),this.state="started",this.adapter.visitStarted(this)):void 0},r.prototype.cancel=function(){var t;return"started"===this.state?(null!=(t=this.request)&&t.cancel(),this.cancelRender(),this.state="canceled"):void 0},r.prototype.complete=function(){var t;return"started"===this.state?(this.recordTimingMetric("visitEnd"),this.state="completed","function"==typeof(t=this.adapter).visitCompleted&&t.visitCompleted(this),this.controller.visitCompleted(this)):void 0},r.prototype.fail=function(){var t;return"started"===this.state?(this.state="failed","function"==typeof(t=this.adapter).visitFailed?t.visitFailed(this):void 0):void 0},r.prototype.changeHistory=function(){var t,e;return this.historyChanged?void 0:(t=this.location.isEqualTo(this.referrer)?"replace":this.action,e=n(t),this.controller[e](this.location,this.restorationIdentifier),this.historyChanged=!0)},r.prototype.issueRequest=function(){return this.shouldIssueRequest()&&null==this.request?(this.progress=0,this.request=new e.HttpRequest(this,this.location,this.referrer),this.request.send()):void 0},r.prototype.getCachedSnapshot=function(){var t;return!(t=this.controller.getCachedSnapshotForLocation(this.location))||null!=this.location.anchor&&!t.hasAnchor(this.location.anchor)||"restore"!==this.action&&!t.isPreviewable()?void 0:t},r.prototype.hasCachedSnapshot=function(){return null!=this.getCachedSnapshot()},r.prototype.loadCachedSnapshot=function(){var t,e;return(e=this.getCachedSnapshot())?(t=this.shouldIssueRequest(),this.render(function(){var r;return this.cacheSnapshot(),this.controller.render({snapshot:e,isPreview:t},this.performScroll),"function"==typeof(r=this.adapter).visitRendered&&r.visitRendered(this),t?void 0:this.complete()})):void 0},r.prototype.loadResponse=function(){return null!=this.response?this.render(function(){var t,e;return this.cacheSnapshot(),this.request.failed?(this.controller.render({error:this.response},this.performScroll),"function"==typeof(t=this.adapter).visitRendered&&t.visitRendered(this),this.fail()):(this.controller.render({snapshot:this.response},this.performScroll),"function"==typeof(e=this.adapter).visitRendered&&e.visitRendered(this),this.complete())}):void 0},r.prototype.followRedirect=function(){return this.redirectedToLocation&&!this.followedRedirect?(this.location=this.redirectedToLocation,this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation,this.restorationIdentifier),this.followedRedirect=!0):void 0},r.prototype.requestStarted=function(){var t;return this.recordTimingMetric("requestStart"),"function"==typeof(t=this.adapter).visitRequestStarted?t.visitRequestStarted(this):void 0},r.prototype.requestProgressed=function(t){var e;return this.progress=t,"function"==typeof(e=this.adapter).visitRequestProgressed?e.visitRequestProgressed(this):void 0},r.prototype.requestCompletedWithResponse=function(t,r){return this.response=t,null!=r&&(this.redirectedToLocation=e.Location.wrap(r)),this.adapter.visitRequestCompleted(this)},r.prototype.requestFailedWithStatusCode=function(t,e){return this.response=e,this.adapter.visitRequestFailedWithStatusCode(this,t)},r.prototype.requestFinished=function(){var t;return this.recordTimingMetric("requestEnd"),"function"==typeof(t=this.adapter).visitRequestFinished?t.visitRequestFinished(this):void 0},r.prototype.performScroll=function(){return this.scrolled?void 0:("restore"===this.action?this.scrollToRestoredPosition()||this.scrollToTop():this.scrollToAnchor()||this.scrollToTop(),this.scrolled=!0)},r.prototype.scrollToRestoredPosition=function(){var t,e;return t=null!=(e=this.restorationData)?e.scrollPosition:void 0,null!=t?(this.controller.scrollToPosition(t),!0):void 0},r.prototype.scrollToAnchor=function(){return null!=this.location.anchor?(this.controller.scrollToAnchor(this.location.anchor),!0):void 0},r.prototype.scrollToTop=function(){return this.controller.scrollToPosition({x:0,y:0})},r.prototype.recordTimingMetric=function(t){var e;return null!=(e=this.timingMetrics)[t]?e[t]:e[t]=(new Date).getTime()},r.prototype.getTimingMetrics=function(){return e.copyObject(this.timingMetrics)},n=function(t){switch(t){case"replace":return"replaceHistoryWithLocationAndRestorationIdentifier";case"advance":case"restore":return"pushHistoryWithLocationAndRestorationIdentifier"}},r.prototype.shouldIssueRequest=function(){return"restore"===this.action?!this.hasCachedSnapshot():!0},r.prototype.cacheSnapshot=function(){return this.snapshotCached?void 0:(this.controller.cacheSnapshot(),this.snapshotCached=!0)},r.prototype.render=function(t){return this.cancelRender(),this.frame=requestAnimationFrame(function(e){return function(){return e.frame=null,t.call(e)}}(this))},r.prototype.cancelRender=function(){return this.frame?cancelAnimationFrame(this.frame):void 0},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Controller=function(){function r(){this.clickBubbled=t(this.clickBubbled,this),this.clickCaptured=t(this.clickCaptured,this),this.pageLoaded=t(this.pageLoaded,this),this.history=new e.History(this),this.view=new e.View(this),this.scrollManager=new e.ScrollManager(this),this.restorationData={},this.clearCache(),this.setProgressBarDelay(500)}return r.prototype.start=function(){return e.supported&&!this.started?(addEventListener("click",this.clickCaptured,!0),addEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.start(),this.startHistory(),this.started=!0,this.enabled=!0):void 0},r.prototype.disable=function(){return this.enabled=!1},r.prototype.stop=function(){return this.started?(removeEventListener("click",this.clickCaptured,!0),removeEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.stop(),this.stopHistory(),this.started=!1):void 0},r.prototype.clearCache=function(){return this.cache=new e.SnapshotCache(10)},r.prototype.visit=function(t,r){var n,o;return null==r&&(r={}),t=e.Location.wrap(t),this.applicationAllowsVisitingLocation(t)?this.locationIsVisitable(t)?(n=null!=(o=r.action)?o:"advance",this.adapter.visitProposedToLocationWithAction(t,n)):window.location=t:void 0},r.prototype.startVisitToLocationWithAction=function(t,r,n){var o;return e.supported?(o=this.getRestorationDataForIdentifier(n),this.startVisit(t,r,{restorationData:o})):window.location=t},r.prototype.setProgressBarDelay=function(t){return this.progressBarDelay=t},r.prototype.startHistory=function(){return this.location=e.Location.wrap(window.location),this.restorationIdentifier=e.uuid(),this.history.start(),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.stopHistory=function(){return this.history.stop()},r.prototype.pushHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.push(this.location,this.restorationIdentifier)},r.prototype.replaceHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.historyPoppedToLocationWithRestorationIdentifier=function(t,r){var n;return this.restorationIdentifier=r,this.enabled?(n=this.getRestorationDataForIdentifier(this.restorationIdentifier),this.startVisit(t,"restore",{restorationIdentifier:this.restorationIdentifier,restorationData:n,historyChanged:!0}),this.location=e.Location.wrap(t)):this.adapter.pageInvalidated()},r.prototype.getCachedSnapshotForLocation=function(t){var e;return e=this.cache.get(t),e?e.clone():void 0},r.prototype.shouldCacheSnapshot=function(){return this.view.getSnapshot().isCacheable()},r.prototype.cacheSnapshot=function(){var t;return this.shouldCacheSnapshot()?(this.notifyApplicationBeforeCachingSnapshot(),t=this.view.getSnapshot(),this.cache.put(this.lastRenderedLocation,t.clone())):void 0},r.prototype.scrollToAnchor=function(t){var e;return(e=this.view.getElementForAnchor(t))?this.scrollToElement(e):this.scrollToPosition({x:0,y:0})},r.prototype.scrollToElement=function(t){return this.scrollManager.scrollToElement(t)},r.prototype.scrollToPosition=function(t){return this.scrollManager.scrollToPosition(t)},r.prototype.scrollPositionChanged=function(t){var e;return e=this.getCurrentRestorationData(),e.scrollPosition=t},r.prototype.render=function(t,e){return this.view.render(t,e)},r.prototype.viewInvalidated=function(){return this.adapter.pageInvalidated()},r.prototype.viewWillRender=function(t){return this.notifyApplicationBeforeRender(t)},r.prototype.viewRendered=function(){return this.lastRenderedLocation=this.currentVisit.location,this.notifyApplicationAfterRender()},r.prototype.pageLoaded=function(){return this.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()},r.prototype.clickCaptured=function(){return removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},r.prototype.clickBubbled=function(t){var e,r,n;return this.enabled&&this.clickEventIsSignificant(t)&&(r=this.getVisitableLinkForNode(t.target))&&(n=this.getVisitableLocationForLink(r))&&this.applicationAllowsFollowingLinkToLocation(r,n)?(t.preventDefault(),e=this.getActionForLink(r),
|
6
|
+
this.visit(n,{action:e})):void 0},r.prototype.applicationAllowsFollowingLinkToLocation=function(t,e){var r;return r=this.notifyApplicationAfterClickingLinkToLocation(t,e),!r.defaultPrevented},r.prototype.applicationAllowsVisitingLocation=function(t){var e;return e=this.notifyApplicationBeforeVisitingLocation(t),!e.defaultPrevented},r.prototype.notifyApplicationAfterClickingLinkToLocation=function(t,r){return e.dispatch("turbolinks:click",{target:t,data:{url:r.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationBeforeVisitingLocation=function(t){return e.dispatch("turbolinks:before-visit",{data:{url:t.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationAfterVisitingLocation=function(t){return e.dispatch("turbolinks:visit",{data:{url:t.absoluteURL}})},r.prototype.notifyApplicationBeforeCachingSnapshot=function(){return e.dispatch("turbolinks:before-cache")},r.prototype.notifyApplicationBeforeRender=function(t){return e.dispatch("turbolinks:before-render",{data:{newBody:t}})},r.prototype.notifyApplicationAfterRender=function(){return e.dispatch("turbolinks:render")},r.prototype.notifyApplicationAfterPageLoad=function(t){return null==t&&(t={}),e.dispatch("turbolinks:load",{data:{url:this.location.absoluteURL,timing:t}})},r.prototype.startVisit=function(t,e,r){var n;return null!=(n=this.currentVisit)&&n.cancel(),this.currentVisit=this.createVisit(t,e,r),this.currentVisit.start(),this.notifyApplicationAfterVisitingLocation(t)},r.prototype.createVisit=function(t,r,n){var o,i,s,a,u;return i=null!=n?n:{},a=i.restorationIdentifier,s=i.restorationData,o=i.historyChanged,u=new e.Visit(this,t,r),u.restorationIdentifier=null!=a?a:e.uuid(),u.restorationData=e.copyObject(s),u.historyChanged=o,u.referrer=this.location,u},r.prototype.visitCompleted=function(t){return this.notifyApplicationAfterPageLoad(t.getTimingMetrics())},r.prototype.clickEventIsSignificant=function(t){return!(t.defaultPrevented||t.target.isContentEditable||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)},r.prototype.getVisitableLinkForNode=function(t){return this.nodeIsVisitable(t)?e.closest(t,"a[href]:not([target]):not([download])"):void 0},r.prototype.getVisitableLocationForLink=function(t){var r;return r=new e.Location(t.getAttribute("href")),this.locationIsVisitable(r)?r:void 0},r.prototype.getActionForLink=function(t){var e;return null!=(e=t.getAttribute("data-turbolinks-action"))?e:"advance"},r.prototype.nodeIsVisitable=function(t){var r;return(r=e.closest(t,"[data-turbolinks]"))?"false"!==r.getAttribute("data-turbolinks"):!0},r.prototype.locationIsVisitable=function(t){return t.isPrefixedBy(this.view.getRootLocation())&&t.isHTML()},r.prototype.getCurrentRestorationData=function(){return this.getRestorationDataForIdentifier(this.restorationIdentifier)},r.prototype.getRestorationDataForIdentifier=function(t){var e;return null!=(e=this.restorationData)[t]?e[t]:e[t]={}},r}()}.call(this),function(){!function(){var t,e;if((t=e=document.currentScript)&&!e.hasAttribute("data-turbolinks-suppress-warning"))for(;t=t.parentNode;)if(t===document.body)return console.warn("You are loading Turbolinks from a <script> element inside the <body> element. This is probably not what you meant to do!\n\nLoad your application\u2019s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.\n\nFor more information, see: https://github.com/turbolinks/turbolinks#working-with-script-elements\n\n\u2014\u2014\nSuppress this warning by adding a `data-turbolinks-suppress-warning` attribute to: %s",e.outerHTML)}()}.call(this),function(){var t,r,n;e.start=function(){return r()?(null==e.controller&&(e.controller=t()),e.controller.start()):void 0},r=function(){return null==window.Turbolinks&&(window.Turbolinks=e),n()},t=function(){var t;return t=new e.Controller,t.adapter=new e.BrowserAdapter(t),t},n=function(){return window.Turbolinks===e},n()&&e.start()}.call(this)}).call(this),"object"==typeof module&&module.exports?module.exports=e:"function"==typeof define&&define.amd&&define(e)}).call(this);
|
@@ -182,7 +182,7 @@
|
|
182
182
|
<% end %>
|
183
183
|
|
184
184
|
<% if method.token_stream %>
|
185
|
-
<% markup = method.
|
185
|
+
<% markup = method.markup_code %>
|
186
186
|
<div class="sourcecode">
|
187
187
|
<%
|
188
188
|
# generate github link
|
@@ -209,8 +209,8 @@
|
|
209
209
|
</div>
|
210
210
|
<% end %>
|
211
211
|
</div>
|
212
|
-
<% end
|
213
|
-
<% end
|
214
|
-
<% end
|
215
|
-
<% end
|
212
|
+
<% end %><%# methods.each %>
|
213
|
+
<% end %><%# visibilities.each %>
|
214
|
+
<% end %><%# context.methods_by_type %>
|
215
|
+
<% end %><%# context.each_section %>
|
216
216
|
</div>
|
@@ -2,6 +2,5 @@
|
|
2
2
|
<link rel="stylesheet" href="<%= "#{rel_prefix}/css/main.css" %>" type="text/css" media="screen" />
|
3
3
|
<link rel="stylesheet" href="<%= "#{rel_prefix}/css/github.css" %>" type="text/css" media="screen" />
|
4
4
|
<script src="<%= "#{rel_prefix}/js/jquery-1.3.2.min.js" %>" type="text/javascript" charset="utf-8"></script>
|
5
|
-
<script src="<%= "#{rel_prefix}/js/jquery-effect.js" %>" type="text/javascript" charset="utf-8"></script>
|
6
5
|
<script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8"></script>
|
7
6
|
<script src="<%= "#{rel_prefix}/js/highlight.pack.js" %>" type="text/javascript" charset="utf-8"></script>
|
@@ -6,6 +6,19 @@
|
|
6
6
|
<title><%= h klass.full_name %></title>
|
7
7
|
<meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
|
8
8
|
<%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
|
9
|
+
|
10
|
+
<meta property="og:title" value="<%= klass.full_name %>">
|
11
|
+
|
12
|
+
<% unless (description = klass.description).empty? %>
|
13
|
+
<% human_desc = truncate(strip_tags(description.gsub("\n", " ").strip)) %>
|
14
|
+
<meta name="description" content="<%= human_desc %>">
|
15
|
+
<meta property="og:description" content="<%= human_desc %>">
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<meta name="keywords" content="<%= klass.full_name %> class">
|
19
|
+
<% unless klass.method_list.empty? %>
|
20
|
+
<meta name="keywords" content="<%= klass.method_list.map(&:name).join(", ") %>">
|
21
|
+
<% end %>
|
9
22
|
</head>
|
10
23
|
|
11
24
|
<body>
|
File without changes
|
File without changes
|
@@ -128,7 +128,7 @@ li
|
|
128
128
|
margin-bottom: 0;
|
129
129
|
}
|
130
130
|
|
131
|
-
pre
|
131
|
+
pre
|
132
132
|
{
|
133
133
|
margin-bottom: 1em;
|
134
134
|
}
|
@@ -321,3 +321,13 @@ tt {
|
|
321
321
|
.ruby-number {
|
322
322
|
color: #40A070;
|
323
323
|
}
|
324
|
+
|
325
|
+
@keyframes highlight {
|
326
|
+
from { background-color: yellow; }
|
327
|
+
to { background-color: white; }
|
328
|
+
}
|
329
|
+
|
330
|
+
.highlight {
|
331
|
+
animation-name: highlight;
|
332
|
+
animation-duration: 1s;
|
333
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -11,7 +11,13 @@ function toggleSource(id) {
|
|
11
11
|
window.highlight = function(url) {
|
12
12
|
var hash = url.match(/#([^#]+)$/);
|
13
13
|
if (hash) {
|
14
|
-
|
14
|
+
var parent = document.querySelector('a[name=' + hash[1] + ']').parentElement;
|
15
|
+
|
16
|
+
parent.classList.add('highlight');
|
17
|
+
|
18
|
+
setTimeout(function() {
|
19
|
+
parent.classList.remove('highlight');
|
20
|
+
}, 1000);
|
15
21
|
}
|
16
22
|
};
|
17
23
|
|
@@ -245,10 +245,10 @@ Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
|
|
245
245
|
html += '</a>';
|
246
246
|
html += '<p>';
|
247
247
|
if (typeof badge != 'undefined') {
|
248
|
-
html += '<span class="badge badge_' + (badge % 6 + 1) + '">' +
|
248
|
+
html += '<span class="badge badge_' + (badge % 6 + 1) + '">' + stripHTML(this.data.badges[badge] || 'unknown') + '</span>';
|
249
249
|
}
|
250
250
|
html += hlt(result.namespace) + '</p>';
|
251
|
-
if (result.snippet) html += '<p class="snippet">' +
|
251
|
+
if (result.snippet) html += '<p class="snippet">' + stripHTML(result.snippet.replace(/^<p>/, '')) + '</p>';
|
252
252
|
li.innerHTML = html;
|
253
253
|
jQuery.data(li, 'path', result.path);
|
254
254
|
return li;
|
@@ -264,6 +264,25 @@ Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
|
|
264
264
|
});
|
265
265
|
}
|
266
266
|
|
267
|
+
function stripHTML(html) {
|
268
|
+
var in_tag = false;
|
269
|
+
var output = "";
|
270
|
+
|
271
|
+
for (var i = 0; i < html.length; i++) {
|
272
|
+
if (html[i] == '<'){
|
273
|
+
in_tag = true;
|
274
|
+
} else if (html[i] == '>') {
|
275
|
+
in_tag = false;
|
276
|
+
i++;
|
277
|
+
}
|
278
|
+
|
279
|
+
if (!in_tag && i < html.length)
|
280
|
+
output += html[i];
|
281
|
+
}
|
282
|
+
|
283
|
+
return output;
|
284
|
+
}
|
285
|
+
|
267
286
|
});
|
268
287
|
|
269
288
|
// tree.js ------------------------------------------------
|
File without changes
|
data/lib/sdoc.rb
CHANGED
data/lib/sdoc/generator.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'erb'
|
3
2
|
require 'pathname'
|
4
3
|
require 'fileutils'
|
@@ -7,6 +6,7 @@ require 'json'
|
|
7
6
|
require 'sdoc/github'
|
8
7
|
require 'sdoc/templatable'
|
9
8
|
require 'sdoc/helpers'
|
9
|
+
require 'sdoc/version'
|
10
10
|
require 'rdoc'
|
11
11
|
|
12
12
|
class RDoc::ClassModule
|
@@ -20,77 +20,6 @@ class RDoc::Options
|
|
20
20
|
attr_accessor :search_index
|
21
21
|
end
|
22
22
|
|
23
|
-
class RDoc::AnyMethod
|
24
|
-
|
25
|
-
TITLE_AFTER = %w(def class module)
|
26
|
-
|
27
|
-
##
|
28
|
-
# Turns the method's token stream into HTML.
|
29
|
-
#
|
30
|
-
# Prepends line numbers if +add_line_numbers+ is true.
|
31
|
-
|
32
|
-
def sdoc_markup_code
|
33
|
-
return '' unless @token_stream
|
34
|
-
|
35
|
-
src = ""
|
36
|
-
starting_title = false
|
37
|
-
|
38
|
-
@token_stream.each do |t|
|
39
|
-
next unless t
|
40
|
-
|
41
|
-
style = case t
|
42
|
-
when RDoc::RubyToken::TkFLOAT then 'ruby-number'
|
43
|
-
when RDoc::RubyToken::TkINTEGER then 'ruby-number'
|
44
|
-
when RDoc::RubyToken::TkCONSTANT then 'ruby-constant'
|
45
|
-
when RDoc::RubyToken::TkKW then 'ruby-keyword'
|
46
|
-
when RDoc::RubyToken::TkIVAR then 'ruby-ivar'
|
47
|
-
when RDoc::RubyToken::TkOp then 'ruby-operator'
|
48
|
-
when RDoc::RubyToken::TkId then 'ruby-identifier'
|
49
|
-
when RDoc::RubyToken::TkNode then 'ruby-node'
|
50
|
-
when RDoc::RubyToken::TkCOMMENT then 'ruby-comment'
|
51
|
-
when RDoc::RubyToken::TkREGEXP then 'ruby-regexp'
|
52
|
-
when RDoc::RubyToken::TkSTRING then 'ruby-string'
|
53
|
-
when RDoc::RubyToken::TkVal then 'ruby-value'
|
54
|
-
end
|
55
|
-
|
56
|
-
if RDoc::RubyToken::TkId === t && starting_title
|
57
|
-
starting_title = false
|
58
|
-
style = 'ruby-keyword ruby-title'
|
59
|
-
end
|
60
|
-
|
61
|
-
if RDoc::RubyToken::TkKW === t && TITLE_AFTER.include?(t.text)
|
62
|
-
starting_title = true
|
63
|
-
end
|
64
|
-
|
65
|
-
text = CGI.escapeHTML t.text
|
66
|
-
|
67
|
-
if style then
|
68
|
-
src << "<span class=\"#{style}\">#{text}</span>"
|
69
|
-
else
|
70
|
-
src << text
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# dedent the source
|
75
|
-
indent = src.length
|
76
|
-
lines = src.lines.to_a
|
77
|
-
lines.shift if src =~ /\A.*#\ *File/i # remove '# File' comment
|
78
|
-
lines.each do |line|
|
79
|
-
if line =~ /^ *(?=\S)/
|
80
|
-
n = $&.length
|
81
|
-
indent = n if n < indent
|
82
|
-
break if n == 0
|
83
|
-
end
|
84
|
-
end
|
85
|
-
src.gsub!(/^#{' ' * indent}/, '') if indent > 0
|
86
|
-
|
87
|
-
add_line_numbers(src) if self.class.add_line_numbers
|
88
|
-
|
89
|
-
src
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
23
|
class RDoc::Generator::SDoc
|
95
24
|
RDoc::RDoc.add_generator self
|
96
25
|
|
@@ -121,8 +50,6 @@ class RDoc::Generator::SDoc
|
|
121
50
|
attr_reader :store
|
122
51
|
|
123
52
|
def self.setup_options(options)
|
124
|
-
@github = false
|
125
|
-
|
126
53
|
opt = options.option_parser
|
127
54
|
opt.separator nil
|
128
55
|
opt.separator "SDoc generator options:"
|
@@ -133,6 +60,10 @@ class RDoc::Generator::SDoc
|
|
133
60
|
end
|
134
61
|
opt.separator nil
|
135
62
|
|
63
|
+
opt.on("--version", "-v", "Output current version") do
|
64
|
+
puts SDoc::VERSION
|
65
|
+
exit
|
66
|
+
end
|
136
67
|
end
|
137
68
|
|
138
69
|
def initialize(store, options)
|
@@ -187,6 +118,7 @@ class RDoc::Generator::SDoc
|
|
187
118
|
debug_msg "Generating index file in #@outputdir"
|
188
119
|
templatefile = @template_dir + 'index.rhtml'
|
189
120
|
outfile = @outputdir + 'index.html'
|
121
|
+
rel_prefix = @outputdir.relative_path_from( outfile.dirname )
|
190
122
|
|
191
123
|
self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
|
192
124
|
end
|
@@ -261,16 +193,23 @@ class RDoc::Generator::SDoc
|
|
261
193
|
|
262
194
|
### Determines index path based on @options.main_page (or lack thereof)
|
263
195
|
def index_path
|
264
|
-
# Break early to avoid a big if block when no main page is specified
|
265
|
-
default = @files.first.path
|
266
|
-
return default unless @options.main_page
|
267
|
-
|
268
196
|
# Transform class name to file path
|
269
197
|
if @options.main_page.include?("::")
|
270
198
|
slashed = @options.main_page.sub(/^::/, "").gsub("::", "/")
|
271
199
|
"%s/%s.html" % [ class_dir, slashed ]
|
272
|
-
|
273
|
-
|
200
|
+
else
|
201
|
+
index.path
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
### Determines index page based on @options.main_page (or lack thereof)
|
206
|
+
def index
|
207
|
+
# Break early to avoid a big if block when no main page is specified
|
208
|
+
default = @files.first
|
209
|
+
return default unless @options.main_page
|
210
|
+
|
211
|
+
if file = @files.find { |f| f.full_name == @options.main_page }
|
212
|
+
file
|
274
213
|
else
|
275
214
|
default
|
276
215
|
end
|
data/lib/sdoc/github.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
module SDoc::GitHub
|
2
2
|
def github_url(path)
|
3
|
+
return false unless have_git?
|
4
|
+
|
3
5
|
unless @github_url_cache.has_key? path
|
4
6
|
@github_url_cache[path] = false
|
5
7
|
file = @store.find_file_named(path)
|
6
8
|
if file
|
7
9
|
base_url = repository_url(path)
|
8
10
|
if base_url
|
9
|
-
|
10
|
-
|
11
|
-
relative_url = path_relative_to_repository(path)
|
12
|
-
@github_url_cache[path] = "#{base_url}#{sha1}#{relative_url}"
|
13
|
-
end
|
11
|
+
relative_url = path_relative_to_repository(path)
|
12
|
+
@github_url_cache[path] = "#{base_url}#{last_commit_sha1}#{relative_url}"
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
@@ -24,23 +23,23 @@ module SDoc::GitHub
|
|
24
23
|
@have_git
|
25
24
|
end
|
26
25
|
|
27
|
-
def
|
28
|
-
return
|
29
|
-
|
30
|
-
|
31
|
-
`git
|
26
|
+
def last_commit_sha1
|
27
|
+
return @sha1 if defined?(@sha1)
|
28
|
+
|
29
|
+
@sha1 = Dir.chdir(base_dir) do
|
30
|
+
`git rev-parse HEAD`.chomp
|
32
31
|
end
|
33
|
-
m = s.match(/commit\s+(\S+)/)
|
34
|
-
m ? m[1] : false
|
35
32
|
end
|
36
33
|
|
37
34
|
def repository_url(path)
|
38
|
-
return
|
35
|
+
return @repository_url if defined?(@repository_url)
|
36
|
+
|
39
37
|
s = Dir.chdir(File.join(base_dir, File.dirname(path))) do
|
40
38
|
`git config --get remote.origin.url`
|
41
39
|
end
|
40
|
+
|
42
41
|
m = s.match(%r{github.com[/:](.*)\.git$})
|
43
|
-
m ? "https://github.com/#{m[1]}/blob/" : false
|
42
|
+
@repository_url = m ? "https://github.com/#{m[1]}/blob/" : false
|
44
43
|
end
|
45
44
|
|
46
45
|
def path_relative_to_repository(path)
|
data/lib/sdoc/helpers.rb
CHANGED
@@ -15,6 +15,28 @@ module SDoc::Helpers
|
|
15
15
|
yield group unless group[:methods].size == 0
|
16
16
|
end
|
17
17
|
|
18
|
+
# Strips out HTML tags from a given string.
|
19
|
+
#
|
20
|
+
# Example:
|
21
|
+
#
|
22
|
+
# strip_tags("<strong>Hello world</strong>") => "Hello world"
|
23
|
+
def strip_tags(text)
|
24
|
+
text.gsub(%r{</?[^>]+?>}, "")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Truncates a given string. It tries to take whole sentences to have
|
28
|
+
# a meaningful description for SEO tags.
|
29
|
+
#
|
30
|
+
# The only available option is +:length+ which defaults to 200.
|
31
|
+
def truncate(text, options = {})
|
32
|
+
if text
|
33
|
+
length = options.fetch(:length, 200)
|
34
|
+
stop = text.rindex(".", length - 1) || length
|
35
|
+
|
36
|
+
"#{text[0, stop]}."
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
18
40
|
protected
|
19
41
|
def group_name name
|
20
42
|
if match = name.match(/^([a-z])/i)
|
data/lib/sdoc/templatable.rb
CHANGED
@@ -6,7 +6,11 @@ module SDoc::Templatable
|
|
6
6
|
### Both +templatefile+ and +outfile+ should be Pathname-like objects.
|
7
7
|
def eval_template(templatefile, context)
|
8
8
|
template_src = templatefile.read
|
9
|
-
template = ERB.
|
9
|
+
template = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
10
|
+
ERB.new( template_src, trim_mode: '<>' )
|
11
|
+
else
|
12
|
+
ERB.new( template_src, nil, '<>' )
|
13
|
+
end
|
10
14
|
template.filename = templatefile.to_s
|
11
15
|
|
12
16
|
begin
|
data/lib/sdoc/version.rb
CHANGED
data/sdoc.gemspec
CHANGED
@@ -22,7 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.rdoc_options = ["--charset=UTF-8"]
|
23
23
|
s.extra_rdoc_files = ["README.md"]
|
24
24
|
|
25
|
-
s.add_runtime_dependency("rdoc", "
|
25
|
+
s.add_runtime_dependency("rdoc", ">= 5.0")
|
26
|
+
s.add_runtime_dependency("rack")
|
26
27
|
|
27
28
|
s.files = `git ls-files`.split("\n")
|
28
29
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe SDoc::Helpers do
|
4
|
+
before :each do
|
5
|
+
@helpers = Class.new do
|
6
|
+
include SDoc::Helpers
|
7
|
+
end.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#strip_tags" do
|
11
|
+
it "should strip out HTML tags from the given string" do
|
12
|
+
strings = [
|
13
|
+
[ %(<strong>Hello world</strong>), "Hello world" ],
|
14
|
+
[ %(<a href="Streams.html">Streams</a> are great), "Streams are great" ],
|
15
|
+
[ %(<a href="https://github.com?x=1&y=2#123">zzak/sdoc</a> Standalone), "zzak/sdoc Standalone" ],
|
16
|
+
[ %(<h1 id="module-AR::Cb-label-Foo+Bar">AR Cb</h1>), "AR Cb" ],
|
17
|
+
[ %(<a href="../Base.html">Base</a>), "Base" ],
|
18
|
+
[ %(Some<br>\ntext), "Some\ntext" ]
|
19
|
+
]
|
20
|
+
|
21
|
+
strings.each do |(html, stripped)|
|
22
|
+
@helpers.strip_tags(html).must_equal stripped
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#truncate" do
|
28
|
+
it "should truncate the given text around a given length" do
|
29
|
+
@helpers.truncate("Hello world", length: 5).must_equal "Hello."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|