podlite 0.0.24 → 0.0.26

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 handlers_1 = require("pod6/built/helpers/handlers");
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: handlers_1.content
20
- },
21
- 'root': {
22
- toHtml: handlers_1.content
23
- }
24
- };
25
- exports.default = exports.core;
@@ -1,22 +0,0 @@
1
- import { content } from 'pod6/built/helpers/handlers';
2
- export const core = {
3
- ':image':{
4
- toHtml:(writer)=>(node)=>{
5
- if (typeof node !== "string" && 'type' in node && node.type === 'image') {
6
- writer.writeRaw(`<img`);
7
- writer.writeRaw(` src="${node.src}"`)
8
- if (node.alt) {
9
- writer.writeRaw(` alt="${node.alt}"`)
10
- }
11
- writer.writeRaw(`/>`)
12
- }
13
- }
14
- },
15
- 'image': {
16
- toHtml: content
17
- },
18
- 'root' : {
19
- toHtml: content
20
- }
21
- }
22
- export default core
package/t/ids.test.ts DELETED
@@ -1,32 +0,0 @@
1
- import { getFromTree, getNodeId, mkRootBlock, PodliteDocument, validatePodliteAst } from "@podlite/schema";
2
- import { toTree } from "pod6";
3
- import middleware from "../src/ids"
4
-
5
- export const parse = (text:string, opt?): PodliteDocument => {
6
- const rawTree = toTree().use(middleware).parse(text, opt={skipChain: 0, podMode: 1})
7
- const root = mkRootBlock({margin:""}, rawTree)
8
- return root;
9
- };
10
- const pod=`=begin
11
- =for para :id<test>
12
- test
13
- =end`
14
-
15
- it("[ID] validate", () => {
16
- const p = parse(pod);
17
- const r = validatePodliteAst(p);
18
- expect(r).toEqual([]);
19
- });
20
-
21
- it("[ID] custom id", () => {
22
- const p = parse(pod);
23
- const para = getFromTree(p, "para")[0];
24
- const id = getNodeId(para,{})
25
- expect(id).toEqual("test");
26
- });
27
-
28
- it("[ID] validate =item", () => {
29
- const p = parse(`=item1 test`);
30
- const r = validatePodliteAst(p);
31
- expect(r).toEqual([]);
32
- });
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
- })