|
import os |
|
from yattag import Doc |
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_article(): |
|
filename = "info.txt" |
|
placeholder = "please create an info.txt to customize this text" |
|
|
|
title = bkgd = sgd1 = sgd2 = td = limitation = con1 = con2 = con3 = membs = placeholder |
|
|
|
if os.path.isfile(filename): |
|
|
|
info = open(filename, "r") |
|
|
|
|
|
description = info.readline() |
|
title = info.readline() |
|
bkgd = info.readline() |
|
sgd1 = info.readline() |
|
sgd2 = info.readline() |
|
td = info.readline() |
|
limitation = info.readline() |
|
con1 = info.readline() |
|
con2 = info.readline() |
|
con3 = info.readline() |
|
membs = info.readline() |
|
|
|
|
|
info.close() |
|
|
|
|
|
doc, tag, text, line = Doc().ttl() |
|
|
|
with tag('div'): |
|
with tag('div', klass='my-div'): |
|
line('h2', 'Project Background') |
|
line('p', bkgd) |
|
|
|
|
|
|
|
with tag('div', klass='my-div'): |
|
line('h2', 'Targeted SGDs and Potential Applications: ') |
|
with tag('ul'): |
|
line('li', sgd1) |
|
line('li', sgd2) |
|
with tag('div', klass='my-div'): |
|
line('h2', 'Technical challenges faced during this project:') |
|
line('p', td) |
|
with tag('div', klass='my-div'): |
|
line('h2', 'Limitation of this Project/Gradio Application') |
|
line('p', limitation) |
|
with tag('div', klass='my-div'): |
|
line('h2', 'Conclusion and Future Work:') |
|
with tag('ul'): |
|
line('li', con1) |
|
line('li', con2) |
|
line('li', con3) |
|
with tag('div', klass='my-div'): |
|
line('h2', 'Team Members') |
|
line('p', membs) |
|
|
|
|
|
css = ''' |
|
.my-div { |
|
border: 2px solid black; |
|
text-align: center; |
|
margin: 10px; |
|
padding: 5%; |
|
} |
|
ul { |
|
display: inline-block; |
|
text-align: left; |
|
} |
|
.description { |
|
text-align: center; |
|
} |
|
''' |
|
|
|
return { |
|
'article': doc.getvalue(), |
|
'css': css, |
|
'title': title, |
|
'description': description, |
|
} |