Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pattern properties #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 161 additions & 140 deletions lib/generateMarkdown.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions lib/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function styleBold(string) {
function styleCode(code) {
if (defined(code)) {
// If it's an object, just serialize it.
if (typeof code === 'object') {
if (typeof code === 'object' && code.constructor != RegExp) {
// Someday may want to use a code fence if it's longer than, say, 88
// chars, but that would require keeping track of the current
// indentation. Not really how things are designed to work right
Expand All @@ -353,7 +353,8 @@ function styleCode(code) {
var stringified = code.toString();

if (stringified.length > 0) {
return '`' + stringified + '`';
// Escape ` so it doesn't end early, and | so it works in a table cell.
return '`' + stringified.replaceAll(/([`|])/g, '\\$1') + '`';
}
}

Expand Down
38 changes: 38 additions & 0 deletions test/test-golden/v2020-12-embed.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I

|===

.`Image` Pattern Properties
|===
| |Type|Description|Required

|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**
|`string`
|The background color for the image
|No

|**`/^(?:height\|width)$/`**
|`string`
|A dimension for the image
|No

|===

Additional properties are allowed.

* **JSON schema**: <<schema-reference-image,`image.schema.json`>>
Expand Down Expand Up @@ -93,6 +109,28 @@ An array of three fractional numbers.
** `[18, 0.1, 1.1]`


=== Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"rgb(255, 99, 71)"`
** `"#ff6347"`
** `"hsl(9, 100%, 64%)"`

=== Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"10"`
** `"400px"`


== Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
29 changes: 29 additions & 0 deletions test/test-golden/v2020-12-keyword.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I
|**fraction**|`number`|A number that **MUST** be between zero and one.|No|
|**moreFractions**|`number` `[3]`|An array of three fractional numbers.|No, default: `[0.1,0.2,0.3]`|

**`Image` Pattern Properties**

| |Type|Description|Required|
|---|---|---|---|
|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**|`string`|The background color for the image|No|
|**`/^(?:height\|width)$/`**|`string`|A dimension for the image|No|

Additional properties are allowed.

### Image.uri
Expand Down Expand Up @@ -72,6 +79,28 @@ An array of three fractional numbers.
* `[18, 0.1, 1.1]`


### Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"rgb(255, 99, 71)"`
* `"#ff6347"`
* `"hsl(9, 100%, 64%)"`

### Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"10"`
* `"400px"`


## Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
38 changes: 38 additions & 0 deletions test/test-golden/v2020-12-linked.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I

|===

.`Image` Pattern Properties
|===
| |Type|Description|Required

|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**
|`string`
|The background color for the image
|No

|**`/^(?:height\|width)$/`**
|`string`
|A dimension for the image
|No

|===

Additional properties are allowed.

* **JSON schema**: link:schema/image.schema.json[image.schema.json]
Expand Down Expand Up @@ -95,6 +111,28 @@ An array of three fractional numbers.
** `[18, 0.1, 1.1]`


==== Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"rgb(255, 99, 71)"`
** `"#ff6347"`
** `"hsl(9, 100%, 64%)"`

==== Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"10"`
** `"400px"`


=== Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
29 changes: 29 additions & 0 deletions test/test-golden/v2020-12-linked.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I
|**fraction**|`number`|A number that **MUST** be between zero and one.|No|
|**moreFractions**|`number` `[3]`|An array of three fractional numbers.|No, default: `[0.1,0.2,0.3]`|

**`Image` Pattern Properties**

| |Type|Description|Required|
|---|---|---|---|
|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**|`string`|The background color for the image|No|
|**`/^(?:height\|width)$/`**|`string`|A dimension for the image|No|

Additional properties are allowed.

* **JSON schema**: [image.schema.json](schema/image.schema.json)
Expand Down Expand Up @@ -74,6 +81,28 @@ An array of three fractional numbers.
* `[18, 0.1, 1.1]`


#### Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"rgb(255, 99, 71)"`
* `"#ff6347"`
* `"hsl(9, 100%, 64%)"`

#### Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"10"`
* `"400px"`


### Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
38 changes: 38 additions & 0 deletions test/test-golden/v2020-12-remote.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I

|===

.`Image` Pattern Properties
|===
| |Type|Description|Required

|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**
|`string`
|The background color for the image
|No

|**`/^(?:height\|width)$/`**
|`string`
|A dimension for the image
|No

|===

Additional properties are allowed.

* **JSON schema**: link:https://www.khronos.org/wetzel/just/testing/schema/image.schema.json[image.schema.json]
Expand Down Expand Up @@ -93,6 +109,28 @@ An array of three fractional numbers.
** `[18, 0.1, 1.1]`


=== Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"rgb(255, 99, 71)"`
** `"#ff6347"`
** `"hsl(9, 100%, 64%)"`

=== Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"10"`
** `"400px"`


== Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
29 changes: 29 additions & 0 deletions test/test-golden/v2020-12-remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I
|**fraction**|`number`|A number that **MUST** be between zero and one.|No|
|**moreFractions**|`number` `[3]`|An array of three fractional numbers.|No, default: `[0.1,0.2,0.3]`|

**`Image` Pattern Properties**

| |Type|Description|Required|
|---|---|---|---|
|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**|`string`|The background color for the image|No|
|**`/^(?:height\|width)$/`**|`string`|A dimension for the image|No|

Additional properties are allowed.

* **JSON schema**: [image.schema.json](https://www.khronos.org/wetzel/just/testing/schema/image.schema.json)
Expand Down Expand Up @@ -72,6 +79,28 @@ An array of three fractional numbers.
* `[18, 0.1, 1.1]`


### Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"rgb(255, 99, 71)"`
* `"#ff6347"`
* `"hsl(9, 100%, 64%)"`

### Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"10"`
* `"400px"`


## Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
38 changes: 38 additions & 0 deletions test/test-golden/v2020-12-simple.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I

|===

.`Image` Pattern Properties
|===
| |Type|Description|Required

|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**
|`string`
|The background color for the image
|No

|**`/^(?:height\|width)$/`**
|`string`
|A dimension for the image
|No

|===

Additional properties are allowed.

=== Image.uri
Expand Down Expand Up @@ -93,6 +109,28 @@ An array of three fractional numbers.
** `[18, 0.1, 1.1]`


=== Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"rgb(255, 99, 71)"`
** `"#ff6347"`
** `"hsl(9, 100%, 64%)"`

=== Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
** `"10"`
** `"400px"`


== Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
29 changes: 29 additions & 0 deletions test/test-golden/v2020-12-simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Image data used to create a texture. Image **MAY** be referenced by an URI (or I
|**fraction**|`number`|A number that **MUST** be between zero and one.|No|
|**moreFractions**|`number` `[3]`|An array of three fractional numbers.|No, default: `[0.1,0.2,0.3]`|

**`Image` Pattern Properties**

| |Type|Description|Required|
|---|---|---|---|
|**`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`**|`string`|The background color for the image|No|
|**`/^(?:height\|width)$/`**|`string`|A dimension for the image|No|

Additional properties are allowed.

### Image.uri
Expand Down Expand Up @@ -72,6 +79,28 @@ An array of three fractional numbers.
* `[18, 0.1, 1.1]`


### Image.`/^(?:rgb\|hex\|hsl\|rgba\|hsla)Color/`

The background color for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"rgb(255, 99, 71)"`
* `"#ff6347"`
* `"hsl(9, 100%, 64%)"`

### Image.`/^(?:height\|width)$/`

A dimension for the image

* **Type**: `string`
* **Required**: No
* **Examples**:
* `"10"`
* `"400px"`


## Examples

* `{"uri": "https://raw.githubusercontent.com/KhronosGroup/glTF/main/specification/figures/gltf.png", "mimeType": "image/png"}`
Expand Down
Loading