Skip to content

Commit a5fd068

Browse files
committed
obs-sn and obs-sq pdf generators
1 parent c6099ae commit a5fd068

17,846 files changed

Lines changed: 22796512 additions & 2077 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bible/generate_bible_pdf/generate_bible_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def run(self):
100100
self.resource = self.manifest['dublin_core']
101101
self.title = self.resource['title']
102102
self.version = self.resource['version']
103-
self.contributors = '; '.join(self.resource['contributor'])
103+
self.contributors = '<br/>'.join(self.resource['contributor'])
104104
self.publisher = self.resource['publisher']
105105
self.issued = dateutil.parser.parse(self.resource['issued']).strftime('%Y-%m-%d')
106106
projects = self.manifest['projects']

general_tools/file_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def load_yaml_object(file_name, default=None):
9797
if not os.path.isfile(file_name):
9898
return default
9999
# return a deserialized object
100-
return yaml.load(read_file(file_name))
100+
return yaml.load(read_file(file_name), Loader=yaml.FullLoader)
101101

102102

103103
def read_file(file_name, encoding='utf-8'):
File renamed without changes.
File renamed without changes.
File renamed without changes.

obs-sn/generate_obs-sn_pdf.py

Lines changed: 602 additions & 0 deletions
Large diffs are not rendered by default.

obs-sn/obs-sn_footer.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
<link href="obs-sn_style.css" rel="stylesheet"/>
6+
<script>
7+
function subst() {
8+
var vars = {};
9+
var query_strings_from_url = document.location.search.substring(1).split('&');
10+
for (var query_string in query_strings_from_url) {
11+
if (query_strings_from_url.hasOwnProperty(query_string)) {
12+
var temp_var = query_strings_from_url[query_string].split('=', 2);
13+
vars[temp_var[0]] = decodeURI(temp_var[1]);
14+
}
15+
}
16+
var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages'];
17+
for (var css_class in css_selector_classes) {
18+
if (css_selector_classes.hasOwnProperty(css_class)) {
19+
var element = document.getElementsByClassName(css_selector_classes[css_class]);
20+
for (var j = 0; j < element.length; ++j) {
21+
element[j].textContent = vars[css_selector_classes[css_class]];
22+
}
23+
}
24+
}
25+
}
26+
</script>
27+
</head>
28+
<body style="border:0; margin: 0;" onload="subst()">
29+
<div style="text-align: center"><span class="page"></span>&nbsp;/&nbsp;<span class="topage"></span></div>
30+
</body>
31+
</html>

obs-sn/obs-sn_header.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
<link href="obs-sn_style.css" rel="stylesheet"/>
6+
<script>
7+
var omitSectionCombos = [
8+
['Open Bible Stories Study Notes', ''],
9+
['Table of Contents'],
10+
['Contributors'],
11+
['OBS Study Notes - French', ''],
12+
];
13+
function subst() {
14+
var vars = {};
15+
var query_strings_from_url = document.location.search.substring(1).split('&');
16+
for (var query_string in query_strings_from_url) {
17+
if (query_strings_from_url.hasOwnProperty(query_string)) {
18+
var temp_var = query_strings_from_url[query_string].split('=', 2);
19+
vars[temp_var[0]] = decodeURI(temp_var[1]);
20+
}
21+
}
22+
for (var i in omitSectionCombos) {
23+
var sections = omitSectionCombos[i];
24+
if (vars['section'] === sections[0]) {
25+
if (sections.length < 2 || sections[1] === vars['subsection']) {
26+
if (sections.length < 3 || sections[2] === vars['subsubsection'])
27+
document.getElementsByClassName("page-header")[0].className += 'empty';
28+
return;
29+
}
30+
}
31+
}
32+
var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages'];
33+
for (var css_class in css_selector_classes) {
34+
if (css_selector_classes.hasOwnProperty(css_class)) {
35+
var element = document.getElementsByClassName(css_selector_classes[css_class]);
36+
for (var j = 0; j < element.length; ++j) {
37+
element[j].textContent = vars[css_selector_classes[css_class]];
38+
}
39+
}
40+
}
41+
}
42+
</script>
43+
</head>
44+
<body style="border:0; margin: 0;" onload="subst()">
45+
<table class="page-header">
46+
<tr>
47+
<td class="section"></td>
48+
<td class="subsection"></td>
49+
<td class="subsubsection"></td>
50+
</tr>
51+
</table>
52+
</body>
53+
</html>

obs-sn/obs-sn_style.css

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
@import url('https://fonts.googleapis.com/css?family=Noto+Serif:400,400i,700,700i');
2+
3+
body {
4+
font-family: 'Noto Serif', sans-serif;
5+
font-size: 12pt;
6+
}
7+
8+
h1, h2, h3, h4, h5, h6,
9+
.h1, .h2, .h3, .h4, .h5, .h6 {
10+
page-break-before: auto !important;
11+
page-break-after: avoid !important;
12+
break-after: avoid-page !important;
13+
}
14+
15+
.frame-text {
16+
font-style: italic;
17+
font-size: 1.2em;
18+
}
19+
20+
.section-header {
21+
display: block;
22+
font-size: 1.5em;
23+
-webkit-margin-before: 0.83em;
24+
-webkit-margin-after: 0.83em;
25+
-webkit-margin-start:0;
26+
-webkit-margin-end:0;
27+
font-weight: bold;
28+
}
29+
30+
li {
31+
page-break-before: avoid;
32+
page-break-after: auto;
33+
}
34+
35+
.page-break, .break, .article, .resource-title-page {
36+
page-break-before: always !important;
37+
clear: both;
38+
}
39+
40+
.no-break {
41+
page-break-before: avoid !important;
42+
}
43+
44+
dl {
45+
padding: 0;
46+
}
47+
48+
dl dt {
49+
padding: 0;
50+
margin-top: 16px;
51+
font-style: italic;
52+
font-weight: bold;
53+
}
54+
55+
dl dd {
56+
padding: 0 16px;
57+
margin-bottom: 16px;
58+
}
59+
60+
blockquote {
61+
padding: 0 15px;
62+
color: #444;
63+
border-left: 4px solid #ddd;
64+
}
65+
blockquote > :first-child {
66+
margin-top: 0;
67+
}
68+
blockquote > :last-child {
69+
margin-bottom: 0;
70+
}
71+
72+
table {
73+
overflow: auto;
74+
margin-left:auto;
75+
margin-right:auto;
76+
margin-bottom: 10px;
77+
word-break: keep-all;
78+
border-collapse: collapse;
79+
border-spacing: 0;
80+
page-break-inside: avoid;
81+
}
82+
thead {
83+
box-shadow: none;
84+
}
85+
table th {
86+
font-weight: bold;
87+
}
88+
table th,
89+
table td {
90+
padding: 6px 13px !important;
91+
}
92+
93+
a {
94+
text-decoration: none;
95+
color: #f47142;
96+
}
97+
a:link {
98+
color: #f47142;
99+
}
100+
a:visited {
101+
color: #f47142;
102+
}
103+
a.internal {
104+
color: #f47142 !important;
105+
}
106+
a.external {
107+
color: #f47142 !important;
108+
}
109+
110+
.docs-bubble-link, .docs-bubble a {
111+
color: #f47142!important;
112+
cursor: pointer;
113+
text-decoration: none!important;
114+
}
115+
116+
img {
117+
max-width: 600px;
118+
text-align: center;
119+
}
120+
121+
ul li, ul li p {
122+
margin: 0;
123+
}
124+
div > ul > li:first-child, ol > li > ul > li:first-child {
125+
margin-top: 1em;
126+
}
127+
div > ul > li:last-child, ol > li > ul > li:last-child {
128+
margin-bottom: 1em;
129+
}
130+
ul li li:last-child {
131+
margin-bottom: .5em;
132+
}
133+
134+
.h1 {
135+
display: block;
136+
font-size: 2em;
137+
-webkit-margin-before: 0.67em;
138+
-webkit-margin-after: 0.67em;
139+
-webkit-margin-start:0;
140+
-webkit-margin-end:0;
141+
font-weight: bold;
142+
}
143+
144+
.h2 {
145+
display: block;
146+
font-size: 1.5em;
147+
-webkit-margin-before: 0.83em;
148+
-webkit-margin-after: 0.83em;
149+
-webkit-margin-start:0;
150+
-webkit-margin-end:0;
151+
font-weight: bold;
152+
}
153+
154+
.h3 {
155+
display: block;
156+
font-size: 1.17em;
157+
-webkit-margin-before: 1em;
158+
-webkit-margin-after: 1em;
159+
-webkit-margin-start:0;
160+
-webkit-margin-end:0;
161+
font-weight: bold;
162+
}
163+
164+
.h4 {
165+
display: block;
166+
-webkit-margin-before: 1.33em;
167+
-webkit-margin-after: 1.33em;
168+
-webkit-margin-start:0;
169+
-webkit-margin-end:0;
170+
font-weight: bold;
171+
}
172+
173+
.h5 {
174+
display: block;
175+
font-size: 0.83em;
176+
-webkit-margin-before: 1.67em;
177+
-webkit-margin-after: 1.67em;
178+
-webkit-margin-start:0;
179+
-webkit-margin-end:0;
180+
font-weight: bold;
181+
}
182+
183+
.h6 {
184+
display: block;
185+
font-size: 0.75em;
186+
-webkit-margin-before: 2em;
187+
-webkit-margin-after: 2em;
188+
-webkit-margin-start:0;
189+
-webkit-margin-end:0;
190+
font-weight: bold;
191+
}
192+
193+
ol {
194+
list-style-type: decimal;
195+
}
196+
ol ol {
197+
list-style-type: upper-latin;
198+
}
199+
ol ol ol {
200+
list-style-type: lower-latin;
201+
}
202+
ol ol ol {
203+
list-style-type: upper-roman;
204+
}
205+
ol ol ol ol {
206+
list-style-type: lower-roman;
207+
}
208+
ul {
209+
list-style-type: disc;
210+
}
211+
ul ul {
212+
list-style-type: circle;
213+
}
214+
ul ul ul {
215+
list-style-type: square;
216+
}
217+
ul ul ul ul {
218+
list-style-type: circle;
219+
}
220+
ul ul ul ul ul {
221+
list-style-type: disc;
222+
}
223+
224+
hr {
225+
display: none;
226+
}
227+
228+
table.tn-notes-table {
229+
border-top: solid black 1px;
230+
border-bottom: solid black 1px;
231+
}
232+
233+
.page-header {
234+
border-bottom: solid grey 1px;
235+
font-style: italic;
236+
height: 1.5em;
237+
width: 100%;
238+
}
239+
240+
.page-header.empty {
241+
display: none;
242+
border: 0;
243+
height: 0;
244+
}
245+
246+
.page-header .section {
247+
text-align: left;
248+
}
249+
250+
.page-header .subsection, .page-header .subsubsection {
251+
overflow: hidden;
252+
text-overflow: ellipsis;
253+
text-align: right;
254+
max-height: 1.5em;
255+
}
256+
257+
.hidden {
258+
color: white;
259+
padding: 0;
260+
margin: 0;
261+
font-size: 2px;
262+
height: 2px;
263+
line-height: 2px;
264+
}
265+
266+
.resource-title-page {
267+
text-align: center;
268+
padding-top: 200px
269+
}
270+
271+
.col1 p {
272+
padding: 0;
273+
margin: 0;
274+
}

obs-sn/requirements.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
backports-abc
2+
beautifulsoup4
3+
bs4
4+
future
5+
futures
6+
markdown2
7+
pyparsing
8+
python-dateutil
9+
PyYAML
10+
singledispatch
11+
six
12+
tornado
13+
gitpython
14+
weasyprint

0 commit comments

Comments
 (0)