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

Commit

Permalink
Merge pull request #150 from trailimage/develop
Browse files Browse the repository at this point in the history
fix 131
  • Loading branch information
Jason-Abbott authored Sep 2, 2018
2 parents 9d4f4e8 + 3b021fe commit 0dec6b6
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 292 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.1.6

- Fix block quote when it's the entire caption (issue #131)

## 4.1.5

- Fix external map links
Expand Down
4 changes: 2 additions & 2 deletions src/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export default {
return /(“|”)/g;
},

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

Expand Down
11 changes: 10 additions & 1 deletion src/views/html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ test('matches post categories to material icons', () => {
expect(html.icon.category('Nothing')).toBe(empty);
});


test('identifies quote at end of text', () => {
const source = lipsum + ds + '“' + lipsum + '”';
const target =
Expand Down Expand Up @@ -191,6 +190,16 @@ test('identifies quote within text', () => {
expect(html.caption(source)).toBe(target);
});

test('identifies block quote when it is the entire caption', () => {
const source = '“' + lipsum + '”¹';
const target = '<blockquote><p>' + lipsum + '<sup>¹</sup></p></blockquote>';
expect(html.caption(source)).toBe(target);
});

// “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.”¹
// ___
// ¹ U.S. Forest Service, “Magruder Road Corridor”: https://www.fs.usda.gov/recarea/nezperceclearwater/recarea/?recid=16482

test('does not blockquote interrupted quotes', () => {
// do no blockquote when quote is interrupted
// “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?
Expand Down
Loading

0 comments on commit 0dec6b6

Please sign in to comment.