Rename to more readable names
This commit is contained in:
@ -2,8 +2,8 @@ const docx = require('../build');
|
||||
|
||||
var doc = new docx.Document();
|
||||
|
||||
var textRun = new docx.TextRun("שלום עולם").rtl();
|
||||
var paragraph = new docx.Paragraph().bidi();
|
||||
var textRun = new docx.TextRun("שלום עולם").rightToLeft();
|
||||
var paragraph = new docx.Paragraph().bidirectional();
|
||||
paragraph.addRun(textRun);
|
||||
|
||||
doc.addParagraph(paragraph);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class Bidi extends XmlComponent {
|
||||
export class Bidirectional extends XmlComponent {
|
||||
constructor() {
|
||||
super("w:bidi");
|
||||
}
|
@ -339,9 +339,9 @@ describe("Paragraph", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#bidi", () => {
|
||||
describe("#bidirectional", () => {
|
||||
it("set paragraph right to left layout", () => {
|
||||
paragraph.bidi();
|
||||
paragraph.bidirectional();
|
||||
const tree = new Formatter().format(paragraph);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:p": [{ "w:pPr": [{ "w:bidi": [] }] }],
|
||||
|
@ -5,7 +5,7 @@ import { Num } from "file/numbering/num";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
import { Alignment } from "./formatting/alignment";
|
||||
import { Bidi } from "./formatting/bidi";
|
||||
import { Bidirectional } from "./formatting/bidirectional";
|
||||
import { ThematicBreak } from "./formatting/border";
|
||||
import { Indent } from "./formatting/indent";
|
||||
import { KeepLines, KeepNext } from "./formatting/keep";
|
||||
@ -217,8 +217,8 @@ export class Paragraph extends XmlComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public bidi(): Paragraph {
|
||||
this.properties.push(new Bidi());
|
||||
public bidirectional(): Paragraph {
|
||||
this.properties.push(new Bidirectional());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ export class Size extends XmlComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export class SizeCs extends XmlComponent {
|
||||
export class SizeComplexScript extends XmlComponent {
|
||||
constructor(size: number) {
|
||||
super("w:szCs");
|
||||
this.root.push(
|
||||
@ -135,7 +135,7 @@ export class SizeCs extends XmlComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export class RTL extends XmlComponent {
|
||||
export class RightToLeft extends XmlComponent {
|
||||
constructor() {
|
||||
super("w:rtl");
|
||||
this.root.push(
|
||||
|
@ -145,7 +145,7 @@ describe("Run", () => {
|
||||
|
||||
describe("#rtl", () => {
|
||||
it("should set the run to the RTL mode", () => {
|
||||
run.rtl();
|
||||
run.rightToLeft();
|
||||
const tree = new Formatter().format(run);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:r": [{ "w:rPr": [{ "w:rtl": [{ _attr: { "w:val": true } }] }] }],
|
||||
|
@ -1,7 +1,7 @@
|
||||
// http://officeopenxml.com/WPtext.php
|
||||
import { Break } from "./break";
|
||||
import { Caps, SmallCaps } from "./caps";
|
||||
import { Bold, Color, DoubleStrike, Italics, RTL, Size, SizeCs, Strike } from "./formatting";
|
||||
import { Bold, Color, DoubleStrike, Italics, RightToLeft, Size, SizeComplexScript, Strike } from "./formatting";
|
||||
import { Begin, End, Page, Separate } from "./page-number";
|
||||
import { RunProperties } from "./properties";
|
||||
import { RunFonts } from "./run-fonts";
|
||||
@ -43,12 +43,12 @@ export class Run extends XmlComponent {
|
||||
|
||||
public size(size: number): Run {
|
||||
this.properties.push(new Size(size));
|
||||
this.properties.push(new SizeCs(size));
|
||||
this.properties.push(new SizeComplexScript(size));
|
||||
return this;
|
||||
}
|
||||
|
||||
public rtl(): Run {
|
||||
this.properties.push(new RTL());
|
||||
public rightToLeft(): Run {
|
||||
this.properties.push(new RightToLeft());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Size, SizeCs } from "../../paragraph/run/formatting";
|
||||
import { Size, SizeComplexScript } from "../../paragraph/run/formatting";
|
||||
import { RunProperties } from "../../paragraph/run/properties";
|
||||
import { RunFonts } from "../../paragraph/run/run-fonts";
|
||||
|
||||
@ -14,7 +14,7 @@ export class RunPropertiesDefaults extends XmlComponent {
|
||||
|
||||
public size(size: number): RunPropertiesDefaults {
|
||||
this.properties.push(new Size(size));
|
||||
this.properties.push(new SizeCs(size));
|
||||
this.properties.push(new SizeComplexScript(size));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ export class ParagraphStyle extends Style {
|
||||
|
||||
public size(twips: number): ParagraphStyle {
|
||||
this.addRunProperty(new formatting.Size(twips));
|
||||
this.addRunProperty(new formatting.SizeCs(twips));
|
||||
this.addRunProperty(new formatting.SizeComplexScript(twips));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ export class CharacterStyle extends Style {
|
||||
|
||||
public size(twips: number): CharacterStyle {
|
||||
this.addRunProperty(new formatting.Size(twips));
|
||||
this.addRunProperty(new formatting.SizeCs(twips));
|
||||
this.addRunProperty(new formatting.SizeComplexScript(twips));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user