Changeset 412
- Timestamp:
- Jun 28, 2016, 12:16:20 AM (3 years ago)
- Location:
- www
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
www/Rules
r401 r412 4 4 ignore "/style.*" 5 5 6 # Don't upload the hotcrp json files7 ignore "/anrw/*/*. json"6 # Don't upload the hotcrp json and xml files 7 ignore "/anrw/*/*.{xml,json}" 8 8 9 9 compile "/**/*.haml" do -
www/content/anrw/2016/program.haml
r410 r412 44 44 45 45 - json = "content/anrw/2016/anrw16-data.json" 46 - xml = "content/anrw/2016/anrw16_jul16_16.xml" 46 47 %table.table.table-striped.no-urlify 47 48 %thead … … 62 63 %td 63 64 %h4.text-danger Session: Multipath 65 66 -# .row= htmlify_paper(xml, 1) 67 -# .row= htmlify_paper(xml, 2) 68 -# .row= htmlify_paper(xml, 3) 69 -# .row= htmlify_paper(xml, 4) 64 70 65 71 .row= htmlify_paper(json, 16) -
www/lib/helper_anrw.rb
r410 r412 2 2 require "active_support/core_ext/string/inflections" 3 3 require "active_support/core_ext/array/conversions" 4 require 'active_support/core_ext/hash' 5 # require 'pp' 4 6 5 7 module ANRW 6 def htmlify_paper(json, nr) 7 papers = JSON.parse(File.read(json)) 8 p = papers.select{ |p| p["pid"] == nr }[0] 9 label = p["options"]["type"] =~ /full/ ? "success" : "default" 8 def htmlify_paper(file, nr) 9 p = case File.extname(file) 10 when ".json" 11 JSON.parse(File.read(file)).select{ |x| x["pid"] == nr }[0] 12 when ".xml" 13 p = Hash.from_xml(File.read(file))["proceeding"]["content"]["section"].each{ |s| 14 # pp nr, s["section_title"] 15 a = s["article_rec"].find{ |x| x["seq_no"].to_i == nr } 16 # pp nr, a["title"] 17 return a 18 } 19 # pp nr, p 20 { 21 "options": { "type": (p["pages"].to_i > 4 ? "Full" : "Short") + " Paper" }, 22 "final": { "content_file": p["fulltext"]["file"]["fname"] }, 23 "authors": p["authors"]["au"].map { |a| 24 { 25 "first": a["first_name"], 26 "last": a["last_name"], 27 "affiliation": a["affiliation"] 28 } 29 }, 30 "title": p["title"], 31 "abstract": p["abstract"].values.join(" ") 32 }.deep_stringify_keys 33 else 34 raise "Don't know how to handle #{file}" 35 end 36 label = p["options"]["type"] =~ /full/i ? "success" : "default" 10 37 names = p["authors"].map { |a| 11 38 a["first"] + " " + a["last"] + (a.key?("affiliation") ? 12 39 " <em class=\"text-muted\">(" + a["affiliation"] + ")</em>" : "") 13 40 } 14 pdf = File.join(File.dirname( json), p["final"]["content_file"])41 pdf = File.join(File.dirname(file), p["final"]["content_file"]) 15 42 16 43 html = %{ … … 30 57 </div> 31 58 <div class="modal-body"> 32 #{p["abstract"] }59 #{p["abstract"].gsub(/([[:alpha:]])-[[:space:]]+/, '\1')} 33 60 </div> 34 61 <div class="modal-footer">
Note: See TracChangeset
for help on using the changeset viewer.