Class: Deplate::Command::AUTHOR
- Inherits:
-
Deplate::Command
- Object
- Element
- Deplate::Command
- Deplate::Command::AUTHOR
- Defined in:
- lib/deplate/commands.rb
Class Method Summary collapse
Methods inherited from Deplate::Command
commands, #finish, #format_special, #process, register_as, #setup, #setup_command, update_variables
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
.accumulate(src, array, deplate, text, match, args, cmd) ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/deplate/commands.rb', line 438 def accumulate(src, array, deplate, text, match, args, cmd) Deplate::Core.log('%s: %s' % [cmd, text], :debug, src) deplate.. ||= [] for this in text.split(/([;\/]|\s+(&|and))\s+/) unless this =~ /^\s*([;\/&]|and)\s*$/ = Deplate::Names.name_match_sf(this) || Deplate::Names.name_match_fs(this) || {} sn = args['surname'] [:surname] = sn if sn fn = args['firstname'] [:firstname] = fn if fn if this.empty? [:name] = args['name'] || '%s %s' % [args['firstname'], args['surname']] else [:name] = this end [:note] = args['note'] deplate.. << end end sep = deplate.variables['authorSep'] || '; ' = deplate...collect {|h| h[:name]} = .join(sep) parsed = deplate.parse_with_source(src, , false) deplate.set_clip('author', Deplate::Element::Clip.new(parsed, deplate, src)) deplate.(src, 'type' => 'metadata', 'name' => 'author', 'value' => ) end |