Skip to content

Commit

Permalink
fix(Themes): Update Microdata URLs and property names
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome authored and alex-ketch committed Feb 18, 2022
1 parent 2f4fc17 commit 294f511
Show file tree
Hide file tree
Showing 10 changed files with 5,189 additions and 16,365 deletions.
21,414 changes: 5,119 additions & 16,295 deletions themes/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/package.json
Expand Up @@ -78,7 +78,7 @@
"@stencila/dev-config": "3.0.2",
"@stencila/encoda": "0.119.0",
"@stencila/eslint-config": "3.0.0",
"@stencila/schema": "1.12.0",
"@stencila/schema": "file:../schema",
"@types/chromedriver": "81.0.0",
"@types/jest": "27.4.0",
"@types/jsdoc-to-markdown": "7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion themes/src/demo/parseCss.ts
Expand Up @@ -16,7 +16,7 @@ const isOutsideRootNode = (rule: Rule): boolean => {
return !(
rule.selectors.length === 1 ||
// TODO: Fix `translate` function never matching selector
rule.selectors[0] === '[itemtype~="http://schema.org/Article"]' ||
rule.selectors[0] === '[itemtype~="https://schema.org/Article"]' ||
rule.selectors[0] === ':root' ||
rule.selectors[0] === translate(':--root') ||
// TODO: Remove once this branch is rebased on https://github.com/stencila/thema/pull/85
Expand Down
8 changes: 4 additions & 4 deletions themes/src/extensions/cite-apa/index.test.ts
Expand Up @@ -4,14 +4,14 @@ const body = document.body

test('DOM manipulations', async () => {
body.innerHTML = `
<section data-itemprop="references">
<li itemscope="" itemtype="http://schema.org/Person" itemprop="author">
<section data-prop="references">
<li itemscope="" itemtype="https://schema.org/Person" itemprop="author">
<meta itemprop="name" content="Sariel J Fleishman">
<span data-itemprop="givenNames">
<span data-prop="givenNames">
<span itemprop="givenName">Sariel</span>
<span itemprop="givenName">J</span>
</span>
<span data-itemprop="familyNames">
<span data-prop="familyNames">
<span itemprop="familyName">Fleishman</span>
</span>
</li>
Expand Down
2 changes: 1 addition & 1 deletion themes/src/extensions/code/index.test.ts
Expand Up @@ -2,7 +2,7 @@ import { attr, first, whenReady } from '../../util/index'

test('Syntax highlighting of CodeBlocks', async () => {
document.body.innerHTML = `
<pre itemscope="" itemtype="http://schema.stenci.la/CodeBlock">
<pre itemscope="" itemtype="https://schema.stenci.la/CodeBlock">
<code></code>
</pre>
`
Expand Down
4 changes: 2 additions & 2 deletions themes/src/extensions/code/index.ts
Expand Up @@ -28,10 +28,10 @@ ready(() => {
(code: { element: Element; language: string }) => {
const { element } = code
const itemtype = element.getAttribute('itemtype')
if (itemtype === 'http://schema.stenci.la/CodeFragment') return false
if (itemtype === 'https://schema.stenci.la/CodeFragment') return false
if (
element.parentElement?.getAttribute('itemtype') ===
'http://schema.stenci.la/CodeBlock'
'https://schema.stenci.la/CodeBlock'
)
return false
return true
Expand Down
18 changes: 9 additions & 9 deletions themes/src/scripts/selectors.ts
Expand Up @@ -26,9 +26,9 @@ const tsPath = path.join(__dirname, '..', 'selectors.ts')
* using the `itemtype` attribute eg.
*
* ```css
* :--Article [itemtype~="http://schema.org/Article]
* :--List [itemtype~="http://schema.org/ItemList]
* :--CodeChunk [itemtype~="http://schema.stenci.la/CodeChunk]
* :--Article [itemtype~="https://schema.org/Article]
* :--List [itemtype~="https://schema.org/ItemList]
* :--CodeChunk [itemtype~="https://schema.stenci.la/CodeChunk]
* ```
*
* For array properties, there are two selectors, for different
Expand All @@ -38,7 +38,7 @@ const tsPath = path.join(__dirname, '..', 'selectors.ts')
* Selector for the property's root element (usually a <ol>)
*
* ```css
* :--authors [data-itemprop~="authors"]
* :--authors [data-prop~="authors"]
* ```
*
* Selector for the property's item elements (usually <li>s)
Expand All @@ -54,9 +54,9 @@ const tsPath = path.join(__dirname, '..', 'selectors.ts')
* ```
*/
const generateSelectors = async (): Promise<void> => {
const [attrRoot, valueRoot] = Object.entries(microdataRoot())[0]
const rootSelectorCss = `@custom-selector :--root [${attrRoot}='${valueRoot}'];`
const rootSelectorJs = `case ":--root": return "[${attrRoot}='${valueRoot}']"`
const [attrRoot, _valueRoot] = Object.entries(microdataRoot())[0]
const rootSelectorCss = `@custom-selector :--root [${attrRoot}];`
const rootSelectorJs = `case ":--root": return "[${attrRoot}]"`

const types = await jsonSchemaTypes()

Expand Down Expand Up @@ -202,8 +202,8 @@ ${propSelectorsCss.join('\n')}
* Translate a custom semantic selector to the equivalent Microdata
* attribute selector.
*
* e.g. :--Article -> [itemtype~='http://schema.org/Article']
* e.g. :--author -> [itemprop~='http://schema.org/author']
* e.g. :--Article -> [itemtype~='https://schema.org/Article']
* e.g. :--author -> [itemprop~='author']
*
* This does the inverse of the mapping defined in \`./selectors.css\`.
*/
Expand Down
80 changes: 40 additions & 40 deletions themes/src/themes/elife/test/fixtures/referencesData.fixture.ts
Expand Up @@ -11,48 +11,48 @@ import { create } from '../../../../util'
*/
// Reference 5 from articleReplication.html example.
const unformattedReference =
'<li itemscope="" itemtype="http://schema.org/Article" itemprop="citation" id="bib5">\n' +
' <ol data-itemprop="authors">\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="DJ Duffy"><span data-itemprop="givenNames"><span itemprop="givenName">DJ</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Duffy</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="A Krstic"><span data-itemprop="givenNames"><span itemprop="givenName">A</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Krstic</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="M Halasz"><span data-itemprop="givenNames"><span itemprop="givenName">M</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Halasz</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="T Schwarzl"><span data-itemprop="givenNames"><span itemprop="givenName">T</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Schwarzl</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="D Fey"><span data-itemprop="givenNames"><span itemprop="givenName">D</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Fey</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="K Iljin"><span data-itemprop="givenNames"><span itemprop="givenName">K</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Iljin</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="JP Mehta"><span data-itemprop="givenNames"><span itemprop="givenName">JP</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Mehta</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="K Killick"><span data-itemprop="givenNames"><span itemprop="givenName">K</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Killick</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="J Whilde"><span data-itemprop="givenNames"><span itemprop="givenName">J</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Whilde</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="B Turriziani"><span data-itemprop="givenNames"><span itemprop="givenName">B</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Turriziani</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="S Haapa-Paananen"><span data-itemprop="givenNames"><span itemprop="givenName">S</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Haapa-Paananen</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="V Fey"><span data-itemprop="givenNames"><span itemprop="givenName">V</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Fey</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="M Fischer"><span data-itemprop="givenNames"><span itemprop="givenName">M</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Fischer</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="F Westermann"><span data-itemprop="givenNames"><span itemprop="givenName">F</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Westermann</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="K-O Henrich"><span data-itemprop="givenNames"><span itemprop="givenName">K-O</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Henrich</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="S Bannert"><span data-itemprop="givenNames"><span itemprop="givenName">S</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Bannert</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="DG Higgins"><span data-itemprop="givenNames"><span itemprop="givenName">DG</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Higgins</span></span></li>\n' +
' <li itemscope="" itemtype="http://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="W Kolch"><span data-itemprop="givenNames"><span itemprop="givenName">W</span></span><span data-itemprop="familyNames"><span itemprop="familyName">Kolch</span></span></li>\n' +
'<li itemscope="" itemtype="https://schema.org/Article" itemprop="citation" id="bib5">\n' +
' <ol data-prop="authors">\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="DJ Duffy"><span data-prop="givenNames"><span itemprop="givenName">DJ</span></span><span data-prop="familyNames"><span itemprop="familyName">Duffy</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="A Krstic"><span data-prop="givenNames"><span itemprop="givenName">A</span></span><span data-prop="familyNames"><span itemprop="familyName">Krstic</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="M Halasz"><span data-prop="givenNames"><span itemprop="givenName">M</span></span><span data-prop="familyNames"><span itemprop="familyName">Halasz</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="T Schwarzl"><span data-prop="givenNames"><span itemprop="givenName">T</span></span><span data-prop="familyNames"><span itemprop="familyName">Schwarzl</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="D Fey"><span data-prop="givenNames"><span itemprop="givenName">D</span></span><span data-prop="familyNames"><span itemprop="familyName">Fey</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="K Iljin"><span data-prop="givenNames"><span itemprop="givenName">K</span></span><span data-prop="familyNames"><span itemprop="familyName">Iljin</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="JP Mehta"><span data-prop="givenNames"><span itemprop="givenName">JP</span></span><span data-prop="familyNames"><span itemprop="familyName">Mehta</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="K Killick"><span data-prop="givenNames"><span itemprop="givenName">K</span></span><span data-prop="familyNames"><span itemprop="familyName">Killick</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="J Whilde"><span data-prop="givenNames"><span itemprop="givenName">J</span></span><span data-prop="familyNames"><span itemprop="familyName">Whilde</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="B Turriziani"><span data-prop="givenNames"><span itemprop="givenName">B</span></span><span data-prop="familyNames"><span itemprop="familyName">Turriziani</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="S Haapa-Paananen"><span data-prop="givenNames"><span itemprop="givenName">S</span></span><span data-prop="familyNames"><span itemprop="familyName">Haapa-Paananen</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="V Fey"><span data-prop="givenNames"><span itemprop="givenName">V</span></span><span data-prop="familyNames"><span itemprop="familyName">Fey</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="M Fischer"><span data-prop="givenNames"><span itemprop="givenName">M</span></span><span data-prop="familyNames"><span itemprop="familyName">Fischer</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="F Westermann"><span data-prop="givenNames"><span itemprop="givenName">F</span></span><span data-prop="familyNames"><span itemprop="familyName">Westermann</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="K-O Henrich"><span data-prop="givenNames"><span itemprop="givenName">K-O</span></span><span data-prop="familyNames"><span itemprop="familyName">Henrich</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="S Bannert"><span data-prop="givenNames"><span itemprop="givenName">S</span></span><span data-prop="familyNames"><span itemprop="familyName">Bannert</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="DG Higgins"><span data-prop="givenNames"><span itemprop="givenName">DG</span></span><span data-prop="familyNames"><span itemprop="familyName">Higgins</span></span></li>\n' +
' <li itemscope="" itemtype="https://schema.org/Person" itemprop="author">\n' +
' <meta itemprop="name" content="W Kolch"><span data-prop="givenNames"><span itemprop="givenName">W</span></span><span data-prop="familyNames"><span itemprop="familyName">Kolch</span></span></li>\n' +
' </ol><time itemprop="datePublished" datetime="2015">2015</time><span itemprop="headline" content="Integrative omics reveals MYCN as a global suppressor of cellular signalling and enables network-based therapeutic target discovery in neuroblastoma">Integrative\n' +
' omics reveals MYCN as a global suppressor of cellular signalling and enables network-based\n' +
' therapeutic target discovery in neuroblastoma</span><span itemscope="" itemtype="http://schema.org/PublicationVolume" itemprop="isPartOf"><span itemprop="volumeNumber" data-itemtype="http://schema.org/Number">6</span><span itemscope="" itemtype="http://schema.org/Periodical" itemprop="isPartOf"><span itemprop="name">Oncotarget</span></span></span><span itemprop="pageStart" data-itemtype="http://schema.org/Number">43182</span><span itemprop="pageEnd" data-itemtype="http://schema.org/Number">43201</span><span itemscope="" itemtype="http://schema.org/Organization" itemprop="publisher">\n' +
' <meta itemprop="name" content="Unknown"><span itemscope="" itemtype="http://schema.org/ImageObject" itemprop="logo">\n' +
' therapeutic target discovery in neuroblastoma</span><span itemscope="" itemtype="https://schema.org/PublicationVolume" itemprop="isPartOf"><span itemprop="volumeNumber" data-itemtype="https://schema.org/Number">6</span><span itemscope="" itemtype="https://schema.org/Periodical" itemprop="isPartOf"><span itemprop="name">Oncotarget</span></span></span><span itemprop="pageStart" data-itemtype="https://schema.org/Number">43182</span><span itemprop="pageEnd" data-itemtype="https://schema.org/Number">43201</span><span itemscope="" itemtype="https://schema.org/Organization" itemprop="publisher">\n' +
' <meta itemprop="name" content="Unknown"><span itemscope="" itemtype="https://schema.org/ImageObject" itemprop="logo">\n' +
' <meta itemprop="url" content="https://via.placeholder.com/600x60/dbdbdb/4a4a4a.png?text=Unknown">\n' +
' </span></span>\n' +
' <meta itemprop="image" content="https://via.placeholder.com/1200x714/dbdbdb/4a4a4a.png?text=Integrative%20omics%20reveals%20MYCN%20as%20a%20global%20suppressor%20of%20cellular%20signalling%20and%20enables%20network-based%20therap%E2%80%A6">\n' +
Expand Down

0 comments on commit 294f511

Please sign in to comment.