podlite 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.core = void 0;
4
- const schema_1 = require("@podlite/schema");
5
- exports.core = {
6
- ':image': {
7
- toHtml: (writer) => (node) => {
8
- if (typeof node !== "string" && 'type' in node && node.type === 'image') {
9
- writer.writeRaw(`<img`);
10
- writer.writeRaw(` src="${node.src}"`);
11
- if (node.alt) {
12
- writer.writeRaw(` alt="${node.alt}"`);
13
- }
14
- writer.writeRaw(`/>`);
15
- }
16
- }
17
- },
18
- 'image': {
19
- toHtml: schema_1.content
20
- },
21
- 'root': {
22
- toHtml: schema_1.content
23
- }
24
- };
25
- exports.default = exports.core;
@@ -1,23 +0,0 @@
1
- import { content } from "@podlite/schema";
2
-
3
- export const core = {
4
- ':image':{
5
- toHtml:(writer)=>(node)=>{
6
- if (typeof node !== "string" && 'type' in node && node.type === 'image') {
7
- writer.writeRaw(`<img`);
8
- writer.writeRaw(` src="${node.src}"`)
9
- if (node.alt) {
10
- writer.writeRaw(` alt="${node.alt}"`)
11
- }
12
- writer.writeRaw(`/>`)
13
- }
14
- }
15
- },
16
- 'image': {
17
- toHtml: content
18
- },
19
- 'root' : {
20
- toHtml: content
21
- }
22
- }
23
- export default core
package/t/ids.test.ts DELETED
@@ -1,31 +0,0 @@
1
- import { getFromTree, getNodeId, mkRootBlock, PodliteDocument, toTree, validatePodliteAst } from "@podlite/schema";
2
- import middleware from "../src/ids"
3
-
4
- export const parse = (text:string, opt?): PodliteDocument => {
5
- const rawTree = toTree().use(middleware).parse(text, opt={skipChain: 0, podMode: 1})
6
- const root = mkRootBlock({margin:""}, rawTree)
7
- return root;
8
- };
9
- const pod=`=begin
10
- =for para :id<test>
11
- test
12
- =end`
13
-
14
- it("[ID] validate", () => {
15
- const p = parse(pod);
16
- const r = validatePodliteAst(p);
17
- expect(r).toEqual([]);
18
- });
19
-
20
- it("[ID] custom id", () => {
21
- const p = parse(pod);
22
- const para = getFromTree(p, "para")[0];
23
- const id = getNodeId(para,{})
24
- expect(id).toEqual("test");
25
- });
26
-
27
- it("[ID] validate =item", () => {
28
- const p = parse(`=item1 test`);
29
- const r = validatePodliteAst(p);
30
- expect(r).toEqual([]);
31
- });
package/t/plugin.test.ts DELETED
@@ -1,23 +0,0 @@
1
- import { Plugin } from "@podlite/schema";
2
- import { podlite, toAnyRules } from "../src";
3
-
4
-
5
- const testPlugin:Plugin = {
6
- toAst: () => () => {
7
-
8
- },
9
- toHtml: () => () => {
10
-
11
- },
12
- }
13
-
14
- test("plugin", () => {
15
- const proc = podlite({importPlugins:false}).use({Test:testPlugin})
16
- const toAstPlugins= toAnyRules('toAst', proc.getPlugins())
17
- const toHtmlPlugins= toAnyRules('toHtml', proc.getPlugins())
18
- const toUNKNOWNPlugins= toAnyRules('toUNKNOWN', proc.getPlugins())
19
- expect(toAstPlugins).toHaveProperty("Test");
20
- expect(toHtmlPlugins).toHaveProperty("Test");
21
- expect(toUNKNOWNPlugins).not.toHaveProperty("Test");
22
-
23
- })