class GetFilePath

Public Class Methods

new(src) click to toggle source
# File lib/qiita_org/old_programs/get_file_path.rb, line 2
def initialize(src)
  @src = src
end

Public Instance Methods

get_file_path() click to toggle source
# File lib/qiita_org/old_programs/get_file_path.rb, line 6
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