-
Notifications
You must be signed in to change notification settings - Fork 1
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
870421d
commit 9b9f2f7
Showing
71 changed files
with
916 additions
and
304 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
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
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,13 @@ | ||
import { Renderer } from '../../../core/rendering/renderer'; | ||
import { InfoBlockColors } from '../../../util/lists/styles'; | ||
import { BasicObjectRenderer } from './basic-object'; | ||
/** Renderer of the algorithm document object */ | ||
export declare class DocumentObjectAlgorithmRenderer extends BasicObjectRenderer implements Renderer { | ||
readonly abstractVariant = "algorithm"; | ||
/** @override */ | ||
protected title: string; | ||
/** @override */ | ||
protected hasOptionalMetaTitle: boolean; | ||
/** @override */ | ||
protected titleBackgroundColor: InfoBlockColors; | ||
} |
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,19 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DocumentObjectAlgorithmRenderer = void 0; | ||
const styles_1 = require("../../../util/lists/styles"); | ||
const basic_object_1 = require("./basic-object"); | ||
/** Renderer of the algorithm document object */ | ||
class DocumentObjectAlgorithmRenderer extends basic_object_1.BasicObjectRenderer { | ||
constructor() { | ||
super(...arguments); | ||
this.abstractVariant = 'algorithm'; | ||
/** @override */ | ||
this.title = 'Algorithm'; | ||
/** @override */ | ||
this.hasOptionalMetaTitle = true; | ||
/** @override */ | ||
this.titleBackgroundColor = styles_1.InfoBlockColors.Blue; | ||
} | ||
} | ||
exports.DocumentObjectAlgorithmRenderer = DocumentObjectAlgorithmRenderer; |
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,26 @@ | ||
import { ASTNode } from '../../../core/ast/ast-node'; | ||
import { Renderer } from '../../../core/rendering/renderer'; | ||
import { RenderingManager } from '../../../core/rendering/rendering-manager'; | ||
import { WooElementKind } from '../../../util/types/woo'; | ||
/** Partially implemented renderer for the most comon document objects */ | ||
export declare abstract class BasicObjectRenderer implements Pick<Required<Renderer>, 'render' | 'kind'> { | ||
readonly kind: WooElementKind; | ||
/** The title of the document object */ | ||
protected abstract title: string; | ||
/** | ||
* Whether the document object can optionally have the title metablock item | ||
*/ | ||
protected hasOptionalMetaTitle: boolean; | ||
protected titleBackgroundColor?: string; | ||
render(renderingManager: RenderingManager, astNode: ASTNode): Node; | ||
/** | ||
* Customize the title of the document object by appending the contents of | ||
* the optional title metablock item, if applicable. | ||
* | ||
* @param title The title to customize | ||
* @param astNode The AST node of the document object | ||
* @returns The customized title | ||
*/ | ||
protected customizeTitle(title: string, astNode: ASTNode): string; | ||
private appendMetaTitle; | ||
} |
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,41 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BasicObjectRenderer = void 0; | ||
const info_block_1 = require("../../../util/html-components/info-block"); | ||
/** Partially implemented renderer for the most comon document objects */ | ||
class BasicObjectRenderer { | ||
constructor() { | ||
this.kind = 'DocumentObject'; | ||
/** | ||
* Whether the document object can optionally have the title metablock item | ||
*/ | ||
this.hasOptionalMetaTitle = false; | ||
} | ||
render(renderingManager, astNode) { | ||
return info_block_1.infoBlockComponent({ | ||
title: this.customizeTitle(this.title, astNode), | ||
children: [renderingManager.render(...astNode.children)], | ||
titleBackgroundColor: this.titleBackgroundColor, | ||
}); | ||
} | ||
/** | ||
* Customize the title of the document object by appending the contents of | ||
* the optional title metablock item, if applicable. | ||
* | ||
* @param title The title to customize | ||
* @param astNode The AST node of the document object | ||
* @returns The customized title | ||
*/ | ||
customizeTitle(title, astNode) { | ||
return this.appendMetaTitle(title, astNode); | ||
} | ||
appendMetaTitle(title, astNode) { | ||
if (!this.hasOptionalMetaTitle) | ||
return title; | ||
const titleMetadata = astNode.getMetadata('title'); | ||
if (typeof titleMetadata === 'string') | ||
title += `: ${titleMetadata}`; | ||
return title; | ||
} | ||
} | ||
exports.BasicObjectRenderer = BasicObjectRenderer; |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { ASTNode } from '../../../core/ast/ast-node'; | ||
import { Renderer } from '../../../core/rendering/renderer'; | ||
import { RenderingManager } from '../../../core/rendering/rendering-manager'; | ||
import { WooElementKind } from '../../../util/types/woo'; | ||
export declare class DocumentObjectCorollaryRenderer implements Renderer { | ||
readonly kind: WooElementKind; | ||
import { InfoBlockColors } from '../../../util/lists/styles'; | ||
import { BasicObjectRenderer } from './basic-object'; | ||
/** Renderer of the corollary document object */ | ||
export declare class DocumentObjectCorollaryRenderer extends BasicObjectRenderer implements Renderer { | ||
readonly abstractVariant = "corollary"; | ||
render(renderingManager: RenderingManager, astNode: ASTNode): Node; | ||
/** @override */ | ||
protected title: string; | ||
/** @override */ | ||
protected hasOptionalMetaTitle: boolean; | ||
/** @override */ | ||
protected titleBackgroundColor: InfoBlockColors; | ||
} |
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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DocumentObjectCorollaryRenderer = void 0; | ||
const info_block_1 = require("../../../util/html-components/info-block"); | ||
class DocumentObjectCorollaryRenderer { | ||
const styles_1 = require("../../../util/lists/styles"); | ||
const basic_object_1 = require("./basic-object"); | ||
/** Renderer of the corollary document object */ | ||
class DocumentObjectCorollaryRenderer extends basic_object_1.BasicObjectRenderer { | ||
constructor() { | ||
this.kind = 'DocumentObject'; | ||
super(...arguments); | ||
this.abstractVariant = 'corollary'; | ||
} | ||
render(renderingManager, astNode) { | ||
let title = 'Corollary'; | ||
const titleMetadata = astNode.getMetadata('title'); | ||
if (typeof titleMetadata === 'string') | ||
title += `: ${titleMetadata}`; | ||
return info_block_1.infoBlockComponent({ | ||
title, | ||
children: [renderingManager.render(...astNode.children)], | ||
}); | ||
/** @override */ | ||
this.title = 'Corollary'; | ||
/** @override */ | ||
this.hasOptionalMetaTitle = true; | ||
/** @override */ | ||
this.titleBackgroundColor = styles_1.InfoBlockColors.Blue; | ||
} | ||
} | ||
exports.DocumentObjectCorollaryRenderer = DocumentObjectCorollaryRenderer; |
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
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { ASTNode } from '../../../core/ast/ast-node'; | ||
import { Renderer } from '../../../core/rendering/renderer'; | ||
import { RenderingManager } from '../../../core/rendering/rendering-manager'; | ||
import { WooElementKind } from '../../../util/types/woo'; | ||
export declare class DocumentObjectDefinitionRenderer implements Renderer { | ||
readonly kind: WooElementKind; | ||
import { InfoBlockColors } from '../../../util/lists/styles'; | ||
import { BasicObjectRenderer } from './basic-object'; | ||
/** Renderer of the definition document object */ | ||
export declare class DocumentObjectDefinitionRenderer extends BasicObjectRenderer implements Renderer { | ||
readonly abstractVariant = "definition"; | ||
render(renderingManager: RenderingManager, astNode: ASTNode): Node; | ||
/** @override */ | ||
protected title: string; | ||
/** @override */ | ||
protected hasOptionalMetaTitle: boolean; | ||
/** @override */ | ||
protected titleBackgroundColor: InfoBlockColors; | ||
} |
Oops, something went wrong.