Skip to content

Commit

Permalink
the "Maida Heatter" case: allow author names to be in Headers (h3-h6)
Browse files Browse the repository at this point in the history
  • Loading branch information
buzcarter committed Nov 11, 2023
1 parent b0b32c6 commit 9cc4178
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/buildRecipes.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ function getHelpSection(helpURLs, name) {

function convertRecipe(outputHTML, recipeHTML, opts) {
const {
name, image,
name,
heroImgURL: image,
autoUrlSections, defaultTheme, favicon, useFractionSymbols, helpURLs, includeHelpLinks, shortenURLs, titleSuffix,
} = opts;
let recipeName = '';
Expand Down
11 changes: 10 additions & 1 deletion src/libs/__tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ describe('buildRecipes', () => {
});
});

describe('', () => {
describe('getAuthor', () => {
const { getAuthor } = utils;

it('should happy path', () => {
const Tests = [{
value: ``,
Expand Down Expand Up @@ -188,6 +189,14 @@ from Mellisa Clark at the New York Times
by Jeff "Handsy" Smith aka "The Frugal Gourmet" (WBEZ Chicago)
`,
expectedResult: 'Jeff "Handsy" Smith aka "The Frugal Gourmet"',
}, {
value: `
# Positively-the-Absolutely-Best-Chocolate-Chip Cookies
### From Maida Heatter
* Yield: **50** cookies.
`,
expectedResult: 'Maida Heatter'
}];

Tests.forEach(({ value, expectedResult}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const RegExes = {
// #endregion

// #region Find Author Credit
AUTHOR: /^\s*(?:by|courtesy of|from(?: the)? kitchen of|from)\s*[ :-]\s*([A-Z][\w "]+)/im
AUTHOR: /^(?:#{3,6})?\s*(?:by|courtesy of|from(?: the)? kitchen of|from)\s*[ :-]\s*([A-Z][\w "]+)/im
// #endregion
};

Expand Down
12 changes: 6 additions & 6 deletions src/static/styles/recipesIndex.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
--color-view-btn-selected: var(--color-primary);
--color-view-svg-selected: var(--color-neutral-00);

--color-filter-inactive: var(--color-neutral-25);
--color-filter-hover: var(--color-neutral-80);
--color-filter-focus: var(--color-neutral-50);
--color-filter-inactive: var(--color-neutral-25);
--color-filter-hover: var(--color-neutral-80);
--color-filter-focus: var(--color-neutral-50);

--search-input-height: 40px;
--search-icon-length: 18px;
Expand Down Expand Up @@ -214,10 +214,11 @@ body .recipe-list .recipe-list__item--hidden {
}

.recipe-list__author {
color: var(--color-neutral-50);
display: block;
font-style: normal;
font-size: 90%;
color: var(--color-neutral-50);
font-style: normal;
font-weight: 300;
}

/* Shared */
Expand All @@ -232,7 +233,6 @@ body .recipe-list .recipe-list__item--hidden {
break-inside: avoid-column;
}


/* view: Compact List */
.view--compact-list .recipe-list__author,
.view--compact-list .recipe-list__photo {
Expand Down

0 comments on commit 9cc4178

Please sign in to comment.