Skip to content

Commit

Permalink
Publish v0.5.0 [#34]
Browse files Browse the repository at this point in the history
  • Loading branch information
davidstraka2 committed May 4, 2021
1 parent d7a43e4 commit 9ececdb
Show file tree
Hide file tree
Showing 46 changed files with 1,067 additions and 60 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.0] (2021-05-04)

### Added

- Navigation pane with table of contents, table of labels, and fuzzy seach [[#33]]
- Cached rendering of TikZ images to SVG (in `!tikz` outer environments) [[#32]]
- Caching of MathJax results [[#31]]

### Changed

- The default keyboard shortcut for `togglePreview` is now `Alt + J` [[#33]]
- Improved styling of `.caption` and `.Figure` [[#32]]

### Fixed

- Infinite loop in rendering causing Atom crash [[#28]]
- MathJax failing to typeset when there is only one element to be typeset [[#30]]

### Chores

- CI testing matrix now additionally contains the minimum supported Atom version [[#29]]
- Tweaked TS compiler settings (esModuleInterop) [[#33]]

## [0.4.0] (2021-04-20)

### Added
Expand Down Expand Up @@ -67,10 +90,17 @@ and this project adheres to
- Set up linting with ESLint (and typescript-eslint/eslint-plugin) [[#10]]
- Set up CI using GitHub Actions [[#6], [#7], [#9], [#11]]

[0.5.0]: https://github.com/davidstraka2/wootom/compare/v0.4.0-src...v0.5.0-src
[0.4.0]: https://github.com/davidstraka2/wootom/compare/v0.3.0-src...v0.4.0-src
[0.3.0]: https://github.com/davidstraka2/wootom/compare/v0.2.0-src...v0.3.0-src
[0.2.0]: https://github.com/davidstraka2/wootom/compare/v0.1.0-src...v0.2.0-src
[0.1.0]: https://github.com/davidstraka2/wootom/releases/tag/v0.1.0-src
[#33]: https://github.com/davidstraka2/wootom/issues/33
[#32]: https://github.com/davidstraka2/wootom/issues/32
[#31]: https://github.com/davidstraka2/wootom/issues/31
[#30]: https://github.com/davidstraka2/wootom/issues/30
[#29]: https://github.com/davidstraka2/wootom/issues/29
[#28]: https://github.com/davidstraka2/wootom/issues/28
[#26]: https://github.com/davidstraka2/wootom/issues/26
[#25]: https://github.com/davidstraka2/wootom/issues/25
[#24]: https://github.com/davidstraka2/wootom/issues/24
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ preview, and more.

[atom]: https://atom.io

## External Dependencies

Wootom relies on a local installation of a TeX distribution to render [TikZ]
images. The TeX distribution must provide the `latex` and `dvisvgm` commands,
as well as the following (La)TeX packages: `amsmath`, `amssymb`, `bbding`,
`fontenc`, `inputenc`, `libertine`, `pgfplots`, `standalone`. If you don't
intend to use [TikZ] images in your WooWoo documents, you may ignore this.

[tikz]: https://texample.net/tikz/examples/

## License

Copyright ©‎ David Straka.
Expand Down
3 changes: 2 additions & 1 deletion keymaps/wootom.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"atom-workspace": {
"alt-n": "wootom:togglePreview"
"alt-n": "wootom:toggleNavigation",
"alt-j": "wootom:togglePreview"
}
}
8 changes: 4 additions & 4 deletions lib/core/html-view/html-view-model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { WorkspaceItemManager } from '../atom-abstractions/workspace-item-manage
import { HTMLView } from './html-view';
/** Handles the application logic of the HTML View pane item */
export declare class HTMLViewModel implements ViewModel {
private title;
private readonly view;
private readonly viewRegistryAdder;
private readonly workspaceItemManager;
protected title: string;
protected readonly view: Required<HTMLView>;
protected readonly viewRegistryAdder: ViewRegistryAdder;
protected readonly workspaceItemManager: WorkspaceItemManager;
/**
* @param title The title of the HTML View pane item
* @param view The view to use for the model
Expand Down
17 changes: 17 additions & 0 deletions lib/core/navigation/navigation-model.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ViewRegistryAdder } from '../atom-abstractions/view-registry-adder';
import { WorkspaceItemManager } from '../atom-abstractions/workspace-item-manager';
import { HTMLView } from '../html-view/html-view';
import { HTMLViewModel } from '../html-view/html-view-model';
export declare class NavigationModel extends HTMLViewModel {
/**
* @param title The title of the HTML View pane item
* @param view The view to use for the model
* @param viewRegistryAdder Used to connect the model layer with the view
* layer
* @param workspaceItemOpener To be used to open a new pane with the view
*/
constructor(title: string, view: Required<HTMLView>, viewRegistryAdder: ViewRegistryAdder, workspaceItemManager: WorkspaceItemManager);
/** Activate the model; register it and its view with the ViewRegistry */
activate(): void;
}
export declare const navigationModel: NavigationModel;
23 changes: 23 additions & 0 deletions lib/core/navigation/navigation-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.navigationModel = exports.NavigationModel = void 0;
const html_view_1 = require("../html-view/html-view");
const html_view_model_1 = require("../html-view/html-view-model");
class NavigationModel extends html_view_model_1.HTMLViewModel {
/**
* @param title The title of the HTML View pane item
* @param view The view to use for the model
* @param viewRegistryAdder Used to connect the model layer with the view
* layer
* @param workspaceItemOpener To be used to open a new pane with the view
*/
constructor(title, view, viewRegistryAdder, workspaceItemManager) {
super(title, view, viewRegistryAdder, workspaceItemManager);
}
/** Activate the model; register it and its view with the ViewRegistry */
activate() {
this.viewRegistryAdder.addViewProvider(NavigationModel, () => this.view.render());
}
}
exports.NavigationModel = NavigationModel;
exports.navigationModel = new NavigationModel('Wootom Navigation', new html_view_1.HTMLView(), atom.views, atom.workspace);
20 changes: 20 additions & 0 deletions lib/core/navigation/navigation-subscriber.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { WorkspaceObserver } from '../atom-abstractions/workspace-observer';
import { HTMLViewModel } from '../html-view/html-view-model';
import { Parser } from '../parser/parser';
import { RenderingManager } from '../rendering/rendering-manager';
export declare class NavigationSubscriber {
private readonly htmlViewModel;
private readonly parser;
private readonly renderingManager;
private readonly workspaceObserver;
private contentCache;
private editor;
private editorSubscriptions;
private workspaceSubscriptions;
constructor(htmlViewModel: Required<HTMLViewModel>, parser: Required<Parser>, renderingManager: Required<RenderingManager>, workspaceObserver: WorkspaceObserver);
activate(): void;
deactivate(): void;
toggle(): Promise<void>;
private updateContent;
private updateEditor;
}
75 changes: 75 additions & 0 deletions lib/core/navigation/navigation-subscriber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigationSubscriber = void 0;
const atom_1 = require("atom");
const navigation_1 = require("./navigation");
class NavigationSubscriber {
constructor(htmlViewModel, parser, renderingManager, workspaceObserver) {
this.htmlViewModel = htmlViewModel;
this.parser = parser;
this.renderingManager = renderingManager;
this.workspaceObserver = workspaceObserver;
this.editorSubscriptions = new atom_1.CompositeDisposable();
this.workspaceSubscriptions = new atom_1.CompositeDisposable();
}
activate() {
this.workspaceSubscriptions.add(this.workspaceObserver.onDidChangeActiveTextEditor(this.updateEditor.bind(this)));
}
deactivate() {
this.contentCache = undefined;
this.editor = undefined;
this.editorSubscriptions.dispose();
this.workspaceSubscriptions.dispose();
}
toggle() {
return __awaiter(this, void 0, void 0, function* () {
if (this.htmlViewModel.isOpen) {
console.log('Wootom: Closing navigation pane.');
this.htmlViewModel.close();
}
else {
console.log('Wootom: Opening navigation pane.');
yield this.htmlViewModel.open();
}
});
}
updateContent() {
if (typeof this.editor === 'undefined' || !this.htmlViewModel.isOpen) {
return;
}
const content = this.editor.getText();
if (typeof this.contentCache === 'undefined' ||
this.contentCache !== content) {
console.log('Wootom: Rendering navigation.');
this.contentCache = content;
const documentRoot = this.parser.parse(content);
const navigation = new navigation_1.Navigation(this.editor, this.renderingManager, documentRoot);
this.htmlViewModel.render(navigation.render());
document.dispatchEvent(new CustomEvent('wootom-preview-rendered'));
}
else {
console.log('Wootom: Hit content cache.');
}
}
updateEditor(editor) {
this.editorSubscriptions.dispose();
this.editor = editor;
if (typeof editor === 'undefined') {
console.log('Wootom: Unsubscribing from text editor.');
return;
}
console.log('Wootom: Subscribing to new editor.');
this.editorSubscriptions.add(editor.onDidSave(this.updateContent.bind(this)), editor.onDidStopChanging(this.updateContent.bind(this)));
this.updateContent();
}
}
exports.NavigationSubscriber = NavigationSubscriber;
11 changes: 11 additions & 0 deletions lib/core/navigation/navigation.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { TextEditor } from 'atom';
import { ASTNode } from '../ast/ast-node';
import { RenderingManager } from '../rendering/rendering-manager';
export declare class Navigation {
private readonly editor;
private readonly renderingManager;
private readonly root;
private documentParts;
constructor(editor: TextEditor, renderingManager: Required<RenderingManager>, root: ASTNode);
render(): Node;
}
24 changes: 24 additions & 0 deletions lib/core/navigation/navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Navigation = void 0;
const table_of_contents_1 = require("./table-of-contents");
const table_of_labels_1 = require("./table-of-labels");
class Navigation {
constructor(editor, renderingManager, root) {
this.editor = editor;
this.renderingManager = renderingManager;
this.root = root;
this.documentParts = root.children.filter(child => child.kind === 'DocumentPart');
}
render() {
const container = document.createElement('div');
container.classList.add('wootom-navigation');
const heading = document.createElement('h1');
heading.append('Navigation');
const toc = new table_of_contents_1.TableOfContents(this.editor, this.renderingManager, this.documentParts);
const tol = new table_of_labels_1.TableOfLabels(this.editor, this.root);
container.append(heading, toc.render(), tol.render());
return container;
}
}
exports.Navigation = Navigation;
19 changes: 19 additions & 0 deletions lib/core/navigation/table-of-contents.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { TextEditor } from 'atom';
import { DocumentPart } from '../ast/document-part';
import { RenderingManager } from '../rendering/rendering-manager';
export declare class TableOfContents {
private readonly editor;
private readonly renderingManager;
private readonly documentParts;
private list;
private searchInput;
private searchResults;
constructor(editor: TextEditor, renderingManager: Required<RenderingManager>, documentParts: DocumentPart[]);
render(): Node;
private renderTreeNode;
private renderHeading;
private getLevel;
private constructHeadingTree;
private renderSearchResults;
private search;
}
Loading

0 comments on commit 9ececdb

Please sign in to comment.