-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
627f8ae
commit 0afdea1
Showing
7 changed files
with
402 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
export function runUnregisteredConditionalPropError(prop: string): string { | ||
|
||
return ` ${prop} is not a registered conditional property. Register it like: | ||
<!--conditional = ${prop}--> | ||
` | ||
|
||
} | ||
|
||
export function runIllegalValueError(value: string): string { | ||
|
||
return `${value} seems to be a reference's name, avoid this please!` | ||
|
||
} | ||
|
||
export function runHasNoreThanOneConditionalAttrsError(tagName: string | undefined): string { | ||
|
||
|
||
return ` This ${tagName} tag has more than one conditional attribute, it's forbidden.` | ||
|
||
} | ||
|
||
export function runInvalidConditionalAttrNameError(attr: string): string { | ||
|
||
return ` Attribute ${attr} is invalid here, because it has an empty value, assign a value to it.` | ||
|
||
} | ||
|
||
export function runInvalidElseValueWarning(value: string): string { | ||
|
||
return ` Remove ${value}, _else is not supposed to have a value.` | ||
|
||
|
||
} | ||
|
||
export function runUnregisteredRefName(refName: string): string { | ||
|
||
return `${refName} is an unregistered reference's name. Register it like this: | ||
<!--ref = ${refName}--> | ||
` | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { attrsI, htmlStructureI } from "./types"; | ||
|
||
export function isACharacter(arg: string): boolean { | ||
return /^[A-z]|\d$/i.test(arg); | ||
} | ||
|
||
export function isASpace(arg: string): boolean { | ||
return /^\s$/.test(arg); | ||
} | ||
|
||
export function mergeAttr(attribute: attrsI<string>, html: htmlStructureI, attrValue: string): void { | ||
|
||
attribute.value = attrValue | ||
|
||
html.attrs.push( | ||
Object.assign({}, attribute) | ||
); | ||
|
||
attribute.name = ""; | ||
attribute.value = ""; | ||
|
||
} | ||
|
||
export function hasProps(obj: Object): boolean { | ||
|
||
return Object.keys(obj).length > 0; | ||
|
||
} | ||
|
||
export function resetElementProps(element: htmlStructureI): void { | ||
|
||
element.tag = ""; | ||
element.type = null; | ||
element.tagStart = 0; | ||
element.tagEnd = 0; | ||
element.attrs = []; | ||
|
||
|
||
} |
Oops, something went wrong.