Skip to content

Instantly share code, notes, and snippets.

@huseyin
Last active September 17, 2015 15:03
Show Gist options
  • Save huseyin/cbb2e77ba7ee038504b3 to your computer and use it in GitHub Desktop.
Save huseyin/cbb2e77ba7ee038504b3 to your computer and use it in GitHub Desktop.
Rakefile'dan önce önizleme.
# encoding: utf-8
# Hüseyin Tekinaslan <[email protected]>
#
# Önizleme dosyasıdır. Ana kaynağı, http://github.com/htaslan/htaslan.github.io deposundadır.
require 'nokogiri'
TEMPLATE = <<-TEMPLATE
<!doctype html>
<html lang=tr>
<head>
<title>GitHub Depoları - Listeli</title>
<meta charset=UTF-8>
<link rel="stylesheet" type="text/css" href="mylocal.css">
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body>
<div>
<p>
<a href="http://19.htaslan.me">
<img src="assets/33/avatar.png" style="float: right;"/>
</a>
</p>
<header>
<hgroup>
<h2>GITHUB REPOSITORIES</h2>
<h4>-----</h4>
</hgroup>
</header>
</div>
TEMPLATE
# Templeyti inşa et.
def build(navbar_conf, article_conf, uname, url, mail)
navbar(navbar_conf)
article(article_conf)
footer(uname, url, mail)
Nokogiri::HTML(TEMPLATE).to_html(indent: 4)
end
private
# Navigasyon çubuğu burada işlensin.
def navbar(n_conf)
tmp = ["<nav>", "<h3>Repositories</h3>", "</nav>"]
sum = 1
n_conf.each do |name, adress|
atag = "<a href=#{adress} style='color: rgb(62, 62, 62); font: 16px Nimbus Sans L;'>#{sum}) #{name}</a><br />"
tmp.insert(-2, atag)
sum += 1
end
TEMPLATE << tmp.join
end
# Depo bilgilendirmeleri burada işlensin.
def article(a_conf)
a_conf.each do |name, desc|
tmp = <<-ARTICLE
<article>
<h3>Repo: #{name}</h3>
<section>Description: #{desc}</section>
</article>
ARTICLE
TEMPLATE << tmp
end
end
# Footer burada işlensin.
def footer(uname, url, mail)
footer = <<-FOOTER
<footer>
<small>#{uname} - <a href=#{url}>#{url}</a></small>
<small><a href="mailto:#{mail}">#{mail}</a></small>
</footer>
</body>
</html>
FOOTER
TEMPLATE << footer
end
/* Buradaki ayarlar ile oynamamanız tavsiye olunur. Bu betik,
* site şablonu dışında tutulmuş bir aracın css şablonudur.
*/
header {
font: 16px Nimbus Mono L;
color: rgb(255, 103, 103);
}
nav {
display: inline;
font: 15px Nimbus Sans L;
color: rgb(35, 111, 88);
float: left;
width:20%;
}
article {
color: rgb(62, 62, 62);
font: 14px Nimbus Sans L;
float: right;
width:79%;
}
footer {
clear: both;
margin: 0;
background: #ffffcc;
border: 1px solid #e2e2e2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment