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

Commit

Permalink
fix(Build): Fix ts-node theme import failing package genereation
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ketch committed Apr 8, 2020
1 parent dda64b5 commit 2981366
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 46 deletions.
87 changes: 43 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ Extensions provide styling, and potentially interactivity, for node types that d
| [cite-apa](./themes/cite-apa) | Provides styling for in-text citations and bibliographies in accordance with the [American Psychological Association (APA) style](https://en.wikipedia.org/wiki/APA_style). |
| [cite-mla](./themes/cite-mla) | Provides styling for in-text citations and bibliographies in accordance with the [Modern Language Association (MLA) style](https://style.mla.org/). |
| [code](./themes/code) | Provides syntax highlighting for `CodeFragment` and `CodeBlock` nodes using [Prism](https://prismjs.com/). Will not style executable node types like `CodeExpression` and `CodeChunk` which are styled by the base Stencila Web Components. |
| [headings](./themes/headings) | A temporary extensions that changes the way that `Heading` nodes are represented. Ensures that there is only one `<h1>` tag (for the `title` property) and that `Heading` nodes are represented as `<h${depth+1}>`. |
| [math](./themes/math) | Provides styling of math nodes using MathJax fonts and styles. Use this if there is any likely to be math content, i.e. `MathFragment` and/or `MathBlock` nodes, in documents that your theme targets. |
| [pages](./themes/pages) | Provides a [`@media print` CSS at-rule](https://developer.mozilla.org/en-US/docs/Web/CSS/@page) to modify properties when printing a document e.g. to PDF. |
| [person](./themes/person) | Provides styling of `Person` nodes e.g the `authors` of an article, or authors for each `citation` in it's `references`. |
Expand Down Expand Up @@ -435,15 +434,15 @@ Several utility functions are provided in the [`util`](./src/util) module for tr
### ready(func)
Register a function to be executed when the DOM is fully loaded.

**Kind**: global function
**Kind**: global function
**Detail**: Use this to wrap calls to the DOM selection and manipulation functions
to be sure that the DOM is ready before working on it.
to be sure that the DOM is ready before working on it.

| Param | Type | Description |
| --- | --- | --- |
| func | <code>function</code> | Function to register |

**Example**
**Example**
```js
ready(() => {
// Use other DOM manipulation functions here
Expand All @@ -454,23 +453,23 @@ ready(() => {
### first([elem], selector) ⇒ <code>Element</code> \| <code>null</code>
Select the first element matching a CSS selector.

**Kind**: global function
**Returns**: <code>Element</code> \| <code>null</code> - An `Element` or `null` if no match
**Kind**: global function
**Returns**: <code>Element</code> \| <code>null</code> - An `Element` or `null` if no match
**Detail**: This function provides a short hand for `querySelector` but
also allowing for the use of semantic selectors.
You can use it for the whole document, or scoped to a particular element.
You can use it for the whole document, or scoped to a particular element.

| Param | Type | Description |
| --- | --- | --- |
| [elem] | <code>Element</code> | The element to query (defaults to the `window.document`) |
| selector | <code>string</code> | The selector to match |

**Example** *(Select the first element from the document matching selector)*
**Example** *(Select the first element from the document matching selector)*
```js

first(':--CodeChunk')
```
**Example** *(Select the first element within an element matching the selector)*
**Example** *(Select the first element within an element matching the selector)*
```js

first(elem, ':--author')
Expand All @@ -480,23 +479,23 @@ first(elem, ':--author')
### select([elem], selector) ⇒ <code>Array.&lt;Element&gt;</code>
Select all elements matching a CSS selector.

**Kind**: global function
**Returns**: <code>Array.&lt;Element&gt;</code> - An array of elements
**Kind**: global function
**Returns**: <code>Array.&lt;Element&gt;</code> - An array of elements
**Detail**: Provides a short hand for using `querySelectorAll` but
also allowing for the use of semantic selectors. You can use it for
the whole document, or scoped to a particular element.
the whole document, or scoped to a particular element.

| Param | Type | Description |
| --- | --- | --- |
| [elem] | <code>Element</code> | The element to query (defaults to the `window.document`) |
| selector | <code>string</code> | The selector to match |

**Example** *(Select all elements from the document matching selector)*
**Example** *(Select all elements from the document matching selector)*
```js

select(':--CodeChunk')
```
**Example** *(Select all elements within an element matching the selector)*
**Example** *(Select all elements within an element matching the selector)*
```js

select(elem, ':--author')
Expand All @@ -506,28 +505,28 @@ select(elem, ':--author')
### create([spec], [attributes], ...children) ⇒ <code>Element</code>
Create a new element.

**Kind**: global function
**Kind**: global function
**Detail**: This function allows creation of new elements using either a
(a) HTML string (b) CSS selector like string, or (c) an `Element`.
CSS selectors are are convenient way to create elements with attributes,
particularly Microdata elements. They can be prone to syntax errors however.
Alternatively, the second argument can
be an object of attribute name:value pairs.
be an object of attribute name:value pairs.

| Param | Type | Description |
| --- | --- | --- |
| [spec] | <code>string</code> \| <code>Element</code> | Specification of element to create. |
| [attributes] | <code>object</code> \| <code>undefined</code> \| <code>null</code> \| <code>boolean</code> \| <code>number</code> \| <code>string</code> \| <code>Element</code> | Attributes for the element. |
| ...children | <code>undefined</code> \| <code>null</code> \| <code>boolean</code> \| <code>number</code> \| <code>string</code> \| <code>Element</code> | Child nodes to to add as text content or elements. |

**Example** *(Create a &lt;figure&gt; with id, class and itemtype attributes)*
**Example** *(Create a &lt;figure&gt; with id, class and itemtype attributes)*
```js

create('figure #fig1 .fig :--Figure')
// <figure id="fig1" class="fig" itemscope="" itemtype="http://schema.stenci.la/Figure">
// </figure>
```
**Example** *(As above but using an object to specify attributes)*
**Example** *(As above but using an object to specify attributes)*
```js

create('figure', {
Expand All @@ -537,7 +536,7 @@ create('figure', {
itemtype: translate(':--Figure')
})
```
**Example** *(Create a Person with a name property)*
**Example** *(Create a Person with a name property)*
```js

create(':--Person', create('span :--name', 'John Doe'))
Expand All @@ -550,31 +549,31 @@ create(':--Person', create('span :--name', 'John Doe'))
### tag(target, [value]) ⇒ <code>string</code> \| <code>Element</code>
Get or set the tag name of an element.

**Kind**: global function
**Kind**: global function
**Returns**: <code>string</code> \| <code>Element</code> - The lowercase tag name when getting,
a new element when setting.
a new element when setting.
**Detail**: Caution must be used when setting the tag. This function
does not actually change the tag of the element (that is not possible)
but instead returns a new `Element` that is a clone of the original apart
from having the new tag name. Use the `replace` function where necessary
in association with this function.
in association with this function.

| Param | Type | Description |
| --- | --- | --- |
| target | <code>Element</code> | The element to get or set the tag |
| [value] | <code>string</code> | The value of the tag (when setting) |

**Example** *(Get the tag name as a lowercase string)*
**Example** *(Get the tag name as a lowercase string)*
```js

tag(elem) // "h3"
```
**Example** *(Setting the tag actually returns a new element)*
**Example** *(Setting the tag actually returns a new element)*
```js

tag(tag(elem, 'h2')) // "h2"
```
**Example** *(Change the tag name of an element)*
**Example** *(Change the tag name of an element)*
```js

replace(elem, tag(elem, 'h2'))
Expand All @@ -584,8 +583,8 @@ replace(elem, tag(elem, 'h2'))
### attrs(target, [attributes]) ⇒ <code>object</code> \| <code>undefined</code>
Get or set the attributes of an element

**Kind**: global function
**Returns**: <code>object</code> \| <code>undefined</code> - The attributes of the element when getting, `undefined` when setting
**Kind**: global function
**Returns**: <code>object</code> \| <code>undefined</code> - The attributes of the element when getting, `undefined` when setting

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -597,21 +596,21 @@ Get or set the attributes of an element
### attr(target, name, [value]) ⇒ <code>string</code> \| <code>null</code>
Get or set the value of an attribute on an element.

**Kind**: global function
**Returns**: <code>string</code> \| <code>null</code> - a `string` if the attribute exists, `null` if does not exist, or when setting
**Kind**: global function
**Returns**: <code>string</code> \| <code>null</code> - a `string` if the attribute exists, `null` if does not exist, or when setting

| Param | Type | Description |
| --- | --- | --- |
| target | <code>Element</code> | The element to get or set the attribute |
| name | <code>string</code> | The name of the attribute |
| [value] | <code>string</code> | The value of the attribute (when setting) |

**Example** *(Set an attribute value)*
**Example** *(Set an attribute value)*
```js

attr(elem, "attr", "value")
```
**Example** *(Get an attribute)*
**Example** *(Get an attribute)*
```js

attr(elem, "attr") // "value"
Expand All @@ -621,21 +620,21 @@ attr(elem, "attr") // "value"
### text(target, [value]) ⇒ <code>string</code> \| <code>null</code> \| <code>undefined</code>
Get or set the text content of an element.

**Kind**: global function
**Kind**: global function
**Returns**: <code>string</code> \| <code>null</code> \| <code>undefined</code> - `null` if there is no text content,
`undefined` when setting
`undefined` when setting

| Param | Type | Description |
| --- | --- | --- |
| target | <code>Element</code> | The element to get or set the text content |
| [value] | <code>string</code> | The value of the text content (when setting) |

**Example** *(Set the text content)*
**Example** *(Set the text content)*
```js

text(elem, "text content")
```
**Example** *(Get the text content)*
**Example** *(Get the text content)*
```js

text(elem) // "text content"
Expand All @@ -645,7 +644,7 @@ text(elem) // "text content"
### append(target, ...elems)
Append new child elements to an element.

**Kind**: global function
**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -657,10 +656,10 @@ Append new child elements to an element.
### prepend(target, ...elems)
Prepend new child elements to an element.

**Kind**: global function
**Kind**: global function
**Detail**: When called with multiple elements to prepend
will maintain the order of those elements (at the top
of the target element).
of the target element).

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -672,7 +671,7 @@ of the target element).
### before(target, ...elems)
Insert new elements before an element.

**Kind**: global function
**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -684,7 +683,7 @@ Insert new elements before an element.
### after(target, ...elems)
Insert new elements after an element.

**Kind**: global function
**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -696,7 +695,7 @@ Insert new elements after an element.
### replace(target, ...elems)
Replace an element with a new element.

**Kind**: global function
**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -708,17 +707,17 @@ Replace an element with a new element.
### wrap(target, elem)
Wrap an element with a new element.

**Kind**: global function
**Kind**: global function
**Detail**: This function can be useful if you need
to create a container element to more easily style
a type of element.
a type of element.

| Param | Description |
| --- | --- |
| target | The element to wrap |
| elem | The element to wrap it in |

**Example** *(Wrap all figure captions in a &lt;div&gt;)*
**Example** *(Wrap all figure captions in a &lt;div&gt;)*
```js

select(':--Figure :--caption')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
},
"husky": {
"hooks": {
"pre-commit": "npm run update:selectors && npm run lint:scripts && pretty-quick --staged",
"pre-commit": "npm run update:selectors && npm run docs:readme && npm run lint:scripts && pretty-quick --staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import path from 'path'
import * as typescript from 'typescript'
import { promisify } from 'util'
import { extensions } from '../extensions'
import { themes } from '../themes'
import { themes } from '../themes/index'

const readFile = promisify(fs.readFile)
const writeFile = promisify(fs.writeFile)
Expand Down

0 comments on commit 2981366

Please sign in to comment.