Code for drawings.hcoder.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
622B

  1. require 'yaml'
  2. $picture_files = (Dir.glob(File.join("source/content", "*.jpg")) +
  3. Dir.glob(File.join("source/content", "*.png"))).sort.reverse
  4. def picture_info_hashes
  5. $picture_files.map {|path|
  6. base_filename = path.gsub(/\.[^.]+$/, "")
  7. info = {"description" => "Some drawing",
  8. "tags" => ["pencil", "scan", "mdscan"]}
  9. begin
  10. info = YAML.load(File.read(base_filename + ".yaml"))
  11. rescue Errno::ENOENT
  12. end
  13. {:id => File.basename(base_filename),
  14. :name => File.basename(path),
  15. :date => info["date"],
  16. :description => info["description"],
  17. :tags => info["tags"]}
  18. }
  19. end