47 lines
931 B
Ruby
47 lines
931 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Repubmark
|
|
module Elems
|
|
class Annotation < Base
|
|
parents :Article
|
|
|
|
def initialize(parent)
|
|
super parent
|
|
@canvas = Canvas.new self
|
|
end
|
|
|
|
#################
|
|
# Basic methods #
|
|
#################
|
|
|
|
def word_count = @canvas.word_count
|
|
|
|
def to_html
|
|
[
|
|
%(<div#{html_class(:annotation)}>\n),
|
|
@canvas.to_html,
|
|
"</div>\n",
|
|
].join.freeze
|
|
end
|
|
|
|
def to_gemtext = @canvas.to_gemtext
|
|
|
|
###################
|
|
# Builder methods #
|
|
###################
|
|
|
|
def respond_to_missing?(method_name, _include_private)
|
|
@canvas.respond_to?(method_name) || super
|
|
end
|
|
|
|
def method_missing(method_name, ...)
|
|
if @canvas.respond_to? method_name
|
|
@canvas.public_send(method_name, ...)
|
|
else
|
|
super
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|