-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Berrysoft/dev/new-config
Use the new config structure.
- Loading branch information
Showing
31 changed files
with
597 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
# Resources | ||
The resources are indexed by locale: | ||
``` yaml | ||
res: | ||
en: | ||
foo: Foo value | ||
bar: Bar value | ||
``` ignore | ||
config.yaml | ||
└─res | ||
├─en.yaml | ||
├─ja.yaml | ||
└─zh.yaml | ||
``` | ||
You can specify other locales, too. | ||
The keys not specified in other locales will fallback to `base_lang` ones. | ||
|
||
`en.yaml` | ||
``` yaml | ||
foo: Foo | ||
bar: Bar | ||
``` | ||
`zh.yaml` | ||
``` yaml | ||
base_lang: en | ||
res: | ||
en: | ||
foo: Foo | ||
bar: Bar | ||
zh: | ||
foo: 天 | ||
bar: 地 | ||
foo: 天 | ||
bar: 地 | ||
``` | ||
|
||
## Reference resources | ||
You can reference resources in texts with `\res{}` command. | ||
``` yaml | ||
- 'The foo value: \res{foo}' | ||
- 'The bar value: \res{bar}' | ||
- The foo value is \res{foo} | ||
- The bar value is \res{bar} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
title: Fibonacci | ||
author: Berrysoft | ||
base_lang: en | ||
paras: | ||
en: | ||
- tag: init | ||
texts: | ||
- 1 | ||
- \exec{$n = 50; $a = 1; $b = 1; $i = 1; $b} | ||
next: loop | ||
- tag: loop | ||
texts: | ||
- \exec{c = $b; $b += $a; $a = c; $i += 1; $b} | ||
next: \exec{if($i < $n, "loop")} | ||
paras: paras | ||
start: init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- tag: init | ||
texts: | ||
- 1 | ||
- \exec{$n = 50; $a = 1; $b = 1; $i = 1; $b} | ||
next: loop | ||
- tag: loop | ||
texts: | ||
- \exec{c = $b; $b += $a; $a = c; $i += 1; $b} | ||
next: \exec{if($i < $n, "loop")} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- tag: init | ||
texts: | ||
- \exec{$n = random.rnd(50); $a = 1; $b = 1; $i = 1; format.fmt("Starting to calculate Fibonacci {}", $n)} | ||
next: loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- tag: loop | ||
texts: | ||
- \exec{a = $a; b = $b; c = $b; $b += $a; $a = c; $i += 1; format.fmt("{:<11} + {:<11} = {:<11}", a, b, $b)} | ||
next: \exec{if($i < $n, "loop")} |
Oops, something went wrong.