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
36
37
38
|
# File 'lib/deplate/commands.rb', line 36
def commands
@@commands
end
|
.register_as(name, c = self) ⇒ Object
40
41
42
|
# File 'lib/deplate/commands.rb', line 40
def register_as(name, c=self)
@@commands[name] = self
end
|
.update_variables(hash, opts, args) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/deplate/commands.rb', line 44
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
83
84
85
86
|
# File 'lib/deplate/commands.rb', line 83
def finish
@elt = [ @accum.join(' ') ]
return self
end
|
94
95
96
|
# File 'lib/deplate/commands.rb', line 94
def format_special
@deplate.formatter.format_unknown(self)
end
|
#process ⇒ Object
88
89
90
91
92
|
# File 'lib/deplate/commands.rb', line 88
def process
process_etc
@elt = @elt.join("\n")
return self
end
|
#setup(args, cmd) ⇒ Object
70
71
72
73
74
75
76
77
78
|
# File 'lib/deplate/commands.rb', line 70
def setup(args, cmd)
@name = cmd
@accum = [@text]
@can_be_labelled = false
@args.update(args)
setup_command
update_args
end
|
#setup_command ⇒ Object
80
81
|
# File 'lib/deplate/commands.rb', line 80
def setup_command
end
|