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

Commit

Permalink
fix(*): Fix selectors used in references for chnages in Encoda
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Sep 5, 2019
1 parent 9864393 commit 854f427
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/common/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import './syntaxHighlight'

export const init = (): void => {
const referenceListItemSel = '[itemprop="references"] > li'
const titleSel = '[itemprop="title"]'
const referenceListItemSel = '.references > li'
const titleSel = 'span[itemprop="headline"]'
const datePublishedSel = '[itemprop="datePublished"]'
const publicationIssueSel =
'[itemtype="https://schema.stenci.la/PublicationIssue"]'
'[itemtype="https://schema.org/PublicationIssue"]'

document.querySelectorAll(referenceListItemSel).forEach(node => {
const datePublished = node.querySelector(datePublishedSel) as HTMLElement
Expand Down
12 changes: 6 additions & 6 deletions src/common/styles/citations.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
content: ')';
}

+ :--title {
+ :--headline {
display: none;
}
}
Expand All @@ -81,7 +81,7 @@
}

:--PublicationIssue {
:--title {
:--headline {
&::after {
content: ' ';
white-space: pre;
Expand Down Expand Up @@ -119,7 +119,7 @@

/* MLA Citation Styles */
:--citation-style-MLA {
:--CreativeWork > :--title {
:--CreativeWork > :--headline {
&:first-of-type {
display: none;
}
Expand Down Expand Up @@ -177,7 +177,7 @@
}

:--datePublished {
+ :--title {
+ :--headline {
display: inline;
}
}
Expand Down Expand Up @@ -211,7 +211,7 @@

/* APA Citation Styles */
:--citation-style-APA {
:--CreativeWork > :--title {
:--CreativeWork > :--headline {
&::after {
content: '.';
}
Expand Down Expand Up @@ -260,7 +260,7 @@
:--PublicationIssue {
display: inline;

:--title {
:--headline {
&::after {
content: ', ';
font-style: normal;
Expand Down
11 changes: 8 additions & 3 deletions src/common/styles/selectors.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
@custom-selector :--PublicationIssue [itemtype='https://schema.stenci.la/PublicationIssue'];

/* Properties */

/* schema.org properties */
@custom-selector :--abstracts [itemprop='abstracts'];
@custom-selector :--author [itemprop='author'];
@custom-selector :--authorDetails [itemprop='authorDetails'];
@custom-selector :--authors [itemprop='authors'];
@custom-selector :--citation [itemprop='citation'];
@custom-selector :--datePublished [itemprop='datePublished'];
@custom-selector :--familyName [itemprop='familyName'];
@custom-selector :--givenName [itemprop='givenName'];
@custom-selector :--headline [itemprop='headline'];
@custom-selector :--issueNumber [itemprop='issueNumber'];
@custom-selector :--pagination [itemprop='pagination'];
@custom-selector :--references [itemprop='references'];
@custom-selector :--title [itemprop='title'];
@custom-selector :--url [itemprop='url'];

/* Custom properties / names */
@custom-selector :--authors .authors;
@custom-selector :--references .references;
4 changes: 2 additions & 2 deletions src/themes/eLife/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ blockquote {
}

:--CreativeWork {
> :--title:first-of-type {
> :--headline:first-of-type {
display: block;
font-size: 1rem;
line-height: 1.5;
Expand All @@ -336,7 +336,7 @@ blockquote {
font-family: var(--body-font);
}

:--title + :--datePublished {
:--headline + :--datePublished {
display: none;
}
}
4 changes: 2 additions & 2 deletions src/themes/nature/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ blockquote {
}

/* MLA Citation Styles */
:--CreativeWork > :--title {
:--CreativeWork > :--headline {
&:first-of-type {
display: none;
}
Expand Down Expand Up @@ -544,7 +544,7 @@ blockquote {
}

:--datePublished {
+ :--title {
+ :--headline {
display: inline;
}

Expand Down
2 changes: 1 addition & 1 deletion src/themes/plos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const init = (): void => {
const referenceListItemSel = '[itemprop="references"] > li'
const datePublishedSel = '[itemprop="datePublished"]'
const publicationIssueTitleSel =
'[itemtype="https://schema.stenci.la/PublicationIssue"] [itemprop="title"]'
'[itemtype="https://schema.org/PublicationIssue"] [itemprop="title"]'

document.querySelectorAll(referenceListItemSel).forEach(node => {
// If PublicationIssue title node exists,
Expand Down
8 changes: 4 additions & 4 deletions src/themes/plos/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ blockquote {
}
}

:--CreativeWork > :--title {
:--CreativeWork > :--headline {
&:first-of-type {
display: none;
}
Expand All @@ -311,7 +311,7 @@ blockquote {
display: none;
}

:--datePublished + :--title {
:--datePublished + :--headline {
display: inline;

&::after {
Expand All @@ -321,14 +321,14 @@ blockquote {
}

:--PublicationIssue {
:--title {
:--headline {
&::after {
content: '. ';
white-space: pre;
}
}

:--title + :--datePublished {
:--headline + :--datePublished {
&:not(:last-child)::after {
content: ';';
white-space: pre;
Expand Down
4 changes: 2 additions & 2 deletions src/themes/stencila/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ blockquote {
:--CreativeWork {
margin-bottom: 1rem;

> :--title:first-of-type {
> :--headline:first-of-type {
display: block;
font-size: 1rem;
line-height: 1.5;
Expand All @@ -403,7 +403,7 @@ blockquote {
}
}

:--title + :--datePublished {
:--headline + :--datePublished {
display: none;
}
}

0 comments on commit 854f427

Please sign in to comment.