Improve the look of the webpage. Add some CSS!

ON ICE!
This commit is contained in:
Donald Ephraim Curtis 2012-01-22 13:57:48 -06:00
parent 76fd6c24d6
commit c28172d4d3
3 changed files with 68 additions and 17 deletions

View file

@ -4,12 +4,12 @@
> a repository for development versions of Emacs packages (hot from the repo).
**Last Updated:** <%= Time.now.strftime("%Y.%m.%d %H:%M") %>
**Last Update:** *<%= Time.now.strftime("%Y.%m.%d %H:%M") %>*
## Current List of Packages being Generated Nightly
<%=
def parse str
<%
def parse str
# credit to: http://stackoverflow.com/q/3128406/154508
tokens = str.scan(/#{Regexp.escape("(")}|#{Regexp.escape(")")}|[a-zA-Z0-9\-\_]+/)
@ -27,11 +27,39 @@ def parse str
end
return stack[-1][-1]
end
parse(File.open("../packages/archive-contents").read)[1..-1].map{ |x|
"* #{x[0]}-#{x[1]} :: #{x[3..-2].join(" ")}"
}.join("\n")
end
headers = ["Package", "Version", "Description"]
data = parse(File.open("../packages/archive-contents").read)[1..-1]
data.map! do |row|
[row[0], row[1][0], row[3..-2].join(" ")]
end
colwidth = [0,0,0]
data.map do |row|
row.to_enum(:each_with_index).map do |e,i|
colwidth[i] = [colwidth[i], e.length].max
end
end
%>
<%=
headers.to_enum(:each_with_index).map{
|h,i| h + " "*(colwidth[i]-h.length) }.join(" ")
%>
<%= colwidth.map{ |w| "-"*w }.join(" ") %>
<%=
data.map{ |row|
row.to_enum(:each_with_index).map{ |c,i|
c + " "*(colwidth[i]-c.length)
}.join(" ")
}.join("\n")
%>
## Installing

22
html/style.css Normal file
View file

@ -0,0 +1,22 @@
table {
border-spacing: 0px;
}
/* td:first-child, th:first-child { */
/* padding-left: 5px; */
/* padding-right: 5px; */
/* } */
td, th {
padding: 3px 7px 3px 7px;
}
tr.header {
background-color: #fad;
}
tr.odd {
background-color: #ccc;
}

3
melpa
View file

@ -4,6 +4,7 @@ BASEDIR=`dirname $0`
cd ${BASEDIR} || exit 1
function melpa_clear_packages {
echo "*** Clearing the packages folder..."
rm -r packages/*
@ -27,7 +28,7 @@ function melpa_generate_html {
echo "*** Building html"
cd html || return 1
erb index.erb > index.md
pandoc -s --mathml -t html --smart index.md > index.html
pandoc --css=style.css -s --mathml -t html --smart index.md > index.html
cd ..
echo
}