Update pages/reader.py
Browse files- pages/reader.py +112 -105
pages/reader.py
CHANGED
|
@@ -34,108 +34,115 @@ st.write(paramx)
|
|
| 34 |
|
| 35 |
filtered_df = df[df['ID'] == paramx]
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
filtered_df = df[df['ID'] == paramx]
|
| 36 |
|
| 37 |
+
tab1, tab2 = st.tabs(["📄 Baca Artikel", "📊 Analisis Artikel"], width="stretch")
|
| 38 |
+
|
| 39 |
+
with tab1:
|
| 40 |
+
|
| 41 |
+
with st.sidebar:
|
| 42 |
+
st.write("Atur Tampilan")
|
| 43 |
+
|
| 44 |
+
font_options = ["Baskerville", "Cambria", "Charter", "Garamond", "Georgia", "Palatino Linotype", "Times New Roman"]
|
| 45 |
+
font_selected = st.selectbox("Gaya kata", font_options)
|
| 46 |
+
|
| 47 |
+
fontsize = st.number_input("Ukuran kata", min_value=5, value=16, step=1)
|
| 48 |
+
no_columns = st.number_input("Jumlah kolom", min_value=1, max_value=4, value=1, step=1)
|
| 49 |
+
|
| 50 |
+
if not filtered_df.empty:
|
| 51 |
+
filtered_df = filtered_df.replace("NaN", "Tidak tersedia")
|
| 52 |
+
row = filtered_df.iloc[0]
|
| 53 |
+
|
| 54 |
+
# Get and clean values
|
| 55 |
+
title = format_html(row.get("Title", ""))
|
| 56 |
+
author = format_html(row.get("Authors", ""))
|
| 57 |
+
intro = format_html(row.get("Introduction", ""))
|
| 58 |
+
method = format_html(row.get("Method", ""))
|
| 59 |
+
abstracten = format_html(row.get("Abstract (en)", ""))
|
| 60 |
+
abstractid = format_html(row.get("Abstract (id)", ""))
|
| 61 |
+
keywords = format_html(row.get("Keywords", ""))
|
| 62 |
+
affiliation = format_html(row.get("Institution", ""))
|
| 63 |
+
result = format_html(row.get("Result", ""))
|
| 64 |
+
discussion = format_html(row.get("Discussion", ""))
|
| 65 |
+
rnd = format_html(row.get("Result & Discussion", ""))
|
| 66 |
+
conclusion = format_html(row.get("Conclusion", ""))
|
| 67 |
+
|
| 68 |
+
# CSS styles for individual sections (no container)
|
| 69 |
+
html_output = f"""
|
| 70 |
+
<style>
|
| 71 |
+
.article-title {{
|
| 72 |
+
text-align: center;
|
| 73 |
+
font-size: 28px;
|
| 74 |
+
font-weight: bold;
|
| 75 |
+
font-family: {font_selected}, serif;
|
| 76 |
+
color: #222;
|
| 77 |
+
margin-bottom: 5px;
|
| 78 |
+
}}
|
| 79 |
+
.article-author {{
|
| 80 |
+
text-align: center;
|
| 81 |
+
font-size: 16px;
|
| 82 |
+
color: #666;
|
| 83 |
+
margin-bottom: 20px;
|
| 84 |
+
font-style: italic;
|
| 85 |
+
}}
|
| 86 |
+
.section-title {{
|
| 87 |
+
text-align: center;
|
| 88 |
+
font-size: 20px;
|
| 89 |
+
font-weight: bold;
|
| 90 |
+
margin-top: 25px;
|
| 91 |
+
margin-bottom: 10px;
|
| 92 |
+
color: #004488;
|
| 93 |
+
}}
|
| 94 |
+
.section-meta {{
|
| 95 |
+
text-align: center;
|
| 96 |
+
font-size: {fontsize}px;
|
| 97 |
+
font-family: {font_selected}, serif;
|
| 98 |
+
line-height: 1.8;
|
| 99 |
+
color: #333;
|
| 100 |
+
font-style: italic;
|
| 101 |
+
}}
|
| 102 |
+
.section-content {{
|
| 103 |
+
column-count: {no_columns};
|
| 104 |
+
column-gap: 40px;
|
| 105 |
+
text-align: justify;
|
| 106 |
+
font-size: {fontsize}px;
|
| 107 |
+
font-family: {font_selected}, serif;
|
| 108 |
+
line-height: 1.8;
|
| 109 |
+
color: #333;
|
| 110 |
+
}}
|
| 111 |
+
</style>
|
| 112 |
+
|
| 113 |
+
<div class="article-title">{title}</div>
|
| 114 |
+
<div class="article-author">By {author}</div>
|
| 115 |
+
<div class="article-author">{affiliation}</div>
|
| 116 |
+
|
| 117 |
+
<div class="section-title">Abstract</div>
|
| 118 |
+
<div class="section-meta">{abstracten}</div>
|
| 119 |
+
<div class="section-title">Abstrak</div>
|
| 120 |
+
<div class="section-meta">{abstractid}</div>
|
| 121 |
+
<div class="article-author">Keywords: {keywords}</div>
|
| 122 |
+
|
| 123 |
+
<div class="section-title">Introduction</div>
|
| 124 |
+
<div class="section-content">{intro}</div>
|
| 125 |
+
|
| 126 |
+
<div class="section-title">Method</div>
|
| 127 |
+
<div class="section-content">{method}</div>
|
| 128 |
+
|
| 129 |
+
<div class="section-title">Result</div>
|
| 130 |
+
<div class="section-content">{result}</div>
|
| 131 |
+
|
| 132 |
+
<div class="section-title">Discussion</div>
|
| 133 |
+
<div class="section-content">{discussion}</div>
|
| 134 |
+
|
| 135 |
+
<div class="section-title">Result & Discussion</div>
|
| 136 |
+
<div class="section-content">{rnd}</div>
|
| 137 |
+
|
| 138 |
+
<div class="section-title">Conclusion</div>
|
| 139 |
+
<div class="section-content">{conclusion}</div>
|
| 140 |
+
"""
|
| 141 |
+
|
| 142 |
+
st.markdown(html_output, unsafe_allow_html=True)
|
| 143 |
+
|
| 144 |
+
else:
|
| 145 |
+
st.warning("No article found with the specified ID.")
|
| 146 |
+
|
| 147 |
+
with tab2:
|
| 148 |
+
st.write("Dalam pembangunan")
|