Fix more spelling rules
This commit is contained in:
29
.cspell.json
29
.cspell.json
@ -19,9 +19,34 @@
|
|||||||
"iroha",
|
"iroha",
|
||||||
"chosung",
|
"chosung",
|
||||||
"Abjad",
|
"Abjad",
|
||||||
"Initializable"
|
"Initializable",
|
||||||
|
"rels",
|
||||||
|
"dolan",
|
||||||
|
"xmlify",
|
||||||
|
"Xmlifyed",
|
||||||
|
"xmlified",
|
||||||
|
"datas",
|
||||||
|
"jszip",
|
||||||
|
"rsid",
|
||||||
|
"NUMPAGES",
|
||||||
|
"ATLEAST"
|
||||||
|
],
|
||||||
|
"ignoreRegExpList": [
|
||||||
|
"/w:.+/",
|
||||||
|
"/s:.+/",
|
||||||
|
"/a:.+/",
|
||||||
|
"/pic:.+/",
|
||||||
|
"/xmlns:.+/",
|
||||||
|
"/vt:.+/",
|
||||||
|
"/[^\\s]{40,}/",
|
||||||
|
"/<xsd:.+/>/",
|
||||||
|
"/[A-Z_]+ = \".+\"/",
|
||||||
|
"/XmlAttributeComponent<{[^}]+}>/g",
|
||||||
|
"/xmlKeys = {[^}]+}/g",
|
||||||
|
"/\\.to\\.deep\\.equal\\({[^)]+}\\)/g",
|
||||||
|
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
|
||||||
|
"/new [a-zA-Z]+\\({[^£]+}\\)/g"
|
||||||
],
|
],
|
||||||
"ignoreRegExpList": ["/w:.+/", "/s:.+/", "/a:.+/", "/pic:.+/", "/xmlns:.+/", "/[^\\s]{40,}/", "/<xsd:.+/>/", "/[A-Z_]+ = \".+\"/", "/XmlAttributeComponent<{(.|\\n| )+}>/"],
|
|
||||||
"allowCompoundWords": true,
|
"allowCompoundWords": true,
|
||||||
// flagWords - list of words to be always considered incorrect
|
// flagWords - list of words to be always considered incorrect
|
||||||
// This is useful for offensive words and common spelling errors.
|
// This is useful for offensive words and common spelling errors.
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json",
|
"typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json",
|
||||||
"style": "prettier -l \"src/**/*.ts\"",
|
"style": "prettier -l \"src/**/*.ts\"",
|
||||||
"style.fix": "npm run style -- --write",
|
"style.fix": "npm run style -- --write",
|
||||||
"cspell": "cspell \"/**/*.{ts,scss,html}\"",
|
"cspell": "cspell \"src/**/*.ts\" && cspell \"demo/**/*.{ts,scss,html}\" && cspell \"docs/**/*.{ts,md,html}\"",
|
||||||
"fix-types": "ts-node --skip-project scripts/types-absolute-fixer.ts",
|
"fix-types": "ts-node --skip-project scripts/types-absolute-fixer.ts",
|
||||||
"e2e": "ts-node scripts/e2e.ts",
|
"e2e": "ts-node scripts/e2e.ts",
|
||||||
"serve.docs": "cd docs && docsify serve",
|
"serve.docs": "cd docs && docsify serve",
|
||||||
|
@ -6,7 +6,7 @@ import { File } from "@file/file";
|
|||||||
import { Formatter } from "../formatter";
|
import { Formatter } from "../formatter";
|
||||||
import { ImageReplacer } from "./image-replacer";
|
import { ImageReplacer } from "./image-replacer";
|
||||||
import { NumberingReplacer } from "./numbering-replacer";
|
import { NumberingReplacer } from "./numbering-replacer";
|
||||||
import { PrettityType } from "./packer";
|
import { PrettifyType } from "./packer";
|
||||||
|
|
||||||
interface IXmlifyedFile {
|
interface IXmlifyedFile {
|
||||||
readonly data: string;
|
readonly data: string;
|
||||||
@ -44,7 +44,7 @@ export class Compiler {
|
|||||||
this.numberingReplacer = new NumberingReplacer();
|
this.numberingReplacer = new NumberingReplacer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public compile(file: File, prettifyXml?: boolean | PrettityType): JSZip {
|
public compile(file: File, prettifyXml?: boolean | PrettifyType): JSZip {
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
|
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
|
||||||
const map = new Map<string, IXmlifyedFile | IXmlifyedFile[]>(Object.entries(xmlifiedFileMapping));
|
const map = new Map<string, IXmlifyedFile | IXmlifyedFile[]>(Object.entries(xmlifiedFileMapping));
|
||||||
@ -67,7 +67,7 @@ export class Compiler {
|
|||||||
return zip;
|
return zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
private xmlifyFile(file: File, prettify?: boolean | PrettityType): IXmlifyedFileMapping {
|
private xmlifyFile(file: File, prettify?: boolean | PrettifyType): IXmlifyedFileMapping {
|
||||||
const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1;
|
const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1;
|
||||||
|
|
||||||
const documentXmlData = xml(
|
const documentXmlData = xml(
|
||||||
|
@ -5,7 +5,7 @@ import { Compiler } from "./next-compiler";
|
|||||||
/**
|
/**
|
||||||
* Use blanks to prettify
|
* Use blanks to prettify
|
||||||
*/
|
*/
|
||||||
export enum PrettityType {
|
export enum PrettifyType {
|
||||||
NONE = "",
|
NONE = "",
|
||||||
WITH_2_BLANKS = " ",
|
WITH_2_BLANKS = " ",
|
||||||
WITH_4_BLANKS = " ",
|
WITH_4_BLANKS = " ",
|
||||||
@ -13,7 +13,7 @@ export enum PrettityType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Packer {
|
export class Packer {
|
||||||
public static async toBuffer(file: File, prettify?: boolean | PrettityType): Promise<Buffer> {
|
public static async toBuffer(file: File, prettify?: boolean | PrettifyType): Promise<Buffer> {
|
||||||
const zip = this.compiler.compile(file, prettify);
|
const zip = this.compiler.compile(file, prettify);
|
||||||
const zipData = await zip.generateAsync({
|
const zipData = await zip.generateAsync({
|
||||||
type: "nodebuffer",
|
type: "nodebuffer",
|
||||||
@ -24,7 +24,7 @@ export class Packer {
|
|||||||
return zipData;
|
return zipData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async toBase64String(file: File, prettify?: boolean | PrettityType): Promise<string> {
|
public static async toBase64String(file: File, prettify?: boolean | PrettifyType): Promise<string> {
|
||||||
const zip = this.compiler.compile(file, prettify);
|
const zip = this.compiler.compile(file, prettify);
|
||||||
const zipData = await zip.generateAsync({
|
const zipData = await zip.generateAsync({
|
||||||
type: "base64",
|
type: "base64",
|
||||||
@ -35,7 +35,7 @@ export class Packer {
|
|||||||
return zipData;
|
return zipData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async toBlob(file: File, prettify?: boolean | PrettityType): Promise<Blob> {
|
public static async toBlob(file: File, prettify?: boolean | PrettifyType): Promise<Blob> {
|
||||||
const zip = this.compiler.compile(file, prettify);
|
const zip = this.compiler.compile(file, prettify);
|
||||||
const zipData = await zip.generateAsync({
|
const zipData = await zip.generateAsync({
|
||||||
type: "blob",
|
type: "blob",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { XmlAttributeComponent } from "@file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
|
/* cSpell:disable */
|
||||||
export interface IDocumentAttributesProperties {
|
export interface IDocumentAttributesProperties {
|
||||||
readonly wpc?: string;
|
readonly wpc?: string;
|
||||||
readonly mc?: string;
|
readonly mc?: string;
|
||||||
@ -41,6 +42,7 @@ export interface IDocumentAttributesProperties {
|
|||||||
readonly w16sdtdh?: string;
|
readonly w16sdtdh?: string;
|
||||||
readonly w16se?: string;
|
readonly w16se?: string;
|
||||||
}
|
}
|
||||||
|
/* cSpell:enable */
|
||||||
|
|
||||||
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
|
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
|
||||||
protected readonly xmlKeys = {
|
protected readonly xmlKeys = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export * from "./math-accent-character";
|
export * from "./math-accent-character";
|
||||||
export * from "./math-base";
|
export * from "./math-base";
|
||||||
export * from "./math-limit-location";
|
export * from "./math-limit-location";
|
||||||
export * from "./math-naray-properties";
|
export * from "./math-n-ary-properties";
|
||||||
export * from "./math-sub-script";
|
export * from "./math-sub-script";
|
||||||
export * from "./math-sum";
|
export * from "./math-sum";
|
||||||
export * from "./math-super-script";
|
export * from "./math-super-script";
|
||||||
|
@ -2,14 +2,14 @@ import { expect } from "chai";
|
|||||||
|
|
||||||
import { Formatter } from "@export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { MathNArayProperties } from "./math-naray-properties";
|
import { MathNAryProperties } from "./math-n-ary-properties";
|
||||||
|
|
||||||
describe("MathNArayProperties", () => {
|
describe("MathNAryProperties", () => {
|
||||||
describe("#constructor()", () => {
|
describe("#constructor()", () => {
|
||||||
it("should create a MathNArayProperties with correct root key", () => {
|
it("should create a MathNAryProperties with correct root key", () => {
|
||||||
const mathNArayProperties = new MathNArayProperties("∑", true, true);
|
const mathNAryProperties = new MathNAryProperties("∑", true, true);
|
||||||
|
|
||||||
const tree = new Formatter().format(mathNArayProperties);
|
const tree = new Formatter().format(mathNAryProperties);
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"m:naryPr": [
|
"m:naryPr": [
|
||||||
{
|
{
|
||||||
@ -31,9 +31,9 @@ describe("MathNArayProperties", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should add super-script hide attributes", () => {
|
it("should add super-script hide attributes", () => {
|
||||||
const mathNArayProperties = new MathNArayProperties("∑", false, true);
|
const mathNAryProperties = new MathNAryProperties("∑", false, true);
|
||||||
|
|
||||||
const tree = new Formatter().format(mathNArayProperties);
|
const tree = new Formatter().format(mathNAryProperties);
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"m:naryPr": [
|
"m:naryPr": [
|
||||||
{
|
{
|
||||||
@ -62,9 +62,9 @@ describe("MathNArayProperties", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should add sub-script hide attributes", () => {
|
it("should add sub-script hide attributes", () => {
|
||||||
const mathNArayProperties = new MathNArayProperties("∑", true, false);
|
const mathNAryProperties = new MathNAryProperties("∑", true, false);
|
||||||
|
|
||||||
const tree = new Formatter().format(mathNArayProperties);
|
const tree = new Formatter().format(mathNAryProperties);
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"m:naryPr": [
|
"m:naryPr": [
|
||||||
{
|
{
|
||||||
@ -93,9 +93,9 @@ describe("MathNArayProperties", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should add both super-script and sub-script hide attributes", () => {
|
it("should add both super-script and sub-script hide attributes", () => {
|
||||||
const mathNArayProperties = new MathNArayProperties("∑", false, false);
|
const mathNAryProperties = new MathNAryProperties("∑", false, false);
|
||||||
|
|
||||||
const tree = new Formatter().format(mathNArayProperties);
|
const tree = new Formatter().format(mathNAryProperties);
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"m:naryPr": [
|
"m:naryPr": [
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ import { MathLimitLocation } from "./math-limit-location";
|
|||||||
import { MathSubScriptHide } from "./math-sub-script-hide";
|
import { MathSubScriptHide } from "./math-sub-script-hide";
|
||||||
import { MathSuperScriptHide } from "./math-super-script-hide";
|
import { MathSuperScriptHide } from "./math-super-script-hide";
|
||||||
|
|
||||||
export class MathNArayProperties extends XmlComponent {
|
export class MathNAryProperties extends XmlComponent {
|
||||||
constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean) {
|
constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean) {
|
||||||
super("m:naryPr");
|
super("m:naryPr");
|
||||||
|
|
@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
|
|||||||
|
|
||||||
import { MathComponent } from "../math-component";
|
import { MathComponent } from "../math-component";
|
||||||
import { MathBase } from "./math-base";
|
import { MathBase } from "./math-base";
|
||||||
import { MathNArayProperties } from "./math-naray-properties";
|
import { MathNAryProperties } from "./math-n-ary-properties";
|
||||||
import { MathSubScriptElement } from "./math-sub-script";
|
import { MathSubScriptElement } from "./math-sub-script";
|
||||||
import { MathSuperScriptElement } from "./math-super-script";
|
import { MathSuperScriptElement } from "./math-super-script";
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ export class MathSum extends XmlComponent {
|
|||||||
constructor(options: IMathSumOptions) {
|
constructor(options: IMathSumOptions) {
|
||||||
super("m:nary");
|
super("m:nary");
|
||||||
|
|
||||||
this.root.push(new MathNArayProperties("∑", !!options.superScript, !!options.subScript));
|
this.root.push(new MathNAryProperties("∑", !!options.superScript, !!options.subScript));
|
||||||
|
|
||||||
if (!!options.subScript) {
|
if (!!options.subScript) {
|
||||||
this.root.push(new MathSubScriptElement(options.subScript));
|
this.root.push(new MathSubScriptElement(options.subScript));
|
||||||
|
@ -27,6 +27,7 @@ export enum RelativeVerticalPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ITableFloatOptions {
|
export interface ITableFloatOptions {
|
||||||
|
/* cSpell:disable */
|
||||||
/**
|
/**
|
||||||
* Specifies the horizontal anchor or the base object from which the horizontal positioning in the
|
* Specifies the horizontal anchor or the base object from which the horizontal positioning in the
|
||||||
* tblpX or tblpXSpec attribute should be determined.
|
* tblpX or tblpXSpec attribute should be determined.
|
||||||
@ -35,6 +36,7 @@ export interface ITableFloatOptions {
|
|||||||
* text - relative to the vertical edge of the text margin for the column in which the anchor paragraph is located
|
* text - relative to the vertical edge of the text margin for the column in which the anchor paragraph is located
|
||||||
* If omitted, the value is assumed to be page.
|
* If omitted, the value is assumed to be page.
|
||||||
*/
|
*/
|
||||||
|
/* cSpell:enable */
|
||||||
readonly horizontalAnchor?: TableAnchorType;
|
readonly horizontalAnchor?: TableAnchorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,8 +13,8 @@ export function convertToXmlComponent(element: XmlElement): ImportedXmlComponent
|
|||||||
case undefined:
|
case undefined:
|
||||||
case "element":
|
case "element":
|
||||||
const xmlComponent = new ImportedXmlComponent(element.name as string, element.attributes);
|
const xmlComponent = new ImportedXmlComponent(element.name as string, element.attributes);
|
||||||
const childElments = element.elements || [];
|
const childElements = element.elements || [];
|
||||||
for (const childElm of childElments) {
|
for (const childElm of childElements) {
|
||||||
const child = convertToXmlComponent(childElm);
|
const child = convertToXmlComponent(childElm);
|
||||||
if (child !== undefined) {
|
if (child !== undefined) {
|
||||||
xmlComponent.push(child);
|
xmlComponent.push(child);
|
||||||
|
@ -73,6 +73,7 @@ describe("values", () => {
|
|||||||
it("should throw on invalid values", () => {
|
it("should throw on invalid values", () => {
|
||||||
expect(() => shortHexNumber("11")).to.throw();
|
expect(() => shortHexNumber("11")).to.throw();
|
||||||
expect(() => shortHexNumber("112233")).to.throw();
|
expect(() => shortHexNumber("112233")).to.throw();
|
||||||
|
/* cspell:disable-next-line */
|
||||||
expect(() => shortHexNumber("FFFG")).to.throw();
|
expect(() => shortHexNumber("FFFG")).to.throw();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -208,6 +208,7 @@ export const pointMeasureValue = unsignedDecimalNumber;
|
|||||||
//
|
//
|
||||||
// http://www.datypic.com/sc/xsd/t-xsd_dateTime.html
|
// http://www.datypic.com/sc/xsd/t-xsd_dateTime.html
|
||||||
// The type xsd:dateTime represents a specific date and time in the format
|
// The type xsd:dateTime represents a specific date and time in the format
|
||||||
|
/* cspell:disable-next-line */
|
||||||
// CCYY-MM-DDThh:mm:ss.sss, which is a concatenation of the date and time forms,
|
// CCYY-MM-DDThh:mm:ss.sss, which is a concatenation of the date and time forms,
|
||||||
// separated by a literal letter "T". All of the same rules that apply to the date
|
// separated by a literal letter "T". All of the same rules that apply to the date
|
||||||
// and time types are applicable to xsd:dateTime as well.
|
// and time types are applicable to xsd:dateTime as well.
|
||||||
|
Reference in New Issue
Block a user