Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frostime/sy-test-template
https://github.com/frostime/sy-test-template
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/frostime/sy-test-template
- Owner: frostime
- License: mit
- Created: 2024-04-26T02:12:24.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-11T06:48:26.000Z (4 months ago)
- Last Synced: 2024-07-11T08:10:20.940Z (4 months ago)
- Language: TypeScript
- Size: 98.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Usage
1. Input the template text into the left-side textarea.
- The left-side textarea supports tab indentation, Shift+Tab unindentation, and Enter for automatic indented newline.
2. Click the "render" button at the top-right corner.
3. The rendered result will be shown in the right textarea.## Two Formats
SiYuan supports two template formats:
1. The vanilla Golang template format: `{{ }}`.
2. The SiYuan built-in revised template format: `.action{}`.> Mainly because the `{{ }}` syntax conflicts with the `embed block` syntax.
This plugin allows you to quickly convert between different formats by clicking the top-left buttons `To .action` and `To {{ }}`.
For example, with the following input into the textarea:
```code
{{ now }}
```And click the "To .action", it will be converted to:
```code
.action{ now }
```## Action Region Syntax
It is not easy to write `.action` or `{{}}` on each line, especially when you want to test a very long template.
For convenience, this plugin offers a **custom** region syntax like this:
```
.startaction
$x := now
$x.Year
add 1 3 | sub 5
.endaction
```Each line placed within the `.startaction ... .endaction` will be implicitly wrapped with `{{ }}` before rendering.
**Notice**! You cannot use this syntax in SiYuan's template system. Please click the "Translate Region" button at the top-right before you want to apply the template you are testing.
## Button Function Descriptions
![](asset/buttons.png)
- Region Functions
- `Insert Region`: Click to insert a `.startaction ... .endaction` region around the cursor (or selected text).
- `Translate Region`: Convert the `.startaction ... .endaction` region to `.action{}` template syntax for easy copying and pasting.
- Remove Functions
- `Remove {{}}`: Remove all `{{ }}` decorators.
- `Remove .action{}`: Remove all `.action{}` decorators.
- Format Conversion
- `To {{}}`: Convert `.action{}` to `{{ }}` decorators.
- `To .action{}`: Convert `{{ }}` to `.action{}` decorators.
- Render: Render the template text in the left text area to the result in the right text area.