Skip to content

Commit 2ff1a6e

Browse files
authored
Merge pull request #39 from oreillymedia/remove-part-titlecasing-per-feedback
Remove part titlecasing per PE feedback
2 parents 7d99dda + ac74af9 commit 2ff1a6e

File tree

8 files changed

+23
-13
lines changed

8 files changed

+23
-13
lines changed

.github/workflows/workflow.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
virtualenvs-in-project: true
2626
installer-parallel: true
2727

28+
- run: poetry config installer.modern-installation false
29+
2830
- name: Load cached venv if possible
2931
id: cached-poetry-dependencies
3032
uses: actions/cache@v2

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These owners will be the default owners for everything in
2+
# the repo.
3+
* @oreillymedia/tools-team

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ Options:
7272

7373
## Release Notes
7474

75+
### 1.0.8
76+
77+
Bug fixes:
78+
- Part caption casing is preserved from `_toc.yaml`
79+
7580
### 1.0.7
7681

7782
Features:

jupyter_book_to_htmlbook/file_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def process_part(part_path: Path, output_dir: Path):
3232
if info:
3333
part_number = info.group(1)
3434
# undo earlier space replacement and do a simple title case
35-
part_name = info.group(2).replace('-', ' ').title()
35+
part_name = info.group(2).replace('-', ' ')
3636

3737
with open(output_dir / f'part-{part_number}.html', 'wt') as f:
3838
f.write(f"""

jupyter_book_to_htmlbook/toc_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def process_parts(parts, src_dir):
119119
part_number += 1 # increment numbering
120120
# create a distinct placeholder Path for downstream processing
121121
try:
122-
part_title = part["caption"].replace(' ', '-').lower()
122+
part_title = part["caption"].replace(' ', '-')
123123
except TypeError: # because it's looking for a string, getting an int
124124
message = ("Missing part caption in _toc.yml. " +
125125
"Part captions are required.")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "jupyter-book-to-htmlbook"
3-
version = "1.0.7"
3+
version = "1.0.8"
44
description = "A script to convert jupyter book html files to htmlbook for consumption in Atlas"
55
authors = ["delfanbaum"]
66

tests/test_part_processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def test_process_part(self, tmp_path):
1212
Take a path with the appropriate part designation, and create
1313
a file with the appropriate numbering and name
1414
"""
15-
part_path = Path(tmp_path / '_jb_part-1-name-of-part.html')
15+
part_path = Path(tmp_path / '_jb_part-1-Name-of-Part.html')
1616
result = process_part(part_path, tmp_path)
1717
assert result == 'part-1.html'
1818
with open(tmp_path / 'part-1.html') as f:
1919
assert f.read() == """
2020
<div xmlns="http://www.w3.org/1999/xhtml" data-type="part" id="part-1">
21-
<h1>Name Of Part</h1>
21+
<h1>Name of Part</h1>
2222
</div>""".lstrip()
2323

2424
def test_process_part_bad_name(self, tmp_path, caplog):

tests/test_toc_processing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ def test_toc_with_parts(self, tmp_path):
108108
result = get_book_toc(tmp_path)
109109
assert result == [
110110
tmp_path / '_build/html/intro.html',
111-
tmp_path / '_build/html/_jb_part-1-name-of-part-1.html',
111+
tmp_path / '_build/html/_jb_part-1-Name-of-Part-1.html',
112112
tmp_path / '_build/html/part1/chapter1.html',
113113
[tmp_path / '_build/html/part1/chapter2.html',
114114
tmp_path / '_build/html/part1/section2-1.html'],
115-
tmp_path / '_build/html/_jb_part-2-name-of-part-2.html',
115+
tmp_path / '_build/html/_jb_part-2-Name-of-Part-2.html',
116116
tmp_path / '_build/html/part2/chapter1.html',
117117
[tmp_path / '_build/html/part2/chapter2.html',
118118
tmp_path / '_build/html/part2/section2-1.html']
@@ -146,10 +146,10 @@ def test_toc_with_parts_move_preface(self, tmp_path):
146146
assert result == [
147147
tmp_path / '_build/html/intro.html',
148148
tmp_path / '_build/html/path-to/00-Preface.html',
149-
tmp_path / '_build/html/_jb_part-1-name-of-part-1.html',
149+
tmp_path / '_build/html/_jb_part-1-Name-of-Part-1.html',
150150
[tmp_path / '_build/html/part1/chapter2.html',
151151
tmp_path / '_build/html/part1/section2-1.html'],
152-
tmp_path / '_build/html/_jb_part-2-name-of-part-2.html',
152+
tmp_path / '_build/html/_jb_part-2-Name-of-Part-2.html',
153153
tmp_path / '_build/html/part2/chapter1.html',
154154
[tmp_path / '_build/html/part2/chapter2.html',
155155
tmp_path / '_build/html/part2/section2-1.html']
@@ -182,10 +182,10 @@ def test_toc_with_parts_move_preface_but_multiple(self, tmp_path):
182182
tmp_path / '_build/html/intro.html',
183183
tmp_path / '_build/html/path-to/preface.html',
184184
tmp_path / '_build/html/path-to/second-preface.html',
185-
tmp_path / '_build/html/_jb_part-1-name-of-part-1.html',
185+
tmp_path / '_build/html/_jb_part-1-Name-of-Part-1.html',
186186
[tmp_path / '_build/html/part1/chapter2.html',
187187
tmp_path / '_build/html/part1/chapter-section.html'],
188-
tmp_path / '_build/html/_jb_part-2-name-of-part-2.html',
188+
tmp_path / '_build/html/_jb_part-2-Name-of-Part-2.html',
189189
tmp_path / '_build/html/part2/chapter1.html',
190190
[tmp_path / '_build/html/part2/chapter2.html',
191191
tmp_path / '_build/html/part2/section2-1.html']
@@ -213,11 +213,11 @@ def test_prefaces_in_sections_do_not_move(self, tmp_path):
213213
tmp_path / '_build/html/intro.html',
214214
tmp_path / '_build/html/path-to/preface.html',
215215
tmp_path / '_build/html/path-to/second-preface.html',
216-
tmp_path / '_build/html/_jb_part-1-name-of-part-1.html',
216+
tmp_path / '_build/html/_jb_part-1-Name-of-Part-1.html',
217217
[tmp_path / '_build/html/part1/chapter2.html',
218218
tmp_path / '_build/html/part1/chapter-section.html',
219219
tmp_path / '_build/html/part1/preface-1.html'],
220-
tmp_path / '_build/html/_jb_part-2-name-of-part-2.html',
220+
tmp_path / '_build/html/_jb_part-2-Name-of-Part-2.html',
221221
tmp_path / '_build/html/example.html'
222222
]
223223

0 commit comments

Comments
 (0)