Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Commit 0dec6b6

Browse files
authored
Merge pull request #150 from trailimage/develop
fix 131
2 parents 9d4f4e8 + 3b021fe commit 0dec6b6

File tree

4 files changed

+437
-292
lines changed

4 files changed

+437
-292
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.1.6
2+
3+
- Fix block quote when it's the entire caption (issue #131)
4+
15
## 4.1.5
26

37
- Fix external map links

src/regex.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export default {
6969
return /(“|”)/g;
7070
},
7171

72-
/** Long quote followed by line break */
73-
block: /(\r\n|\r|\n)([^]{275,}[¹²³]*)\s*(\r\n|\r|\n)?/g
72+
/** Long quote followed by line break or end of text */
73+
block: /(\r\n|\r|\n|^)([^]{275,}[¹²³]*)\s*(\r\n|\r|\n|$)/g
7474
//get block() { return /[\r\n]*(“[^”]{275,}”[⁰¹²³⁴⁵⁶⁷⁸⁹]*)\s*[\r\n]/g; }
7575
},
7676

src/views/html.test.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ test('matches post categories to material icons', () => {
150150
expect(html.icon.category('Nothing')).toBe(empty);
151151
});
152152

153-
154153
test('identifies quote at end of text', () => {
155154
const source = lipsum + ds + '“' + lipsum + '”';
156155
const target =
@@ -191,6 +190,16 @@ test('identifies quote within text', () => {
191190
expect(html.caption(source)).toBe(target);
192191
});
193192

193+
test('identifies block quote when it is the entire caption', () => {
194+
const source = '“' + lipsum + '”¹';
195+
const target = '<blockquote><p>' + lipsum + '<sup>¹</sup></p></blockquote>';
196+
expect(html.caption(source)).toBe(target);
197+
});
198+
199+
// “The historic, 101-mile, single-lane, mostly-unimproved Magruder Corridor Road winds through a vast undeveloped area, offering solitude and pristine beauty as well as expansive mountain views. The corridor was created in 1980 leaving a unique road that enables a traveler to drive between two wildernesses: the 1.2 million-acre Selway-Bitterroot Wilderness to the north, and the 2.3-million-acre Frank Church-River of No Return Wilderness to the South. The road itself has changed little since its construction by the Civilian Conservation Corps (CCC) in the 1930s.”¹
200+
// ___
201+
// ¹ U.S. Forest Service, “Magruder Road Corridor”: https://www.fs.usda.gov/recarea/nezperceclearwater/recarea/?recid=16482
202+
194203
test('does not blockquote interrupted quotes', () => {
195204
// do no blockquote when quote is interrupted
196205
// “The constitutions of nearly all the states have qualifications for voters simply on citizenship,” Pefley countered, “without question with regard to what they believe on this or that question. Then I ask, why make a distinction of the people of Idaho?

0 commit comments

Comments
 (0)