Class: Deplate::Base

Inherits:
CommonObject show all
Includes:
CommonGround
Defined in:
lib/deplate/common.rb

Direct Known Subclasses

BaseElement, BaseParticle

Instance Attribute Summary

Attributes included from CommonGround

#args, #container, #deplate, #doc_slot, #doc_type, #elt, #epilogue, #indentation, #indentation_level, #keep_whitespace, #level, #level_as_list, #level_as_string, #match, #prologue, #prototype, #source, #styles, #text

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommonGround

#can_be_labelled, #element_or_particle, #filter_template, #format_element, get_explicit_id, #get_id, #heading_level, #initialize, #inlay?, #labels_sans_id, #log, #match_expected, #output, #output_at, #output_file_name, #output_location, #output_preferably_at, #plain_caption?, post_process_text, #styles_as_string, #tagged_as?, #top_container, #update_args, #update_id, #update_styles, #warn_unpexpected

Methods inherited from CommonObject

class_attribute, class_attributes, class_attributes=, class_attributes_ensure, class_meta_attributes, inherited, method_missing, respond_to?

Class Method Details

.def_get(name, arg = nil) ⇒ Object



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/deplate/common.rb', line 507

def def_get(name, arg=nil)
    mname = "get_#{name}"
    case arg
    when Array
        define_method(mname) do 
            for i in arg
                rv = @match[i]
                return rv if rv
            end
        end
    when Proc
        define_method(mname, arg)
    when Numeric
        define_method(mname) {@match[arg]}
    else
        define_method(mname) {nil}
    end
end

.set_formatter(formatter, alt = false) ⇒ Object



526
527
528
529
530
531
532
# File 'lib/deplate/common.rb', line 526

def set_formatter(formatter, alt=false)
    if alt
        self.formatter2 = formatter
    else
        self.formatter = formatter
    end
end

.set_rx(rx) ⇒ Object



503
504
505
# File 'lib/deplate/common.rb', line 503

def set_rx(rx)
    self.rx = rx
end

Instance Method Details

#exclude?(filter, container = nil) ⇒ Boolean

Returns:

  • (Boolean)


543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/deplate/common.rb', line 543

def exclude?(filter, container=nil)
    unless filter
        return false
    end
    tags = @args['tag'] || 'any'
    taglist = Deplate::Core.split_list(tags)
		if container and (tags = @container.args['tag'])
			taglist += Deplate::Core.split_list(tags)
		end
    if (globaltags = @deplate.variables['tag'])
        taglist += Deplate::Core.split_list(globaltags)
    end
    Deplate::Core.split_list(filter).each do |ftag|
        if ftag == 'any' and taglist.empty?
            return false
        else
            taglist.each do |tag|
                if ftag == tag
                    return false
                end
            end
        end
    end
    return true
end

#label_modeObject



535
536
537
# File 'lib/deplate/common.rb', line 535

def label_mode
    self.class.label_mode
end

#pop(array) ⇒ Object



539
540
541
# File 'lib/deplate/common.rb', line 539

def pop(array)
    array.pop
end