Skip to content

Commit

Permalink
adding a rake todo:list function
Browse files Browse the repository at this point in the history
  • Loading branch information
Hampton Catlin committed Dec 24, 2008
1 parent d11f1c6 commit b480d4d
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 85 deletions.
4 changes: 4 additions & 0 deletions 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
Expand Down
13 changes: 4 additions & 9 deletions config/wikipedias.yaml
Expand Up @@ -8,22 +8,17 @@ 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:
article_of_the_day: "/html/body/div/div/div/div[2]/table[3]/tr/td/div"
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]"
article_of_the_day: "div[style='padding: 5px; font-size: 9pt;']"
news_items: "#bodyContent :nth-child(7) :nth-child(5)"
20 changes: 20 additions & 0 deletions 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
2 changes: 1 addition & 1 deletion lib/wikipedia.rb
Expand Up @@ -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 = {}

Expand Down
250 changes: 176 additions & 74 deletions 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; }
7 changes: 6 additions & 1 deletion public/stylesheets/sass/application.sass
Expand Up @@ -170,4 +170,9 @@ table.admin

.today
.noprint
display: none
display: none

/ hacks for different languages

.floatright
float: right

0 comments on commit b480d4d

Please sign in to comment.