Comparing version 0.10.3 to 0.10.4
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a){var b=a("./index"),c=function(a,b){for(var c=0;c<a.length;c++)a[c].setAttribute("style",b)},d="font-size:11px;font-family:Verdana, sans-serif;",e="position:fixed;top:10px;right:10px;border:2px solid #000;background:rgba(255,255,255,.9);padding:15px;z-index:999;max-height:400px;overflow:auto;",f="list-style:decimal outside;margin-left:20px;",g="margin: 0;padding:0;",h="color:#008;text-decoration:underline;",i="float: right; margin: 0 0 5px 5px; padding: 5px; border: 1px #008 solid;color:#00f;background-color:#ccf;",j=b(document.body).asHTML(!0),k=document.createElement("div");c([k],e+d),k.innerHTML=j,c(k.getElementsByTagName("li"),f+d),c(k.getElementsByTagName("ol"),g+d),c(k.getElementsByTagName("a"),h+d);var l=k.insertBefore(document.createElement("a"),k.firstChild);c([l],i),l.innerHTML="Close",l.href="#",l.onclick=function(a){document.body.removeChild(k),k=l=null,a.preventDefault()},document.body.appendChild(k)},{"./index":2}],2:[function(a,b){b.exports=a("./src/createOutline")},{"./src/createOutline":7}],3:[function(a,b){function c(a,b){this.startingNode=a.node,this.sections=[b]}var d=a("./asHTML");c.prototype.getLastSection=function(){return this.sections[this.sections.length-1]},c.prototype.asHTML=function(a){return d(this.sections,a)},b.exports=c},{"./asHTML":6}],4:[function(a,b){function c(a){this.node=a}b.exports=c},{}],5:[function(a,b){function c(a){this.sections=[],this.startingNode=a}c.prototype.append=function(a){a.container=this,this.sections.push(a)},b.exports=c},{}],6:[function(a,b){function c(a){if(a.heading.implied)return"<i>Untitled "+f.getTagName(a.startingNode)+"</i>";var b=f.getRankingHeadingElement(a.heading);if(!b)return"<i>Error: no H1-H6 inside HGROUP</i>";var c=b.textContent;return c?f.escapeHtml(c):"<i>No text content inside "+f.getTagName(b)+"</i>"}function d(a,b){var c=a.startingNode.getAttribute("id");if(c)return c;if(!a.heading.implied){var d=a.heading.getAttribute("id");if(d)return d}var e=a.startingNode;do var f="h5o-"+ ++b.linkCounter;while(e.ownerDocument.getElementById(f));return e.setAttribute("id",f),f}function e(a,b){if("object"!=typeof b&&(b={createLinks:!!b}),!a.length)return"";if(b.skipTopHeader)return e(a[0].sections,{skipToHeader:!1,createLinks:b.createLinks});"undefined"==typeof b.linkCounter&&(b.linkCounter=0);var f=!!b.createLinks,g=[];g.push("<ol>");for(var h=0;h<a.length;h++){var i=a[h];g.push("<li>"),f&&g.push('<a href="#'+d(i,b)+'">'),g.push(c(i)),f&&g.push("</a>"),g.push(e(i.sections,b)),g.push("</li>")}return g.push("</ol>"),g.join("")}var f=a("./utils");b.exports=e},{"./utils":8}],7:[function(a,b){function c(){return j.length?j[j.length-1].node:void 0}function d(a){var b=o.getRankingHeadingElement(a);return b?-parseInt(o.getTagName(b).substr(1)):-1}function e(a){var b=c();if(!o.isHeading(b)&&!o.hasHiddenAttribute(b)){if(o.hasHiddenAttribute(a))return void j.push({node:a});if(o.isSecContent(a))return null!=h&&(i.heading||(i.heading={implied:!0}),j.push(h)),h=new m(a),i=new k(a),void(h.outline=new l(h.node,i));if(o.isSecRoot(a))return null!=h&&j.push(h),h=new m(a),h.parentSection=i,i=new k(a),void(h.outline=new l(h.node,i));if(o.isHeading(a)){if(i.heading)if(h.outline.getLastSection().heading.implied||d(a)>=d(h.outline.getLastSection().heading)){var e=new k(a);h.outline.sections.push(e),i=e,i.heading=a}else{var f=!1,g=i;do{if(d(a)<d(g.heading)){var e=new k(a);g.append(e),i=e,i.heading=a,f=!0}var n=g.container;g=n}while(!f)}else i.heading=a;return void j.push({node:a})}}}function f(a){var b=c();if(b===a&&j.pop(),!o.isHeading(b)&&!o.hasHiddenAttribute(b)){if(!(o.isSecContent(a)&&j.length>0))return o.isSecRoot(a)&&j.length>0?(i.heading||(i.heading={implied:!0}),i=h.parentSection,void(h=j.pop())):o.isSecContent(a)||o.isSecRoot(a)?void(i.heading||(i.heading={implied:!0})):void 0;i.heading||(i.heading={implied:!0});var d=h;h=j.pop(),i=h.outline.getLastSection();for(var e=0;e<d.outline.sections.length;e++)i.append(d.outline.sections[e])}}function g(a){if(!o.isSecContent(a)&&!o.isSecRoot(a))throw new TypeError("Invalid argument: start element must either be sectioning root or sectioning content.");return h=null,i=null,j=[],n(a,e,f),h.outline}var h,i,j,k=a("./Section"),l=a("./Outline"),m=a("./OutlineTarget"),n=a("./walk"),o=a("./utils");b.exports=g},{"./Outline":3,"./OutlineTarget":4,"./Section":5,"./utils":8,"./walk":9}],8:[function(a,b,c){function d(a){return a.tagName.toUpperCase()}function e(a){return function(b){return f(b)&&new RegExp(a,"i").test(d(b))}}function f(a){return a&&a.tagName}function g(a){if(!j(a))throw new Error("Not a heading element");var b=d(a);if("HGROUP"!==b)return a;for(var c=1;6>=c;c++){var e=a.getElementsByTagName("H"+c);if(e.length)return e[0]}return null}function h(a){return(""+a).replace(/&/g,"&").replace(/</g,"<")}function i(a){return f(a)&&a.hasAttribute("hidden")}var j=e("^H[1-6]|HGROUP$");c.getTagName=d,c.hasHiddenAttribute=i,c.isSecRoot=e("^BLOCKQUOTE|BODY|DETAILS|FIELDSET|FIGURE|TD$"),c.isSecContent=e("^ARTICLE|ASIDE|NAV|SECTION$"),c.isHeading=j,c.getRankingHeadingElement=g,c.escapeHtml=h},{}],9:[function(a,b){b.exports=function(a,b,c){var d=a;a:for(;d;)if(b(d),d.firstChild)d=d.firstChild;else for(;d;){if(c(d),d.nextSibling){d=d.nextSibling;continue a}d=d==a?null:d.parentNode}}},{}]},{},[1]); | ||
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./index"),e=function(a,b){for(var c=0;c<a.length;c++)a[c].setAttribute("style",b)},f="font-size:11px;font-family:Verdana, sans-serif;",g="position:fixed;top:10px;right:10px;border:2px solid #000;background:rgba(255,255,255,.9);padding:15px;z-index:999;max-height:400px;overflow:auto;",h="list-style:decimal outside;margin-left:20px;",i="margin: 0;padding:0;",j="color:#008;text-decoration:underline;",k="float: right; margin: 0 0 5px 5px; padding: 5px; border: 1px #008 solid;color:#00f;background-color:#ccf;",l=d(document.body).asHTML(!0),m=document.createElement("div");e([m],g+f),m.innerHTML=l,e(m.getElementsByTagName("li"),h+f),e(m.getElementsByTagName("ol"),i+f),e(m.getElementsByTagName("a"),j+f);var n=m.insertBefore(document.createElement("a"),m.firstChild);e([n],k),n.innerHTML="Close",n.href="#",n.onclick=function(a){document.body.removeChild(m),m=n=null,a.preventDefault()},document.body.appendChild(m)},{"./index":2}],2:[function(a,b,c){b.exports=a("./src/createOutline")},{"./src/createOutline":7}],3:[function(a,b,c){function d(a,b){this.startingNode=a.node,this.sections=[b]}var e=a("./asHTML");d.prototype.getLastSection=function(){return this.sections[this.sections.length-1]},d.prototype.asHTML=function(a){return e(this.sections,a)},b.exports=d},{"./asHTML":6}],4:[function(a,b,c){function d(a){this.node=a}b.exports=d},{}],5:[function(a,b,c){function d(a){this.sections=[],this.startingNode=a}d.prototype.append=function(a){a.container=this,this.sections.push(a)},b.exports=d},{}],6:[function(a,b,c){function d(a){if(a.heading.implied)return"<i>Untitled "+g.getTagName(a.startingNode)+"</i>";var b=g.getRankingHeadingElement(a.heading);if(!b)return"<i>Error: no H1-H6 inside HGROUP</i>";var c=b.textContent;return c?g.escapeHtml(c):"<i>No text content inside "+g.getTagName(b)+"</i>"}function e(a,b){var c=a.startingNode.getAttribute("id");if(c)return c;if(!a.heading.implied){var d=a.heading.getAttribute("id");if(d)return d}var e=a.startingNode;do var f="h5o-"+ ++b.linkCounter;while(e.ownerDocument.getElementById(f));return e.setAttribute("id",f),f}function f(a,b){if("object"!=typeof b&&(b={createLinks:!!b}),!a.length)return"";if(b.skipTopHeader)return f(a[0].sections,{skipToHeader:!1,createLinks:b.createLinks});"undefined"==typeof b.linkCounter&&(b.linkCounter=0);var c=!!b.createLinks,g=[];g.push("<ol>");for(var h=0;h<a.length;h++){var i=a[h];g.push("<li>"),c&&g.push('<a href="#'+e(i,b)+'">'),g.push(d(i)),c&&g.push("</a>"),g.push(f(i.sections,b)),g.push("</li>")}return g.push("</ol>"),g.join("")}var g=a("./utils");b.exports=f},{"./utils":8}],7:[function(a,b,c){function d(){return k.length?k[k.length-1].node:void 0}function e(a){var b=p.getRankingHeadingElement(a);return b?-parseInt(p.getTagName(b).substr(1)):-1}function f(a){var b=d();if(!p.isHeading(b)&&!p.hasHiddenAttribute(b)){if(p.hasHiddenAttribute(a))return void k.push({node:a});if(p.isSecContent(a))return null!=i&&(j.heading||(j.heading={implied:!0}),k.push(i)),i=new n(a),j=new l(a),void(i.outline=new m(i.node,j));if(p.isSecRoot(a))return null!=i&&k.push(i),i=new n(a),i.parentSection=j,j=new l(a),void(i.outline=new m(i.node,j));if(p.isHeading(a)){if(j.heading)if(i.outline.getLastSection().heading.implied||e(a)>=e(i.outline.getLastSection().heading)){var c=new l(a);i.outline.sections.push(c),j=c,j.heading=a}else{var f=!1,g=j;do{if(e(a)<e(g.heading)){var c=new l(a);g.append(c),j=c,j.heading=a,f=!0}var h=g.container;g=h}while(!f)}else j.heading=a;return void k.push({node:a})}}}function g(a){var b=d();if(b===a&&k.pop(),!p.isHeading(b)&&!p.hasHiddenAttribute(b)){if(!(p.isSecContent(a)&&k.length>0))return p.isSecRoot(a)&&k.length>0?(j.heading||(j.heading={implied:!0}),j=i.parentSection,void(i=k.pop())):p.isSecContent(a)||p.isSecRoot(a)?void(j.heading||(j.heading={implied:!0})):void 0;j.heading||(j.heading={implied:!0});var c=i;i=k.pop(),j=i.outline.getLastSection();for(var e=0;e<c.outline.sections.length;e++)j.append(c.outline.sections[e])}}function h(a){if(!p.isSecContent(a)&&!p.isSecRoot(a))throw new TypeError("Invalid argument: start element must either be sectioning root or sectioning content.");return i=null,j=null,k=[],o(a,f,g),i.outline}var i,j,k,l=a("./Section"),m=a("./Outline"),n=a("./OutlineTarget"),o=a("./walk"),p=a("./utils");b.exports=h},{"./Outline":3,"./OutlineTarget":4,"./Section":5,"./utils":8,"./walk":9}],8:[function(a,b,c){function d(a){return a.tagName.toUpperCase()}function e(a){return function(b){return f(b)&&new RegExp(a,"i").test(d(b))}}function f(a){return a&&a.tagName}function g(a){if(!j(a))throw new Error("Not a heading element");var b=d(a);if("HGROUP"!==b)return a;for(var c=1;6>=c;c++){var e=a.getElementsByTagName("H"+c);if(e.length)return e[0]}return null}function h(a){return(""+a).replace(/&/g,"&").replace(/</g,"<")}function i(a){return f(a)&&a.hasAttribute("hidden")}var j=e("^H[1-6]|HGROUP$");c.getTagName=d,c.hasHiddenAttribute=i,c.isSecRoot=e("^BLOCKQUOTE|BODY|DETAILS|FIELDSET|FIGURE|TD$"),c.isSecContent=e("^ARTICLE|ASIDE|NAV|SECTION$"),c.isHeading=j,c.getRankingHeadingElement=g,c.escapeHtml=h},{}],9:[function(a,b,c){b.exports=function(a,b,c){var d=a;a:for(;d;)if(b(d),d.firstChild)d=d.firstChild;else for(;d;){if(c(d),d.nextSibling){d=d.nextSibling;continue a}d=d==a?null:d.parentNode}}},{}]},{},[1]); |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.HTML5Outline=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){b.exports=a("./src/createOutline")},{"./src/createOutline":6}],2:[function(a,b){function c(a,b){this.startingNode=a.node,this.sections=[b]}var d=a("./asHTML");c.prototype.getLastSection=function(){return this.sections[this.sections.length-1]},c.prototype.asHTML=function(a){return d(this.sections,a)},b.exports=c},{"./asHTML":5}],3:[function(a,b){function c(a){this.node=a}b.exports=c},{}],4:[function(a,b){function c(a){this.sections=[],this.startingNode=a}c.prototype.append=function(a){a.container=this,this.sections.push(a)},b.exports=c},{}],5:[function(a,b){function c(a){if(a.heading.implied)return"<i>Untitled "+f.getTagName(a.startingNode)+"</i>";var b=f.getRankingHeadingElement(a.heading);if(!b)return"<i>Error: no H1-H6 inside HGROUP</i>";var c=b.textContent;return c?f.escapeHtml(c):"<i>No text content inside "+f.getTagName(b)+"</i>"}function d(a,b){var c=a.startingNode.getAttribute("id");if(c)return c;if(!a.heading.implied){var d=a.heading.getAttribute("id");if(d)return d}var e=a.startingNode;do var f="h5o-"+ ++b.linkCounter;while(e.ownerDocument.getElementById(f));return e.setAttribute("id",f),f}function e(a,b){if("object"!=typeof b&&(b={createLinks:!!b}),!a.length)return"";if(b.skipTopHeader)return e(a[0].sections,{skipToHeader:!1,createLinks:b.createLinks});"undefined"==typeof b.linkCounter&&(b.linkCounter=0);var f=!!b.createLinks,g=[];g.push("<ol>");for(var h=0;h<a.length;h++){var i=a[h];g.push("<li>"),f&&g.push('<a href="#'+d(i,b)+'">'),g.push(c(i)),f&&g.push("</a>"),g.push(e(i.sections,b)),g.push("</li>")}return g.push("</ol>"),g.join("")}var f=a("./utils");b.exports=e},{"./utils":7}],6:[function(a,b){function c(){return j.length?j[j.length-1].node:void 0}function d(a){var b=o.getRankingHeadingElement(a);return b?-parseInt(o.getTagName(b).substr(1)):-1}function e(a){var b=c();if(!o.isHeading(b)&&!o.hasHiddenAttribute(b)){if(o.hasHiddenAttribute(a))return void j.push({node:a});if(o.isSecContent(a))return null!=h&&(i.heading||(i.heading={implied:!0}),j.push(h)),h=new m(a),i=new k(a),void(h.outline=new l(h.node,i));if(o.isSecRoot(a))return null!=h&&j.push(h),h=new m(a),h.parentSection=i,i=new k(a),void(h.outline=new l(h.node,i));if(o.isHeading(a)){if(i.heading)if(h.outline.getLastSection().heading.implied||d(a)>=d(h.outline.getLastSection().heading)){var e=new k(a);h.outline.sections.push(e),i=e,i.heading=a}else{var f=!1,g=i;do{if(d(a)<d(g.heading)){var e=new k(a);g.append(e),i=e,i.heading=a,f=!0}var n=g.container;g=n}while(!f)}else i.heading=a;return void j.push({node:a})}}}function f(a){var b=c();if(b===a&&j.pop(),!o.isHeading(b)&&!o.hasHiddenAttribute(b)){if(!(o.isSecContent(a)&&j.length>0))return o.isSecRoot(a)&&j.length>0?(i.heading||(i.heading={implied:!0}),i=h.parentSection,void(h=j.pop())):o.isSecContent(a)||o.isSecRoot(a)?void(i.heading||(i.heading={implied:!0})):void 0;i.heading||(i.heading={implied:!0});var d=h;h=j.pop(),i=h.outline.getLastSection();for(var e=0;e<d.outline.sections.length;e++)i.append(d.outline.sections[e])}}function g(a){if(!o.isSecContent(a)&&!o.isSecRoot(a))throw new TypeError("Invalid argument: start element must either be sectioning root or sectioning content.");return h=null,i=null,j=[],n(a,e,f),h.outline}var h,i,j,k=a("./Section"),l=a("./Outline"),m=a("./OutlineTarget"),n=a("./walk"),o=a("./utils");b.exports=g},{"./Outline":2,"./OutlineTarget":3,"./Section":4,"./utils":7,"./walk":8}],7:[function(a,b,c){function d(a){return a.tagName.toUpperCase()}function e(a){return function(b){return f(b)&&new RegExp(a,"i").test(d(b))}}function f(a){return a&&a.tagName}function g(a){if(!j(a))throw new Error("Not a heading element");var b=d(a);if("HGROUP"!==b)return a;for(var c=1;6>=c;c++){var e=a.getElementsByTagName("H"+c);if(e.length)return e[0]}return null}function h(a){return(""+a).replace(/&/g,"&").replace(/</g,"<")}function i(a){return f(a)&&a.hasAttribute("hidden")}var j=e("^H[1-6]|HGROUP$");c.getTagName=d,c.hasHiddenAttribute=i,c.isSecRoot=e("^BLOCKQUOTE|BODY|DETAILS|FIELDSET|FIGURE|TD$"),c.isSecContent=e("^ARTICLE|ASIDE|NAV|SECTION$"),c.isHeading=j,c.getRankingHeadingElement=g,c.escapeHtml=h},{}],8:[function(a,b){b.exports=function(a,b,c){var d=a;a:for(;d;)if(b(d),d.firstChild)d=d.firstChild;else for(;d;){if(c(d),d.nextSibling){d=d.nextSibling;continue a}d=d==a?null:d.parentNode}}},{}]},{},[1])(1)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.HTML5Outline=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){b.exports=a("./src/createOutline")},{"./src/createOutline":6}],2:[function(a,b,c){function d(a,b){this.startingNode=a.node,this.sections=[b]}var e=a("./asHTML");d.prototype.getLastSection=function(){return this.sections[this.sections.length-1]},d.prototype.asHTML=function(a){return e(this.sections,a)},b.exports=d},{"./asHTML":5}],3:[function(a,b,c){function d(a){this.node=a}b.exports=d},{}],4:[function(a,b,c){function d(a){this.sections=[],this.startingNode=a}d.prototype.append=function(a){a.container=this,this.sections.push(a)},b.exports=d},{}],5:[function(a,b,c){function d(a){if(a.heading.implied)return"<i>Untitled "+g.getTagName(a.startingNode)+"</i>";var b=g.getRankingHeadingElement(a.heading);if(!b)return"<i>Error: no H1-H6 inside HGROUP</i>";var c=b.textContent;return c?g.escapeHtml(c):"<i>No text content inside "+g.getTagName(b)+"</i>"}function e(a,b){var c=a.startingNode.getAttribute("id");if(c)return c;if(!a.heading.implied){var d=a.heading.getAttribute("id");if(d)return d}var e=a.startingNode;do var f="h5o-"+ ++b.linkCounter;while(e.ownerDocument.getElementById(f));return e.setAttribute("id",f),f}function f(a,b){if("object"!=typeof b&&(b={createLinks:!!b}),!a.length)return"";if(b.skipTopHeader)return f(a[0].sections,{skipToHeader:!1,createLinks:b.createLinks});"undefined"==typeof b.linkCounter&&(b.linkCounter=0);var c=!!b.createLinks,g=[];g.push("<ol>");for(var h=0;h<a.length;h++){var i=a[h];g.push("<li>"),c&&g.push('<a href="#'+e(i,b)+'">'),g.push(d(i)),c&&g.push("</a>"),g.push(f(i.sections,b)),g.push("</li>")}return g.push("</ol>"),g.join("")}var g=a("./utils");b.exports=f},{"./utils":7}],6:[function(a,b,c){function d(){return k.length?k[k.length-1].node:void 0}function e(a){var b=p.getRankingHeadingElement(a);return b?-parseInt(p.getTagName(b).substr(1)):-1}function f(a){var b=d();if(!p.isHeading(b)&&!p.hasHiddenAttribute(b)){if(p.hasHiddenAttribute(a))return void k.push({node:a});if(p.isSecContent(a))return null!=i&&(j.heading||(j.heading={implied:!0}),k.push(i)),i=new n(a),j=new l(a),void(i.outline=new m(i.node,j));if(p.isSecRoot(a))return null!=i&&k.push(i),i=new n(a),i.parentSection=j,j=new l(a),void(i.outline=new m(i.node,j));if(p.isHeading(a)){if(j.heading)if(i.outline.getLastSection().heading.implied||e(a)>=e(i.outline.getLastSection().heading)){var c=new l(a);i.outline.sections.push(c),j=c,j.heading=a}else{var f=!1,g=j;do{if(e(a)<e(g.heading)){var c=new l(a);g.append(c),j=c,j.heading=a,f=!0}var h=g.container;g=h}while(!f)}else j.heading=a;return void k.push({node:a})}}}function g(a){var b=d();if(b===a&&k.pop(),!p.isHeading(b)&&!p.hasHiddenAttribute(b)){if(!(p.isSecContent(a)&&k.length>0))return p.isSecRoot(a)&&k.length>0?(j.heading||(j.heading={implied:!0}),j=i.parentSection,void(i=k.pop())):p.isSecContent(a)||p.isSecRoot(a)?void(j.heading||(j.heading={implied:!0})):void 0;j.heading||(j.heading={implied:!0});var c=i;i=k.pop(),j=i.outline.getLastSection();for(var e=0;e<c.outline.sections.length;e++)j.append(c.outline.sections[e])}}function h(a){if(!p.isSecContent(a)&&!p.isSecRoot(a))throw new TypeError("Invalid argument: start element must either be sectioning root or sectioning content.");return i=null,j=null,k=[],o(a,f,g),i.outline}var i,j,k,l=a("./Section"),m=a("./Outline"),n=a("./OutlineTarget"),o=a("./walk"),p=a("./utils");b.exports=h},{"./Outline":2,"./OutlineTarget":3,"./Section":4,"./utils":7,"./walk":8}],7:[function(a,b,c){function d(a){return a.tagName.toUpperCase()}function e(a){return function(b){return f(b)&&new RegExp(a,"i").test(d(b))}}function f(a){return a&&a.tagName}function g(a){if(!j(a))throw new Error("Not a heading element");var b=d(a);if("HGROUP"!==b)return a;for(var c=1;6>=c;c++){var e=a.getElementsByTagName("H"+c);if(e.length)return e[0]}return null}function h(a){return(""+a).replace(/&/g,"&").replace(/</g,"<")}function i(a){return f(a)&&a.hasAttribute("hidden")}var j=e("^H[1-6]|HGROUP$");c.getTagName=d,c.hasHiddenAttribute=i,c.isSecRoot=e("^BLOCKQUOTE|BODY|DETAILS|FIELDSET|FIGURE|TD$"),c.isSecContent=e("^ARTICLE|ASIDE|NAV|SECTION$"),c.isHeading=j,c.getRankingHeadingElement=g,c.escapeHtml=h},{}],8:[function(a,b,c){b.exports=function(a,b,c){var d=a;a:for(;d;)if(b(d),d.firstChild)d=d.firstChild;else for(;d;){if(c(d),d.nextSibling){d=d.nextSibling;continue a}d=d==a?null:d.parentNode}}},{}]},{},[1])(1)}); |
{ | ||
"name": "h5o", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"description": "HTML5 outliner", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,16 +22,16 @@ # HTML5 outliner # | ||
* [Chrome extension](https://chrome.google.com/extensions/detail/afoibpobokebhgfnknfndkgemglggomo) available | ||
- Source: https://github.com/h5o/h5o-chrome | ||
- Standalone `crx`: https://github.com/h5o/h5o-chrome/releases/latest (note that while the signing key for the `crx` is encrypted, the password is "known" to Travis) | ||
* [Bookmarklet](http://h5o.github.io/bookmarklet.html) | ||
* `npm install h5o` (as of 2015, you should not be using any other way of managing your JS dependencies) | ||
- Use the UMD module available in `dist/outliner.min.js` with a fallback to global `HTML5Outline` or | ||
`var HTML5Outline = require('h5o')` in node or browserify | ||
- `HTML5Outline(startFrom)` (you likely want `startFrom` to be `document.body`). Returned value is an outline object, with sections. | ||
- `outline.asHTML( [ options | createLinks ])` to get HTML with an ordered list. | ||
- If `options.createLinks` (or `createLinks`) is `true`, the DOM will be amended with IDs and the list will contain links for navigation. | ||
- If `options.skipToHeader` is true, the outline HTML will only include the sub-sections of the first section in | ||
the outline (which is usually the `body`), i.e. it will only contain the sections of the documents, skipping | ||
the title of the whole document. | ||
`npm install h5o` (as of 2015, you should not be using any other way of managing your JS dependencies, but | ||
you can still [download latest release](https://github.com/h5o/h5o-js/releases/latest)) | ||
* Use the UMD module available in `dist/outliner.min.js` with a fallback to global `HTML5Outline` or | ||
`var HTML5Outline = require('h5o')` in node or browserify | ||
* `var outline = HTML5Outline(startFrom)` (you likely want `startFrom` to be `document.body`). Returned value is an outline object, with sections. | ||
* `outline.asHTML( [ options | createLinks ])` to get HTML with an ordered list. | ||
- If `options.createLinks` (or `createLinks`) is `true`, the DOM will be amended with IDs and the list will contain links for navigation. | ||
- If `options.skipToHeader` is true, the outline HTML will only include the sub-sections of the first section in | ||
the outline (which is usually the `body`), i.e. it will only contain the sections of the documents, skipping | ||
the title of the whole document. | ||
Visit https://h5o.github.io/ for the Chrome extension and bookmarklet. | ||
## Development ## | ||
@@ -54,10 +54,2 @@ | ||
### Release ### | ||
Run `grunt release --bump=[patch|minor|major]` | ||
* Will bump version | ||
* Will tag the release | ||
* Will `npm publish` | ||
* Will push out an update `gh-pages` | ||
## History ## | ||
@@ -68,3 +60,7 @@ | ||
### v0.10.1 (2015-03-25) ### | ||
### v0.10.4 (2015-03-39 ### | ||
* Bookmarklet no longer part of GH releases | ||
* Some styling for bookmarklet.html | ||
### v0.10.1-v0.10.3 (2015-03-25) ### | ||
* Auto-publish in npm via Travis | ||
@@ -71,0 +67,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
141041
145