Skip to content

Commit

Permalink
better url structure
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceninja committed Aug 11, 2023
1 parent 6ed65d8 commit c5a61ff
Show file tree
Hide file tree
Showing 26 changed files with 161 additions and 112 deletions.
5 changes: 1 addition & 4 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const markdownIt = require('markdown-it');
const markdownItAnchor = require('markdown-it-anchor');
const markdownItFootnote = require('markdown-it-footnote');

module.exports = function (eleventyConfig) {
Expand All @@ -15,9 +14,7 @@ module.exports = function (eleventyConfig) {
let options = {
html: true,
};
let markdownLibrary = markdownIt(options)
.use(markdownItAnchor)
.use(markdownItFootnote);
let markdownLibrary = markdownIt(options).use(markdownItFootnote);
eleventyConfig.setLibrary('md', markdownLibrary);

return {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
},
"devDependencies": {
"@11ty/eleventy": "2.0.1",
"markdown-it-anchor": "8.6.7",
"markdown-it-footnote": "3.0.3",
"npm-run-all": "4.1.5",
"prettier": "3.0.1",
Expand Down
8 changes: 8 additions & 0 deletions src/_data/parts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"I": {
"title": "(Being a Reprint from the Reminiscences of John H. Watson, M.D., late of the Army Medical Department.)"
},
"II": {
"title": "The Country of the Saints."
}
}
25 changes: 25 additions & 0 deletions src/_includes/chapter.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: layout.njk
---

{% if showPartTitle %}
<header class="part-header">
<h2
id="pt-{{ currentPart}}"
>
Part {{ currentPart }}.
</h2>
<p><em>{{ parts[currentPart].title }}</em></p>
</header>
<hr>
{% endif %}

<h3
class="chapter-title"
id="ch-{{ chapter }}-{{ title | slugify }}"
>
<strong>Chapter {{ chapter }}:</strong>
{{ title }}
</h3>

{{ content | safe }}
6 changes: 3 additions & 3 deletions src/_includes/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ title }} - A Study in Scarlet</title>
<title>{% if chapter %}Chapter {{ chapter }}: {% endif %}{{ title }}{% if title %}, {% endif %}A Study in Scarlet</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Expand All @@ -23,7 +23,7 @@
</main>
<hr />
<footer class="footer">
{% if show_nav %}
{% if showNav %}
<nav class="chapter-nav">
<div class="chapter-nav__item chapter-nav__prev{% if not prev %} is-disabled{% endif %}">
{% if prev %}
Expand All @@ -33,7 +33,7 @@
{% endif %}
</div>
<div class="chapter-nav__item chapter-nav__toc">
<a class="chapter-nav__link" href="../">Table of Contents</a>
<a class="chapter-nav__link" href="/">Table of Contents</a>
</div>
<div class="chapter-nav__item chapter-nav__next{% if not next %} is-disabled{% endif %}">
{% if next %}
Expand Down
8 changes: 8 additions & 0 deletions src/_scss/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ figcaption {
text-align: center;
}

.chapter-title {
text-align: center;

strong {
display: block;
}
}

.chapter-nav {
display: flex;
gap: 1em;
Expand Down
9 changes: 4 additions & 5 deletions src/index.njk
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
layout: layout.njk
title: A Study in Scarlet
main_class: toc
---

<h1>A Study in Scarlet</h1>
<h1 id="a-study-in-scarlet">A Study in Scarlet</h1>
<p class="credits">By A. Conan Doyle</p>
<p class="credits">With numerous original engravings by D.H. Friston.</p>

Expand All @@ -20,13 +19,13 @@ main_class: toc
</figcaption>
</figure>

<h2>Contents</h2>
<h2 id="contents">Contents</h2>

<section>
<header class="toc-header">
<h3>Part I.</h3>
<p>
<i>(Being a Reprint from the Reminiscences of <em>John H. Watson, M.D.</em>, late of the Army Medical Department.)</i>
<i>{{ parts['I'].title }}</i>
</p>
</header>
<ol type="I">
Expand All @@ -44,7 +43,7 @@ main_class: toc
<header class="toc-header">
<h3>Part II.</h3>
<p>
<i>The Country of the Saints.</i>
<i>{{ parts['I'].title }}</i>
</p>
</header>
<ol type="I">
Expand Down
17 changes: 4 additions & 13 deletions src/1-1.md → src/part-1/chapter-1.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: I
title: Mr. Sherlock Holmes
tags:
- chapters
- partOne
date: 1887-01-01
show_nav: true
next: 1-2
showNav: true
showPartTitle: true
next: chapter-2
---

<header class="part-header">

## Part I.

_(Being a Reprint from the Reminiscences of *John H. Watson, M.D.*, late of the Army Medical Department.)_

</header>

### Chapter {{chapter}}: {{ title }}

In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. Having completed my studies there, I was duly attached to the Fifth Northumberland Fusiliers as Assistant Surgeon. The regiment was stationed in India at the time, and before I could join it, the second Afghan war had broken out. On landing at Bombay, I learned that my corps had advanced through the passes, and was already deep in the enemy’s country. I followed, however, with many other officers who were in the same situation as myself, and succeeded in reaching Candahar in safety, where I found my regiment, and at once entered upon my new duties.

The campaign brought honours and promotion to many, but for me it had nothing but misfortune and disaster. I was removed from my brigade and attached to the Berkshires, with whom I served at the fatal battle of Maiwand. There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery. I should have fallen into the hands of the murderous Ghazis had it not been for the devotion and courage shown by Murray, my orderly, who threw me across a pack-horse, and succeeded in bringing me safely to the British lines.
Expand Down
10 changes: 4 additions & 6 deletions src/1-2.md → src/part-1/chapter-2.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: II
title: The Science of Deduction
tags:
- chapters
- partOne
date: 1887-01-02
show_nav: true
prev: 1-1
next: 1-3
showNav: true
prev: chapter-1
next: chapter-3
---

### Chapter {{chapter}}: {{ title }}

We met next day as he had arranged, and inspected the rooms at No. 221B, Baker Street, of which he had spoken at our meeting. They consisted of a couple of comfortable bed-rooms and a single large airy sitting-room, cheerfully furnished, and illuminated by two broad windows. So desirable in every way were the apartments, and so moderate did the terms seem when divided between us, that the bargain was concluded upon the spot, and we at once entered into possession. That very evening I moved my things round from the hotel, and on the following morning Sherlock Holmes followed me with several boxes and portmanteaus. For a day or two we were busily employed in unpacking and laying out our property to the best advantage. That done, we gradually began to settle down and to accommodate ourselves to our new surroundings.

Holmes was certainly not a difficult man to live with. He was quiet in his ways, and his habits were regular. It was rare for him to be up after ten at night, and he had invariably breakfasted and gone out before I rose in the morning. Sometimes he spent his day at the chemical laboratory, sometimes in the dissecting-rooms, and occasionally in long walks, which appeared to take him into the lowest portions of the City. Nothing could exceed his energy when the working fit was upon him; but now and again a reaction would seize him, and for days on end he would lie upon the sofa in the sitting-room, hardly uttering a word or moving a muscle from morning to night. On these occasions I have noticed such a dreamy, vacant expression in his eyes, that I might have suspected him of being addicted to the use of some narcotic, had not the temperance and cleanliness of his whole life forbidden such a notion.
Expand Down
10 changes: 4 additions & 6 deletions src/1-3.md → src/part-1/chapter-3.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: III
title: The Lauriston Gardens Mystery
tags:
- chapters
- partOne
date: 1887-01-03
show_nav: true
prev: 1-2
next: 1-4
showNav: true
prev: chapter-2
next: chapter-4
---

### Chapter {{chapter}}: {{ title }}

I confess that I was considerably startled by this fresh proof of the practical nature of my companion’s theories. My respect for his powers of analysis increased wondrously. There still remained some lurking suspicion in my mind, however, that the whole thing was a pre-arranged episode, intended to dazzle me, though what earthly object he could have in taking me in was past my comprehension. When I looked at him he had finished reading the note, and his eyes had assumed the vacant, lack-lustre expression which showed mental abstraction.

“How in the world did you deduce that?” I asked.
Expand Down
10 changes: 4 additions & 6 deletions src/1-4.md → src/part-1/chapter-4.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: IV
title: What John Rance had to Tell
tags:
- chapters
- partOne
date: 1887-01-04
show_nav: true
prev: 1-3
next: 1-5
showNav: true
prev: chapter-3
next: chapter-5
---

### Chapter {{chapter}}: {{ title }}

It was one o’clock when we left No. 3, Lauriston Gardens. Sherlock Holmes led me to the nearest telegraph office, whence he dispatched a long telegram. He then hailed a cab, and ordered the driver to take us to the address given us by Lestrade.

“There is nothing like first hand evidence,” he remarked; “as a matter of fact, my mind is entirely made up upon the case, but still we may as well learn all that is to be learned.”
Expand Down
10 changes: 4 additions & 6 deletions src/1-5.md → src/part-1/chapter-5.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: V
title: Our Advertisement Brings a Visitor
tags:
- chapters
- partOne
date: 1887-01-05
show_nav: true
prev: 1-4
next: 1-6
showNav: true
prev: chapter-4
next: chapter-6
---

### Chapter {{chapter}}: {{ title }}

Our morning’s exertions had been too much for my weak health, and I was tired out in the afternoon. After Holmes’ departure for the concert, I lay down upon the sofa and endeavoured to get a couple of hours’ sleep. It was a useless attempt. My mind had been too much excited by all that had occurred, and the strangest fancies and surmises crowded into it. Every time that I closed my eyes I saw before me the distorted baboon-like countenance of the murdered man. So sinister was the impression which that face had produced upon me that I found it difficult to feel anything but gratitude for him who had removed its owner from the world. If ever human features bespoke vice of the most malignant type, they were certainly those of Enoch J. Drebber, of Cleveland. Still I recognized that justice must be done, and that the depravity of the victim was no condonement in the eyes of the law.

The more I thought of it the more extraordinary did my companion’s hypothesis, that the man had been poisoned, appear. I remembered how he had sniffed his lips, and had no doubt that he had detected something which had given rise to the idea. Then, again, if not poison, what had caused the man’s death, since there was neither wound nor marks of strangulation? But, on the other hand, whose blood was that which lay so thickly upon the floor? There were no signs of a struggle, nor had the victim any weapon with which he might have wounded an antagonist. As long as all these questions were unsolved, I felt that sleep would be no easy matter, either for Holmes or myself. His quiet self-confident manner convinced me that he had already formed a theory which explained all the facts, though what it was I could not for an instant conjecture.
Expand Down
10 changes: 4 additions & 6 deletions src/1-6.md → src/part-1/chapter-6.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: VI
title: Tobias Gregson Shows What he Can do
tags:
- chapters
- partOne
date: 1887-01-06
show_nav: true
prev: 1-5
next: 1-7
showNav: true
prev: chapter-5
next: chapter-7
---

### Chapter {{chapter}}: {{ title }}

The papers next day were full of the “Brixton Mystery,” as they termed it. Each had a long account of the affair, and some had leaders upon it in addition. There was some information in them which was new to me. I still retain in my scrap-book numerous clippings and extracts bearing upon the case. Here is a condensation of a few of them:—

The _Daily Telegraph_ remarked that in the history of crime there had seldom been a tragedy which presented stranger features. The German name of the victim, the absence of all other motive, and the sinister inscription on the wall, all pointed to its perpetration by political refugees and revolutionists. The Socialists had many branches in America, and the deceased had, no doubt, infringed their unwritten laws, and been tracked down by them. After alluding airily to the Vehmgericht, aqua tofana, Carbonari, the Marchioness de Brinvilliers, the Darwinian theory, the principles of Malthus, and the Ratcliff Highway murders, the article concluded by admonishing the Government and advocating a closer watch over foreigners in England.
Expand Down
10 changes: 4 additions & 6 deletions src/1-7.md → src/part-1/chapter-7.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: VII
title: Light in the Darkness
tags:
- chapters
- partOne
date: 1887-01-07
show_nav: true
prev: 1-6
next: 2-1
showNav: true
prev: chapter-6
next: ../part-2/chapter-1
---

### Chapter {{chapter}}: {{ title }}

The intelligence with which Lestrade greeted us was so momentous and so unexpected, that we were all three fairly dumfoundered. Gregson sprang out of his chair and upset the remainder of his whiskey and water. I stared in silence at Sherlock Holmes, whose lips were compressed and his brows drawn down over his eyes.

“Stangerson too!” he muttered. “The plot thickens.”
Expand Down
25 changes: 25 additions & 0 deletions src/part-1/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: layout.njk
eleventyComputed:
title: 'Part {{ currentPart }}'
---

<h2>Contents</h2>

<section>
<header class="toc-header">
<h3>Part {{ currentPart }}.</h3>
<p>
<i>{{ parts[currentPart].title }}</i>
</p>
</header>
<ol type="I">
{% for chapter in collections.partOne %}
<li>
<a href="{{ chapter.page.url }}">
{{ chapter.data.title }}
</a>
</li>
{% endfor %}
</ol>
</section>
3 changes: 3 additions & 0 deletions src/part-1/part-1.11tydata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"currentPart": "I"
}
15 changes: 5 additions & 10 deletions src/2-1.md → src/part-2/chapter-1.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
---
layout: layout.njk
layout: chapter.njk
chapter: I
title: On the Great Alkali Plain
tags:
- chapters
- partTwo
date: 1887-02-01
show_nav: true
prev: 1-7
next: 2-2
showNav: true
showPartTitle: true
prev: ../part-1/chapter-7
next: chapter-2
---

## Part II.

_The Country of the Saints._

### Chapter {{chapter}}: {{ title }}

In the central portion of the great North American Continent there lies an arid and repulsive desert, which for many a long year served as a barrier against the advance of civilisation. From the Sierra Nevada to Nebraska, and from the Yellowstone River in the north to the Colorado upon the south, is a region of desolation and silence. Nor is Nature always in one mood throughout this grim district. It comprises snow-capped and lofty mountains, and dark and gloomy valleys. There are swift-flowing rivers which dash through jagged cañons; and there are enormous plains, which in winter are white with snow, and in summer are grey with the saline alkali dust. They all preserve, however, the common characteristics of barrenness, inhospitality, and misery.

There are no inhabitants of this land of despair. A band of Pawnees or of Blackfeet may occasionally traverse it in order to reach other hunting-grounds, but the hardiest of the braves are glad to lose sight of those awesome plains, and to find themselves once more upon their prairies. The coyote skulks among the scrub, the buzzard flaps heavily through the air, and the clumsy grizzly bear lumbers through the dark ravines, and picks up such sustenance as it can amongst the rocks. These are the sole dwellers in the wilderness.
Expand Down
10 changes: 4 additions & 6 deletions src/2-2.md → src/part-2/chapter-2.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: layout.njk
layout: chapter.njk
chapter: II
title: The Flower of Utah
tags:
- chapters
- partTwo
date: 1887-02-02
show_nav: true
prev: 2-1
next: 2-3
showNav: true
prev: chapter-1
next: chapter-3
---

### Chapter {{chapter}}: {{ title }}

This is not the place to commemorate the trials and privations endured by the immigrant Mormons before they came to their final haven. From the shores of the Mississippi to the western slopes of the Rocky Mountains they had struggled on with a constancy almost unparalleled in history. The savage man, and the savage beast, hunger, thirst, fatigue, and disease—every impediment which Nature could place in the way, had all been overcome with Anglo-Saxon tenacity. Yet the long journey and the accumulated terrors had shaken the hearts of the stoutest among them. There was not one who did not sink upon his knees in heartfelt prayer when they saw the broad valley of Utah bathed in the sunlight beneath them, and learned from the lips of their leader that this was the promised land, and that these virgin acres were to be theirs for evermore.

Young speedily proved himself to be a skilful administrator as well as a resolute chief. Maps were drawn and charts prepared, in which the future city was sketched out. All around farms were apportioned and allotted in proportion to the standing of each individual. The tradesman was put to his trade and the artisan to his calling. In the town streets and squares sprang up, as if by magic. In the country there was draining and hedging, planting and clearing, until the next summer saw the whole country golden with the wheat crop. Everything prospered in the strange settlement. Above all, the great temple which they had erected in the centre of the city grew ever taller and larger. From the first blush of dawn until the closing of the twilight, the clatter of the hammer and the rasp of the saw was never absent from the monument which the immigrants erected to Him who had led them safe through many dangers.
Expand Down
Loading

0 comments on commit c5a61ff

Please sign in to comment.