diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 3ca8abd..dad1343 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -1,3 +1,7 @@ +# This is the place for general todo's +# TODO: Add a search box +# TODO: Support WAP with formatters + class Application < Merb::Controller def send_home diff --git a/config/wikipedias.yaml b/config/wikipedias.yaml index d034c77..aabdc45 100644 --- a/config/wikipedias.yaml +++ b/config/wikipedias.yaml @@ -8,16 +8,11 @@ de: selectors: article_of_the_day: "#hauptseite-artikel .inhalt" news_items: "#hauptseite-nachrichten .inhalt" -es: - main_page: "Wikipedia:Portada" - selectors: - article_of_the_day: "/html/body/div/div/div/div[2]/table[3]/tr/td/table/tr[2]/td/div" - news_items: "/html/body/div/div/div/div[2]/table[3]/tr/td/table/tr[8]/td" fr: main_page: "Accueil" selectors: - article_of_the_day: "/html/body/div/div/div/div[2]/table/tr[3]/td[3]/div/div" - news_items: "/html/body/div/div/div/div[2]/table/tr[3]/td[3]/div[3]/div" + article_of_the_day: "#bodyContent table tr:nth-child(3) td:nth-child(3) div:nth-child(1) .accueil_contenu" + news_items: "#bodyContent table tr:nth-child(3) td:nth-child(3) div:nth-child(3) .accueil_contenu" jp: main_page: "メインページ" selectors: @@ -25,5 +20,5 @@ jp: pl: main_page: "Strona_główna" selectors: - article_of_the_day: "/html/body/div/div/div/div[2]/div[7]/div[2]/div[3]" - news_items: "/html/body/div/div/div/div[2]/div[6]/div/div[3]" \ No newline at end of file + article_of_the_day: "div[style='padding: 5px; font-size: 9pt;']" + news_items: "#bodyContent :nth-child(7) :nth-child(5)" \ No newline at end of file diff --git a/lib/tasks/todo.rake b/lib/tasks/todo.rake new file mode 100644 index 0000000..38dc468 --- /dev/null +++ b/lib/tasks/todo.rake @@ -0,0 +1,20 @@ +require File.expand_path(File.dirname(__FILE__) + "/../../config/init") + +namespace :todo do + desc 'List TODOs in all .rb files under app/' + task(:list) do + FileList["app/**/*.rb"].egrep(/TODO/) + end + + desc 'Edit all TODOs in VIM' # or your favorite editor + task(:edit) do + # jump to the first TODO in the first file + cmd = 'vim +/TODO/' + + filelist = [] + FileList["app/**/*.rb"].egrep(/TODO/) {|fn,cnt,line| filelist << fn} + + # will fork a new process and exit, if you're using gvim + system("#{cmd} #{filelist.sort.join(' ')}") + end +end \ No newline at end of file diff --git a/lib/wikipedia.rb b/lib/wikipedia.rb index e5e773a..fd44c66 100644 --- a/lib/wikipedia.rb +++ b/lib/wikipedia.rb @@ -15,7 +15,7 @@ def self.main_page(language_code) setting = self.settings[language_code] || ((language_code = "en") && self.settings["en"] ) html = Curl::Easy.perform("http://#{language_code}.wikipedia.org/wiki/#{setting['main_page']}").body_str - parser = Nokogiri::XML(html) + parser = Nokogiri::HTML(html) results = {} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index b5b8f54..0e7aefc 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1,75 +1,177 @@ -span.t, sup[style*="help"], .reference, .portal, .editsection, #protected-icon, .references-small, .sisterproject, .printfooter, .catlinks, .magnify, #siteSub, #jump-to-nav { display: none; } - -.logo { text-align: right; padding-top: 5px; } -.logo a { clear: right; } - -#main_box { margin-top: -20px; } - - -html { font-size: 67.5%; } - -body { line-height: 1; font-size: 1.2em; color: #000; background: #fff; font-family: sans-serif; overflow-x: hidden; -webkit-user-select: none; -webkit-text-size-adjust: none; } - -p, li, dl, #featured_article { line-height: 1.65; } - -pre { white-space: pre-wrap; } - -h2 { border-bottom: 1px solid #aaa; padding: 5px 0; } - -a { text-decoration: none; color: #002bb8; } -a:visited { color: #5a3696; } -a:active { color: #faa700; } -a:hover { text-decoration: underline; } - -.links { float: left; padding: 10px; } - - -#contentSub, .dablink { margin-bottom: 10px; } - -img.thumbborder { border: 1px solid #ccc; } - - -.thumb { border: 1px solid #ccc; background: #f9f9f9; margin-bottom: 10px; } -.thumb .thumbinner[style] { margin: 5px auto; } -.thumb .thumbcaption { width: 100%; margin: 5px 10px 0; text-align: center; width: auto !important; } - - -table { border-spacing: 0 !important; width: 100%; border-collapse: collapse !important; border: 1px solid #ccc; padding: 3px; margin-bottom: 15px; } -table td, table th { border: 1px solid #ccc; padding: 3px; } -table table { border: 0; } -table table td, table table th { border: 0; } -table.toc { background: #f9f9f9; } -table.toc h2 { border: 0; padding: 0; margin-top: 5px; } -table.navbox { font-size: 0.9em; width: 100% !important; } -table.navbox th.navbox-title { background: #CCCCFF; padding: 5px; } -table.navbox td.navbox-abovebelow { padding: 3px; } -table.navbox td.navbox-group { background: #DDDDFF; width: 25%; padding: 3px; } -table.navbox td.navbox-group+td { padding: 3px; } -table.navbox div[style*="padding"] { padding-left: 0 !important; padding-right: 0 !important; } -table.navbox div[style*="padding"] a { white-space: pre-wrap; } -table.navbox span[style*="white"] { white-space: pre-wrap !important; } -table.navbox td, table.navbox th { padding: 0; } -table.navbox table { margin-bottom: 0; } -table.wikitable th { background: #f3f3f3; } -table[style] { width: 100% !important; float: none !important; margin-left: 0 !important; } -table.infobox { background: #f9f9f9; } -table.infobox th, table.infobox td { border: 0; } -table.infobox td[colspan="3"], table.infobox th[colspan="3"] { border: 1px solid #ccc; } -table.gallery { background: #f9f9f9; border-bottom: 0; } -table.gallery th, table.gallery td { display: block; border: 0; border-bottom: 1px solid #ccc; } -table.gallery .gallerybox[style] { width: auto !important; margin-bottom: -16px; } -table.gallery .thumb[style] { border: 0; padding: 0 !important; width: auto !important; margin: 0 auto; } -table.gallery .gallerytext { margin-top: -12px; text-align: center; } -table.geography[style] th { text-align: left; } -table.geography[style] span span { display: block; } -table.geography[style] td[style*="text-align"], table.geography[style] td[colspan="2"] { text-align: left !important; margin-left: 0 !important; margin-right: 0 !important; } -table.geography[style] td[style*="text-align"] div[style], table.geography[style] td[colspan="2"] div[style] { text-align: left !important; } - -table.admin { width: 300px; } - - -.help dt { font-weight: bold; border-bottom: 1px solid #aaa; padding-bottom: 2px; font-size: 1.05em; } -.help dd { margin-bottom: 25px; margin-left: 20px; } - -.today .noprint { display: none; } +span.t, sup[style*="help"], .reference, .portal, .editsection, #protected-icon, .references-small, .sisterproject, .printfooter, .catlinks, .magnify, #siteSub, #jump-to-nav { + display: none; } + +.logo { + text-align: right; + padding-top: 5px; } + .logo a { + clear: right; } + +#main_box { + margin-top: -20px; } + + +html { + font-size: 67.5%; } + +body { + line-height: 1; + font-size: 1.2em; + color: #000; + background: #fff; + font-family: sans-serif; + overflow-x: hidden; + -webkit-user-select: none; + -webkit-text-size-adjust: none; } + +p, li, dl, #featured_article { + line-height: 1.65; } + +pre { + white-space: pre-wrap; } + +h2 { + border-bottom: 1px solid #aaa; + padding: 5px 0; } + +a { + text-decoration: none; + color: #002bb8; } + a:visited { + color: #5a3696; } + a:active { + color: #faa700; } + a:hover { + text-decoration: underline; } + +.links { + float: left; + padding: 10px; } + + +#contentSub, .dablink { + margin-bottom: 10px; } + +img.thumbborder { + border: 1px solid #ccc; } + + +.thumb { + border: 1px solid #ccc; + background: #f9f9f9; + margin-bottom: 10px; } + .thumb .thumbinner[style] { + margin: 5px auto; } + .thumb .thumbcaption { + width: 100%; + margin: 5px 10px 0; + text-align: center; + width: auto !important; } + + +table { + border-spacing: 0 !important; + width: 100%; + border-collapse: collapse !important; + border: 1px solid #ccc; + padding: 3px; + margin-bottom: 15px; } + table td, table th { + border: 1px solid #ccc; + padding: 3px; } + table table { + border: 0; } + table table td, table table th { + border: 0; } + table.toc { + background: #f9f9f9; } + table.toc h2 { + border: 0; + padding: 0; + margin-top: 5px; } + table.navbox { + font-size: 0.9em; + width: 100% !important; } + table.navbox th.navbox-title { + background: #CCCCFF; + padding: 5px; } + table.navbox td.navbox-abovebelow { + padding: 3px; } + table.navbox td.navbox-group { + background: #DDDDFF; + width: 25%; + padding: 3px; } + table.navbox td.navbox-group+td { + padding: 3px; } + table.navbox div[style*="padding"] { + padding-left: 0 !important; + padding-right: 0 !important; } + table.navbox div[style*="padding"] a { + white-space: pre-wrap; } + table.navbox span[style*="white"] { + white-space: pre-wrap !important; } + table.navbox td, table.navbox th { + padding: 0; } + table.navbox table { + margin-bottom: 0; } + table.wikitable th { + background: #f3f3f3; } + table[style] { + width: 100% !important; + float: none !important; + margin-left: 0 !important; } + table.infobox { + background: #f9f9f9; } + table.infobox th, table.infobox td { + border: 0; } + table.infobox td[colspan="3"], table.infobox th[colspan="3"] { + border: 1px solid #ccc; } + table.gallery { + background: #f9f9f9; + border-bottom: 0; } + table.gallery th, table.gallery td { + display: block; + border: 0; + border-bottom: 1px solid #ccc; } + table.gallery .gallerybox[style] { + width: auto !important; + margin-bottom: -16px; } + table.gallery .thumb[style] { + border: 0; + padding: 0 !important; + width: auto !important; + margin: 0 auto; } + table.gallery .gallerytext { + margin-top: -12px; + text-align: center; } + table.geography[style] th { + text-align: left; } + table.geography[style] span span { + display: block; } + table.geography[style] td[style*="text-align"], table.geography[style] td[colspan="2"] { + text-align: left !important; + margin-left: 0 !important; + margin-right: 0 !important; } + table.geography[style] td[style*="text-align"] div[style], table.geography[style] td[colspan="2"] div[style] { + text-align: left !important; } + +table.admin { + width: 300px; } + + +.help dt { + font-weight: bold; + border-bottom: 1px solid #aaa; + padding-bottom: 2px; + font-size: 1.05em; } +.help dd { + margin-bottom: 25px; + margin-left: 20px; } + +.today .noprint { + display: none; } + + +.floatright { + float: right; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index a6914e1..622001d 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -170,4 +170,9 @@ table.admin .today .noprint - display: none \ No newline at end of file + display: none + +/ hacks for different languages + +.floatright + float: right \ No newline at end of file