Skip to content

Commit

Permalink
Publish v0.6.0 [#40]
Browse files Browse the repository at this point in the history
  • Loading branch information
davidstraka2 committed May 13, 2021
1 parent 9ececdb commit a903482
Show file tree
Hide file tree
Showing 20 changed files with 563 additions and 75 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ 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.6.0] (2021-05-13)

### Added

- FIT Template snippets [[#37]]
- Rendering of the `footnote` inner environment and partial rendering of the
`cite`, `eqref`, and `reference` inner environments [[#39]]

### Changed

- Improved WooWoo syntax highlighting grammar (better comments, `@` inner
environment shorthand support) [[#35]]

### Fixed

- Properly clear custom MathJax typesetting pre-queue [[#38]]

### Chores

- Updated project description [[#36]]

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

### Added
Expand Down Expand Up @@ -90,11 +111,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.6.0]: https://github.com/davidstraka2/wootom/compare/v0.5.0-src...v0.6.0-src
[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
[#39]: https://github.com/davidstraka2/wootom/issues/39
[#38]: https://github.com/davidstraka2/wootom/issues/38
[#37]: https://github.com/davidstraka2/wootom/issues/37
[#36]: https://github.com/davidstraka2/wootom/issues/36
[#35]: https://github.com/davidstraka2/wootom/issues/35
[#33]: https://github.com/davidstraka2/wootom/issues/33
[#32]: https://github.com/davidstraka2/wootom/issues/32
[#31]: https://github.com/davidstraka2/wootom/issues/31
Expand Down
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@

---

**WARNING: THIS PROJECT IS A WORK IN PROGRESS**

## About

Wootom is a package (an extension) for the popular text editor [Atom]. Wootom
adds support for more comfortable editing of WooWoo documents.

Some of the added features are syntax highlighting, a toolbar to aid with
frequently used actions, [WYSIWYM](https://en.wikipedia.org/wiki/WYSIWYM)
preview, and more.
adds support for streamlining the process of editing WooWoo documents.

Added features:

- WooWoo syntax highlighting
- Live [WYSIWYM](https://en.wikipedia.org/wiki/WYSIWYM) preview of the currently
open file (`wootom:togglePreview`) using the FIT Template, including support
for displaying math expressions and TikZ images
- Custom MathJax macros support, as well as custom LaTeX preamble support for
generating TikZ SVGs, and different modes of displaying the SVGs (see the
package settings)
- Navigation pane with the table of contents and table of labels of the
currently open file (`wootom:toggleNavigation`), including fuzzy search
within the tables
- WooWoo support for the `editor:toggle-line-comments` command
- Snippets for the FIT Template

[atom]: https://atom.io

Expand All @@ -27,6 +36,25 @@ intend to use [TikZ] images in your WooWoo documents, you may ignore this.

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

## Development Setup

Node.js (with npm) is required for development in addition to the previously
mentioned dependencies.

1. `apm link`
2. `npm install`
3. `npm run build`

### Useful Commands

- `npm test` - Run package tests
- `npm run build` - Build
- `npm run format:check` - Check formatting
- `npm run format:fix` - Fix formatting
- `npm run lint:check` - Lint
- `npm run lint:fix` - Lint and attempt to fix issues
- `npm run pack` - Create production package

## License

Copyright ©‎ David Straka.
Expand Down
58 changes: 9 additions & 49 deletions grammars/woo.cson
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ patterns: [
{include: '#innerEnvironmentVerbose'}
{include: '#annotation'}
{include: '#reference'}
{include: '#indexedReference'}
{include: '#inlineMath'}
{include: '#tailMetablocks'}
]

repository:
inlineComment: {
match: '^%.*'
match: '^\\s*%.*'
name: 'comment.line.woo'
}
partHeading: {
Expand Down Expand Up @@ -97,6 +98,13 @@ repository:
2: name: 'keyword.operator.foo'
3: name: 'storage.type.foo'
}
indexedReference: {
match: '(")(@)(\\d+)'
captures:
1: name: 'keyword.operator.foo'
2: name: 'keyword.operator.foo'
3: name: 'storage.type.foo'
}
inlineMath: {
match: '(\\$)([^$]+)(\\$)'
captures:
Expand All @@ -105,7 +113,6 @@ repository:
3: name: 'keyword.operator.foo'
}
tailMetablocks: {
# Inherently flawed (see comments below), but at least some implementation
begin: '^[^\\S\\r\\n]{2,}(\\w+)(:)'
beginCaptures:
1: name: 'entity.name.tag.yaml'
Expand All @@ -116,50 +123,3 @@ repository:
{include: '#yamlMetablock'}
]
}

# TODO Consistent block (and its metablock) indentation makes this
# a non-context-free issue
#
#block: {
# begin: '^[^\\S\\n\\r]*[^\\s].*'
# end: '^\\s*$'
# #name: 'storage.type.foo'
# patterns: [
# {
# begin: '^([^\\S\\n\\r]*)[^\\s].*(\\r?\\n\\1[^\\s].*)*(\\r?\\n\\1\\s+[^\\s].*)*'
# beginCaptures:
# 1: 'storage.type.foo'
# 3: 'comment.line.woo'
# end: '^\\s*$'
# }
# ]
#}

# TODO Inner environment (and annotation, and reference) nesting makes this
# a non-regular-free issue
#
# Consider e.g. the following strings:
# `abc "def".label ghi`,
# `"abc "def" ghi".label`,
# `"abc".label def "dhi".label`,
# `"abc "def".label ghi".label.`.
# The first and the second string aren't an issue, the third and fourth
# strings however are.
#
#innerEnvironmentVerbose: {
# match: '(")(.*)(")(\\.)([a-z]\\w*)((\\.)(\\d+))?'
# captures:
# 1: name: 'keyword.operator.foo'
# 2: name: 'markup.quote.foo'
# 3: name: 'keyword.operator.foo'
# 4: name: 'keyword.operator.foo'
# 5: name: 'storage.type.foo'
# 7: name: 'keyword.operator.foo'
# 8: name: 'storage.type.foo'
# patterns: [
# #{include: '$self'}
# #{include: '#innerEnvironmentShort'}
# #{include: '#innerEnvironmentVerbose'}
# #{include: '#inlineMath'}
# ]
#}
10 changes: 9 additions & 1 deletion lib/template/all-renderers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ const h1_1 = require("./renderers/document-part/h1");
const h2_1 = require("./renderers/document-part/h2");
const h3_1 = require("./renderers/document-part/h3");
const b_1 = require("./renderers/inner-env/b");
const cite_1 = require("./renderers/inner-env/cite");
const code_1 = require("./renderers/inner-env/code");
const default_3 = require("./renderers/inner-env/default");
const eqref_1 = require("./renderers/inner-env/eqref");
const footnote_1 = require("./renderers/inner-env/footnote");
const i_1 = require("./renderers/inner-env/i");
const inline_math_1 = require("./renderers/inner-env/inline-math");
const quoted_1 = require("./renderers/inner-env/quoted");
const reference_1 = require("./renderers/inner-env/reference");
const _index_1 = require("./renderers/inner-env/_index");
const _reference_1 = require("./renderers/inner-env/_reference");
const document_root_1 = require("./renderers/other/document-root");
Expand Down Expand Up @@ -72,12 +76,16 @@ function registerTemplateRenderers() {
core_1.rendererRegistry.setRenderer(new tikz_1.OuterEnvTikzRenderer());
core_1.rendererRegistry.setRenderer(new quote_1.OuterEnvQuoteRenderer());
core_1.rendererRegistry.setRenderer(new default_3.DefaultInnerEnvRenderer());
core_1.rendererRegistry.setRenderer(new cite_1.InnerEnvCiteRenderer());
core_1.rendererRegistry.setRenderer(new code_1.InnerEnvCodeRenderer());
core_1.rendererRegistry.setRenderer(new i_1.InnerEnvIRenderer());
core_1.rendererRegistry.setRenderer(new eqref_1.InnerEnvEqrefRenderer());
core_1.rendererRegistry.setRenderer(new footnote_1.InnerEnvFootnoteRenderer());
core_1.rendererRegistry.setRenderer(new inline_math_1.InnerEnvInlineMathRenderer());
core_1.rendererRegistry.setRenderer(new b_1.InnerEnvBRenderer());
core_1.rendererRegistry.setRenderer(new quoted_1.InnerEnvQuotedRenderer());
core_1.rendererRegistry.setRenderer(new reference_1.InnerEnvReferenceRenderer());
core_1.rendererRegistry.setRenderer(new _index_1.InnerEnvIndexRenderer());
core_1.rendererRegistry.setRenderer(new _reference_1.InnerEnvReferenceRenderer());
core_1.rendererRegistry.setRenderer(new _reference_1.InnerEnvUReferenceRenderer());
}
exports.registerTemplateRenderers = registerTemplateRenderers;
3 changes: 2 additions & 1 deletion lib/template/mathjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function typesetInlineMath(mathSource) {
}
exports.typesetInlineMath = typesetInlineMath;
/** A queue containing items to be later added to the MathJax Queue */
const mathJaxPreQueue = [];
let mathJaxPreQueue = [];
/**
* Add math to the typesetting queue
*
Expand All @@ -129,6 +129,7 @@ function typesetMath(nodes, callback) {
/** Trigger typesetting of all math in the typesetting queue */
function typesetAllMath() {
mathJaxPreQueue.forEach(item => MathJax.Hub.Queue(item));
mathJaxPreQueue = [];
}
/** Configure MathJax */
function configureMathJax() {
Expand Down
2 changes: 1 addition & 1 deletion lib/template/renderers/inner-env/_reference.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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 InnerEnvReferenceRenderer implements Renderer {
export declare class InnerEnvUReferenceRenderer implements Renderer {
readonly kind: WooElementKind;
readonly abstractVariant = "_reference";
render(renderingManager: RenderingManager, astNode: ASTNode): Node;
Expand Down
6 changes: 3 additions & 3 deletions lib/template/renderers/inner-env/_reference.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InnerEnvReferenceRenderer = void 0;
class InnerEnvReferenceRenderer {
exports.InnerEnvUReferenceRenderer = void 0;
class InnerEnvUReferenceRenderer {
constructor() {
this.kind = 'InnerEnv';
this.abstractVariant = '_reference';
Expand All @@ -10,4 +10,4 @@ class InnerEnvReferenceRenderer {
return renderingManager.render(...astNode.children);
}
}
exports.InnerEnvReferenceRenderer = InnerEnvReferenceRenderer;
exports.InnerEnvUReferenceRenderer = InnerEnvUReferenceRenderer;
10 changes: 10 additions & 0 deletions lib/template/renderers/inner-env/cite.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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';
/** Renderer of the cite inner environment */
export declare class InnerEnvCiteRenderer implements Renderer {
readonly kind: WooElementKind;
readonly abstractVariant = "cite";
render(renderingManager: RenderingManager, astNode: ASTNode): Node;
}
16 changes: 16 additions & 0 deletions lib/template/renderers/inner-env/cite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InnerEnvCiteRenderer = void 0;
/** Renderer of the cite inner environment */
class InnerEnvCiteRenderer {
constructor() {
this.kind = 'InnerEnv';
this.abstractVariant = 'cite';
}
render(renderingManager, astNode) {
const cite = document.createElement('cite');
cite.append('[', renderingManager.render(...astNode.children), ']');
return cite;
}
}
exports.InnerEnvCiteRenderer = InnerEnvCiteRenderer;
10 changes: 10 additions & 0 deletions lib/template/renderers/inner-env/eqref.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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';
/** Renderer of the eqref inner environment */
export declare class InnerEnvEqrefRenderer implements Renderer {
readonly kind: WooElementKind;
readonly abstractVariant = "eqref";
render(renderingManager: RenderingManager, astNode: ASTNode): Node;
}
14 changes: 14 additions & 0 deletions lib/template/renderers/inner-env/eqref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InnerEnvEqrefRenderer = void 0;
/** Renderer of the eqref inner environment */
class InnerEnvEqrefRenderer {
constructor() {
this.kind = 'InnerEnv';
this.abstractVariant = 'eqref';
}
render(renderingManager, astNode) {
return renderingManager.render(...astNode.children);
}
}
exports.InnerEnvEqrefRenderer = InnerEnvEqrefRenderer;
10 changes: 10 additions & 0 deletions lib/template/renderers/inner-env/footnote.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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';
/** Renderer of the footnote inner environment */
export declare class InnerEnvFootnoteRenderer implements Renderer {
readonly kind: WooElementKind;
readonly abstractVariant = "footnote";
render(renderingManager: RenderingManager, astNode: ASTNode): Node;
}
22 changes: 22 additions & 0 deletions lib/template/renderers/inner-env/footnote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InnerEnvFootnoteRenderer = void 0;
/** Renderer of the footnote inner environment */
class InnerEnvFootnoteRenderer {
constructor() {
this.kind = 'InnerEnv';
this.abstractVariant = 'footnote';
}
render(renderingManager, astNode) {
const footnote = document.createElement('span');
footnote.classList.add('wootom-footnote');
const controls = document.createElement('span');
controls.classList.add('wootom-footnote-controls');
controls.addEventListener('click', () => footnote.classList.toggle('wootom-footnote-shown'));
const content = document.createElement('span');
content.append(renderingManager.render(...astNode.children));
footnote.append(controls, content);
return footnote;
}
}
exports.InnerEnvFootnoteRenderer = InnerEnvFootnoteRenderer;
10 changes: 10 additions & 0 deletions lib/template/renderers/inner-env/reference.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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';
/** Renderer of the reference inner environment */
export declare class InnerEnvReferenceRenderer implements Renderer {
readonly kind: WooElementKind;
readonly abstractVariant = "reference";
render(renderingManager: RenderingManager, astNode: ASTNode): Node;
}
14 changes: 14 additions & 0 deletions lib/template/renderers/inner-env/reference.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InnerEnvReferenceRenderer = void 0;
/** Renderer of the reference inner environment */
class InnerEnvReferenceRenderer {
constructor() {
this.kind = 'InnerEnv';
this.abstractVariant = 'reference';
}
render(renderingManager, astNode) {
return renderingManager.render(...astNode.children);
}
}
exports.InnerEnvReferenceRenderer = InnerEnvReferenceRenderer;
Loading

0 comments on commit a903482

Please sign in to comment.