Reorganize repo.
This commit is contained in:
1
docs/dsl/.gitignore
vendored
Normal file
1
docs/dsl/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
21
docs/dsl/LICENSE.md
Normal file
21
docs/dsl/LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Joshua Michael Bemenderfer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
31
docs/dsl/index.js
Normal file
31
docs/dsl/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { document } from '../../../implementations/js/packages/core/src/terrace.js'
|
||||
import fs from 'node:fs'
|
||||
import readline from 'node:readline/promises'
|
||||
import markdown from '../../../packages/js/block-markdown/index.js'
|
||||
|
||||
async function main() {
|
||||
const mdHandler = markdown({})
|
||||
|
||||
const it = readline.createInterface({
|
||||
input: fs.createReadStream('./test.tce', 'utf-8'),
|
||||
})[Symbol.asyncIterator]()
|
||||
|
||||
const doc = document(async () => (await it.next()).value)
|
||||
|
||||
async function mainHandler({ line, lineData, ended, next, current }, page) {
|
||||
if (ended) return page
|
||||
|
||||
if (line.startsWith('markdown')) {
|
||||
lineData.offset = 'markdown'.length
|
||||
page.body += await mdHandler(current(), mainHandler)
|
||||
lineData.offset = 0
|
||||
return mainHandler(current(), page)
|
||||
}
|
||||
|
||||
return mainHandler(await next(), page)
|
||||
}
|
||||
|
||||
console.log(await mainHandler(await doc.next(), { body: '' }))
|
||||
}
|
||||
|
||||
main()
|
||||
23
docs/dsl/index.test.js
Normal file
23
docs/dsl/index.test.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, it } from "vitest"
|
||||
import { document } from '../../../implementations/js/packages/core/src/terrace.js'
|
||||
import fs from 'node:fs'
|
||||
import readline from 'node:readline/promises'
|
||||
|
||||
describe('Terrace DSL: thederf.com', () => {
|
||||
it('loads', async () => {
|
||||
const it = readline.createInterface({
|
||||
input: fs.createReadStream('./test.tce', 'utf-8'),
|
||||
})[Symbol.asyncIterator]()
|
||||
|
||||
const getLine = async () => {
|
||||
console.log(1)
|
||||
console.log('GETLINE', await it.next())
|
||||
console.log(2)
|
||||
const val = (await it.next()).value
|
||||
return val
|
||||
}
|
||||
|
||||
const doc = document(getLine, ' ')
|
||||
doc.next(() => {})
|
||||
})
|
||||
})
|
||||
1278
docs/dsl/package-lock.json
generated
Normal file
1278
docs/dsl/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
docs/dsl/package.json
Normal file
11
docs/dsl/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@terrace/dsl-terrace-docs",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "vitest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitest": "^0.24.5"
|
||||
}
|
||||
}
|
||||
15
docs/dsl/test.tce
Normal file
15
docs/dsl/test.tce
Normal file
@@ -0,0 +1,15 @@
|
||||
title TEST
|
||||
|
||||
markdown
|
||||
# Title
|
||||
|
||||
Dolore do do sit velit ullamco labore nisi laborum ut.
|
||||
|
||||
List time
|
||||
- List 1
|
||||
- List 2
|
||||
|
||||
markdown
|
||||
# Title 2
|
||||
|
||||
Incididunt qui nulla est enim officia ad sunt excepteur consequat sunt.
|
||||
2
docs/pages/index.tce
Normal file
2
docs/pages/index.tce
Normal file
@@ -0,0 +1,2 @@
|
||||
title Terrace - A fast, flexible, metamarkup language
|
||||
description
|
||||
Reference in New Issue
Block a user