app/models/tramea.rb
# NOTE: The 'sections' are always in English; you'll have to look up
# translations based on those strings. Activities and revisions are stored
# separately.
The 'sections' are always in English; you'll have to look up
translations based on those strings. Activities and revisions are stored
separately.
The ' sections ' are always in English ; you ' ll have to look up translations based on those strings . Activities and revisions are stored separately .
def article_from_data_object(article, taxon = nil)
      raise "Must be an article" unless article.article?
      {
        "id" => article.id,
        "guid" => article.guid,
        "title" => article.object_title,
        "sections" => article.toc_items.map { |ti| ti.label }.compact,
        "language" => article.language.iso_639_1,
        "body_html" => Sanitize.clean(
            article.description.balance_tags,
            Sanitize::Config::RELAXED
          ).fix_old_user_added_text_linebreaks(:wrap_in_paragraph => true),
        "references" => article.refs.map do |ref|
          ref.full_reference.balance_tags.add_missing_hyperlinks
        end
      }.merge(license_from_data_object(article)).
        merge(trust_from_curatable(article, taxon))
    end
def article_from_data_object ( article , taxon = nil ) raise "Must be an article" unless article . article? { "id" => article . id , "guid" => article . guid , "title" => article . object_title , "sections" => article . toc_items . map { | ti | ti . label } . compact , "language" => article . language . iso_639_1 , "body_html" => Sanitize . clean ( article . description . balance_tags , Sanitize :: Config :: RELAXED ) . fix_old_user_added_text_linebreaks ( :wrap_in_paragraph => true ) , "references" => article . refs . map do | ref | ref . full_reference . balance_tags . add_missing_hyperlinks end } . merge ( license_from_data_object ( article ) ) . merge ( trust_from_curatable ( article , taxon ) ) end
NOTE: The 'sections' are always in English; you'll have to look up
translations based on those strings.
NOTE : The ' sections ' are always in English ; you ' ll have to look up translations based on those strings .
# NOTE: I removed an autolink here (it wasn't working; seemed superfluous here anyway) # NOTE: Yes, I too am tearing my hair out: # NOTE: refs actually also have one or more optional "identifiers". I # don't think we need them, now that we have autolinks, so I am going to # ignore them entirely.
article
<not_specific>
taxon
<not_specific>