doc: update daleth syntax

This commit is contained in:
Artemy Egorov 2024-08-08 09:16:16 +03:00
parent e8dd2c8f35
commit 4258f3296d
2 changed files with 95 additions and 92 deletions

116
README.md
View file

@ -21,123 +21,123 @@ This is Daleth (high level language that compiles to Daletl).
```yaml ```yaml
# multilines # multilines
# #
# (text) - input is trimmed with indent # `text` - input is trimmed with indent
# #
# (~n text) - n is number of minimum spaces to add after trimming with indent # `~n text` - n is number of minimum spaces to add after trimming with indent
# for each line # for each line
# #
# (# text) - input not modified # `# text` - input not modified
# #
# tag syntax # tag syntax
# #
# tag: text body # tag: text body
# tag (multiline text body) # tag { multiline text body }
# body text always trimmed # body text always trimmed
# #
# tag { multiple tags body } # tag [ multiple tags body ]
# #
# Arguments # Arguments
# tag[argument] # tag(argument)
# #
# Tags without body and argument also supported # Tags without body and argument also supported
meta[title]: Daleth syntax concept meta(title): Daleth syntax concept
meta[description]: This document describes Daleth syntax and some tags meta(description): This document describes Daleth syntax and some tags
h[1]: TxtDot revolution h(1): TxtDot revolution
p: TxtDot is a cool project p: TxtDot is a cool project
# If no tag is specified, then the 'el' tag is placed # If no tag is specified, then the 'el' tag is placed
This is element This is element
br br
# if no tag is specified but a '()' is present, then the 'p' tag is placed # if no tag is specified but a '{}' is present, then the 'p' tag is placed
# '\n' is deleted only in this format. If a break line is needed in a paragraph, use ' \n'. # '\n' is deleted only in this format. If a break line is needed in a paragraph, use ' \n'.
( {
Check Dalet too Check Dalet too
This is one paragraph This is one paragraph
)
( This is another paragraph )
# [ ] for argument
row[center] {
link[https://github.com/txtdot/txtdot]: Homepage
btn[https://example.com/donate] {
# tag without body
img[https://example.com/donate.png]
Donate
}
} }
# {} for multiple objects { This is another paragraph }
row {
{
h[2]: Features
ul { # ( ) for argument
row(center) [
link(https://github.com/txtdot/txtdot): Homepage
btn(https://example.com/donate) [
# tag without body
img(https://example.com/donate.png)
Donate
]
]
# [] for multiple tags
row [
[
h(2): Features
ul [
Server-side page simplification Server-side page simplification
Media proxy Media proxy
Image compression with Sharp Image compression with Sharp
Rendering client-side apps (Vanilla, React, Vue, etc) with webder Rendering client-side apps `Vanilla, React, Vue, etc` with webder
Search with SearXNG Search with SearXNG
Handy API endpoints Handy API endpoints
No client JavaScript No client JavaScript
Some kind of Material Design 3 Some kind of Material Design 3
Customization with plugins, see @txtdot/sdk and @txtdot/plugins Customization with plugins, see @txtdot/sdk and @txtdot/plugins
} ]
} ]
{ [
h[2]: Running h(2): Running
{ [
h[3]: Dev h(3): Dev
# () for multiline strings, indent is automatically trimmed # {} for multiline strings, indent is automatically trimmed
code ( code {
npm install npm install
npm run dev npm run dev
) }
# (~n Text) n is number of minimum spaces # {~n Text} n is number of minimum spaces
code[markdown] (~4 code[markdown] {~4
this is codeblock this is codeblock
) }
# (# Text) Text after "(# " not modified # {# Text} Text after "`# " not modified
code[markdown] (# this is codeblock) code[markdown] {# this is codeblock}
} ]
{ [
h[3]: Production h(3): Production
code ( code {
npm install npm install
npm run build npm run build
npm run start npm run start
) }
} ]
{ [
h[3]: Docker h(3): Docker
code: docker compose up -d code: docker compose up -d
} ]
} ]
} ]
# Table has custom format if text used # Table has custom format if text used
# +| cells | - primary column # +| cells | - primary column
# | cells | - secondary column # | cells | - secondary column
# | Element | Description | - converts to # | Element | Description | - converts to
# tcol { # tcol [
# Element # Element
# Description # Description
# } # ]
table ( table {
+| Tag | Description | +| Tag | Description |
| h | Heading | | h | Heading |
| p | Paragraph | | p | Paragraph |
@ -147,5 +147,5 @@ table (
| ul | Unordered list | | ul | Unordered list |
| br | Line break | | br | Line break |
+| quantity | 7 | +| quantity | 7 |
) }
``` ```

View file

@ -15,7 +15,9 @@ Most primitive tag. Also used if no tag is specified.
```yaml ```yaml
el: I am Element el: I am Element
el: { h[1]: I am first level heading } el: [
h(1): I am first level heading
]
Element also used if no tag is specified. Element also used if no tag is specified.
``` ```
@ -33,11 +35,11 @@ Heading is used for text formatting.
**Daleth example**: **Daleth example**:
```yaml ```yaml
h[1]: Dalet h(1): Dalet
h[2]: Daleth h(2): Daleth
h[3]: High level h(3): High level
h[2]: Daletl h(2): Daletl
h[3]: Low level h(3): Low level
``` ```
## 2. Paragraph ## 2. Paragraph
@ -55,6 +57,7 @@ Paragraph is used for text formatting.
```yaml ```yaml
p: This is a paragraph p: This is a paragraph
{ Paragraph also used if no tag specified but with `{\}` }
``` ```
## 3. Line break ## 3. Line break
@ -88,10 +91,10 @@ Unordered list is used to create a list.
**Daleth example**: **Daleth example**:
```txt ```txt
ul: { ul [
Item 1 Item 1
Item 2 Item 2
} ]
``` ```
## 5. Ordered list ## 5. Ordered list
@ -108,11 +111,11 @@ Ordered list is used to create a list with increasing numbers.
**Daleth example**: **Daleth example**:
```txt ```txt
ol: { ol [
Item Item
Item Item
Item Item
} ]
``` ```
## 6. Row ## 6. Row
@ -128,15 +131,15 @@ Splits the text into rows. The alignment argument specifies how the items inside
**Daleth example**: **Daleth example**:
```txt ```txt
row: { row [
Left Left
Right Right
} ]
row[start]: { row(start) [
Left Left
Right Right
} ]
``` ```
Argument converts to numbers in daletl. Argument converts to numbers in daletl.
@ -158,7 +161,7 @@ Link to other sites. On click the link opens in new tab.
**Daleth example**: **Daleth example**:
```yaml ```yaml
link[https://example.com]: I am Link link(https://example.com): I am Link
``` ```
## 8. Navlink ## 8. Navlink
@ -175,7 +178,7 @@ Link to the same site. On click the link opens in current tab.
**Daleth example**: **Daleth example**:
```yaml ```yaml
navlink[/specification]: I am Navlink navlink(/specification): I am Navlink
``` ```
## 9. Button ## 9. Button
@ -192,7 +195,7 @@ Same as link, but with button style.
**Daleth example**: **Daleth example**:
```yaml ```yaml
btn[https://example.com]: I am Button btn(https://example.com): I am Button
``` ```
## 10. NavButton ## 10. NavButton
@ -209,7 +212,7 @@ Same as navlink, but with button style.
**Daleth example**: **Daleth example**:
```yaml ```yaml
navbtn[https://example.com]: I am NavButton navbtn(https://example.com): I am NavButton
``` ```
## 11. Image ## 11. Image
@ -226,7 +229,7 @@ Displays an image.
**Daleth example**: **Daleth example**:
```yaml ```yaml
img[/dalet.png] img(/dalet.png)
``` ```
## 12. Table ## 12. Table
@ -243,9 +246,9 @@ Creates a table.
**Daleth example**: **Daleth example**:
```txt ```txt
table: { table {
Name | Age Name | Age
Elon | 53, Elon | 53
} }
``` ```
@ -263,10 +266,10 @@ Creates a table column.
**Daleth example**: **Daleth example**:
```txt ```txt
tcol: { tcol [
Name Name
Age Age
} ]
``` ```
## 14. Table Primary Column ## 14. Table Primary Column
@ -283,10 +286,10 @@ Like table column, but with primary background.
**Daleth example**: **Daleth example**:
```txt ```txt
tpcol: { tpcol [
Name Name
Age Age
} ]
``` ```
## 15. Horizontal rule ## 15. Horizontal rule
@ -371,7 +374,7 @@ Link to footnote.
**Daleth example**: **Daleth example**:
```yaml ```yaml
footlnk[1] footlnk(1)
``` ```
## 20. Footnote ## 20. Footnote
@ -388,7 +391,7 @@ Creates footnote.
**Daleth example**: **Daleth example**:
```yaml ```yaml
footn[1]: I am Footnote footn(1): I am Footnote
``` ```
## 21. Anchor ## 21. Anchor
@ -398,14 +401,14 @@ footn[1]: I am Footnote
| name | a | | name | a |
| id | 21 | | id | 21 |
| body | no | | body | no |
| argument | text , number | | argument | text, number |
Creates anchor. Like `<a href="#argument"></a>` in HTML. Creates anchor. Like `<a href="#argument"></a>` in HTML.
**Daleth example**: **Daleth example**:
```yaml ```yaml
a[0] a(0)
``` ```
## 22. Strikethrough ## 22. Strikethrough
@ -473,7 +476,7 @@ Creates disclosure element.
**Daleth example**: **Daleth example**:
```yaml ```yaml
disc[Click to expand]: I am Disclosure disc(Click to expand): I am Disclosure
``` ```
## 26. Block ## 26. Block
@ -512,10 +515,10 @@ Creates carousel.
**Daleth example**: **Daleth example**:
```txt ```txt
carousel: { carousel [
Example 1 Example 1
Example 2, Example 2,
} ]
``` ```
## 28. Code ## 28. Code
@ -532,7 +535,7 @@ Creates code block.
**Daleth example**: **Daleth example**:
```txt ```txt
code[js]: let code = "js" code(js): let code = "js"
``` ```
## 29. Pre-formatted text ## 29. Pre-formatted text
@ -566,5 +569,5 @@ Not displayed. Specifies metadata such as title, description. Must be before all
**Daleth example**: **Daleth example**:
```yaml ```yaml
meta[description]: I am description meta(description): I am description
``` ```