Mercurial Hosting > luan
changeset 779:c38f6619feb9
move blog into examples
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 28 Aug 2016 14:50:47 -0600 |
parents | 305ffb00ebc1 |
children | 6a87d51ae0ed |
files | blog/read_me.txt blog/serve.sh blog/src/edit.luan blog/src/index.html.luan blog/src/lib/Db.luan blog/src/lib/Db_mod.luan blog/src/lib/Post.luan blog/src/lib/test.luan blog/src/new.luan blog/src/private/tools/backup.luan blog/src/private/tools/lucene.luan blog/src/private/tools/run.luan blog/src/private/tools/shell.luan blog/src/private/tools/test.luan blog/src/site.css blog/test.sh examples/blog/read_me.txt examples/blog/serve.sh examples/blog/src/edit.luan examples/blog/src/index.html.luan examples/blog/src/lib/Db.luan examples/blog/src/lib/Db_mod.luan examples/blog/src/lib/Post.luan examples/blog/src/lib/test.luan examples/blog/src/new.luan examples/blog/src/private/tools/backup.luan examples/blog/src/private/tools/lucene.luan examples/blog/src/private/tools/run.luan examples/blog/src/private/tools/shell.luan examples/blog/src/private/tools/test.luan examples/blog/src/site.css examples/blog/test.sh |
diffstat | 32 files changed, 376 insertions(+), 376 deletions(-) [+] |
line wrap: on
line diff
--- a/blog/read_me.txt Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -This is just a demo website not meant for real use. It is just to demonstrate how to implement a simple website in Luan.
--- a/blog/serve.sh Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -luan luan:http/serve.luan file:src 2>&1 | tee err
--- a/blog/src/edit.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local String = require "luan:String.luan" -local to_number = String.to_number or error() -local Io = require "luan:Io.luan" -local Http = require "luan:http/Http.luan" -local Post = require "site:/lib/Post.luan" - - -return function() - local post_id = to_number(Http.request.parameter.post) or error() - local post = Post.get_by_id(post_id) or error() - if Http.request.parameter.save ~= nil then - post.subject = Http.request.parameter.subject - post.content = Http.request.parameter.content - post.save() - Http.response.send_redirect("/#p"..post.id) - return - end - - Io.stdout = Http.response.text_writer() -%> -<html> - <head> - <style> - @import "/site.css"; - </style> - </head> - <body> - <h1>Make New Post</h1> - - <form method=post> - <p>Subject: <input name=subject size=50 type=text value="<%= post.subject %>"></p> - <p><textarea name=content rows=20 cols=90><%= post.content %></textarea><br>bbcode works</p> - <p> - <input type=submit name=save value=Submit> - </p> - </form> - - </body> -</html> -<% -end
--- a/blog/src/index.html.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local ipairs = Luan.ipairs or error() -local Time = require "luan:Time.luan" -local Io = require "luan:Io.luan" -local Parsers = require "luan:Parsers.luan" -local bbcode_to_html = Parsers.bbcode_to_html or error() -local Html = require "luan:Html.luan" -local html_encode = Html.encode or error() -local Http = require "luan:http/Http.luan" -local Post = require "site:/lib/Post.luan" - - -return function() - local query = Http.request.parameter.query - - Io.stdout = Http.response.text_writer() -%> -<html> - <head> - <style> - @import "/site.css"; - </style> - </head> - <body> - <h1><a href="/">Demo Blog App</a></h1> - - <form> - <input name=query type=text value="<%= query or "" %>"> - <input type=submit value=Search> - </form> - - <div><a href="new">Make New Post</a></div> - - <% - local posts = query and Post.search(query) or Post.get_all() - for _, post in ipairs(posts) do - %> - <a name="p<%= post.id %>"> - <h2><%= post.subject %></h2> - <p><%= Time.format(post.date) %> - <a href="edit?post=<%= post.id %>">Edit</a></p> - <pre><%= bbcode_to_html(html_encode(post.content)) %></pre> - <hr> - <% - end - %> - - </body> -</html> -<% -end
--- a/blog/src/lib/Db.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -return require "site:/lib/Db_mod.luan".new_db()
--- a/blog/src/lib/Db_mod.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -local Lucene = require "luan:lucene/Lucene.luan" -local Io = require "luan:Io.luan" - - -local M = {} - -M.lucene_dir = "site:/private/local/lucene" - -function M.new_db() - local dir = Io.uri(M.lucene_dir).to_string() - local db = Lucene.index( dir, Lucene.type.english, {"subject","content"} ) - --- this is how you index a field --- db.indexed_fields.post_date = Lucene.type.long - - return db -end - -return M
--- a/blog/src/lib/Post.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local ipairs = Luan.ipairs or error() -local assert_string = Luan.assert_string or error() -local Time = require "luan:Time.luan" -local now = Time.now or error() -local String = require "luan:String.luan" -local trim = String.trim or error() -local Db = require "site:/lib/Db.luan" - - -local M = {} - -local function from_doc(doc) - return M.new { - id = doc.id - subject = doc.subject - content = doc.content - date = doc.date - } -end - -function M.new(this) - assert_string(this.subject) - assert_string(this.content) - this.date = this.date or now() - - function this.save() - local doc = { - type = "post" - id = this.id - subject = this.subject - content = this.content - date = this.date - } - Db.save(doc) - this.id = doc.id - end - - return this -end - -function M.get_by_id(id) - local doc = Db.get_document("id:"..id) - return doc and from_doc(doc) -end - -function M.get_all() - local docs = Db.search("type:post",1,1000,"id desc") - local posts = {} - for _, doc in ipairs(docs) do - posts[#posts+1] = from_doc(doc) - end - return posts -end - -function M.search(query) - query = trim(query) - if #query == 0 then - return M.get_all() - end - local docs = Db.search(query,1,1000) - local posts = {} - for _, doc in ipairs(docs) do - posts[#posts+1] = from_doc(doc) - end - return posts -end - -return M
--- a/blog/src/lib/test.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local to_string = Luan.to_string or error() -local Http = require "luan:http/Http.luan" -local Http_test = require "luan:http/Http_test.luan" -local init = Http_test.init or error() -local get_page = Http_test.get_page or error() -local Io = require "luan:Io.luan" -local print = Io.print or error() -local String = require "luan:String.luan" -local matches = String.matches or error() - -Http.uncache_site() - -local Db_mod = require "site:/lib/Db_mod.luan" - -Db_mod.lucene_dir = "site:/private/local/lucene_test" -local Db = require "site:/lib/Db.luan" -Db.delete_all() - -local Post = require "site:/lib/Post.luan" -local page - -print 'go' - -init() -print '/' -get_page '/' - -init() -print '/new' -get_page '/new' - -init() -Http.request.parameter.subject = 'test' -Http.request.parameter.content = 'this is a test' -Http.request.parameter.save = 'whatever' -print '/new submit' -get_page '/new' -local posts = Post.get_all() -#posts == 1 or error() -local post_id = to_string(posts[1].id) - -init() -Http.request.parameter.post = post_id -print '/edit' -get_page '/edit' - -init() -Http.request.parameter.post = post_id -Http.request.parameter.subject = 'test' -Http.request.parameter.content = 'this is an edit' -Http.request.parameter.save = 'whatever' -print '/edit submit' -get_page '/edit' - -init() -print '/ again' -page = get_page '/' -matches(page,'this is an edit') or error() - -print 'done'
--- a/blog/src/new.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local Io = require "luan:Io.luan" -local Http = require "luan:http/Http.luan" -local Post = require "site:/lib/Post.luan" - - -return function() - local subject = Http.request.parameter.subject - local content = Http.request.parameter.content - if Http.request.parameter.save ~= nil then - local post = Post.new{ subject=subject, content=content } - post.save() - Http.response.send_redirect("/") - return - end - - Io.stdout = Http.response.text_writer() -%> -<html> - <head> - <style> - @import "/site.css"; - </style> - </head> - <body> - <h1>Make New Post</h1> - - <form method=post> - <p>Subject: <input name=subject size=50 type=text></p> - <p><textarea name=content rows=20 cols=90></textarea><br>bbcode works</p> - <p> - <input type=submit name=save value=Submit> - </p> - </form> - - </body> -</html> -<% -end
--- a/blog/src/private/tools/backup.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -local Io = require "luan:Io.luan" -local Http = require "luan:http/Http.luan" -local Db = require "site:/lib/Db.luan" - - -return function() - local backup = Io.uri "site:/private/local/backup.zip" - backup.delete() - Db.backup(backup) - - Io.stdout = Http.response.text_writer() - %> - <html> - <body> - backed up to <a href="/private/local/backup.zip">/private/local/backup.zip</a> - </body> - </html> - <% -end
--- a/blog/src/private/tools/lucene.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -local Web_search = require "luan:lucene/Web_search.luan" -local Db = require "site:/lib/Db.luan" - -return Web_search.of(Db)
--- a/blog/src/private/tools/run.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -return require "luan:http/run.luan"
--- a/blog/src/private/tools/shell.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -return require "luan:http/shell.luan"
--- a/blog/src/private/tools/test.luan Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -local Luan = require "luan:Luan.luan" -local do_file = Luan.do_file -local try = Luan.try -local Io = require "luan:Io.luan" -local print = Io.print -local Http = require "luan:http/Http.luan" - - -return function() - Io.stdout = Http.response.text_writer() - Http.response.content_type = "text/plain" - try { - function() - do_file "site:/lib/test.luan" - end; - catch = function(e) - print() - print("error:",e) - end; - } - local Db = require "site:/lib/Db" - Db.close() -end
--- a/blog/src/site.css Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; - margin: 1em 5%; -} - -a[href] { - text-decoration: inherit; - color: #337ab7; -} -a[href]:visited { - color: #034a87; -} -a[href]:hover { - text-decoration: underline; -} - - -input[type="text"], input[type="email"] { - font: inherit; - padding: .5em .8em; - border-radius: 4px; - border-style: groove; -} -input[type="text"]:focus, input[type="email"]:focus { - border-color: #66afe9; - outline: none; -} -input[type="submit"] { - font: inherit; - padding: .5em; - border-radius: 4px; - background: #eee; - border-color: #eee; -} -input[type="submit"]:hover { - background: #ddd !important; -}
--- a/blog/test.sh Sun Aug 28 03:26:39 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -luan luan:http/test.luan file:src site:/lib/test.luan 2>&1 | tee err
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/read_me.txt Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,1 @@ +This is just a demo website not meant for real use. It is just to demonstrate how to implement a simple website in Luan.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/serve.sh Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,1 @@ +luan luan:http/serve.luan file:src 2>&1 | tee err
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/edit.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,43 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local String = require "luan:String.luan" +local to_number = String.to_number or error() +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Post = require "site:/lib/Post.luan" + + +return function() + local post_id = to_number(Http.request.parameter.post) or error() + local post = Post.get_by_id(post_id) or error() + if Http.request.parameter.save ~= nil then + post.subject = Http.request.parameter.subject + post.content = Http.request.parameter.content + post.save() + Http.response.send_redirect("/#p"..post.id) + return + end + + Io.stdout = Http.response.text_writer() +%> +<html> + <head> + <style> + @import "/site.css"; + </style> + </head> + <body> + <h1>Make New Post</h1> + + <form method=post> + <p>Subject: <input name=subject size=50 type=text value="<%= post.subject %>"></p> + <p><textarea name=content rows=20 cols=90><%= post.content %></textarea><br>bbcode works</p> + <p> + <input type=submit name=save value=Submit> + </p> + </form> + + </body> +</html> +<% +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/index.html.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,51 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local ipairs = Luan.ipairs or error() +local Time = require "luan:Time.luan" +local Io = require "luan:Io.luan" +local Parsers = require "luan:Parsers.luan" +local bbcode_to_html = Parsers.bbcode_to_html or error() +local Html = require "luan:Html.luan" +local html_encode = Html.encode or error() +local Http = require "luan:http/Http.luan" +local Post = require "site:/lib/Post.luan" + + +return function() + local query = Http.request.parameter.query + + Io.stdout = Http.response.text_writer() +%> +<html> + <head> + <style> + @import "/site.css"; + </style> + </head> + <body> + <h1><a href="/">Demo Blog App</a></h1> + + <form> + <input name=query type=text value="<%= query or "" %>"> + <input type=submit value=Search> + </form> + + <div><a href="new">Make New Post</a></div> + + <% + local posts = query and Post.search(query) or Post.get_all() + for _, post in ipairs(posts) do + %> + <a name="p<%= post.id %>"> + <h2><%= post.subject %></h2> + <p><%= Time.format(post.date) %> - <a href="edit?post=<%= post.id %>">Edit</a></p> + <pre><%= bbcode_to_html(html_encode(post.content)) %></pre> + <hr> + <% + end + %> + + </body> +</html> +<% +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/lib/Db.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,1 @@ +return require "site:/lib/Db_mod.luan".new_db()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/lib/Db_mod.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,19 @@ +local Lucene = require "luan:lucene/Lucene.luan" +local Io = require "luan:Io.luan" + + +local M = {} + +M.lucene_dir = "site:/private/local/lucene" + +function M.new_db() + local dir = Io.uri(M.lucene_dir).to_string() + local db = Lucene.index( dir, Lucene.type.english, {"subject","content"} ) + +-- this is how you index a field +-- db.indexed_fields.post_date = Lucene.type.long + + return db +end + +return M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/lib/Post.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,70 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local ipairs = Luan.ipairs or error() +local assert_string = Luan.assert_string or error() +local Time = require "luan:Time.luan" +local now = Time.now or error() +local String = require "luan:String.luan" +local trim = String.trim or error() +local Db = require "site:/lib/Db.luan" + + +local M = {} + +local function from_doc(doc) + return M.new { + id = doc.id + subject = doc.subject + content = doc.content + date = doc.date + } +end + +function M.new(this) + assert_string(this.subject) + assert_string(this.content) + this.date = this.date or now() + + function this.save() + local doc = { + type = "post" + id = this.id + subject = this.subject + content = this.content + date = this.date + } + Db.save(doc) + this.id = doc.id + end + + return this +end + +function M.get_by_id(id) + local doc = Db.get_document("id:"..id) + return doc and from_doc(doc) +end + +function M.get_all() + local docs = Db.search("type:post",1,1000,"id desc") + local posts = {} + for _, doc in ipairs(docs) do + posts[#posts+1] = from_doc(doc) + end + return posts +end + +function M.search(query) + query = trim(query) + if #query == 0 then + return M.get_all() + end + local docs = Db.search(query,1,1000) + local posts = {} + for _, doc in ipairs(docs) do + posts[#posts+1] = from_doc(doc) + end + return posts +end + +return M
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/lib/test.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,62 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local to_string = Luan.to_string or error() +local Http = require "luan:http/Http.luan" +local Http_test = require "luan:http/Http_test.luan" +local init = Http_test.init or error() +local get_page = Http_test.get_page or error() +local Io = require "luan:Io.luan" +local print = Io.print or error() +local String = require "luan:String.luan" +local matches = String.matches or error() + +Http.uncache_site() + +local Db_mod = require "site:/lib/Db_mod.luan" + +Db_mod.lucene_dir = "site:/private/local/lucene_test" +local Db = require "site:/lib/Db.luan" +Db.delete_all() + +local Post = require "site:/lib/Post.luan" +local page + +print 'go' + +init() +print '/' +get_page '/' + +init() +print '/new' +get_page '/new' + +init() +Http.request.parameter.subject = 'test' +Http.request.parameter.content = 'this is a test' +Http.request.parameter.save = 'whatever' +print '/new submit' +get_page '/new' +local posts = Post.get_all() +#posts == 1 or error() +local post_id = to_string(posts[1].id) + +init() +Http.request.parameter.post = post_id +print '/edit' +get_page '/edit' + +init() +Http.request.parameter.post = post_id +Http.request.parameter.subject = 'test' +Http.request.parameter.content = 'this is an edit' +Http.request.parameter.save = 'whatever' +print '/edit submit' +get_page '/edit' + +init() +print '/ again' +page = get_page '/' +matches(page,'this is an edit') or error() + +print 'done'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/new.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,40 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Post = require "site:/lib/Post.luan" + + +return function() + local subject = Http.request.parameter.subject + local content = Http.request.parameter.content + if Http.request.parameter.save ~= nil then + local post = Post.new{ subject=subject, content=content } + post.save() + Http.response.send_redirect("/") + return + end + + Io.stdout = Http.response.text_writer() +%> +<html> + <head> + <style> + @import "/site.css"; + </style> + </head> + <body> + <h1>Make New Post</h1> + + <form method=post> + <p>Subject: <input name=subject size=50 type=text></p> + <p><textarea name=content rows=20 cols=90></textarea><br>bbcode works</p> + <p> + <input type=submit name=save value=Submit> + </p> + </form> + + </body> +</html> +<% +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/private/tools/backup.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,19 @@ +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Db = require "site:/lib/Db.luan" + + +return function() + local backup = Io.uri "site:/private/local/backup.zip" + backup.delete() + Db.backup(backup) + + Io.stdout = Http.response.text_writer() + %> + <html> + <body> + backed up to <a href="/private/local/backup.zip">/private/local/backup.zip</a> + </body> + </html> + <% +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/private/tools/lucene.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,4 @@ +local Web_search = require "luan:lucene/Web_search.luan" +local Db = require "site:/lib/Db.luan" + +return Web_search.of(Db)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/private/tools/run.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,1 @@ +return require "luan:http/run.luan"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/private/tools/shell.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,1 @@ +return require "luan:http/shell.luan"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/private/tools/test.luan Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,23 @@ +local Luan = require "luan:Luan.luan" +local do_file = Luan.do_file +local try = Luan.try +local Io = require "luan:Io.luan" +local print = Io.print +local Http = require "luan:http/Http.luan" + + +return function() + Io.stdout = Http.response.text_writer() + Http.response.content_type = "text/plain" + try { + function() + do_file "site:/lib/test.luan" + end; + catch = function(e) + print() + print("error:",e) + end; + } + local Db = require "site:/lib/Db" + Db.close() +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/src/site.css Sun Aug 28 14:50:47 2016 -0600 @@ -0,0 +1,39 @@ + +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + margin: 1em 5%; +} + +a[href] { + text-decoration: inherit; + color: #337ab7; +} +a[href]:visited { + color: #034a87; +} +a[href]:hover { + text-decoration: underline; +} + + +input[type="text"], input[type="email"] { + font: inherit; + padding: .5em .8em; + border-radius: 4px; + border-style: groove; +} +input[type="text"]:focus, input[type="email"]:focus { + border-color: #66afe9; + outline: none; +} +input[type="submit"] { + font: inherit; + padding: .5em; + border-radius: 4px; + background: #eee; + border-color: #eee; +} +input[type="submit"]:hover { + background: #ddd !important; +}