mabuseif commited on
Commit
5a70603
·
verified ·
1 Parent(s): f9288fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import streamlit as st
3
  import hashlib
4
  import urllib.parse
@@ -135,10 +134,10 @@ def generate_citation_hash(author, year, url, fragment_text, cited_text, usernam
135
  def format_citation_html(url, fragment_text, author, year, scc_hash):
136
  encoded_fragment = urllib.parse.quote(fragment_text)
137
  full_url = f"{url}#:~:text={encoded_fragment}"
138
- return f'<a href="{full_url}" data-hash="{scc_hash}">({author}, {year})</a>'
139
 
140
  def format_citation_plaintext(author, year, scc_hash):
141
- return f'({author}, {year}) [hash: {scc_hash[:12]}...]'
142
 
143
  def check_for_fragment(url):
144
  return '#:~:text=' in url
@@ -216,7 +215,7 @@ st.sidebar.markdown("""
216
 
217
  <strong>📤 Output (HTML - example hash):</strong><br>
218
  <div class="hash-display">
219
- &lt;a href="https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=A%20proposed%20design%20framework%20for%20green%20roof%20settings%20in%20general%20and%20trees%20on%20buildings" data-hash="[GENERATED_HASH]"&gt;(Abuseif et al., 2025)&lt;/a&gt;
220
  </div>
221
  </div>
222
  """, unsafe_allow_html=True)
@@ -472,9 +471,4 @@ with tabs[1]:
472
  st.session_state.verified_hashes = []
473
  st.experimental_rerun()
474
 
475
- st.markdown('</div>', unsafe_allow_html=True)
476
-
477
-
478
-
479
-
480
-
 
 
1
  import streamlit as st
2
  import hashlib
3
  import urllib.parse
 
134
  def format_citation_html(url, fragment_text, author, year, scc_hash):
135
  encoded_fragment = urllib.parse.quote(fragment_text)
136
  full_url = f"{url}#:~:text={encoded_fragment}"
137
+ return f'<a href="{full_url}" data-hash="{scc_hash}">Full Guidelines</a>'
138
 
139
  def format_citation_plaintext(author, year, scc_hash):
140
+ return f'Full Guidelines [hash: {scc_hash[:12]}...]'
141
 
142
  def check_for_fragment(url):
143
  return '#:~:text=' in url
 
215
 
216
  <strong>📤 Output (HTML - example hash):</strong><br>
217
  <div class="hash-display">
218
+ &lt;a href="https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=A%20proposed%20design%20framework%20for%20green%20roof%20settings%20in%20general%20and%20trees%20on%20buildings" data-hash="[GENERATED_HASH]"&gt;Full Guidelines&lt;/a&gt;
219
  </div>
220
  </div>
221
  """, unsafe_allow_html=True)
 
471
  st.session_state.verified_hashes = []
472
  st.experimental_rerun()
473
 
474
+ st.markdown('</div>', unsafe_allow_html=True)