Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ install:
script:
- ruby proofer.rb
- python app.py
- python prof_app.py
- bash push.sh

branches:
Expand Down
44 changes: 44 additions & 0 deletions data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{

"B.D.F.L": [
"gauravrpjain"
],
"Manager": [
"bad-smruti"
],
"Advisor": [
"OrkoHunter",
"AvijitGhosh82",
"kshitij10496",
"mayank-kgp",
"pr4nay",
"Shorit",
"nishnik"
],
"Executive": [
"nitinkgp23",
"DefCon-007",
"madan96",
"Parth-Vader",
"pranitbauva1997",
"shubham5",
"shikhapanwar",
"pratham-pc",
"parikshit-soni"
],
"Core Team Member": [
"ankita132",
"rava-dosa",
"aribis369",
"ashishkg0022",
"obitors",
"djbarnwal",
"dibyadas",
"harishnandan",
"tibrewalpratik17",
"vernwalrahul",
"americast",
"shaildaswani",
"sipah00"
]
}
64 changes: 64 additions & 0 deletions prof_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os
import json
import requests
from collections import OrderedDict

import jinja2


def render_jinja_html(template_loc, file_name, **context):
return jinja2.Environment(
loader=jinja2.FileSystemLoader(template_loc+'/')
).get_template(file_name).render(context)


def profile(name, position=None):
url = "https://api.github.com/graphql"
headers = {"Authorization": "Basic "+os.environ['OUATH_KEY']}
query = json.dumps({"query": "query{user(login: \"" + name +
"\") { name email avatarUrl url bio websiteUrl"
" pinnedRepositories(first: 6) "
"{ nodes { name url description } } } }"})
r = requests.post(url, headers=headers, data=query)
print(r.content.decode("utf-8"))
data_dict = json.loads(r.content.decode("utf-8"), sorted)
pinned_repos = data_dict['data']['user']['pinnedRepositories']['nodes']
image = data_dict['data']['user']['avatarUrl']
gh_link = data_dict['data']['user']['url']
bio = data_dict['data']['user']['bio']
full_name = data_dict['data']['user']['name']
email = data_dict['data']['user']['email']
blog = data_dict['data']['user']['websiteUrl']

x = render_jinja_html('templates', 'template.tmpl', name=name,
pinned_repos=pinned_repos,
image=image,
gh_link=gh_link,
bio=bio,
full_name=full_name,
email=email,
blog=blog,
position=position
)
with open("profiles/" + name + ".html", "w") as f:
f.write(x)


def generate(id=None):
if id is not None:
print("here")
profile(id, position="Member")
else:
with open("data.json") as json_data_file:
json_data = json.load(json_data_file)
for i in json_data:
for j in json_data[i]:
try:
profile(j, i)
except Exception:
print("Error generating profile for :- ")
print("ID - " + j)
return "Completed"


generate()
185 changes: 185 additions & 0 deletions templates/template.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
<!DOCTYPE html>
<html>
<head>
<!-- Standard Meta -->
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

<!-- Site Properties -->
<title>KOSS-Kharagpur Open Source Society</title>
<meta content='KOSS organizes various technical workshops and seminars in the campus in order to continue the healthy culture of Technology and Open Source.' name='description' />
<meta content='KOSS, Kharagpur Open Source Society, IIT Kharagpur, open source, KWOC, Winter of Code, Ubuntu install, Gsoc Seminar, Android, workshop, hackathon, Linux environment, Git Development Workflow, Algorithms and Data Structures' name='keywords'/>

<link rel="stylesheet" type="text/css" href="../semantic-ui/semantic.css">
<link rel="stylesheet" type="text/css" href="../css/homepage.css">

<script src="../assets/library/jquery.min.js"></script>
<script src="../semantic-ui/semantic.js"></script>
<script src="../header.js"></script>
<script src="../semantic-ui/visibility.js"></script>
<script src="../semantic-ui/sidebar.js"></script>
<script src="../semantic-ui/transition.js"></script>
<script src="../js/homepage.js"></script>
<script src="../header.js"></script>

<style>
.masthead.aligned.segment {
min-height: 500px;
padding: 1em 0;
background: #353336 url("images/event3.jpg") repeat scroll 0 0 / cover;
background-attachment: fixed;
}
</style>
<style>
.hn1{
font-size: 2.6em;
margin-top: 3.5em;
}
.hn2{
font-size: 26px;
font-weight: lighter;
font-style: italic;
}

.page-name{
padding-top: 100px;
font-size: 80px;
}
.description-brief{
font-size: 30px;
text-align: center;
}

.ui .center .aligned .blue .header{
color: blue;
font-size: 40px;
text-align: center;
}
</style>

</head>
<body>

<!-- Following Menu -->

<div class="ui large top menu hidden fixed">
<div class="ui container">
<!--The menu items are not yet decided but it is recommended to add the page you are working on in this menu-->
<!--and add the \'active\' class along with \'item\' class on your page name-->
<a href="../index.html" class="item"><img src="../assets/images/kosslogo.png"></a>
<div class="left menu">
<script>header('team');</script>
</div>
<div class="right item">
<script>header('right');</script>
</div>
</div>
</div>

<!-- Sidebar Menu -->
<div class="ui vertical inverted sidebar menu">
<script>header('team');</script>
</div>

<!-- Page Contents -->
<div class="pusher">
<div class="ui inverted vertical masthead center aligned segment" style="height: 972px;">


<div class="ui container">
<div class="ui large secondary inverted pointing menu">
<a class="item logo" href="../index.html"><img src="../assets/images/kosslogo_bw.png"></a>
<div class="left item">
<script>header('team');</script>
<a class="toc item">
<i class="sidebar icon"></i>
</a>
</div>
<div class="right item">
<script>header('inv right');</script>
</div>
</div>
<div class="ui text container">
<div class="page-name">@{{name}}</div>
<div class="hn2">{% if position %}{{position}}{% else %}{% endif %}</div>
</div>
</div>
<div class="elementor-shape elementor-shape-bottom" data-negative="false">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none">
<path class="elementor-shape-fill" d="M761.9,44.1L643.1,27.2L333.8,98L0,3.8V0l1000,0v3.9">
</path>
</svg>
</div>
</div>




<!--****** START CODING FROM HERE *****-->
<img src="images/top.jpeg" class="ui centered image">
<div class="ui grid">
<div class="two wide column"></div>
<div class="four wide column">
<br><br>
<br><div> &nbsp;&nbsp;&nbsp;</div><img class="ui small bordered circular left image circleborder" src="{{image}}">
<h3 class="ui header left aligned" id="name">{{full_name}}</h3>
<img src="images/left.jpeg" class="ui image" /img><br>
<div class="centered"> SOFTWARE DEVELOPER </div><br>
<img src="images/lhs.png" class="ui image" /img>
<div>{% if email%}
&nbsp;&nbsp;<i class="mail icon"></i> {{email}}<br>
{% else %}
{% endif %}
<br></div>
<a href="https://github.com/{{name}}" class="ui small button" aria-label="Follow @{{name}} on GitHub"><i class="github icon" ></i> <span>Follow @{{name}}</span></a>
</div>

<!-- <div class="two wide column"></div> -->
<div class="eight wide column">
<br><br>
<div class="ui right floated header">PROFILE</div><br>
<div class="ui segment"><h2>Hi, I am <b>{{full_name}}</b>!</h2>
<img src="images/right.png" class="ui image" /img>
Indian Institute of Technology, Kharagpur</div>
<div class="ui segment">{% if bio %} {{bio}} {% else %} {% endif %}</div>

<div class="ui segment"> <h2>PROJECTS</h2>
<div class="ui list">

{% for i in range(pinned_repos|length) %}
<div class="item">
<i class="angle double right icon"></i>
<div class="content">
<a class="header" href="{{pinned_repos[i]['url']}}"><h3>{{pinned_repos[i]['name']}}</h3></a>
<div class="description">{% if pinned_repos[i]['description'] %}{{pinned_repos[i]['description']}} {% else %} {% endif %}</div>
</div>
</div>
{% endfor %}


</div>
</div>

<a class="ui large button" href="{{blog}}">Blog</a><a class="ui large button" href="{{gh_link}}"><i class="github icon"></i> GitHub</a><br><br>

</div>
<div class="two wide column">
<img src="images/rhs.jpeg" class="ui image" /img>
</div>
</div>

<!--****** END YOUR CODE HERE *****-->




<!--****footer****-->

<div id = "footer"><script src="../footer.js"></script></div>

</div>

</body>

</html>