{"id":7160,"date":"2009-11-04T02:15:11","date_gmt":"2009-11-04T02:15:11","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/sectionize\/"},"modified":"2009-12-18T00:38:47","modified_gmt":"2009-12-18T00:38:47","slug":"sectionize","status":"publish","type":"plugin","link":"https:\/\/ur.wordpress.org\/plugins\/sectionize\/","author":186678,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1","stable_tag":"trunk","tested":"2.9.2","requires":"2.8","requires_php":"","requires_plugins":"","header_name":"Sectionize","header_author":"Weston Ruter","header_description":"","assets_banners_color":"","last_updated":"2009-12-18 00:38:47","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/wordpress.org\/extend\/plugins\/sectionize\/","header_author_uri":"http:\/\/weston.ruter.net\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":2320,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[203,12900,186,10851,10852],"plugin_category":[55],"plugin_contributors":[78438],"plugin_business_model":[],"class_list":["post-7160","plugin","type-plugin","status-publish","hentry","plugin_tags-html5","plugin_tags-sections","plugin_tags-seo","plugin_tags-table-of-contents","plugin_tags-toc","plugin_category-seo-and-marketing","plugin_contributors-westonruter","plugin_committers-westonruter"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/sectionize.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p><em>This plugin is developed at\n<a href=\"http:\/\/www.shepherd-interactive.com\/\" title=\"Shepherd Interactive specializes in web design and development in Portland, Oregon\">Shepherd Interactive<\/a>\nfor the benefit of the community. No support is available. Please post any questions to the <a href=\"http:\/\/wordpress.org\/tags\/sectionize?forum_id=10\">support forum<\/a>.<\/em><\/p>\n\n<p>Takes HTML content which contains flat heading elements inline with paragraphs\nand automatically nests them withing HTML5 <code>&lt;section&gt;<\/code> elements. It also\nconditionally prepends an <code>&lt;ol&gt;<\/code> Table of Contents (TOC) with links to the\nsections in the content, for example:<\/p>\n\n<pre><code>&lt;nav class='toc'&gt;&lt;ol&gt;\n    &lt;li&gt;&lt;a href=\"#section-first-top\"&gt;First Top&lt;\/a&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;a href=\"#section-second-top\"&gt;Second Top&lt;\/a&gt;\n    &lt;ol&gt;\n        &lt;li&gt;&lt;a href=\"#section-first-sub\"&gt;First Sub&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=\"#section-second-sub\"&gt;Second Sub&lt;\/a&gt;&lt;\/li&gt;\n    &lt;\/ol&gt;\n    &lt;\/li&gt;\n    &lt;li&gt;&lt;a href=\"#section-third-top\"&gt;Third Top&lt;\/a&gt;&lt;\/li&gt;\n&lt;\/ol&gt;&lt;\/nav&gt;\n<\/code><\/pre>\n\n<p>This would reflect original post content such as:<\/p>\n\n<pre><code>&lt;h2&gt;First Top&lt;\/h2&gt;\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n&lt;h2&gt;Second Top&lt;\/h2&gt;\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n&lt;h3&gt;First Sub&lt;\/h2&gt;\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n&lt;h3&gt;Second Sub&lt;\/h2&gt;\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n&lt;h2&gt;Third Top&lt;\/h2&gt;\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n<\/code><\/pre>\n\n<p>Original post content such as this would be sectionized as follows:<\/p>\n\n<pre><code>&lt;section id=\"section-first-top\"&gt;\n    &lt;h2&gt;First Top&lt;\/h2&gt;\n    Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n&lt;\/section&gt;\n&lt;section id=\"section-second-top\"&gt;\n    &lt;h2&gt;Second Top&lt;\/h2&gt;\n    Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n    &lt;section id=\"section-first-sub\"&gt;\n        &lt;h3&gt;First Sub&lt;\/h2&gt;\n        Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n    &lt;\/section&gt;\n    &lt;section id=\"section-second-sub\"&gt;\n        &lt;h3&gt;Second Sub&lt;\/h2&gt;\n        Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n    &lt;\/section&gt;\n&lt;\/section&gt;\n&lt;section id=\"section-third-top\"&gt;\n    &lt;h2&gt;Third Top&lt;\/h2&gt;\n    Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n&lt;\/section&gt;\n<\/code><\/pre>\n\n<p>Adding a table of contents as such not only aids navigation for visitors once\non the page, but Google also now provides direct links to such sections in relevant search result\nsnippets (see <a href=\"http:\/\/googleblog.blogspot.com\/2009\/09\/jump-to-information-you-want-right-from.html\" title=\"Jump to the information you want right from the search snippets\">announcement<\/a>).\nSo people browsing search results may be able to see your section links\nright from the results page and then be able to jump directly to the relevant\nsection.<\/p>\n\n<p>The start\/end tags for both the sections and the TOC, as well as the prefixes\nused when generating the section IDs, may all be configured via the following\nWordPress options (with their defaults):<\/p>\n\n<ul>\n<li><code>sectionize_id_prefix<\/code>: <code>'section-'<\/code><\/li>\n<li><code>sectionize_start_section<\/code>: <code>'&lt;section id=\"%id\"&gt;'<\/code><\/li>\n<li><code>sectionize_end_section<\/code>:  <code>&lt;\/section&gt;<\/code><\/li>\n<li><code>sectionize_include_toc_threshold<\/code>: <code>2<\/code><\/li>\n<li><code>sectionize_before_toc<\/code>: <code>'&lt;nav class=\"toc\"&gt;'<\/code><\/li>\n<li><code>sectionize_after_toc<\/code>: <code>'&lt;\/nav&gt;'<\/code><\/li>\n<li><code>sectionize_disabled<\/code>: <code>false<\/code> (no corresponding function argument)<\/li>\n<\/ul>\n\n<p>These global WordPress options may be overridden by individual posts\/pages by\ncreating custom fields (postmeta) with the same names.<\/p>\n\n<p>These options are retreived if their corresponding arguments are not supplied\nto the <code>sectionize()<\/code> function (that is, if they are <code>null<\/code>):<\/p>\n\n<pre><code>function sectionize($original_content,\n                    $id_prefix = null,\n                    $start_section = null,\n                    $end_section = null,\n                    $include_toc_threshold = null,\n                    $before_toc = null,\n                    $after_toc = null)\n<\/code><\/pre>\n\n<p>This <code>sectionize()<\/code> function is added as a filter for <code>the_content<\/code> (this is\ndisabled if the option or postmeta <code>sectionize_disabled<\/code> evaluates to <code>true<\/code>):<\/p>\n\n<pre><code>add_filter('the_content', 'sectionize');\n<\/code><\/pre>\n\n<p>Noted above, the TOC is conditionally included. It is not included if:<\/p>\n\n<ol>\n<li>there are no headings in the content (thus there is nothing to sectionize),<\/li>\n<li>the headings are not nested properly (see below), or<\/li>\n<li>the heading count does not meet the threshold (or the threshold is -1)<\/li>\n<\/ol>\n\n<p>If the number of headings in the content is less than the\n    include_toc_threshold option\/argument then the TOC is not displayed;\nlikewise, if <code>include_toc_threshold<\/code> is <code>-1<\/code> then the TOC is not displayed.<\/p>\n\n<p><em>Important!<\/em> Regarding headings being \"nested properly\", you must ensure that\nyou properly arrange your headings in a hierarchical manner in which no heading\nis immediately preceeded by another heading that is more than one level greater\n(e.g. an <code>h3<\/code> must be preceeded by an <code>h2<\/code> or another <code>h3<\/code>). For example, this\nworks:<\/p>\n\n<pre><code>h2\n    h3\n    h3\n        h4\n    h3\nh2\n<\/code><\/pre>\n\n<p>But this does not:<\/p>\n\n<pre><code>h2\n    h4 -- fail\n        h6 -- fail\nh2\n<\/code><\/pre>\n\n<p>If you make such a mistake, this plugin will abort and have no effect. An error\nnotice will be included in the HTML output in the form of an HTML comment.<\/p>\n\n<p>Please see source code for additional documentation: numerous filters are provided\nto further customize the behavior. <em>Be one with the code!<\/em>\nTo help serve HTML5 content, see the <a href=\"http:\/\/wordpress.org\/extend\/plugins\/xhtml5-support\/\">XHTML5 Support&lt;\/a&lt;&gt; plugin.<\/a><\/p>\n\n<!--section=changelog-->\n<h4>2009-11-03: 1.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>\n\n<h4>2009-12-17: 1.1<\/h4>\n\n<ul>\n<li>Moved <code>add_option('sectionize_...)<\/code> calls to activation hook.<\/li>\n<li>Adding <code>sectionize_toc_text<\/code> filter so that the link text in the TOC can be customized,\nalong with a default filter which strips off tags and a trailing ':'<\/li>\n<\/ul>","raw_excerpt":"Parses HTML for sections demarcated by heading elements, wraps them in HTML5 section elements, and generates table of contents with links to each.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/7160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=7160"}],"author":[{"embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/westonruter"}],"wp:attachment":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=7160"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=7160"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=7160"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=7160"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=7160"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=7160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}