You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2018/03/29 21:02:50 UTC

pdfbox-docs git commit: PDFBOX-3330: add new template for documentation; auto generate toc for documentation

Repository: pdfbox-docs
Updated Branches:
  refs/heads/master 386f163ba -> 37123aa78


PDFBOX-3330: add new template for documentation; auto generate toc for documentation


Project: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/commit/37123aa7
Tree: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/tree/37123aa7
Diff: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/diff/37123aa7

Branch: refs/heads/master
Commit: 37123aa785562c08ad3fa748a289a9ad81c8734c
Parents: 386f163
Author: Maruan Sahyoun <sa...@fileaffairs.de>
Authored: Thu Mar 29 22:55:53 2018 +0200
Committer: Maruan Sahyoun <sa...@fileaffairs.de>
Committed: Thu Mar 29 22:55:53 2018 +0200

----------------------------------------------------------------------
 content/2.0/commandline.md          | 16 +-----
 content/2.0/cookbook/encryption.md  |  2 +-
 content/2.0/dependencies.md         |  2 +-
 content/2.0/examples.md             |  2 +-
 content/2.0/faq.md                  | 31 +-----------
 content/2.0/getting-started.md      |  6 ++-
 content/2.0/migration.md            |  2 +-
 content/_includes/toc.html          | 85 ++++++++++++++++++++++++++++++++
 content/_layouts/documentation.html | 60 ++++++++++++++++++++++
 content/css/site.css                | 84 +++++++++++++++++++++++++++++--
 10 files changed, 235 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/commandline.md
----------------------------------------------------------------------
diff --git a/content/2.0/commandline.md b/content/2.0/commandline.md
index c2be77f..ede9212 100644
--- a/content/2.0/commandline.md
+++ b/content/2.0/commandline.md
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   Command-Line Tools
 ---
 
@@ -27,20 +27,6 @@ PDFBox comes with a series of command-line utilities. They are available as stan
 See the [Dependencies](/2.0/dependencies.html) page for instructions on how to set your classpath in order to run
 PDFBox tools as Java applications.
 
-**Table of Contents**
- - [Decrypt](#decrypt)
- - [Encrypt](#encrypt)
- - [ExtractImages](#extractimages)
- - [ExtractText](#extracttext)
- - [OverlayPDF](#overlaypdf)
- - [PDFDebugger](#pdfdebugger)
- - [PDFMerger](#pdfmerger)
- - [PDFSplit](#pdfsplit)
- - [PDFToImage](#pdftoimage)
- - [PrintPDF](#printpdf)
- - [TextToPDF](#texttopdf)
- - [WriteDecodedDoc](#writedecodeddoc)
-
 ## Decrypt ##
 
 This application will decrypt a PDF document.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/cookbook/encryption.md
----------------------------------------------------------------------
diff --git a/content/2.0/cookbook/encryption.md b/content/2.0/cookbook/encryption.md
index 9850bfd..8370258 100644
--- a/content/2.0/cookbook/encryption.md
+++ b/content/2.0/cookbook/encryption.md
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   Cookbook - Encrypting a File
 ---
 

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/dependencies.md
----------------------------------------------------------------------
diff --git a/content/2.0/dependencies.md b/content/2.0/dependencies.md
index 0f0712e..c2f9b4e 100644
--- a/content/2.0/dependencies.md
+++ b/content/2.0/dependencies.md
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   Dependencies
 ---
 

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/examples.md
----------------------------------------------------------------------
diff --git a/content/2.0/examples.md b/content/2.0/examples.md
index 39b9fec..38e976b 100644
--- a/content/2.0/examples.md
+++ b/content/2.0/examples.md
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   Examples
 ---
 

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/faq.md
----------------------------------------------------------------------
diff --git a/content/2.0/faq.md b/content/2.0/faq.md
index 1c0970b..a8489b0 100644
--- a/content/2.0/faq.md
+++ b/content/2.0/faq.md
@@ -16,41 +16,12 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   Frequently Asked Questions (FAQ)
 ---
 
 # Frequently Asked Questions
 
-### General Questions
-
- - [I am getting the below Log4J warning message, how do I remove it?](#log4j)
- - [Is PDFBox thread safe?](#threadsafe)
- - [Why do I get a "Warning: You did not close the PDF Document"?](#notclosed)
-
-### Font Handling
-
- - [I'm getting java.lang.IllegalArgumentException: ... is not available in this font's encoding: WinAnsiEncoding](#fontencoding)
-
-### PDF Creation
-
- - [I'm creating a PDF but my page is empty. Why?](#emptypage)
-
-### Text Extraction
-
- - [Why does the extracted text appear in the wrong sequence?](#textorder)
- - [How come I am not getting any text from the PDF document?](#notext)
- - [How come I am getting gibberish(G38G43G36G51G5) when extracting text?](#gibberish)
- - [What does "java.io.IOException: Can't handle font width" mean?](#fontwidth)
- - [Why do I get "You do not have permission to extract text" on some documents?](#permission)
- - [Can't we just extract the text without parsing the whole document or extract text as it is parsed?](#partially)
-
-### PDF Rendering
-
- - [I'm getting an OutOfMemoryError. What can I do?](#outofmemoryerror)
- - [A drop shadow is missing or at the wrong position when rendering a page](#dropshadow)
- - [Why are some texts in poor quality and not antialiased?](#textantialias)
-
 ## General Questions
 
 <a name="log4j"></a>

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/getting-started.md
----------------------------------------------------------------------
diff --git a/content/2.0/getting-started.md b/content/2.0/getting-started.md
index ebf79f4..fc8f8f9 100644
--- a/content/2.0/getting-started.md
+++ b/content/2.0/getting-started.md
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   Getting Started
 ---
 
@@ -53,6 +53,8 @@ https://bugs.openjdk.java.net/browse/JDK-8041125
 
 PDFBox 2.0.4 introduced a new command line setting
 
- ``-Dorg.apache.pdfbox.rendering.UsePureJavaCMYKConversion=true``
+ ```
+ -Dorg.apache.pdfbox.rendering.UsePureJavaCMYKConversion=true
+ ```
 
 which may improve the performance of rendering PDFs on some systems especially if there are a lot of images on a page.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/2.0/migration.md
----------------------------------------------------------------------
diff --git a/content/2.0/migration.md b/content/2.0/migration.md
index 9f7f5b4..55f6154 100644
--- a/content/2.0/migration.md
+++ b/content/2.0/migration.md
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
          specific language governing permissions and limitations
          under the License.
 
-layout:  default
+layout:  documentation
 title:   PDFBox 2.0.0 Migration Guide
 ---
 

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/_includes/toc.html
----------------------------------------------------------------------
diff --git a/content/_includes/toc.html b/content/_includes/toc.html
new file mode 100644
index 0000000..b9316a0
--- /dev/null
+++ b/content/_includes/toc.html
@@ -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 }}

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/_layouts/documentation.html
----------------------------------------------------------------------
diff --git a/content/_layouts/documentation.html b/content/_layouts/documentation.html
new file mode 100644
index 0000000..2618895
--- /dev/null
+++ b/content/_layouts/documentation.html
@@ -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>

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/37123aa7/content/css/site.css
----------------------------------------------------------------------
diff --git a/content/css/site.css b/content/css/site.css
index e93f482..04e7128 100644
--- a/content/css/site.css
+++ b/content/css/site.css
@@ -33,7 +33,7 @@ body {
 }
 
 body > .container {
-  padding-top: 20px;
+  padding-top: 5rem;
 }
 
 .main-header {
@@ -168,9 +168,7 @@ code {
  * Default styling for the tables copied over from bootstrap
  * to get basic styling for tables created through markdown
  */
-table {
-    width: 100%;
-}
+
 
 table th, table td {
     padding: 8px;
@@ -249,6 +247,84 @@ table tr:nth-child(even) td, table tr.even td {
   content: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='#0088cc' d='M1.5 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z' transform='translate(1)' /%3E%3C/svg%3E");
 }
 
+.documentation {
+  display: flex;
+}
+
+.documentation section h1, .documentation section h2,
+.documentation section h3, .documentation section h4,
+.documentation section ul,
+.documentation section p {
+  padding-left: 3rem;
+  padding-right: 1rem;
+}
+
+.documentation section table {
+  margin-left: 3rem;
+  margin-right: 1rem;
+}
+
+.documentation section ul {
+  padding-left: 5rem;
+}
+
+.documentation nav {
+  min-width: 25rem;
+  box-shadow: 1px 0 0 rgba(81,88,90,0.17);
+}
+
+.documentation nav h1 {
+  font-size: 1.2rem;
+  text-transform: uppercase;
+}
+
+.documentation nav ul {
+  list-style: none;
+}
+
+.documentation nav > ul {
+  list-style: none;
+  padding: 0;
+}
+
+.documentation nav li a {
+  padding: .20em 15px;
+}
+
+.documentation nav li a:hover, .documentation nav li a:focus {
+  background-color: #eee;
+  text-decoration: none;
+}
+
+.documentation aside {
+  min-width: 22rem;
+  max-width: 22rem;  
+  padding-left: 2rem;
+}
+
+.documentation aside h1 {
+  font-size: 1.2rem;
+  text-transform: uppercase;
+}
+
+.documentation aside ul {
+  list-style: none;
+  padding: 0 1rem;
+}
+
+.documentation aside > ul {
+  list-style: none;
+  padding: 0;
+}
+
+.documentation aside a {
+  font-size: 13px;
+  text-decoration: none;
+  border-radius: 2px;
+  padding: 4px 5px 4px 23px;
+  display: block;
+}
+
 
 /*
  * Off Canvas