Skip to content

Commit

Permalink
renamed folders
Browse files Browse the repository at this point in the history
  • Loading branch information
VolodymyrBaydalka committed Nov 24, 2021
1 parent 8984d41 commit 45c1b5d
Show file tree
Hide file tree
Showing 26 changed files with 173 additions and 138 deletions.
231 changes: 122 additions & 109 deletions dist/docx-preview.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/docx-preview.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/docx-preview.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/docx-preview.min.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/document-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import {
DomType, IDomTable, IDomNumbering,
IDomHyperlink, IDomImage, OpenXmlElement, IDomTableColumn, IDomTableCell,
IDomTableRow, NumberingPicBullet, TextElement, SymbolElement, BreakElement
} from './dom/dom';
} from './document/dom';
import * as utils from './utils';
import { DocumentElement } from './dom/document';
import { ParagraphElement, parseParagraphProperties, parseParagraphProperty } from './dom/paragraph';
import { parseSectionProperties } from './dom/section';
import { DocumentElement } from './document/document';
import { ParagraphElement, parseParagraphProperties, parseParagraphProperty } from './document/paragraph';
import { parseSectionProperties } from './document/section';
import globalXmlParser from './parser/xml-parser';
import { RunElement } from './dom/run';
import { parseBookmarkEnd, parseBookmarkStart } from './dom/bookmark';
import { IDomStyle, IDomSubStyle } from './dom/style';
import { RunElement } from './document/run';
import { parseBookmarkEnd, parseBookmarkStart } from './document/bookmark';
import { IDomStyle, IDomSubStyle } from './document/style';
import { WmlFooter } from './footer/footer';
import { WmlHeader } from './header/header';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions src/dom/section.ts → src/document/section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ export enum SectionType {
OddPage = "oddPage",
}

export interface FooterHeaderReference {
id: string;
type: string;
}

export interface SectionProperties {
type: SectionType | string;
pageSize: PageSize,
pageMargins: PageMargins,
columns: Columns;
footerRefs: FooterHeaderReference[];
headerRefs: FooterHeaderReference[];
}

export function parseSectionProperties(elem: Element, xml: XmlParser): SectionProperties {
Expand Down Expand Up @@ -77,6 +84,14 @@ export function parseSectionProperties(elem: Element, xml: XmlParser): SectionPr
case "cols":
section.columns = parseColumns(e, xml);
break;

case "headerReference":
(section.headerRefs ?? (section.headerRefs = [])).push(parseFooterHeaderReference(e, xml));
break;

case "footerReference":
(section.footerRefs ?? (section.footerRefs = [])).push(parseFooterHeaderReference(e, xml));
break;
}
}

Expand All @@ -95,4 +110,11 @@ function parseColumns(elem: Element, xml: XmlParser): Columns {
space: xml.lengthAttr(e, "space")
})
};
}

function parseFooterHeaderReference(elem: Element, xml: XmlParser): FooterHeaderReference {
return {
id: xml.attr(elem, "id"),
type: xml.attr(elem, "type"),
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion src/footer/footer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomType, OpenXmlElement } from "../dom/dom";
import { DomType, OpenXmlElement } from "../document/dom";

export class WmlFooter implements OpenXmlElement {
type: DomType = DomType.Footer;
Expand Down
2 changes: 1 addition & 1 deletion src/header/header.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomType, OpenXmlElement } from "../dom/dom";
import { DomType, OpenXmlElement } from "../document/dom";

export class WmlHeader implements OpenXmlElement {
type: DomType = DomType.Header;
Expand Down
16 changes: 8 additions & 8 deletions src/html-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { WordDocument } from './word-document';
import {
DomType, IDomTable, IDomNumbering,
IDomHyperlink, IDomImage, OpenXmlElement, IDomTableColumn, IDomTableCell, TextElement, SymbolElement, BreakElement
} from './dom/dom';
import { Length, CommonProperties } from './dom/common';
} from './document/dom';
import { Length, CommonProperties } from './document/common';
import { Options } from './docx-preview';
import { DocumentElement } from './dom/document';
import { ParagraphElement } from './dom/paragraph';
import { DocumentElement } from './document/document';
import { ParagraphElement } from './document/paragraph';
import { appendClass } from './utils';
import { updateTabStop } from './javascript';
import { FontTablePart } from './font-table/font-table';
import { SectionProperties } from './dom/section';
import { RunElement, RunProperties } from './dom/run';
import { BookmarkStartElement } from './dom/bookmark';
import { IDomStyle } from './dom/style';
import { SectionProperties } from './document/section';
import { RunElement, RunProperties } from './document/run';
import { BookmarkStartElement } from './document/bookmark';
import { IDomStyle } from './document/style';

export class HtmlRenderer {

Expand Down
2 changes: 1 addition & 1 deletion src/javascript.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ParagraphTab } from "./dom/paragraph";
import { ParagraphTab } from "./document/paragraph";

export function updateTabStop(elem: HTMLElement, tabs: ParagraphTab[], pixelToPoint: number = 72 / 96) {

Expand Down
2 changes: 1 addition & 1 deletion src/numbering/numbering-part.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OpenXmlPackage } from "../common/open-xml-package";
import { Part } from "../common/part";
import { DocumentParser } from "../document-parser";
import { IDomNumbering } from "../dom/dom";
import { IDomNumbering } from "../document/dom";
import { AbstractNumbering, Numbering, NumberingBulletPicture, NumberingPartProperties, parseNumberingPart } from "./numbering";

export class NumberingPart extends Part implements NumberingPartProperties {
Expand Down
6 changes: 3 additions & 3 deletions src/numbering/numbering.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NumberingPicBullet } from "../dom/dom";
import { ParagraphProperties, parseParagraphProperties } from "../dom/paragraph";
import { parseRunProperties, RunProperties } from "../dom/run";
import { NumberingPicBullet } from "../document/dom";
import { ParagraphProperties, parseParagraphProperties } from "../document/paragraph";
import { parseRunProperties, RunProperties } from "../document/run";
import { XmlParser } from "../parser/xml-parser";

export interface NumberingPartProperties {
Expand Down
2 changes: 1 addition & 1 deletion src/parser/xml-parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Length, LengthUsage, LengthUsageType, convertLength } from "../dom/common";
import { Length, LengthUsage, LengthUsageType, convertLength } from "../document/common";

export function parseXmlString(xmlString: string, trimXmlDeclaration: boolean = false): Document {
if (trimXmlDeclaration)
Expand Down
2 changes: 1 addition & 1 deletion src/styles/styles-part.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OpenXmlPackage } from "../common/open-xml-package";
import { Part } from "../common/part";
import { DocumentParser } from "../document-parser";
import { IDomStyle } from "../dom/style";
import { IDomStyle } from "../document/style";

export class StylesPart extends Part {
styles: IDomStyle[];
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OpenXmlElement } from "./dom/dom";
import { OpenXmlElement } from "./document/dom";

export function addElementClass(element: OpenXmlElement, className: string): string {
return element.className = appendClass(element.className, className);
Expand Down
2 changes: 1 addition & 1 deletion src/word-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Relationship, RelationshipTypes } from './common/relationship';
import { Part } from './common/part';
import { FontTablePart } from './font-table/font-table';
import { OpenXmlPackage } from './common/open-xml-package';
import { DocumentPart } from './dom/document-part';
import { DocumentPart } from './document/document-part';
import { resolvePath, splitPath } from './utils';
import { NumberingPart } from './numbering/numbering-part';
import { StylesPart } from './styles/styles-part';
Expand Down

0 comments on commit 45c1b5d

Please sign in to comment.