├── .editorconfig ├── .eslintrc ├── .gitignore ├── LICENSE ├── README.md ├── assets ├── README.md ├── dist │ ├── app-0cc3b4da6e.js │ └── app-1bac334b99.css ├── js │ └── app.js ├── less │ ├── app.less │ └── code.less └── webpack.config.js ├── config └── config.exs ├── gulpfile.js ├── lib ├── elixir_lang_guide.ex └── elixir_lang_guide │ ├── cli.ex │ ├── epub.ex │ └── templates │ └── page.eex ├── mix.exs ├── mix.lock ├── package.json └── test ├── elixir_lang_guide_test.exs └── test_helper.exs /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | insert_final_newline = true 9 | 10 | [*.{ex,exs}] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "env": { 4 | "browser": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # The directory Mix will write compiled artifacts to. 2 | /_build 3 | 4 | # If you run "mix test --cover", coverage assets end up here. 5 | /cover 6 | 7 | # The directory Mix downloads your dependencies sources to. 8 | /deps 9 | 10 | # Where 3rd-party dependencies like ExDoc output generated docs. 11 | /doc 12 | 13 | # If the VM crashes, it generates a dump, let's ignore it too. 14 | erl_crash.dump 15 | 16 | # Also ignore archive artifacts (built via "mix archive.build"). 17 | *.ez 18 | *.epub 19 | node_modules/ 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 Milton Mazzarri 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elixir Lang Guides (EPUB format) 2 | 3 | The idea behind this application is to offer an efficient way to transform 4 | the [Elixir Lang guides][getting_started] into an EPUB document. 5 | 6 | ## How to start 7 | 8 | ```console 9 | $ git clone https://github.com/milmazz/elixir_getting_started_guide_to_go 10 | $ cd elixir_getting_started_guide_to_go 11 | $ mix deps.get 12 | $ mix escript.build 13 | $ ./elixir_lang_guide path/to/elixir-lang.github.com 14 | ``` 15 | 16 | ## More options via command line 17 | 18 | If you need more information about the command line options, please use the 19 | `./elixir_lang_guide --help`: 20 | 21 | * `-g`, `--guide` - Guide that you want to convert, options: 22 | `getting_started`, `meta` or `mix_otp`, default: `getting_started` 23 | * `-h`, `--help` - Show help information 24 | * `-o`, `--output` - Output directory for the EPUB document, default: `doc` 25 | * `-s`, `--scripts` - List of custom JS files to include in the EPUB 26 | document 27 | * `-c`, `--styles` - List of custom CSS files to include in the EPUB 28 | document 29 | * `-v`, `--version` - Show version 30 | 31 | [getting_started]: http://elixir-lang.org/getting-started/ 32 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # Assets 2 | 3 | In this directory live all assets for `ElixirLangGuide`. The ready to 4 | use built versions are found in `priv/dist`. To change any of them read please 5 | read the following instructions: 6 | 7 | ## Dependencies 8 | 9 | To work on these assets you need to install [Node.js] and [npm] first (probably 10 | as superuser or administrator). After that execute the following commands: 11 | 12 | ```bash 13 | $ npm install -g gulp 14 | $ npm install 15 | ``` 16 | 17 | Now many gulp tasks are available via the `gulp` command line. 18 | 19 | ## Available [gulp] tasks 20 | 21 | If you run [gulp] without any option by default you will lint all JavaScript 22 | files using [ESLint] and then the `build` task. 23 | 24 | #### `build` 25 | 26 | This will build a complete bundle, including JavaScript and CSS. 27 | 28 | Using the flag `--type production` will result in minified JavaScript and CSS 29 | bundles. 30 | 31 | #### `clean` 32 | 33 | Clean all content in the build folder `dist` for each format. 34 | 35 | #### `javascript` 36 | 37 | Build the JavaScript in `js` into a bundled file using [webpack] for each 38 | format. 39 | 40 | #### `less` 41 | 42 | Build the [less] files in `less` into a bundled CSS file for each format. 43 | 44 | #### `lint` 45 | 46 | Lint all JavaScript files in `js` using [ESLint]. 47 | 48 | [Node.js]: https://nodejs.org/ 49 | [npm]: https://www.npmjs.com/ 50 | [gulp]: https://www.npmjs.com/package/gulp 51 | [webpack]: http://webpack.github.io/ 52 | [less]: http://lesscss.org/ 53 | [ESLint]: http://eslint.org/ 54 | -------------------------------------------------------------------------------- /assets/dist/app-0cc3b4da6e.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i),a=n(2),s=r(a);window.$=o.default,(0,o.default)(function(){s.default.configure({tabReplace:" ",languages:[]}),s.default.initHighlighting()})},function(e,t,n){var r,i;!function(t,n){"use strict";"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,o){"use strict";function a(e,t){t=t||oe;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function s(e){var t=!!e&&"length"in e&&e.length,n=ye.type(e);return"function"!==n&&!ye.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function l(e,t,n){return ye.isFunction(t)?ye.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?ye.grep(e,function(e){return e===t!==n}):"string"!=typeof t?ye.grep(e,function(e){return ue.call(t,e)>-1!==n}):Se.test(t)?ye.filter(t,e,n):(t=ye.filter(t,e),ye.grep(e,function(e){return ue.call(t,e)>-1!==n&&1===e.nodeType}))}function c(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function u(e){var t={};return ye.each(e.match(Le)||[],function(e,n){t[n]=!0}),t}function d(e){return e}function f(e){throw e}function p(e,t,n){var r;try{e&&ye.isFunction(r=e.promise)?r.call(e).done(t).fail(n):e&&ye.isFunction(r=e.then)?r.call(e,t,n):t.call(void 0,e)}catch(e){n.call(void 0,e)}}function h(){oe.removeEventListener("DOMContentLoaded",h),n.removeEventListener("load",h),ye.ready()}function g(){this.expando=ye.expando+g.uid++}function m(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Fe.test(e)?JSON.parse(e):e)}function v(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace($e,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n=m(n)}catch(e){}Pe.set(e,t,n)}else n=void 0;return n}function y(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return ye.css(e,t,"")},l=s(),c=n&&n[3]||(ye.cssNumber[t]?"":"px"),u=(ye.cssNumber[t]||"px"!==c&&+l)&&We.exec(ye.css(e,t));if(u&&u[3]!==c){c=c||u[3],n=n||[],u=+l||1;do o=o||".5",u/=o,ye.style(e,t,u+c);while(o!==(o=s()/l)&&1!==o&&--a)}return n&&(u=+u||+l||0,i=n[1]?u+(n[1]+1)*n[2]:+n[2],r&&(r.unit=c,r.start=u,r.end=i)),i}function b(e){var t,n=e.ownerDocument,r=e.nodeName,i=Xe[r];return i?i:(t=n.body.appendChild(n.createElement(r)),i=ye.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),Xe[r]=i,i)}function x(e,t){for(var n,r,i=[],o=0,a=e.length;o-1)i&&i.push(o);else if(c=ye.contains(o.ownerDocument,o),a=_(d.appendChild(o),"script"),c&&w(a),n)for(u=0;o=a[u++];)Ve.test(o.type||"")&&n.push(o);return d}function N(){return!0}function T(){return!1}function C(){try{return oe.activeElement}catch(e){}}function k(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)k(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=T;else if(!i)return e;return 1===o&&(a=i,i=function(e){return ye().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=ye.guid++)),e.each(function(){ye.event.add(this,t,i,r,n)})}function S(e,t){return ye.nodeName(e,"table")&&ye.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function A(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function D(e){var t=st.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function O(e,t){var n,r,i,o,a,s,l,c;if(1===t.nodeType){if(Ie.hasData(e)&&(o=Ie.access(e),a=Ie.set(t,o),c=o.events)){delete a.handle,a.events={};for(i in c)for(n=0,r=c[i].length;n1&&"string"==typeof h&&!me.checkClone&&at.test(h))return e.each(function(i){var o=e.eq(i);g&&(t[0]=h.call(this,i,o.html())),R(o,t,n,r)});if(f&&(i=E(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=ye.map(_(i,"script"),A),l=s.length;d=0&&nE.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=R.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)E.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return function(t){return"form"in t?t.parentNode&&t.disabled===!1?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Ne(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function u(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function d(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function p(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function m(e,n,r){for(var i=0,o=n.length;i-1&&(r[c]=!(a[c]=d))}}else b=v(b===a?b.splice(h,b.length):b),o?o(null,a,b,l):Y.apply(a,b)})}function b(e){for(var t,n,r,i=e.length,o=E.relative[e[0].type],a=o||E.relative[" "],s=o?1:0,l=h(function(e){return e===t},a,!0),c=h(function(e){return ee(t,e)>-1},a,!0),u=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];s1&&g(u),s>1&&p(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,l,c){var u,d,f,p=0,h="0",g=r&&[],m=[],y=A,b=r||o&&E.find.TAG("*",c),x=$+=null==y?1:Math.random()||.1,_=b.length;for(c&&(A=a===R||a||c);h!==_&&null!=(u=b[h]);h++){if(o&&u){for(d=0,a||u.ownerDocument===R||(M(u),s=!j);f=e[d++];)if(f(u,a||R,s)){l.push(u);break}c&&($=x)}i&&((u=!f&&u)&&p--,r&&g.push(u))}if(p+=h,i&&h!==p){for(d=0;f=n[d++];)f(g,m,a,s);if(r){if(p>0)for(;h--;)g[h]||m[h]||(m[h]=Q.call(l));m=v(m)}Y.apply(l,m),c&&!r&&m.length>0&&p+n.length>1&&t.uniqueSort(l)}return c&&($=x,A=y),g};return i?r(a):a}var _,w,E,N,T,C,k,S,A,D,O,M,R,L,j,q,H,B,I,P="sizzle"+1*new Date,F=e.document,$=0,z=0,W=n(),U=n(),K=n(),G=function(e,t){return e===t&&(O=!0),0},X={}.hasOwnProperty,Z=[],Q=Z.pop,V=Z.push,Y=Z.push,J=Z.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ue=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),de=new RegExp(oe),fe=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ve=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),xe=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},_e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,we=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Ee=function(){M()},Ne=h(function(e){return e.disabled===!0&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{Y.apply(Z=J.call(F.childNodes),F.childNodes),Z[F.childNodes.length].nodeType}catch(e){Y={apply:Z.length?function(e,t){V.apply(e,J.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},T=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},M=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:F;return r!==R&&9===r.nodeType&&r.documentElement?(R=r,L=R.documentElement,j=!T(R),F!==R&&(n=R.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Ee,!1):n.attachEvent&&n.attachEvent("onunload",Ee)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(R.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(R.getElementsByClassName),w.getById=i(function(e){return L.appendChild(e).id=P,!R.getElementsByName||!R.getElementsByName(P).length}),w.getById?(E.filter.ID=function(e){var t=e.replace(be,xe);return function(e){return e.getAttribute("id")===t}},E.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&j){var n=t.getElementById(e);return n?[n]:[]}}):(E.filter.ID=function(e){var t=e.replace(be,xe);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},E.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&j){var n,r,i,o=t.getElementById(e);if(o){if(n=o.getAttributeNode("id"),n&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if(n=o.getAttributeNode("id"),n&&n.value===e)return[o]}return[]}}),E.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},E.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&j)return t.getElementsByClassName(e)},H=[],q=[],(w.qsa=me.test(R.querySelectorAll))&&(i(function(e){L.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||q.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||q.push("~="),e.querySelectorAll(":checked").length||q.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||q.push(".#.+[+~]")}),i(function(e){e.innerHTML="";var t=R.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&q.push("name"+ne+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),L.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),q.push(",.*:")})),(w.matchesSelector=me.test(B=L.matches||L.webkitMatchesSelector||L.mozMatchesSelector||L.oMatchesSelector||L.msMatchesSelector))&&i(function(e){w.disconnectedMatch=B.call(e,"*"),B.call(e,"[s!='']:x"),H.push("!=",oe)}),q=q.length&&new RegExp(q.join("|")),H=H.length&&new RegExp(H.join("|")),t=me.test(L.compareDocumentPosition),I=t||me.test(L.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},G=t?function(e,t){if(e===t)return O=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===R||e.ownerDocument===F&&I(F,e)?-1:t===R||t.ownerDocument===F&&I(F,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return O=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],l=[t];if(!i||!o)return e===R?-1:t===R?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)l.unshift(n);for(;s[r]===l[r];)r++;return r?a(s[r],l[r]):s[r]===F?-1:l[r]===F?1:0},R):R},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==R&&M(e),n=n.replace(ue,"='$1']"),w.matchesSelector&&j&&!K[n+" "]&&(!H||!H.test(n))&&(!q||!q.test(n)))try{var r=B.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return t(n,R,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==R&&M(e),I(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==R&&M(e);var n=E.attrHandle[t.toLowerCase()],r=n&&X.call(E.attrHandle,t.toLowerCase())?n(e,t,!j):void 0;return void 0!==r?r:w.attributes||!j?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(_e,we)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(O=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(G),O){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},N=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=N(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=N(t);return n},E=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,xe),e[3]=(e[3]||e[4]||e[5]||"").replace(be,xe),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&de.test(n)&&(t=C(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,xe).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var c,u,d,f,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!l&&!s,b=!1;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&y){for(f=m,d=f[P]||(f[P]={}),u=d[f.uniqueID]||(d[f.uniqueID]={}),c=u[e]||[],p=c[0]===$&&c[1],b=p&&c[2],f=p&&m.childNodes[p];f=++p&&f&&f[g]||(b=p=0)||h.pop();)if(1===f.nodeType&&++b&&f===t){u[e]=[$,p,b];break}}else if(y&&(f=t,d=f[P]||(f[P]={}),u=d[f.uniqueID]||(d[f.uniqueID]={}),c=u[e]||[],p=c[0]===$&&c[1],b=p),b===!1)for(;(f=++p&&f&&f[g]||(b=p=0)||h.pop())&&((s?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++b||(y&&(d=f[P]||(f[P]={}),u=d[f.uniqueID]||(d[f.uniqueID]={}),u[e]=[$,b]),f!==t)););return b-=i,b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,n){var i,o=E.pseudos[e]||E.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],E.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){ 2 | return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,xe),function(t){return(t.textContent||t.innerText||N(t)).indexOf(e)>-1}}),lang:r(function(e){return fe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,xe).toLowerCase(),function(t){var n;do if(n=j?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===L},focus:function(e){return e===R.activeElement&&(!R.hasFocus||R.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:c(!1),disabled:c(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!E.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[n<0?n+t:n]}),even:u(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:u(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&9===t.nodeType&&j&&E.relative[o[1].type]){if(t=(E.find.ID(a.matches[0].replace(be,xe),t)||[])[0],!t)return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!E.relative[s=a.type]);)if((l=E.find[s])&&(r=l(a.matches[0].replace(be,xe),ye.test(o[0].type)&&d(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&p(o),!e)return Y.apply(n,r),n;break}}return(c||k(e,u))(r,t,!j,n,!t||ye.test(e)&&d(t.parentNode)||t),n},w.sortStable=P.split("").sort(G).join("")===P,w.detectDuplicates=!!O,M(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(R.createElement("fieldset"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(n);ye.find=Ee,ye.expr=Ee.selectors,ye.expr[":"]=ye.expr.pseudos,ye.uniqueSort=ye.unique=Ee.uniqueSort,ye.text=Ee.getText,ye.isXMLDoc=Ee.isXML,ye.contains=Ee.contains,ye.escapeSelector=Ee.escape;var Ne=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&ye(e).is(n))break;r.push(e)}return r},Te=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Ce=ye.expr.match.needsContext,ke=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Se=/^.[^:#\[\.,]*$/;ye.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ye.find.matchesSelector(r,e)?[r]:[]:ye.find.matches(e,ye.grep(t,function(e){return 1===e.nodeType}))},ye.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(ye(e).filter(function(){for(t=0;t1?ye.uniqueSort(n):n},filter:function(e){return this.pushStack(l(this,e||[],!1))},not:function(e){return this.pushStack(l(this,e||[],!0))},is:function(e){return!!l(this,"string"==typeof e&&Ce.test(e)?ye(e):e||[],!1).length}});var Ae,De=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,Oe=ye.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ae,"string"==typeof e){if(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:De.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ye?t[0]:t,ye.merge(this,ye.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:oe,!0)),ke.test(r[1])&&ye.isPlainObject(t))for(r in t)ye.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=oe.getElementById(r[2]),i&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):ye.isFunction(e)?void 0!==n.ready?n.ready(e):e(ye):ye.makeArray(e,this)};Oe.prototype=ye.fn,Ae=ye(oe);var Me=/^(?:parents|prev(?:Until|All))/,Re={children:!0,contents:!0,next:!0,prev:!0};ye.fn.extend({has:function(e){var t=ye(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&ye.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?ye.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?ue.call(ye(e),this[0]):ue.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ye.uniqueSort(ye.merge(this.get(),ye(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ye.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Ne(e,"parentNode")},parentsUntil:function(e,t,n){return Ne(e,"parentNode",n)},next:function(e){return c(e,"nextSibling")},prev:function(e){return c(e,"previousSibling")},nextAll:function(e){return Ne(e,"nextSibling")},prevAll:function(e){return Ne(e,"previousSibling")},nextUntil:function(e,t,n){return Ne(e,"nextSibling",n)},prevUntil:function(e,t,n){return Ne(e,"previousSibling",n)},siblings:function(e){return Te((e.parentNode||{}).firstChild,e)},children:function(e){return Te(e.firstChild)},contents:function(e){return e.contentDocument||ye.merge([],e.childNodes)}},function(e,t){ye.fn[e]=function(n,r){var i=ye.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=ye.filter(r,i)),this.length>1&&(Re[e]||ye.uniqueSort(i),Me.test(e)&&i.reverse()),this.pushStack(i)}});var Le=/[^\x20\t\r\n\f]+/g;ye.Callbacks=function(e){e="string"==typeof e?u(e):ye.extend({},e);var t,n,r,i,o=[],a=[],s=-1,l=function(){for(i=e.once,r=t=!0;a.length;s=-1)for(n=a.shift();++s-1;)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?ye.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],a.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},ye.extend({Deferred:function(e){var t=[["notify","progress",ye.Callbacks("memory"),ye.Callbacks("memory"),2],["resolve","done",ye.Callbacks("once memory"),ye.Callbacks("once memory"),0,"resolved"],["reject","fail",ye.Callbacks("once memory"),ye.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return ye.Deferred(function(n){ye.each(t,function(t,r){var i=ye.isFunction(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&ye.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(e,r,i){function o(e,t,r,i){return function(){var s=this,l=arguments,c=function(){var n,c;if(!(e=a&&(r!==f&&(s=void 0,l=[n]),t.rejectWith(s,l))}};e?u():(ye.Deferred.getStackHook&&(u.stackTrace=ye.Deferred.getStackHook()),n.setTimeout(u))}}var a=0;return ye.Deferred(function(n){t[0][3].add(o(0,n,ye.isFunction(i)?i:d,n.notifyWith)),t[1][3].add(o(0,n,ye.isFunction(e)?e:d)),t[2][3].add(o(0,n,ye.isFunction(r)?r:f))}).promise()},promise:function(e){return null!=e?ye.extend(e,i):i}},o={};return ye.each(t,function(e,n){var a=n[2],s=n[5];i[n[1]]=a.add,s&&a.add(function(){r=s},t[3-e][2].disable,t[0][2].lock),a.add(n[3].fire),o[n[0]]=function(){return o[n[0]+"With"](this===o?void 0:this,arguments),this},o[n[0]+"With"]=a.fireWith}),i.promise(o),e&&e.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=se.call(arguments),o=ye.Deferred(),a=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?se.call(arguments):n,--t||o.resolveWith(r,i)}};if(t<=1&&(p(e,o.done(a(n)).resolve,o.reject),"pending"===o.state()||ye.isFunction(i[n]&&i[n].then)))return o.then();for(;n--;)p(i[n],a(n),o.reject);return o.promise()}});var je=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ye.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&je.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ye.readyException=function(e){n.setTimeout(function(){throw e})};var qe=ye.Deferred();ye.fn.ready=function(e){return qe.then(e).catch(function(e){ye.readyException(e)}),this},ye.extend({isReady:!1,readyWait:1,holdReady:function(e){e?ye.readyWait++:ye.ready(!0)},ready:function(e){(e===!0?--ye.readyWait:ye.isReady)||(ye.isReady=!0,e!==!0&&--ye.readyWait>0||qe.resolveWith(oe,[ye]))}}),ye.ready.then=qe.then,"complete"===oe.readyState||"loading"!==oe.readyState&&!oe.documentElement.doScroll?n.setTimeout(ye.ready):(oe.addEventListener("DOMContentLoaded",h),n.addEventListener("load",h));var He=function(e,t,n,r,i,o,a){var s=0,l=e.length,c=null==n;if("object"===ye.type(n)){i=!0;for(s in n)He(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,ye.isFunction(r)||(a=!0),c&&(a?(t.call(e,r),t=null):(c=t,t=function(e,t,n){return c.call(ye(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){Pe.remove(this,e)})}}),ye.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Ie.get(e,t),n&&(!r||ye.isArray(n)?r=Ie.access(e,t,ye.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ye.queue(e,t),r=n.length,i=n.shift(),o=ye._queueHooks(e,t),a=function(){ye.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Ie.get(e,n)||Ie.access(e,n,{empty:ye.Callbacks("once memory").add(function(){Ie.remove(e,[t+"queue",n])})})}}),ye.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,Ve=/^$|\/(?:java|ecma)script/i,Ye={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ye.optgroup=Ye.option,Ye.tbody=Ye.tfoot=Ye.colgroup=Ye.caption=Ye.thead,Ye.th=Ye.td;var Je=/<|&#?\w+;/;!function(){var e=oe.createDocumentFragment(),t=e.appendChild(oe.createElement("div")),n=oe.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),me.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",me.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var et=oe.documentElement,tt=/^key/,nt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rt=/^([^.]*)(?:\.(.+)|)/;ye.event={global:{},add:function(e,t,n,r,i){var o,a,s,l,c,u,d,f,p,h,g,m=Ie.get(e);if(m)for(n.handler&&(o=n,n=o.handler,i=o.selector),i&&ye.find.matchesSelector(et,i),n.guid||(n.guid=ye.guid++),(l=m.events)||(l=m.events={}),(a=m.handle)||(a=m.handle=function(t){return"undefined"!=typeof ye&&ye.event.triggered!==t.type?ye.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Le)||[""],c=t.length;c--;)s=rt.exec(t[c])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p&&(d=ye.event.special[p]||{},p=(i?d.delegateType:d.bindType)||p,d=ye.event.special[p]||{},u=ye.extend({type:p,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ye.expr.match.needsContext.test(i),namespace:h.join(".")},o),(f=l[p])||(f=l[p]=[],f.delegateCount=0,d.setup&&d.setup.call(e,r,h,a)!==!1||e.addEventListener&&e.addEventListener(p,a)),d.add&&(d.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),i?f.splice(f.delegateCount++,0,u):f.push(u),ye.event.global[p]=!0)},remove:function(e,t,n,r,i){var o,a,s,l,c,u,d,f,p,h,g,m=Ie.hasData(e)&&Ie.get(e);if(m&&(l=m.events)){for(t=(t||"").match(Le)||[""],c=t.length;c--;)if(s=rt.exec(t[c])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p){for(d=ye.event.special[p]||{},p=(r?d.delegateType:d.bindType)||p,f=l[p]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=f.length;o--;)u=f[o],!i&&g!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||r&&r!==u.selector&&("**"!==r||!u.selector)||(f.splice(o,1),u.selector&&f.delegateCount--,d.remove&&d.remove.call(e,u));a&&!f.length&&(d.teardown&&d.teardown.call(e,h,m.handle)!==!1||ye.removeEvent(e,p,m.handle),delete l[p])}else for(p in l)ye.event.remove(e,p+t[c],n,r,!0);ye.isEmptyObject(l)&&Ie.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=ye.event.fix(e),l=new Array(arguments.length),c=(Ie.get(this,"events")||{})[s.type]||[],u=ye.event.special[s.type]||{};for(l[0]=s,t=1;t=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||c.disabled!==!0)){for(o=[],a={},n=0;n-1:ye.find(i,this,null,[c]).length),a[i]&&o.push(r);o.length&&s.push({elem:c,handlers:o})}return c=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,ot=/\s*$/g;ye.extend({htmlPrefilter:function(e){return e.replace(it,"<$1>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),l=ye.contains(e.ownerDocument,e);if(!(me.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ye.isXMLDoc(e)))for(a=_(s),o=_(e),r=0,i=o.length;r0&&w(a,!l&&_(e,"script")),s},cleanData:function(e){for(var t,n,r,i=ye.event.special,o=0;void 0!==(n=e[o]);o++)if(Be(n)){if(t=n[Ie.expando]){if(t.events)for(r in t.events)i[r]?ye.event.remove(n,r):ye.removeEvent(n,r,t.handle);n[Ie.expando]=void 0}n[Pe.expando]&&(n[Pe.expando]=void 0)}}}),ye.fn.extend({detach:function(e){return L(this,e,!0)},remove:function(e){return L(this,e)},text:function(e){return He(this,function(e){return void 0===e?ye.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return R(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=S(this,e);t.appendChild(e)}})},prepend:function(){return R(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=S(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return R(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return R(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ye.cleanData(_(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ye.clone(this,e,t)})},html:function(e){return He(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ot.test(e)&&!Ye[(Qe.exec(e)||["",""])[1].toLowerCase()]){e=ye.htmlPrefilter(e);try{for(;n1)}}),ye.Tween=F,F.prototype={constructor:F,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ye.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ye.cssNumber[n]?"":"px")},cur:function(){var e=F.propHooks[this.prop];return e&&e.get?e.get(this):F.propHooks._default.get(this)},run:function(e){var t,n=F.propHooks[this.prop];return this.options.duration?this.pos=t=ye.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):F.propHooks._default.set(this),this}},F.prototype.init.prototype=F.prototype,F.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ye.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){ye.fx.step[e.prop]?ye.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[ye.cssProps[e.prop]]&&!ye.cssHooks[e.prop]?e.elem[e.prop]=e.now:ye.style(e.elem,e.prop,e.now+e.unit)}}},F.propHooks.scrollTop=F.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ye.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ye.fx=F.prototype.init,ye.fx.step={};var vt,yt,bt=/^(?:toggle|show|hide)$/,xt=/queueHooks$/;ye.Animation=ye.extend(X,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return y(n.elem,e,We.exec(t),n),n}]},tweener:function(e,t){ye.isFunction(e)?(t=e,e=["*"]):e=e.match(Le);for(var n,r=0,i=e.length;r1)},removeAttr:function(e){return this.each(function(){ye.removeAttr(this,e)})}}),ye.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ye.prop(e,t,n):(1===o&&ye.isXMLDoc(e)||(i=ye.attrHooks[t.toLowerCase()]||(ye.expr.match.bool.test(t)?_t:void 0)),void 0!==n?null===n?void ye.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=ye.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!me.radioValue&&"radio"===t&&ye.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(Le);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),_t={set:function(e,t,n){return t===!1?ye.removeAttr(e,n):e.setAttribute(n,n),n}},ye.each(ye.expr.match.bool.source.match(/\w+/g),function(e,t){var n=wt[t]||ye.find.attr;wt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=wt[a],wt[a]=i,i=null!=n(e,t,r)?a:null,wt[a]=o),i}});var Et=/^(?:input|select|textarea|button)$/i,Nt=/^(?:a|area)$/i;ye.fn.extend({prop:function(e,t){return He(this,ye.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[ye.propFix[e]||e]})}}),ye.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ye.isXMLDoc(e)||(t=ye.propFix[t]||t,i=ye.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ye.find.attr(e,"tabindex");return t?parseInt(t,10):Et.test(e.nodeName)||Nt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),me.optSelected||(ye.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ye.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ye.propFix[this.toLowerCase()]=this}),ye.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,l=0;if(ye.isFunction(e))return this.each(function(t){ye(this).addClass(e.call(this,t,Q(this)))});if("string"==typeof e&&e)for(t=e.match(Le)||[];n=this[l++];)if(i=Q(n),r=1===n.nodeType&&" "+Z(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=Z(r),i!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,l=0;if(ye.isFunction(e))return this.each(function(t){ye(this).removeClass(e.call(this,t,Q(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(Le)||[];n=this[l++];)if(i=Q(n),r=1===n.nodeType&&" "+Z(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=Z(r),i!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):ye.isFunction(e)?this.each(function(n){ye(this).toggleClass(e.call(this,n,Q(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=ye(this),o=e.match(Le)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=Q(this),t&&Ie.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":Ie.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+Z(Q(n))+" ").indexOf(t)>-1)return!0;return!1}});var Tt=/\r/g;ye.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=ye.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,ye(this).val()):e,null==i?i="":"number"==typeof i?i+="":ye.isArray(i)&&(i=ye.map(i,function(e){return null==e?"":e+""})),t=ye.valHooks[this.type]||ye.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=ye.valHooks[i.type]||ye.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Tt,""):null==n?"":n)}}}),ye.extend({valHooks:{option:{get:function(e){var t=ye.find.attr(e,"value");return null!=t?t:Z(ye.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],l=a?o+1:i.length;for(r=o<0?l:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ye.each(["radio","checkbox"],function(){ye.valHooks[this]={set:function(e,t){if(ye.isArray(t))return e.checked=ye.inArray(ye(e).val(),t)>-1}},me.checkOn||(ye.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Ct=/^(?:focusinfocus|focusoutblur)$/;ye.extend(ye.event,{trigger:function(e,t,r,i){var o,a,s,l,c,u,d,f=[r||oe],p=pe.call(e,"type")?e.type:e,h=pe.call(e,"namespace")?e.namespace.split("."):[];if(a=s=r=r||oe,3!==r.nodeType&&8!==r.nodeType&&!Ct.test(p+ye.event.triggered)&&(p.indexOf(".")>-1&&(h=p.split("."),p=h.shift(),h.sort()),c=p.indexOf(":")<0&&"on"+p,e=e[ye.expando]?e:new ye.Event(p,"object"==typeof e&&e),e.isTrigger=i?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:ye.makeArray(t,[e]),d=ye.event.special[p]||{},i||!d.trigger||d.trigger.apply(r,t)!==!1)){if(!i&&!d.noBubble&&!ye.isWindow(r)){for(l=d.delegateType||p,Ct.test(l+p)||(a=a.parentNode);a;a=a.parentNode)f.push(a),s=a;s===(r.ownerDocument||oe)&&f.push(s.defaultView||s.parentWindow||n)}for(o=0;(a=f[o++])&&!e.isPropagationStopped();)e.type=o>1?l:d.bindType||p,u=(Ie.get(a,"events")||{})[e.type]&&Ie.get(a,"handle"),u&&u.apply(a,t),u=c&&a[c],u&&u.apply&&Be(a)&&(e.result=u.apply(a,t),e.result===!1&&e.preventDefault());return e.type=p,i||e.isDefaultPrevented()||d._default&&d._default.apply(f.pop(),t)!==!1||!Be(r)||c&&ye.isFunction(r[p])&&!ye.isWindow(r)&&(s=r[c],s&&(r[c]=null),ye.event.triggered=p,r[p](),ye.event.triggered=void 0,s&&(r[c]=s)),e.result}},simulate:function(e,t,n){var r=ye.extend(new ye.Event,n,{type:e,isSimulated:!0});ye.event.trigger(r,null,t)}}),ye.fn.extend({trigger:function(e,t){return this.each(function(){ye.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ye.event.trigger(e,t,n,!0)}}),ye.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){ye.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),ye.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),me.focusin="onfocusin"in n,me.focusin||ye.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){ye.event.simulate(t,e.target,ye.event.fix(e))};ye.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=Ie.access(r,t);i||r.addEventListener(e,n,!0),Ie.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=Ie.access(r,t)-1;i?Ie.access(r,t,i):(r.removeEventListener(e,n,!0),Ie.remove(r,t))}}});var kt=n.location,St=ye.now(),At=/\?/;ye.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||ye.error("Invalid XML: "+e),t};var Dt=/\[\]$/,Ot=/\r?\n/g,Mt=/^(?:submit|button|image|reset|file)$/i,Rt=/^(?:input|select|textarea|keygen)/i;ye.param=function(e,t){var n,r=[],i=function(e,t){var n=ye.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(ye.isArray(e)||e.jquery&&!ye.isPlainObject(e))ye.each(e,function(){i(this.name,this.value)});else for(n in e)V(n,e[n],t,i);return r.join("&")},ye.fn.extend({serialize:function(){return ye.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ye.prop(this,"elements");return e?ye.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ye(this).is(":disabled")&&Rt.test(this.nodeName)&&!Mt.test(e)&&(this.checked||!Ze.test(e))}).map(function(e,t){var n=ye(this).val();return null==n?null:ye.isArray(n)?ye.map(n,function(e){return{name:t.name,value:e.replace(Ot,"\r\n")}}):{name:t.name,value:n.replace(Ot,"\r\n")}}).get()}});var Lt=/%20/g,jt=/#.*$/,qt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Bt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,It=/^(?:GET|HEAD)$/,Pt=/^\/\//,Ft={},$t={},zt="*/".concat("*"),Wt=oe.createElement("a");Wt.href=kt.href,ye.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:kt.href,type:"GET",isLocal:Bt.test(kt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ye.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ee(ee(e,ye.ajaxSettings),t):ee(ye.ajaxSettings,e)},ajaxPrefilter:Y(Ft),ajaxTransport:Y($t),ajax:function(e,t){function r(e,t,r,s){var c,f,p,x,_,w=t;u||(u=!0,l&&n.clearTimeout(l),i=void 0,a=s||"",E.readyState=e>0?4:0,c=e>=200&&e<300||304===e,r&&(x=te(h,E,r)),x=ne(h,x,E,c),c?(h.ifModified&&(_=E.getResponseHeader("Last-Modified"),_&&(ye.lastModified[o]=_),_=E.getResponseHeader("etag"),_&&(ye.etag[o]=_)),204===e||"HEAD"===h.type?w="nocontent":304===e?w="notmodified":(w=x.state,f=x.data,p=x.error,c=!p)):(p=w,!e&&w||(w="error",e<0&&(e=0))),E.status=e,E.statusText=(t||w)+"",c?v.resolveWith(g,[f,w,E]):v.rejectWith(g,[E,w,p]),E.statusCode(b),b=void 0,d&&m.trigger(c?"ajaxSuccess":"ajaxError",[E,h,c?f:p]),y.fireWith(g,[E,w]),d&&(m.trigger("ajaxComplete",[E,h]),--ye.active||ye.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,o,a,s,l,c,u,d,f,p,h=ye.ajaxSetup({},t),g=h.context||h,m=h.context&&(g.nodeType||g.jquery)?ye(g):ye.event,v=ye.Deferred(),y=ye.Callbacks("once memory"),b=h.statusCode||{},x={},_={},w="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(u){if(!s)for(s={};t=Ht.exec(a);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return u?a:null},setRequestHeader:function(e,t){return null==u&&(e=_[e.toLowerCase()]=_[e.toLowerCase()]||e,x[e]=t),this},overrideMimeType:function(e){return null==u&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)E.always(e[E.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||w;return i&&i.abort(t),r(0,t),this}};if(v.promise(E),h.url=((e||h.url||kt.href)+"").replace(Pt,kt.protocol+"//"),h.type=t.method||t.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(Le)||[""],null==h.crossDomain){c=oe.createElement("a");try{c.href=h.url,c.href=c.href,h.crossDomain=Wt.protocol+"//"+Wt.host!=c.protocol+"//"+c.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=ye.param(h.data,h.traditional)),J(Ft,h,t,E),u)return E;d=ye.event&&h.global,d&&0===ye.active++&&ye.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!It.test(h.type),o=h.url.replace(jt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(Lt,"+")):(p=h.url.slice(o.length),h.data&&(o+=(At.test(o)?"&":"?")+h.data,delete h.data),h.cache===!1&&(o=o.replace(qt,"$1"),p=(At.test(o)?"&":"?")+"_="+St++ +p),h.url=o+p),h.ifModified&&(ye.lastModified[o]&&E.setRequestHeader("If-Modified-Since",ye.lastModified[o]),ye.etag[o]&&E.setRequestHeader("If-None-Match",ye.etag[o])),(h.data&&h.hasContent&&h.contentType!==!1||t.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+zt+"; q=0.01":""):h.accepts["*"]);for(f in h.headers)E.setRequestHeader(f,h.headers[f]);if(h.beforeSend&&(h.beforeSend.call(g,E,h)===!1||u))return E.abort();if(w="abort",y.add(h.complete),E.done(h.success),E.fail(h.error),i=J($t,h,t,E)){if(E.readyState=1,d&&m.trigger("ajaxSend",[E,h]),u)return E;h.async&&h.timeout>0&&(l=n.setTimeout(function(){E.abort("timeout")},h.timeout));try{u=!1,i.send(x,r)}catch(e){if(u)throw e;r(-1,e)}}else r(-1,"No Transport");return E},getJSON:function(e,t,n){return ye.get(e,t,n,"json")},getScript:function(e,t){return ye.get(e,void 0,t,"script")}}),ye.each(["get","post"],function(e,t){ye[t]=function(e,n,r,i){return ye.isFunction(n)&&(i=i||r,r=n,n=void 0),ye.ajax(ye.extend({url:e,type:t,dataType:i,data:n,success:r},ye.isPlainObject(e)&&e))}}),ye._evalUrl=function(e){return ye.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},ye.fn.extend({wrapAll:function(e){var t;return this[0]&&(ye.isFunction(e)&&(e=e.call(this[0])),t=ye(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return ye.isFunction(e)?this.each(function(t){ye(this).wrapInner(e.call(this,t))}):this.each(function(){var t=ye(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=ye.isFunction(e);return this.each(function(n){ye(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ye(this).replaceWith(this.childNodes)}),this}}),ye.expr.pseudos.hidden=function(e){return!ye.expr.pseudos.visible(e)},ye.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ye.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Ut={0:200,1223:204},Kt=ye.ajaxSettings.xhr();me.cors=!!Kt&&"withCredentials"in Kt,me.ajax=Kt=!!Kt,ye.ajaxTransport(function(e){var t,r;if(me.cors||Kt&&!e.crossDomain)return{send:function(i,o){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);t=function(e){return function(){t&&(t=r=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Ut[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),r=s.onerror=t("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&n.setTimeout(function(){t&&r()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),ye.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ye.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ye.globalEval(e),e}}}),ye.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ye.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=ye("",returnEnd:!0,subLanguage:["actionscript","javascript","handlebars","xml"]}},{className:"meta",variants:[{begin:/<\?xml/,end:/\?>/,relevance:10},{begin:/<\?\w+/,end:/\?>/}]},{className:"tag",begin:"",contains:[{className:"name",begin:/[^\/><\s]+/,relevance:0},n]}]}}),e.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$"},{begin:"^.+?\\n[=-]{2,}$"}]},{begin:"<",end:">",subLanguage:"xml",relevance:0},{className:"bullet",begin:"^([*+-]|(\\d+\\.))\\s+"},{className:"strong",begin:"[*_]{2}.+?[*_]{2}"},{className:"emphasis",variants:[{begin:"\\*.+?\\*"},{begin:"_.+?_",relevance:0}]},{className:"quote",begin:"^>\\s+",end:"$"},{className:"code",variants:[{begin:"^```w*s*$",end:"^```s*$"},{begin:"`.+?`"},{begin:"^( {4}|\t)",end:"$",relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},{begin:"\\[.+?\\][\\(\\[].*?[\\)\\]]",returnBegin:!0,contains:[{className:"string",begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0,relevance:0},{className:"link",begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}],relevance:10},{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}),e.registerLanguage("sql",function(e){var t=e.COMMENT("--","$");return{case_insensitive:!0,illegal:/[<>{}*#]/,contains:[{beginKeywords:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",end:/;/,endsWithParent:!0,lexemes:/[\w\.]+/,keywords:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},contains:[{className:"string",begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE,{begin:"''"}]},{className:"string",begin:'"',end:'"',contains:[e.BACKSLASH_ESCAPE,{begin:'""'}]},{className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t]},e.C_BLOCK_COMMENT_MODE,t]}}),e})}]); -------------------------------------------------------------------------------- /assets/dist/app-1bac334b99.css: -------------------------------------------------------------------------------- 1 | .hljs{display:block;overflow-x:auto;padding:.5em;background:#002b36;color:#839496}.hljs-comment,.hljs-quote{color:#586e75}.hljs-addition,.hljs-keyword,.hljs-selector-tag{color:#859900}.hljs-doctag,.hljs-literal,.hljs-meta .hljs-meta-string,.hljs-number,.hljs-regexp,.hljs-string{color:#2aa198}.hljs-name,.hljs-section,.hljs-selector-class,.hljs-selector-id,.hljs-title{color:#268bd2}.hljs-attr,.hljs-attribute,.hljs-class .hljs-title,.hljs-template-variable,.hljs-type,.hljs-variable{color:#b58900}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-meta .hljs-keyword,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-subst,.hljs-symbol{color:#cb4b16}.hljs-built_in,.hljs-deletion{color:#dc322f}.hljs-formula{background:#073642}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700} -------------------------------------------------------------------------------- /assets/js/app.js: -------------------------------------------------------------------------------- 1 | // Dependencies 2 | // ------------ 3 | 4 | import $ from 'jquery' 5 | import hljs from 'highlight.js/build/highlight.pack' 6 | 7 | window.$ = $ 8 | 9 | $(() => { 10 | // Setup Highlight.js 11 | hljs.configure({ 12 | tabReplace: ' ', // 4 spaces 13 | languages: [] // disable auto-detect 14 | }) 15 | 16 | hljs.initHighlighting() 17 | }) 18 | -------------------------------------------------------------------------------- /assets/less/app.less: -------------------------------------------------------------------------------- 1 | @import './code'; 2 | -------------------------------------------------------------------------------- /assets/less/code.less: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | background: #002b36; 12 | color: #839496; 13 | } 14 | 15 | .hljs-comment, 16 | .hljs-quote { 17 | color: #586e75; 18 | } 19 | 20 | /* Solarized Green */ 21 | .hljs-keyword, 22 | .hljs-selector-tag, 23 | .hljs-addition { 24 | color: #859900; 25 | } 26 | 27 | /* Solarized Cyan */ 28 | .hljs-number, 29 | .hljs-string, 30 | .hljs-meta .hljs-meta-string, 31 | .hljs-literal, 32 | .hljs-doctag, 33 | .hljs-regexp { 34 | color: #2aa198; 35 | } 36 | 37 | /* Solarized Blue */ 38 | .hljs-title, 39 | .hljs-section, 40 | .hljs-name, 41 | .hljs-selector-id, 42 | .hljs-selector-class { 43 | color: #268bd2; 44 | } 45 | 46 | /* Solarized Yellow */ 47 | .hljs-attribute, 48 | .hljs-attr, 49 | .hljs-variable, 50 | .hljs-template-variable, 51 | .hljs-class .hljs-title, 52 | .hljs-type { 53 | color: #b58900; 54 | } 55 | 56 | /* Solarized Orange */ 57 | .hljs-symbol, 58 | .hljs-bullet, 59 | .hljs-subst, 60 | .hljs-meta, 61 | .hljs-meta .hljs-keyword, 62 | .hljs-selector-attr, 63 | .hljs-selector-pseudo, 64 | .hljs-link { 65 | color: #cb4b16; 66 | } 67 | 68 | /* Solarized Red */ 69 | .hljs-built_in, 70 | .hljs-deletion { 71 | color: #dc322f; 72 | } 73 | 74 | .hljs-formula { 75 | background: #073642; 76 | } 77 | 78 | .hljs-emphasis { 79 | font-style: italic; 80 | } 81 | 82 | .hljs-strong { 83 | font-weight: bold; 84 | } 85 | -------------------------------------------------------------------------------- /assets/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack') 2 | 3 | var output = { 4 | filename: 'app.js' 5 | } 6 | 7 | var loaders = [{ 8 | test: /\.js$/, 9 | exclude: /(node_modules|bower_components)/, 10 | loader: 'babel', 11 | query: { 12 | presets: ['es2015'] 13 | } 14 | }] 15 | 16 | module.exports = { 17 | development: { 18 | debug: true, 19 | devtool: 'eval-source-map', 20 | output: output, 21 | module: { 22 | loaders: loaders 23 | } 24 | }, 25 | production: { 26 | output: output, 27 | module: { 28 | loaders: loaders 29 | }, 30 | plugins: [ 31 | new webpack.optimize.DedupePlugin() 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/config.exs: -------------------------------------------------------------------------------- 1 | # This file is responsible for configuring your application 2 | # and its dependencies with the aid of the Mix.Config module. 3 | use Mix.Config 4 | 5 | # This configuration is loaded before any dependency and is restricted 6 | # to this project. If another project depends on this project, this 7 | # file won't be loaded nor affect the parent project. For this reason, 8 | # if you want to provide default values for your application for 9 | # 3rd-party users, it should be done in your "mix.exs" file. 10 | 11 | # You can configure for your application as: 12 | # 13 | # config :elixir_getting_started_guide, key: :value 14 | # 15 | # And access this configuration in your application as: 16 | # 17 | # Application.get_env(:elixir_getting_started_guide, :key) 18 | # 19 | # Or configure a 3rd-party app: 20 | # 21 | # config :logger, level: :info 22 | # 23 | 24 | # It is also possible to import configuration files, relative to this 25 | # directory. For example, you can emulate configuration per environment 26 | # by uncommenting the line below and defining dev.exs, test.exs and such. 27 | # Configuration from the imported file will override the ones defined 28 | # here (which is why it is important to import them last). 29 | # 30 | # import_config "#{Mix.env}.exs" 31 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | // Borrowed from ExDoc: 2 | // https://github.com/elixir-lang/ex_doc 3 | // 4 | // Dependencies 5 | // ------------ 6 | 7 | var gulp = require('gulp') 8 | var $ = require('gulp-load-plugins')({camelize: true}) 9 | var sequence = require('run-sequence') 10 | var del = require('del') 11 | var LessPluginNpmImport = require('less-plugin-npm-import') 12 | var LessPluginAutoPrefix = require('less-plugin-autoprefix') 13 | var webpack = require('webpack-stream') 14 | var exec = require('child_process').exec 15 | 16 | var config = require('./assets/webpack.config') 17 | 18 | // Config 19 | // ------ 20 | 21 | // Set variable via $ gulp --type production 22 | var environment = $.util.env.type || 'development' 23 | var isProduction = environment === 'production' 24 | 25 | var distPath = 'assets/dist' 26 | 27 | var npmPlugin = new LessPluginNpmImport() 28 | var autoprefixPlugin = new LessPluginAutoPrefix({ 29 | browsers: ['last 2 versions'] 30 | }) 31 | 32 | var languages = [ 33 | 'bash', 34 | 'css', 35 | 'diff', 36 | 'elixir', 37 | 'erlang', 38 | 'erlang-repl', 39 | 'xml', 40 | 'http', 41 | 'javascript', 42 | 'json', 43 | 'markdown', 44 | 'sql' 45 | ] 46 | 47 | // Tasks 48 | // ----- 49 | 50 | gulp.task('buildHighlight', function (done) { 51 | exec('npm install', { 52 | cwd: './node_modules/highlight.js' 53 | }, function (err, stdout, stderr) { 54 | if (err) return done(err) 55 | 56 | exec('node tools/build.js -n ' + languages.join(' '), { 57 | cwd: './node_modules/highlight.js' 58 | }, function (err, stdout, stderr) { 59 | if (err) return done(err) 60 | 61 | done() 62 | }) 63 | }) 64 | }) 65 | 66 | gulp.task('clean', function () { 67 | return del(distPath) 68 | }) 69 | 70 | gulp.task('javascript', ['buildHighlight'], function () { 71 | return javascript({src: 'assets/js/app.js', dest: distPath}) 72 | }) 73 | 74 | gulp.task('less', function () { 75 | return less({src: 'assets/less/app.less', dest: distPath}) 76 | }) 77 | 78 | gulp.task('lint', function () { 79 | return gulp.src([ 80 | 'gulpfile.js', 81 | 'assets/js/**/*.js' 82 | ]) 83 | .pipe($.eslint()) 84 | .pipe($.eslint.format()) 85 | .pipe($.eslint.failOnError()) 86 | }) 87 | 88 | gulp.task('build', function (done) { 89 | sequence( 90 | 'clean', 91 | ['javascript', 'less'], 92 | done 93 | ) 94 | }) 95 | 96 | gulp.task('default', ['lint', 'build']) 97 | 98 | /** 99 | * Helpers 100 | */ 101 | var javascript = function (options) { 102 | return gulp.src(options.src) 103 | .pipe(webpack(isProduction ? config.production : config.development)) 104 | .pipe($.if(isProduction, $.uglify())) 105 | .pipe($.if(isProduction, $.rev())) 106 | .pipe($.size({title: 'js'})) 107 | .pipe(gulp.dest(options.dest)) 108 | } 109 | 110 | var less = function (options) { 111 | return gulp.src(options.src) 112 | .pipe($.less({ 113 | plugins: [ 114 | npmPlugin, 115 | autoprefixPlugin 116 | ] 117 | })) 118 | .pipe($.plumber()) 119 | .pipe($.if(isProduction, $.cleanCss({ 120 | compatibility: 'ie8', 121 | processImport: false 122 | }))) 123 | .pipe($.if(isProduction, $.rev())) 124 | .pipe($.size({title: 'less'})) 125 | .pipe(gulp.dest(options.dest)) 126 | } 127 | -------------------------------------------------------------------------------- /lib/elixir_lang_guide.ex: -------------------------------------------------------------------------------- 1 | defmodule ElixirLangGuide do 2 | @moduledoc """ 3 | The idea behind this application is to offer an efficient way to transform 4 | the [Elixir Lang guides](http://elixir-lang.org/getting-started/) into an 5 | EPUB document. 6 | 7 | """ 8 | 9 | @vsn Mix.Project.config[:version] 10 | 11 | defmodule Config do 12 | @moduledoc """ 13 | Configuration structure with all the available options for `ElixirLangGuide` 14 | 15 | You can find more information about this options in the `ElixirLangGuide.CLI` module. 16 | """ 17 | @homepage "http://elixir-lang.org" 18 | @scripts Path.wildcard(Path.join(__DIR__, "../assets/dist/app-*.js")) 19 | @styles Path.wildcard(Path.join(__DIR__, "../assets/dist/app-*.css")) 20 | 21 | defstruct [ 22 | guide: "getting_started", 23 | homepage: @homepage, 24 | output: "doc", 25 | root_dir: nil, 26 | scripts: @scripts, 27 | styles: @styles, 28 | images: [] 29 | ] 30 | 31 | @type t :: %__MODULE__{ 32 | guide: String.t, 33 | homepage: String.t, 34 | output: Path.t, 35 | root_dir: Path.t, 36 | scripts: [Path.t], 37 | styles: [Path.t], 38 | images: [Path.t] 39 | } 40 | end 41 | 42 | @doc """ 43 | Convert a given Elixir Lang guide to EPUB format 44 | """ 45 | @spec to_epub(Keyword.t) :: String.t 46 | def to_epub(options) do 47 | config = struct(Config, options) 48 | ElixirLangGuide.EPUB.run(config) 49 | end 50 | 51 | @doc """ 52 | Returns the current version of this application 53 | """ 54 | @spec version :: String.t 55 | def version, do: @vsn 56 | end 57 | -------------------------------------------------------------------------------- /lib/elixir_lang_guide/cli.ex: -------------------------------------------------------------------------------- 1 | defmodule ElixirLangGuide.CLI do 2 | @shortdoc "CLI interface to convert Elixir Guides to EPUB format" 3 | 4 | @moduledoc """ 5 | Convert the Elixir Lang Guides to EPUB format. By default the "Getting 6 | Started" is converted, but, you can pass parameter to choose the 7 | "Meta-programming with Elixir" or "Mix and OTP" guides. 8 | 9 | ## Command line options 10 | 11 | * `-g`, `--guide` - Guide that you want to convert, options: 12 | `getting_started`, `meta` or `mix_otp`, default: `getting_started` 13 | * `-h`, `--help` - Show help 14 | * `-o`, `--output` - Output directory for the EPUB document, default: `doc` 15 | * `-s`, `--scripts` - List of custom JS files to include in the EPUB 16 | document 17 | * `-c`, `--styles` - List of custom CSS files to include in the EPUB 18 | document 19 | * `-v`, `--version` - Show version 20 | """ 21 | 22 | @spec main(OptionParser.argv) :: String.t 23 | def main(args) do 24 | args 25 | |> parse_args() 26 | |> process() 27 | end 28 | 29 | defp parse_args(args) do 30 | switches = [help: :boolean, scripts: :keep, styles: :keep, 31 | version: :boolean] 32 | aliases = [g: :guide, h: :help, o: :output, v: :version] 33 | 34 | parse = OptionParser.parse(args, switches: switches, aliases: aliases) 35 | 36 | case parse do 37 | {[{opts, true}], _, _} -> opts 38 | {opts, [root_dir], []} -> {:run, root_dir, opts} 39 | _ -> :help 40 | end 41 | end 42 | 43 | defp process(:help) do 44 | {_, more_info} = Code.get_docs(__MODULE__, :moduledoc) 45 | usage = ~S""" 46 | Usage: 47 | elixir_lang_guide SITE_ROOT [OPTIONS] 48 | 49 | Examples: 50 | elixir_lang_guide ../elixir-lang.github.com 51 | elixir_lang_guide ../elixir-lang.github.com --guide "meta" 52 | 53 | """ 54 | IO.puts usage <> more_info 55 | end 56 | 57 | defp process(:version) do 58 | IO.puts "ElixirLangGuide v#{ElixirLangGuide.version()}" 59 | end 60 | 61 | defp process({:run, root_dir, opts}) when is_binary(root_dir) and is_list(opts) do 62 | opts 63 | |> process_keep(:styles) 64 | |> process_keep(:scripts) 65 | |> Keyword.put(:root_dir, root_dir) 66 | |> ElixirLangGuide.to_epub() 67 | |> IO.puts() 68 | end 69 | 70 | defp process_keep(options, key) do 71 | values = Keyword.get_values(options, key) 72 | if values == [], do: options, else: Keyword.put(options, key, values) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /lib/elixir_lang_guide/epub.ex: -------------------------------------------------------------------------------- 1 | defmodule ElixirLangGuide.EPUB do 2 | @moduledoc """ 3 | Generate an EPUB document of the given Elixir Lang guide 4 | """ 5 | 6 | require EEx 7 | 8 | @doc """ 9 | Generate EPUB documentation for the given Elixir Lang guide 10 | """ 11 | @spec run(ElixirLangGuide.Config.t) :: String.t 12 | def run(options) do 13 | nav = 14 | options.root_dir 15 | |> Path.expand() 16 | |> Path.join("_data/getting-started.yml") 17 | |> YamlElixir.read_from_file() 18 | |> generate_nav(options) 19 | 20 | nav |> convert_markdown_pages(options) |> to_epub(nav, options) 21 | end 22 | 23 | defp generate_nav(yaml, options) do 24 | yaml = 25 | case options.guide do 26 | "getting_started" -> List.first(yaml) 27 | "meta" -> List.last(yaml) 28 | "mix_otp" -> Enum.at(yaml, 1) 29 | _ -> raise "invalid guide, allowed: `mix_otp`, `meta` or `getting_started`" 30 | end 31 | 32 | Enum.flat_map(List.wrap(yaml), fn(section) -> 33 | Enum.map(section["pages"], fn(%{"slug" => slug, "title" => title}) -> 34 | %{id: slug, label: title, content: "#{slug}.xhtml", dir: section["dir"], 35 | scripts: List.wrap(options.scripts), styles: List.wrap(options.styles)} 36 | end) 37 | end) 38 | end 39 | 40 | defp convert_markdown_pages(config, options) do 41 | config 42 | |> Enum.map(&Task.async(fn -> 43 | to_xhtml(&1, options) 44 | end)) 45 | |> Enum.map(&Task.await(&1, :infinity)) 46 | end 47 | 48 | defp to_xhtml(%{content: path, dir: dir} = nav, options) do 49 | content = 50 | options.root_dir 51 | |> Path.expand() 52 | |> Path.join("#{dir}#{path}") 53 | |> String.replace(~r/(.*)\.xhtml/, "\\1.markdown") 54 | |> File.read!() 55 | |> clean_markdown(options) 56 | |> Earmark.to_html() 57 | |> wrap_html(nav) 58 | 59 | unless File.exists?(Path.join(options.output, dir)) do 60 | File.mkdir_p(Path.join(options.output, dir)) 61 | end 62 | 63 | file_path = "#{options.output}#{dir}#{path}" 64 | File.write!(file_path, content) 65 | file_path 66 | end 67 | 68 | defp to_epub(files, nav, options) do 69 | title = 70 | case options.guide do 71 | "getting_started" -> "Elixir Getting Started Guide" 72 | "meta" -> "Meta-programming in Elixir" 73 | "mix_otp" -> "Mix and OTP" 74 | _ -> raise "invalid guide, allowed: `mix_otp`, `meta` or `getting_started`" 75 | end 76 | 77 | images = 78 | if options.guide == "mix_otp" do 79 | [options.root_dir |> Path.join("images/contents/kv-observer.png")] 80 | else 81 | [] 82 | end 83 | 84 | config = %BUPE.Config{ 85 | title: title, 86 | creator: "Plataformatec", 87 | unique_identifier: title_to_filename(title), 88 | source: "#{options.homepage}/getting-started/", 89 | pages: files, 90 | scripts: List.wrap(options.scripts), 91 | styles: List.wrap(options.styles), 92 | images: images, 93 | nav: nav 94 | } 95 | 96 | output_file = "#{options.output}/#{title_to_filename(title)}.epub" 97 | BUPE.build(config, output_file) 98 | delete_generated_files(files) 99 | Path.relative_to_cwd(output_file) 100 | end 101 | 102 | defp delete_generated_files(files) do 103 | Enum.map(files, &File.rm!(&1)) 104 | end 105 | 106 | defp title_to_filename(title) do 107 | title |> String.replace(" ", "-") |> String.downcase() 108 | end 109 | 110 | defp clean_markdown(content, options) do 111 | content 112 | |> remove_includes() 113 | |> remove_span_hidden_hack() 114 | |> remove_raw_endraw_tags() 115 | |> remove_frontmatter() 116 | |> fix_backslashes() 117 | |> fix_images() 118 | |> map_links(options) 119 | end 120 | 121 | defp remove_includes(content) do 122 | content 123 | |> String.replace("{% include toc.html %}", "") 124 | |> String.replace("{% include mix-otp-preface.html %}", "") 125 | end 126 | 127 | # The is a hack used in pattern-matching.md 128 | defp remove_span_hidden_hack(content) do 129 | String.replace(content, ~r/# {{ page.title }}(