Sha256: 58bb4d9cd476b946f333839d9409fd79b0862cce0a03995f991f617bd0eef35b

Contents?: true

Size: 753 Bytes

Versions: 26

Compression:

Stored size: 753 Bytes

Contents

class GetFilePath
  def initialize(src)
    @src = src
  end

  def get_file_path()
    #lines = File.readlines(@src.gsub(".org", ".md"))
    lines = File.readlines(@src)
    files = []
    lines.each do |line|
      #if path2 = line.match(/\!\[img\]\(((.+))/)# "(.+)"\)/)
      #if path2 = line.match(/\[\[file\:(.+)\](.+)\]\]/) || line.match(/\[\[file:(.+)\]\]/)
      if path2 = line.match(/\[\[(.+)\]\[file:(.+)\]\]/) || line.match(/\[\[file:(.+)\]\]/)
        if path2[2] == nil
          files << path2[1]
        else
          files << path2[2]
        end
      end
    end

    #paths = []
    #files.each do |file|
      #paths << File.join(Dir.pwd, file)
    #end
    #return paths
    return files
  end
end

#GetFilePath.new("thesis.org")

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
qiita_org-0.2.2 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.2.1 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.41 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.40 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.39 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.38 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.37 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.35 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.34 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.33 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.32 lib/qiita_org/old_programs/get_file_path.rb
qiita_org-0.1.31 lib/qiita_org/get_file_path.rb
qiita_org-0.1.30 lib/qiita_org/get_file_path.rb
qiita_org-0.1.29 lib/qiita_org/get_file_path.rb
qiita_org-0.1.28 lib/qiita_org/get_file_path.rb
qiita_org-0.1.27 lib/qiita_org/get_file_path.rb
qiita_org-0.1.26 lib/qiita_org/get_file_path.rb
qiita_org-0.1.25 lib/qiita_org/get_file_path.rb
qiita_org-0.1.24 lib/qiita_org/get_file_path.rb
qiita_org-0.1.23 lib/qiita_org/get_file_path.rb