new Tag(name, argsopt, callbackArgs)
Class for a single tag element, this is the tag itself but not the action.
A tag contains tag name and arguments.
Arguments will be normalized and validated before tag runs.
Parameters:
Name |
Type |
Attributes |
Description |
name |
string
|
|
|
args |
Object.<string, ?>
|
<optional>
|
|
callbackArgs |
Array.<string>
|
|
|
- Implements:
- Tutorials:
-
Members
(static) actions :object.<string, TagAction>
Type:
(static) validators
Validator validates/modifies arguments for tag.
Object
You can create your own validator and add it during runtime.
It can be specified via TagActions.rules[].type
args
Properties:
Type |
Description |
Object.<String, ?>
|
|
conductor
Properties:
Type |
Attributes |
Description |
Conductor
|
<nullable>
|
conductorがこのタグを実行する時、これを変わります。 |
file
Properties:
lineNumber
Properties:
Type |
Description |
number
|
KAGFileオブジェクトのlinesにある、このタグのインデックス |
originalCharNumber
Properties:
Type |
Attributes |
Description |
number
|
<nullable>
|
.ksファイルにあるキャラクターナンバー |
originalLineNumber
Properties:
Type |
Attributes |
Description |
number
|
<nullable>
|
.ksファイルにあるラインナンバー |
scopeVars
Properties:
Type |
Attributes |
Description |
object.<string, ?>
|
<optional>
|
|
tagName
Properties:
Methods
(static) restore(obj) → {Tag|Promise.<Tag>}
Parameters:
Returns:
-
Type
-
Tag
|
Promise.<Tag>
argsForAction() → {object.<string, ?>}
Returns:
-
Type
-
object.<string, ?>
done()
タグが終わったらこれを呼べば次のタグに移行します
error(message)
エラーメッセージをプリント
Parameters:
Name |
Type |
Description |
message |
string
|
|
eval(value)
Eval with custom scope
Parameters:
Name |
Type |
Description |
value |
string
|
|
exitScope()
Call the exitScope of TagAction.
Override this in action if needed.
flattenCurrentScope() → {object}
Returns:
-
Type
-
object
getAction(name) → (nullable) {TagAction}
Specify where to find TagActions, default is conductor.tagActions.
Designed to be overwritten for customization.
Parameters:
Name |
Type |
Description |
name |
string
|
|
Returns:
-
Type
-
TagAction
Returns:
-
Type
-
PartialFile
getCloseTag() → {Tag}
閉じタグを返す
Returns:
-
Type
-
Tag
getOpenTag() → {Tag}
閉じタグがopenTagを探します
Returns:
-
Type
-
Tag
isOpen() → {boolean}
Callbackあるかどうか
Returns:
-
Type
-
boolean
jumpToTag(tag)
Jump to a certain tag, handle stack pop if needed.
Parameters:
Name |
Type |
Description |
tag |
Tag
|
The tag to jump to |
makeScopeVars(arr) → {Object}
Parameters:
Name |
Type |
Description |
arr |
Array
|
|
Returns:
-
Type
-
Object
normalizedArgs(args) → {object.<string, ?>}
[font size="&f.fontsize"] みたいなjs変数を対応
[font size=%fontsize] みたいなマクロ属性を対応
Parameters:
Name |
Type |
Description |
args |
object.<string, ?>
|
|
Returns:
-
Type
-
object.<string, ?>
Run the tag, this also normalize and validate args.
Returns:
-
Type
-
Tag.ActionResult
setScopeVars(args)
Parameters:
Name |
Type |
Description |
args |
Object
|
Array
|
|
- Implements:
Returns:
- An plain that can be serialized to json
-
Type
-
object
|
Serializable
|
Restorable
これは復元できる形にするfunction
toJSONの中にないのはセーブ以外の場合にも使いたいだからです。
KAGFileはいつもメモリーにあるとは限らない(メモリー消耗を抑えるため)ので、
直接tagを置かなくてtoRestorableで復元できる状態として保存される場合があります。
例えばconductorのmacroDef.startTagとか
Returns:
-
Type
-
Tag.Restorable
validate(_args) → {any}
Parameters:
Name |
Type |
Description |
_args |
object
|
|
Returns:
-
Type
-
any
warn(message)
警告メッセージをプリント
Parameters:
Name |
Type |
Description |
message |
string
|
|
Type Definitions
ActionResult
- 0 means finished immediately
- 1 means waiting the tag to finish
- 2 means the tag stopped, never finish.
Type:
Restorable
Type:
- Implements: