Skip to content

Commit

Permalink
2024.06.23: Translate doc to Simplified Chinese.
Browse files Browse the repository at this point in the history
  • Loading branch information
jellyterra committed Jun 23, 2024
1 parent bac3e63 commit b72b3d1
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 105 deletions.
38 changes: 27 additions & 11 deletions en-US/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Find the executable that matches your OS and architecture in [releases](https://
$ go install github.com/webpagine/pagine/v2/cmd/pagine@latest
```

> [!TIP]
> Install Pagine via Go mod is recommended for non-amd64 platforms. Choose Go toolchain for your platform [here](https://go.dev/dl).
## Usage

Usage of pagine:
Expand Down Expand Up @@ -64,6 +67,10 @@ It automatically executes generation when file changes are detected by `inotify`
Since v2.1.0, the server provides a WebSocket interface at `/ws` to provide event monitoring for the client, such as page updates.

> [!CAUTION]
> Exposing your Pagine server to the public network might be risky!
> You should deploy your final pages via static page services.
## Structure

### Template
Expand Down Expand Up @@ -168,13 +175,18 @@ define = { title = "Page not found" }
| `sub` | a, b: Int | Int |
| `mul` | a, b: Int | Int |
| `div` | a, b: Int | Int |
| `mod` | a,b : Int | Int |
| `mod` | a, b: Int | Int |

### Engine API

| Func | Args | Description |
|-----------|------------------------|--------------------------------------------------------------------------------------------------|
| `getAttr` | key: String | Get meta information in the form of map about units, hierarchy and templates provided by engine. |
| Func | Description |
|-----------|--------------------------------------------------------------------------------------------------|
| `getEnv` | Get environment information for debug use. |
| `getAttr` | Get meta information in the form of map about units, hierarchy and templates provided by engine. |

| Environment | Description |
|-------------|---------------------------------------------|
| `isServing` | Return true if Pagine is running as server. |

| Attribution | Description |
|----------------|-------------------------------------------------|
Expand All @@ -185,6 +197,9 @@ define = { title = "Page not found" }
|---------------|-------------------------------------------------------|
| `getMetadata` | It returns the root node of metadata of the template. |

> [!TIP]
> `(getEnv).isServing` can be used to enable some debug code in templates such as page realtime update.
### Data processing

| Func | Args | Result |
Expand All @@ -201,13 +216,14 @@ define = { title = "Page not found" }

Path starts from where the unit is.

| Func | Args | Description |
|------------------|------------------------|-----------------------------------------|
| `apply` | path: String, data Any | Invoke a template. |
| `embed` | path: String | Embed file raw content. |
| `render` | path: String | Invoke renderer by file extension name. |
| `renderAsciidoc` | path: String | Render and embed Asciidoc content. |
| `renderMarkdown` | path: String | Render and embed Markdown content. |
| Func | Args | Description |
|------------------|--------------------------------|------------------------------------------|
| `apply` | path: String, data: Any | Invoke a template. |
| `applyFromEnv` | templateKey: String, data: Any | Invoke a template defined in `env.toml`. |
| `embed` | path: String | Embed file raw content. |
| `render` | path: String | Invoke renderer by file extension name. |
| `renderAsciidoc` | path: String | Render and embed Asciidoc content. |
| `renderMarkdown` | path: String | Render and embed Markdown content. |

| Format | File Extension Name |
|----------|---------------------|
Expand Down
Loading

0 comments on commit b72b3d1

Please sign in to comment.