Skip to content

Commit

Permalink
Format the code
Browse files Browse the repository at this point in the history
Beautified each file.
  • Loading branch information
manuth committed Aug 24, 2017
1 parent 06a8186 commit 75bc9e3
Show file tree
Hide file tree
Showing 21 changed files with 126 additions and 125 deletions.
2 changes: 1 addition & 1 deletion package.nls.de-CH.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"config.document.localization": "Sprache",
"config.document.localization.description": "Die Sprach-Einstellungen.",
"config.document.localization.locale": "Sprache",
"config.document.localization.locale.description": "Die Sprache, in der das Datum ausgegeben wird.\n\nNote:\nLassen Sie diesen Einstellung weg, um die Sprache von Visual Studio Code zu verwenden.",
"config.document.localization.locale.description": "Die Sprache, in der das Datum ausgegeben wird.\n\nNote:\nLassen Sie diesen Einstellung weg, um die Sprache von Visual Studio Code zu verwenden.",
"config.document.localization.dateFormat": "Datums-Format",
"config.document.localization.dateFormat.description": "Ein Datums-Format-string, in der das Datum ausgegeben werden soll.\nSiehe: https://msdn.microsoft.com/de-de/library/8kb3ddd4(v=vs.110).aspx",
"config.document.layout": "Layout",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"config.document.localization": "Sprache",
"config.document.localization.description": "Die Sprach-Einstellungen.",
"config.document.localization.locale": "Sprache",
"config.document.localization.locale.description": "Die Sprache, in der das Datum ausgegeben wird.\n\nNote:\nLassen Sie diesen Einstellung weg, um die Sprache von Visual Studio Code zu verwenden.",
"config.document.localization.locale.description": "Die Sprache, in der das Datum ausgegeben wird.\n\nNote:\nLassen Sie diesen Einstellung weg, um die Sprache von Visual Studio Code zu verwenden.",
"config.document.localization.dateFormat": "Datums-Format",
"config.document.localization.dateFormat.description": "Ein Datums-Format-string, in der das Datum ausgegeben werden soll.\nSiehe: https://msdn.microsoft.com/de-de/library/8kb3ddd4(v=vs.110).aspx",
"config.document.layout": "Layout",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"config.document.localization": "Localization",
"config.document.localization.description": "The localization-settings.",
"config.document.localization.locale": "Locale",
"config.document.localization.locale.description": "The locale to print the date.\n\nNote:\nOverrides VSCode's locale.",
"config.document.localization.locale.description": "The locale to print the date.\n\nNote:\nOverrides VSCode's locale.",
"config.document.localization.dateFormat": "Date-Format",
"config.document.localization.dateFormat.description": "A format-string to print the date\nSee: https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx",
"config.document.layout": "Layout",
Expand Down
6 changes: 3 additions & 3 deletions src/ConversionType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export enum ConversionType
* PNG-conversion.
*/
PNG,

/**
* PPM-conversion.
*/
Expand All @@ -35,9 +35,9 @@ export enum ConversionType
/**
* The extensions of the conversion-types.
*/
export function GetExtensions() : { [id : number] : string }
export function GetExtensions(): { [id: number]: string }
{
let extensions : { [id : number] : string } = { };
let extensions: { [id: number]: string } = {};
extensions[ConversionType.BMP] = '.bmp';
extensions[ConversionType.HTML] = '.html';
extensions[ConversionType.JPEG] = '.jpg';
Expand Down
14 changes: 7 additions & 7 deletions src/Converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export class Converter
/**
* The document which is to be converted.
*/
private document : Document = null;
private document: Document = null;

/**
* Initializes a new instance of the Constructor class with a filepath.
*
* @param document
* The document which is to be converted.
*/
constructor(document : Document)
constructor(document: Document)
{
this.document = document;
}
Expand All @@ -38,12 +38,12 @@ export class Converter
* @param path
* The path to save the converted file to.
*/
public Start(conversionType : ConversionType, path : string) : void
public Start(conversionType: ConversionType, path: string): void
{
if (conversionType != ConversionType.HTML)
{
// Saving the JSON that represents the document to a temporary JSON-file.
let jsonPath = Temp.path({ suffix: '.json'});
let jsonPath = Temp.path({ suffix: '.json' });
{
FS.writeFileSync(jsonPath, this.document.toJSON());
}
Expand All @@ -69,9 +69,9 @@ export class Converter
}
throw result.error;
}

let error = result.stderr.toString();

if (error)
{
throw new Error(error);
Expand All @@ -96,7 +96,7 @@ export class Converter
{
FS.unlinkSync(tempPath);
}

if (FS.existsSync(jsonPath))
{
FS.unlinkSync(jsonPath);
Expand Down
33 changes: 17 additions & 16 deletions src/PhantomJS/PDFGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ catch (e)
* Starts the rendering-process.
* @param args
*/
function Main(args) : void
function Main(args): void
{
/**
* The file-type of the resulting file.
*/
var type : string;
var type: string;

/**
* The document to render.
Expand All @@ -40,16 +40,16 @@ catch (e)
/**
* The path to save the rendered file to.
*/
var destination : string;
var destination: string;

if (args.length >= 3)
{
var page = WebPage.create();
type = args[0];
doc = JSON.parse(FS.read(args[1]));
destination = args[2];
page.onLoadFinished = function(status)

page.onLoadFinished = function (status)
{
RenderPage(page);
}
Expand All @@ -72,9 +72,9 @@ catch (e)
* @param subject
* The subject to check for pagenumber-variables.
*/
function ReplacePageNumbers(subject : string, pageNumber : number, pageCount : number) : string
function ReplacePageNumbers(subject: string, pageNumber: number, pageCount: number): string
{
subject = subject.replace(/{{[\s]*(PageNumber|PageCount)[\s]*}}/g, function (match : string) : string
subject = subject.replace(/{{[\s]*(PageNumber|PageCount)[\s]*}}/g, function (match: string): string
{
if (/PageNumber/g.test(match))
{
Expand All @@ -100,12 +100,12 @@ catch (e)
var renderType;
page.paperSize = CalculatePaperSize(page);

switch(type)
switch (type)
{
case "BMP":
renderType = "bmp";
break;
case "JPEG":
case "JPEG":
renderType = "jpeg";
break;
case "PNG":
Expand Down Expand Up @@ -148,9 +148,9 @@ catch (e)
*/
function CreatePaper()
{
var paper : any = { };
var paper: any = {};
var layout = doc.Layout;

if (layout.Margin.Top || layout.Margin.Right || layout.Margin.Bottom || layout.Margin.Left)
{
paper.margin = {
Expand Down Expand Up @@ -185,7 +185,8 @@ catch (e)
function GetStyles()
{
var styles = document.querySelectorAll('link,style');
styles = Array.prototype.reduce.call(styles, function (string, node) {
styles = Array.prototype.reduce.call(styles, function (string, node)
{
return string + (node.outerHTML || '')
}, '');
return styles;
Expand All @@ -197,11 +198,11 @@ catch (e)
* @param styles
* The css-styles of the header.
*/
function CreateHeader(styles : string)
function CreateHeader(styles: string)
{
return {
height: doc.Header.Height,
contents: phantom.callback(function(pageNumber, pageCount)
contents: phantom.callback(function (pageNumber, pageCount)
{
var header = GetHeader(pageNumber, pageCount);
return styles + ReplacePageNumbers(header.Content, pageNumber, pageCount);
Expand Down Expand Up @@ -248,11 +249,11 @@ catch (e)
* @param styles
* The css-styles of the header.
*/
function CreateFooter(styles : string)
function CreateFooter(styles: string)
{
return {
height: doc.Footer.Height,
contents: phantom.callback(function(pageNumber, pageCount)
contents: phantom.callback(function (pageNumber, pageCount)
{
var footer = GetFooter(pageNumber, pageCount);
return styles + ReplacePageNumbers(footer.Content, pageNumber, pageCount);
Expand Down
6 changes: 3 additions & 3 deletions src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export class Program
/**
* Converts a markdown-file to other file-types
*/
public static Main(textDocument : TextDocument, types : ConversionType[], outDir : string, fileName : string, autoSave : boolean) : void
public static Main(textDocument: TextDocument, types: ConversionType[], outDir: string, fileName: string, autoSave: boolean): void
{
let localize : any = NLS.config({ locale: env.language })(Path.join(__dirname, '..', '..', 'Resources', 'Localization', 'MarkdownConverter'));
let doc : Document;
let localize: any = NLS.config({ locale: env.language })(Path.join(__dirname, '..', '..', 'Resources', 'Localization', 'MarkdownConverter'));
let doc: Document;

if (textDocument.isUntitled || (textDocument.isDirty && autoSave))
{
Expand Down
6 changes: 3 additions & 3 deletions src/Properties/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { KeyNotFoundException } from "../System/KeyNotFoundException";
import { Layout } from "../System/Drawing/Layout";
import { ListType } from "../System/Drawing/ListType";
import { Margin } from "../System/Drawing/Margin";
import { TocSettings } from "../System/Drawing/TocSettings";
import { TOCSettings } from "../System/Drawing/TOCSettings";

export class Settings
{
Expand Down Expand Up @@ -244,9 +244,9 @@ export class Settings
/**
* Gets the settings for the table of contents of the document.
*/
public get TOCSettings(): TocSettings
public get TOCSettings(): TOCSettings
{
let tocSettings = new TocSettings();
let tocSettings = new TOCSettings();
tocSettings.Class = this.getConfigEntry<string>('document.toc.class', 'toc');
tocSettings.LevelRange = this.getConfigEntry<string>('document.toc.levels', '4-6');
tocSettings.Indicator = this.getConfigEntry<RegExp>('document.toc.indicator', /^\[\[\s*toc\s*\]\]/im);
Expand Down
8 changes: 4 additions & 4 deletions src/System/Drawing/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MultiRange } from 'multi-integer-range';
import * as Mustache from 'mustache';
import * as Request from 'sync-request';
import { Settings } from "../../Properties/Settings";
import { TocSettings } from "./TocSettings";
import { TOCSettings } from "./TOCSettings";
import * as TwEmoji from 'twemoji';
import { UnauthorizedAccessException } from "../UnauthorizedAccessException";
import { YAMLException } from "../YAML/YAMLException";
Expand Down Expand Up @@ -124,7 +124,7 @@ export class Document
/**
* The definitions of the table of contents.
*/
private tocSettings: TocSettings = new TocSettings();
private tocSettings: TOCSettings = new TOCSettings();

/**
* The template to use for the RenderBody-process.
Expand Down Expand Up @@ -469,11 +469,11 @@ export class Document
* Gets or sets the definitions of the table of contents.
*/
@enumerable(true)
public get TOCSettings(): TocSettings
public get TOCSettings(): TOCSettings
{
return this.tocSettings;
}
public set TOCSettings(value: TocSettings)
public set TOCSettings(value: TOCSettings)
{
this.tocSettings = value;
}
Expand Down
Loading

0 comments on commit 75bc9e3

Please sign in to comment.