Fixed PDF generation scripts so they work correctly now
This commit is contained in:
parent
97f0f32a2a
commit
0397cb4162
@ -11,11 +11,11 @@ entries:
|
||||
type: frontmatter
|
||||
folderitems:
|
||||
- title:
|
||||
url: /titlepage
|
||||
url: /titlepage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
- title:
|
||||
url: /tocpage
|
||||
url: /tocpage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
|
||||
|
@ -12,11 +12,11 @@ entries:
|
||||
type: frontmatter
|
||||
folderitems:
|
||||
- title:
|
||||
url: /titlepage
|
||||
url: /titlepage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
- title:
|
||||
url: /tocpage
|
||||
url: /tocpage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
|
||||
|
@ -11,11 +11,11 @@ entries:
|
||||
type: frontmatter
|
||||
folderitems:
|
||||
- title:
|
||||
url: /titlepage
|
||||
url: /titlepage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
- title:
|
||||
url: /tocpage
|
||||
url: /tocpage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="css/customstyles.css">
|
||||
|
||||
<link rel="stylesheet" href="css/boxshadowproperties.css">
|
||||
<!-- most color styles are extracted out to here -->
|
||||
<link rel="stylesheet" href="css/theme-blue.css">
|
||||
|
||||
|
@ -10,9 +10,8 @@
|
||||
<link rel="stylesheet" href="{{ "/css/font-awesome.min.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/bootstrap.min.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/modern-business.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/lavish-bootstrap.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/customstyles.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/theme-green.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/theme-blue.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/syntax.css" | prepend: site.baseurl | prepend: site.url }}">
|
||||
<link rel="stylesheet" href="{{ "/css/printstyles.css" | prepend: site.baseurl }}">
|
||||
|
||||
@ -27,7 +26,3 @@
|
||||
return "{{site.print_title}} User Guide";
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -14,6 +14,9 @@
|
||||
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
|
||||
{% elsif page.url == folderitem.url %}
|
||||
<li class="active"><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
|
||||
{% elsif folderitem.type == "empty" %}
|
||||
<li><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
|
||||
|
||||
{% else %}
|
||||
<li><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
|
||||
{% endif %}
|
||||
|
7526
css/bootstrap.min.css
vendored
7526
css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
24
css/boxshadowproperties.css
Normal file
24
css/boxshadowproperties.css
Normal file
@ -0,0 +1,24 @@
|
||||
/* box-shadow fonts return errors with prince, so extracting here to put in web output only */
|
||||
|
||||
#search-demo-container ul#results-container {
|
||||
box-shadow: 2px 3px 2px #dedede;
|
||||
}
|
||||
|
||||
|
||||
hr.shaded {
|
||||
box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.videoThumbs img {
|
||||
box-shadow: 2px 2px 1px #f0f0f0;
|
||||
}
|
||||
|
||||
.box {
|
||||
box-shadow: 2px 2px 4px #dedede;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
|
||||
.navbar-collapse {
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
|
||||
}
|
@ -206,7 +206,6 @@ p.post-meta {font-size: 80%; color: #777;}
|
||||
z-index: -1;
|
||||
width:223px;
|
||||
border-left: 1px solid #dedede;
|
||||
box-shadow: 2px 3px 2px #dedede;
|
||||
}
|
||||
|
||||
|
||||
@ -551,7 +550,6 @@ hr.faded {
|
||||
hr.shaded {
|
||||
height: 12px;
|
||||
border: 0;
|
||||
box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.5);
|
||||
margin-top: 70px;
|
||||
background: white;
|
||||
width: 100%;
|
||||
@ -904,7 +902,6 @@ span.soft {
|
||||
.videoThumbs img {
|
||||
float: left;
|
||||
margin:15px 15px 15px 0px;
|
||||
box-shadow: 2px 2px 1px #f0f0f0;
|
||||
border: 1px solid #dedede;
|
||||
}
|
||||
|
||||
@ -1045,7 +1042,6 @@ table thead th code.highlighter-rouge {
|
||||
.box {
|
||||
padding: 10px;
|
||||
border: 1px solid #888;
|
||||
box-shadow: 2px 2px 4px #dedede;
|
||||
width: 100px;
|
||||
height: 80px;
|
||||
background-color: #f5f5f5;
|
||||
@ -1179,7 +1175,6 @@ h4.panel-title {
|
||||
}
|
||||
.navbar-collapse {
|
||||
border-top: 1px solid transparent;
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
|
||||
}
|
||||
.navbar-fixed-top {
|
||||
top: 0;
|
||||
|
@ -48,7 +48,7 @@ a[href*="mailto"]::after, a[data-toggle="tooltip"]::after, a[href].noCrossRef::a
|
||||
.printSubtitle {
|
||||
font-size: 19pt;
|
||||
color: #cccccc !important;
|
||||
front-family: "Grotesque MT Light";
|
||||
font-family: "Grotesque MT Light";
|
||||
line-height: 22pt;
|
||||
letter-spacing: -.5px;
|
||||
margin-bottom:20px;
|
||||
|
@ -10,7 +10,7 @@ folder: mydoc
|
||||
---
|
||||
|
||||
## About content reuse
|
||||
You can embed content from one file inside another using includes. Put the file containing content you want to reuse (e.g., mypage.html) inside the \_includes/custom folder and then use a tag like this:
|
||||
You can embed content from one file inside another using includes. Put the file containing content you want to reuse (e.g., mypage.html) inside the \_includes/custom folder and then use a tag like this:
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
@ -20,9 +20,13 @@ You can embed content from one file inside another using includes. Put the file
|
||||
|
||||
With content in your \_includes folder, you don't add any frontmatter to these pages because they will be included on other pages already containing frontmatter.
|
||||
|
||||
Also, when you include a file, all of the file's contents get included. You can't specify that you only want a specific part of the file included. However, you can use parameters with includes. See the following Jekyll cast for more info about using parameters with includes:
|
||||
Also, when you include a file, all of the file's contents get included. You can't specify that you only want a specific part of the file included. However, you can use parameters with includes.
|
||||
|
||||
{% unless site.output == "pdf" %}
|
||||
See the following Jekyll cast for more info about using parameters with includes:
|
||||
|
||||
<iframe width="640" height="480" src="https://www.youtube.com/embed/kzpGqdEMbIs" frameborder="0" allowfullscreen></iframe>
|
||||
{% endunless %}
|
||||
|
||||
## Page-level variables
|
||||
|
||||
|
@ -54,17 +54,19 @@ defaults:
|
||||
layout: "page_print"
|
||||
comments: true
|
||||
search: true
|
||||
|
||||
pdf_sidebar: mydoc_sidebar
|
||||
```
|
||||
|
||||
{% include note.html content="Although you're creating a PDF, you must still build an HTML web target before running Prince. Prince will pull from the HTML files and from the file-list for the TOC." %}
|
||||
|
||||
Note that the default page layout specified by this configuration file is `page_print`. This layout strips out all the sections that shouldn't appear in the print PDF, such as the sidebar and top navigation bar.
|
||||
|
||||
Also note that there's a `output: pdf` toggle in case you want to make some of your content unique to PDF output. For example, you could add conditional logic that checks whether `site.output` is `pdf` or `web`. If it's `pdf`, then include information only for the PDF, and so on. If you're using nav tabs, you'll definitely want to create an alternative experience in the PDF.
|
||||
Also note that there's a `output: pdf` property in case you want to make some of your content unique to PDF output. For example, you could add conditional logic that checks whether `site.output` is `pdf` or `web`. If it's `pdf`, then include information only for the PDF, and so on. If you're using nav tabs, you'll definitely want to create an alternative experience in the PDF.
|
||||
|
||||
In the configuration file, customize the values for the `print_title` and `print_subtitle` that you want. These will appear on the title page of the PDF.
|
||||
|
||||
## 3. Make sure your sidebar_doc.yml file has a titlepage.html and tocpage.html
|
||||
## 3. Make sure your sidebar data file has titlepage.html and tocpage.html entries
|
||||
|
||||
There are two template pages in the root directory that are critical to the PDF:
|
||||
|
||||
@ -74,18 +76,18 @@ There are two template pages in the root directory that are critical to the PDF:
|
||||
These pages should appear in your sidebar YML file (in this product, mydoc_sidebar.yml):
|
||||
|
||||
```yaml
|
||||
- title:
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
folderitems:
|
||||
- title:
|
||||
url: /titlepage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
- title:
|
||||
url: /tocpage.html
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
folderitems:
|
||||
- title:
|
||||
url: /titlepage/
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
- title:
|
||||
url: /tocpage/
|
||||
output: pdf
|
||||
type: frontmatter
|
||||
```
|
||||
|
||||
Leave these pages here in your sidebar. (The `output: pdf` property means they won't appear in your online TOC because the conditional logic of the sidebar.html checks whether `web` is equal to `pdf` or not before including the item in the web version of the content.)
|
||||
@ -288,7 +290,7 @@ This gets the current page:
|
||||
|
||||
Because the theme uses JavaScript in the CSS, you have to add the `--javascript` tag in the Prince command (detailed later on this page).
|
||||
|
||||
## 5. Customize the PDF script
|
||||
## 5. Customize and run the PDF script
|
||||
|
||||
Duplicate the pdf-mydocf.sh file in the root directory and customize it for your specific configuration files.
|
||||
|
||||
@ -302,7 +304,7 @@ jekyll serve --detach --config _config.yml,pdfconfigs/config_mydoc_pdf.yml;
|
||||
echo "done";
|
||||
|
||||
echo "Building the PDF ...";
|
||||
prince --javascript --input-list=_site/pdfconfigs/prince-list.txt -o _pdf/mydoc.pdf;
|
||||
prince --javascript --input-list=_site/pdfconfigs/prince-list.txt -o pdf/mydoc.pdf;
|
||||
echo "done";
|
||||
```
|
||||
|
||||
@ -340,7 +342,7 @@ You can add a download button for your PDF using some Bootstrap button code:
|
||||
|
||||
Here's what that looks like:
|
||||
|
||||
<a target="_blank" class="noCrossRef" href={{ "pdf/mydoc.pdf"}}"><button type="button" class="btn btn-default" aria-label="Left Align"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> PDF Download</button></a>
|
||||
<a target="\_blank" class="noCrossRef" href={{ "pdf/mydoc.pdf"}}"><button type="button" class="btn btn-default" aria-label="Left Align"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> PDF Download</button></a>
|
||||
|
||||
## JavaScript conflicts
|
||||
|
||||
@ -356,13 +358,11 @@ You need to conditionalize out any JavaScript from your PDF web output before bu
|
||||
|
||||
Then surround the JavaScript with conditional tags like this:
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
{% unless site.output == "pdf" %}
|
||||
{% raw %}{% unless site.output == "pdf" %}
|
||||
javascript content here ...
|
||||
{% endunless %}
|
||||
{% endunless %}{% endraw %}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
For more detail about using `unless` in conditional logic, see [Conditional logic][mydoc_conditional_logic]. What this code means is "run this code unless this value is the case."
|
||||
|
||||
|
@ -10,5 +10,5 @@ echo "done";
|
||||
|
||||
echo "Building the PDF ...";
|
||||
prince --javascript --input-list=_site/pdfconfigs/prince-list.txt -o pdf/mydoc.pdf;
|
||||
echo "done";
|
||||
|
||||
echo "Done. Look in the pdf directory to see if it printed successfully."
|
||||
|
@ -3,9 +3,9 @@ kill -9 $(ps aux | grep '[j]ekyll' | awk '{print $2}')
|
||||
clear
|
||||
|
||||
echo "Building PDF-friendly HTML site for Product1 ...";
|
||||
jekyll serve --detach --config _config.yml,pdfconfigs/config_product1_pdf.yml;
|
||||
bundle exec jekyll serve --detach --config _config.yml,pdfconfigs/config_product1_pdf.yml;
|
||||
echo "done";
|
||||
|
||||
echo "Building the PDF ...";
|
||||
prince --javascript --input-list=_site/pdfconfigs/prince-list.txt -o pdf/product1.pdf;
|
||||
echo "done";
|
||||
echo "done";
|
||||
|
@ -3,9 +3,9 @@ kill -9 $(ps aux | grep '[j]ekyll' | awk '{print $2}')
|
||||
clear
|
||||
|
||||
echo "Building PDF-friendly HTML site for Product2 ...";
|
||||
jekyll serve --detach --config _config.yml,pdfconfigs/config_product2_pdf.yml;
|
||||
bundle exec jekyll serve --detach --config _config.yml,pdfconfigs/config_product2_pdf.yml;
|
||||
echo "done";
|
||||
|
||||
echo "Building the PDF ...";
|
||||
prince --javascript --input-list=_site/pdfconfigs/prince-list.txt -o pdf/product2.pdf;
|
||||
echo "done";
|
||||
echo "done";
|
||||
|
20226
pdf/mydoc.pdf
20226
pdf/mydoc.pdf
File diff suppressed because it is too large
Load Diff
BIN
pdf/product1.pdf
BIN
pdf/product1.pdf
Binary file not shown.
BIN
pdf/product2.pdf
BIN
pdf/product2.pdf
Binary file not shown.
@ -5,7 +5,7 @@ port: 4010
|
||||
output: pdf
|
||||
product: mydoc
|
||||
print_title: Jekyll theme for documentation — mydoc product
|
||||
print_subtitle: version 5.0
|
||||
print_subtitle: version 6.0
|
||||
output: pdf
|
||||
defaults:
|
||||
-
|
||||
|
@ -3,9 +3,11 @@ layout: none
|
||||
search: exclude
|
||||
---
|
||||
|
||||
{% assign sidebar = site.pdf_sidebar %}
|
||||
|
||||
{% for entry in sidebar_pdf %}
|
||||
{% assign sidebar = site.data.sidebars[site.pdf_sidebar].entries %}
|
||||
|
||||
{% for entry in sidebar %}
|
||||
|
||||
{% for folder in entry.folders %}
|
||||
{% if folder.output contains "pdf" %}
|
||||
{% for folderitem in folder.folderitems %}
|
||||
@ -25,3 +27,56 @@ search: exclude
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
{% comment %}
|
||||
|
||||
{% assign sidebar = site.data.sidebars[page.sidebar].entries %}
|
||||
|
||||
{% for entry in sidebar %}
|
||||
{% for folder in entry.folders %}
|
||||
{% if folder.output contains "web" %}
|
||||
<li>
|
||||
<a href="#">{{ folder.title }}</a>
|
||||
<ul>
|
||||
{% for folderitem in folder.folderitems %}
|
||||
{% if folderitem.output contains "web" %}
|
||||
{% if folderitem.external_url %}
|
||||
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
|
||||
{% elsif page.url == folderitem.url %}
|
||||
<li class="active"><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
|
||||
{% elsif folderitem.type == "empty" %}
|
||||
<li><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
|
||||
|
||||
{% else %}
|
||||
<li><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
|
||||
{% endif %}
|
||||
{% for subfolders in folderitem.subfolders %}
|
||||
{% if subfolders.output contains "web" %}
|
||||
<li class="subfolders">
|
||||
<a href="#">{{ subfolders.title }}</a>
|
||||
<ul>
|
||||
{% for subfolderitem in subfolders.subfolderitems %}
|
||||
{% if subfolderitem.output contains "web" %}
|
||||
{% if subfolderitem.external_url %}
|
||||
<li><a href="{{subfolderitem.external_url}}" target="_blank">{{subfolderitem.title}}</a></li>
|
||||
{% elsif page.url == subfolderitem.url %}
|
||||
<li class="active"><a href="{{subfolderitem.url | remove: "/"}}">{{subfolderitem.title}}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{subfolderitem.url | remove: "/"}}">{{subfolderitem.title}}</a></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endcomment %}
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
type: title
|
||||
search: exclude
|
||||
permalink: /titlepage/
|
||||
permalink: /titlepage.html/
|
||||
---
|
||||
<div class="printTitleArea">
|
||||
<div class="printTitle">{{site.print_title}}</div>
|
||||
|
@ -1,17 +1,17 @@
|
||||
---
|
||||
type: frontmatter
|
||||
search: exclude
|
||||
permalink: /tocpage/
|
||||
permalink: /tocpage.html/
|
||||
---
|
||||
|
||||
<!-- new page -->
|
||||
<div id="navig">
|
||||
<h1>Table of Contents</h1>
|
||||
|
||||
{% assign sidebar = site.pdf_sidebar %}
|
||||
{% assign sidebar = site.data.sidebars[site.pdf_sidebar].entries %}
|
||||
|
||||
<ul id="mysidebar" class="nav">
|
||||
{% for entry in sidebar_pdf %}
|
||||
{% for entry in sidebar %}
|
||||
{% for folder in entry.folders %}
|
||||
{% if folder.output contains "pdf" and folder.type != "frontmatter" %}
|
||||
<li class="sectionHead">{{ folder.title }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user