Sha256: 7705886b29ca9bba84e4f7c2aad2694c9af2631b8ca1d8362ff54673d28750e6

Contents?: true

Size: 909 Bytes

Versions: 34

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true

# title: Doing File Export
# description: Export Doing format data
# author: Brett Terpstra
# url: https://brettterpstra.com
module Doing
  class DoingExport
    def self.settings
      {
        trigger: 'doing'
      }
    end

    def self.render(wwid, items, variables: {})
      return if items.nil?

      content = Doing::Items.new
      items.each do |item|
        content.add_section(item.section, log: false)
        content.push(item)
      end

      out = []
      content.sections.each do |section|
        out.push(section.original)
        is = content.in_section(section.title).sort_by { |i| [i.date, i.title] }
        is.reverse! if Doing.setting('doing_file_sort').normalize_order == :desc
        is.each { |item| out.push(item.to_s) }
      end

      Doing::Pager.page out.join("\n")
    end

    Doing::Plugins.register 'doing', :export, self
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
doing-2.1.88 lib/doing/plugins/export/doing_export.rb
doing-2.1.87 lib/doing/plugins/export/doing_export.rb
doing-2.1.86 lib/doing/plugins/export/doing_export.rb
doing-2.1.85 lib/doing/plugins/export/doing_export.rb
doing-2.1.84 lib/doing/plugins/export/doing_export.rb
doing-2.1.83 lib/doing/plugins/export/doing_export.rb
doing-2.1.82 lib/doing/plugins/export/doing_export.rb
doing-2.1.81 lib/doing/plugins/export/doing_export.rb
doing-2.1.80 lib/doing/plugins/export/doing_export.rb
doing-2.1.79 lib/doing/plugins/export/doing_export.rb
doing-2.1.78 lib/doing/plugins/export/doing_export.rb
doing-2.1.77 lib/doing/plugins/export/doing_export.rb
doing-2.1.76 lib/doing/plugins/export/doing_export.rb
doing-2.1.75 lib/doing/plugins/export/doing_export.rb
doing-2.1.74 lib/doing/plugins/export/doing_export.rb
doing-2.1.73 lib/doing/plugins/export/doing_export.rb
doing-2.1.72 lib/doing/plugins/export/doing_export.rb
doing-2.1.69 lib/doing/plugins/export/doing_export.rb
doing-2.1.68 lib/doing/plugins/export/doing_export.rb
doing-2.1.66 lib/doing/plugins/export/doing_export.rb