ecmarkdown
Advanced tools
Comparing version 5.1.0 to 5.1.1
@@ -80,6 +80,4 @@ "use strict"; | ||
emitListItem(li) { | ||
let label = li.label === null | ||
? '' | ||
: ` id="${li.name === 'ordered-list-item' ? 'step' : 'item'}-${li.label}"`; | ||
this.str += `<li${label}>`; | ||
let id = li.id === null ? '' : ` id="${li.id}"`; | ||
this.str += `<li${id}>`; | ||
this.emitFragment(li.contents); | ||
@@ -86,0 +84,0 @@ if (li.sublist !== null) { |
@@ -66,4 +66,4 @@ export declare type Position = { | ||
}; | ||
export declare type LabelToken = { | ||
name: 'label'; | ||
export declare type IdToken = { | ||
name: 'id'; | ||
value: string; | ||
@@ -145,3 +145,3 @@ location?: LocationRange; | ||
sublist: ListNode | null; | ||
label: string | null; | ||
id: string | null; | ||
location?: LocationRange; | ||
@@ -153,3 +153,3 @@ }; | ||
sublist: ListNode | null; | ||
label: string | null; | ||
id: string | null; | ||
location?: LocationRange; | ||
@@ -156,0 +156,0 @@ }; |
@@ -81,3 +81,3 @@ "use strict"; | ||
this._t.next(); | ||
const label = this._t.tryScanLabel(); | ||
const id = this._t.tryScanId(); | ||
const contents = this.parseFragment({ inList: true }); | ||
@@ -94,3 +94,3 @@ const listItemTok = this._t.peek(); | ||
let name = kind === 'ol' ? 'ordered-list-item' : 'unordered-list-item'; | ||
return this.finish({ name, contents, sublist, label }); | ||
return this.finish({ name, contents, sublist, id }); | ||
} | ||
@@ -97,0 +97,0 @@ parseFragment(opts, closingFormatKind) { |
@@ -23,3 +23,3 @@ import type { Token, Position } from './node-types'; | ||
tryScanComment(): string | undefined; | ||
tryScanLabel(): string | null; | ||
tryScanId(): string | null; | ||
matchToken(): void; | ||
@@ -26,0 +26,0 @@ getLocation(): Position; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const commentRegexp = /^<!--[\w\W]*?-->/; | ||
const labelRegexp = /^\[label="([\w-]+)"] /; | ||
const idRegexp = /^\[id="([\w-]+)"] /; | ||
const digitRegexp = /\d/; | ||
@@ -143,5 +143,5 @@ const opaqueTags = new Set(['emu-grammar', 'emu-production', 'pre', 'code', 'script', 'style']); | ||
} | ||
// Label tokens are only valid immediately after list tokens, so we let this be called by the parser. | ||
tryScanLabel() { | ||
const match = this.str.slice(this.pos).match(labelRegexp); | ||
// ID tokens are only valid immediately after list tokens, so we let this be called by the parser. | ||
tryScanId() { | ||
const match = this.str.slice(this.pos).match(idRegexp); | ||
if (!match) { | ||
@@ -148,0 +148,0 @@ return null; |
{ | ||
"name": "ecmarkdown", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "A compiler for \"Ecmarkdown\" algorithm shorthand into HTML.", | ||
@@ -5,0 +5,0 @@ "main": "dist/ecmarkdown.js", |
@@ -58,3 +58,3 @@ # Ecmarkdown | ||
List items can be given a label by putting `[label="something"]` at the start of the item, as in `1. [label="something"]`. This will generate a `<li>` element with an id property of `step-something` or `item-something` for ordered and unordered lists respectively. This is used by Ecmarkup for referencing specific steps of Ecmarkdown algorithms. | ||
List items can be given a id by putting `[id="something"]` at the start of the item, as in `1. [id="something"]`. This will generate a `<li>` element with an id property of `something`. This is used by Ecmarkup for referencing specific steps of Ecmarkdown algorithms. | ||
@@ -61,0 +61,0 @@ #### HTML Blocks |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50171
1193