rb/noat.rb
# Public: add an annotation to the list of annotations to be applied.
#
# * tag     - A string to be used as the tag, eg `'em'` becomes `<em>`/`</em>`.
# * a_start - An integer that is the text position of the open tag.
# * a_end   - (optional) - An integer that is the test position of the closing tag.
#               If not provided, the start is used (ie the tag is opened and then
#               closed immediately, eg `...blah<span></span>blah...`).
# * attrs   - (optional) - A hash of key-value attributes to be added to
#               the tag, eg `{ :id => 'foo' }` becomes `id="foo"`.
add an annotation to the list of annotations to be applied.
add an annotation to the list of annotations to be applied .
def add(tag, a_start, a_end_or_attrs=nil, attrs=nil)
        a_start = a_start.to_i()
        if a_end_or_attrs.is_a? Integer or a_end_or_attrs.is_a? Float
            a_end = a_end_or_attrs
        else
            a_end = a_start
            attrs = a_end_or_attrs
        end
        if a_end.nil?
            a_end = a_start
        end
        if attrs.nil?
            attrs = {}
        end
        a_end = a_end.to_i()
        self._validateRange(a_start, a_end)
        @annotations.push({
            :tag    => tag,
            :start  => a_start,
            :end    => a_end,
            :attrs  => attrs,
        })
        @_markup = nil
    end
def add ( tag , a_start , a_end_or_attrs = nil , attrs = nil ) a_start = a_start . to_i ( ) if a_end_or_attrs . is_a? Integer or a_end_or_attrs . is_a? Float a_end = a_end_or_attrs else a_end = a_start attrs = a_end_or_attrs end if a_end . nil? a_end = a_start end if attrs . nil? attrs = { } end a_end = a_end . to_i ( ) self . _validateRange ( a_start , a_end ) @annotations . push ( { :tag => tag , :start => a_start , :end => a_end , :attrs => attrs , } ) @_markup = nil end
Public: add an annotation to the list of annotations to be applied.
Public : add an annotation to the list of annotations to be applied .
tag
<not_specific>
a_start
<not_specific>
a_end_or_attrs
<not_specific>
attrs
<not_specific>