Class: Deplate::Command
Direct Known Subclasses
ABBREV, ARG, AUTHOR, AUTHORNOTE, AUTOIDX, BIB, CAP, COUNTER, DATE, DEFCOUNTER, DEFLIST, DONTIDX, GET, IDX, IMG, INC, LANG, LIST, LTX, MAKEBIB, MAKETITLE, MODULE, Matter, NOIDX, NOP, OPT, PHP, PUT, REGISTER, TABLE, TITLE, VAR, WITH, XARG, Define::Command, Define::CommandNative, Element::PAGE, Input::Play::ACT, Input::Play::CAST
Defined Under Namespace
Classes: ABBREV, ARG, AUTHOR, AUTHORNOTE, AUTOIDX, BIB, BODY, CAP, COUNTER, DATE, DEFCOUNTER, DEFLIST, DONTIDX, GET, IDX, IMG, INC, KEYWORDS, LANG, LIST, LTX, MAKEBIB, MAKETITLE, MODULE, Matter, NOIDX, NOP, OPT, PHP, POSTMATTER, PREMATTER, PUSH, PUT, REGISTER, TABLE, TITLE, VAR, WITH, XARG
Constant Summary
collapse
- @@commands =
{}
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Names
name_match_c, name_match_fs, name_match_sf
Methods inherited from Element
#join_lines, #join_lines_re_zh_cn
Class Method Details
.commands ⇒ Object
44
45
46
|
# File 'lib/deplate/commands.rb', line 44
def commands
@@commands
end
|
.register_as(name, c = self) ⇒ Object
48
49
50
|
# File 'lib/deplate/commands.rb', line 48
def register_as(name, c=self)
@@commands[name] = self
end
|
.update_variables(hash, opts, args) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/deplate/commands.rb', line 52
def update_variables(hash, opts, args)
if args
opts ||= {}
d = args['date']
args['date'] = get_date(d, args) if d
if opts['add']
if opts['add'].kind_of?(String)
sep = opts['add']
else
sep = ' '
end
args.each_pair do |k,v|
if hash[k]
v = hash[k] + sep + v
end
hash[k] = v
end
else
hash.update(args)
end
else
Deplate::Core.log(['No arguments', opts], :error, src)
end
end
|
Instance Method Details
#finish ⇒ Object
91
92
93
94
|
# File 'lib/deplate/commands.rb', line 91
def finish
@elt = [ @accum.join(' ') ]
return self
end
|
102
103
104
|
# File 'lib/deplate/commands.rb', line 102
def format_special
@deplate.formatter.format_unknown(self)
end
|
#process ⇒ Object
96
97
98
99
100
|
# File 'lib/deplate/commands.rb', line 96
def process
process_etc
@elt = @elt.join("\n")
return self
end
|
#setup(args, cmd) ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/deplate/commands.rb', line 78
def setup(args, cmd)
@name = cmd
@accum = [@text]
@can_be_labelled = false
@args.update(args)
setup_command
update_args
end
|
#setup_command ⇒ Object
88
89
|
# File 'lib/deplate/commands.rb', line 88
def setup_command
end
|