-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PDFBOX-3330: add new template for documentation; auto generate toc fo…
…r documentation
- Loading branch information
Showing
10 changed files
with
235 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{% capture tocWorkspace %} | ||
{% comment %} | ||
Version 1.0.4 | ||
https://github.com/allejo/jekyll-toc | ||
|
||
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe | ||
|
||
Usage: | ||
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} | ||
|
||
Parameters: | ||
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll | ||
|
||
Optional Parameters: | ||
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC | ||
* class (string) : '' - a CSS class assigned to the TOC | ||
* id (string) : '' - an ID to assigned to the TOC | ||
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored | ||
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored | ||
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list | ||
* item_class (string) : '' - add custom class for each list item; has support for '%level%' placeholder, which is the current heading level | ||
|
||
Output: | ||
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only generate the table of contents and will NOT output the markdown given to it | ||
{% endcomment %} | ||
|
||
{% capture my_toc %}{% endcapture %} | ||
{% assign orderedList = include.ordered | default: false %} | ||
{% assign minHeader = include.h_min | default: 1 %} | ||
{% assign maxHeader = include.h_max | default: 6 %} | ||
{% assign nodes = include.html | split: '<h' %} | ||
{% assign firstHeader = true %} | ||
|
||
{% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %} | ||
|
||
{% for node in nodes %} | ||
{% if node == "" %} | ||
{% continue %} | ||
{% endif %} | ||
|
||
{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %} | ||
|
||
{% if headerLevel < minHeader or headerLevel > maxHeader %} | ||
{% continue %} | ||
{% endif %} | ||
|
||
{% if firstHeader %} | ||
{% assign firstHeader = false %} | ||
{% assign minHeader = headerLevel %} | ||
{% endif %} | ||
|
||
{% assign indentAmount = headerLevel | minus: minHeader | add: 1 %} | ||
{% assign _workspace = node | split: '</h' %} | ||
|
||
{% assign _idWorkspace = _workspace[0] | split: 'id="' %} | ||
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %} | ||
{% assign html_id = _idWorkspace[0] %} | ||
|
||
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %} | ||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} | ||
|
||
{% assign space = '' %} | ||
{% for i in (1..indentAmount) %} | ||
{% assign space = space | prepend: ' ' %} | ||
{% endfor %} | ||
|
||
{% unless include.item_class == blank %} | ||
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %} | ||
{% endunless %} | ||
|
||
{% capture my_toc %}{{ my_toc }} | ||
{{ space }}{{ listModifier }} {{ listItemClass }} [{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}](#{{ html_id }}){% endcapture %} | ||
|
||
{% endfor %} | ||
|
||
{% if include.class %} | ||
{% capture my_toc %}{:.{{ include.class }}} | ||
{{ my_toc | lstrip }}{% endcapture %} | ||
{% endif %} | ||
|
||
{% if include.id %} | ||
{% capture my_toc %}{: #{{ include.id }}} | ||
{{ my_toc | lstrip }}{% endcapture %} | ||
{% endif %} | ||
{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE- 2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
{% include head.html %} | ||
|
||
<body> | ||
|
||
{% include header.html %} | ||
|
||
<div class="container documentation"> | ||
<nav> | ||
<h1>Documentation</h1> | ||
<ul> | ||
<li><a href="/2.0/migration.html">Migration Guide</a></li> | ||
<li><a href="/2.0/getting-started.html">Getting Started</a></li> | ||
<li><a href="/2.0/examples.html">Examples</a></li> | ||
<li><a href="/2.0/dependencies.html">Dependencies</a></li> | ||
<li class="sidebar-node" id="v2-0-cookbook"> | ||
<a href="#">Cookbook</a> | ||
<ul> | ||
<li><a href="/2.0/cookbook/encryption.html">Document Encryption</a></li> | ||
</ul> | ||
</li> | ||
<li><a href="/2.0/commandline.html">Command-Line Tools</a></li> | ||
<li><a href="/2.0/faq.html">FAQ</a></li> | ||
<li><a href="/docs/2.0.8/javadocs/">API Docs</a></li> | ||
</nav> | ||
<section> | ||
{{ content }} | ||
</section> | ||
<aside> | ||
<h1>Table of Contents</h1> | ||
{% include toc.html html=content h_min=2 h_max=3 %} | ||
</aside> | ||
</div> | ||
|
||
{% include footer.html %} | ||
{% include footer_scripts.html %} | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters