Spaces:
Sleeping
Sleeping
Update app.py
Browse files96 unmodified lines97989910010110210310410510610710810962 unmodified lines17217317417517617717842 unmodified lines22122222322422522622731 unmodified lines25926026126226326426576 unmodified lines34234334434534634734896 unmodified linesreturn hashlib.sha256(data.encode('utf-8')).hexdigest()def format_citation_html(url, fragment_text, author, year, scc_hash):encoded_fragment = urllib.parse.quote(fragment_text)full_url = f"{url}#:~:text={encoded_fragment}"return f'<a href="{full_url}" data-hash="{scc_hash}">{author} ({year})</a>'def format_metadata_html(url, author, year, scc_hash, username, task_name, current_date, current_time):metadata = f"{username}—{task_name}—{current_date}—{current_time}"encoded_metadata = urllib.parse.quote(metadata)full_url = f"{url}#:~:text={encoded_metadata}"return f'<a href="{full_url}" data-hash="{scc_hash}">{author} ({year}). {scc_hash}</a>'62 unmodified linesconst date = `${parts[4].value}-${parts[2].value}-${parts[0].value}`;const time = `${parts[6].value}:${parts[8].value}:${parts[10].value}`;const datetimeElement = document.getElementById('live_datetime');if (datetimeElement) {datetimeElement.innerText = `${date} ${time}`;}}42 unmodified lines<ul><li><strong>Citation (Start of Text):</strong> <span style="font-size: 1.2rem;">Abuseif et al. (2023)</span> (hyperlinked to <code>https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=A%20proposed%20design%20framework%20for%20green%20roof%20settings%20in%20general%20and%20trees%20on%20buildings%20in%20particular</code>)</li><li><strong>Citation (End of Text):</strong> <span style="font-size: 1.2rem;">(Abuseif et al., 2023)</span> (hyperlinked to <code>https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=A%20proposed%20design%20framework%20for%20green%20roof%20settings%20in%20general%20and%20trees%20on%20buildings%20in%20particular</code>)</li><li><strong>SCC Index:</strong> <span style="font-size: 0.85rem;">Abuseif et al. (2023). cda7ba19e51e430107e58696758fdf79b8f016d8f27e8f8691ad713e7c8bc668</span> (hyperlinked to <code>https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=Majed%252525E2%25252580%25252594Design%252520Strategies%252520for%252520Trees%252520on%252520Buildings%252525E2%25252580%252525942025-08-06%252525E2%25252580%2525259420:41:11</code>)</li></ul></div>""", unsafe_allow_html=True)31 unmodified lines</li></ol><h4>Using References and the SCC Index in Your Document</h4><ol><li>Paste the reference directly in the appropriate place within your document.</li><li>Create an SCC Index (instead of a traditional reference list), and paste the corresponding SCC Index entry for each reference you’ve used.</li></ul>76 unmodified lineselse:scc_hash = generate_citation_hash(author_name, publication_year, source_url, annotated_text, annotated_text, username, task_name, current_date, current_time)citation_link_start = format_citation_html(source_url, annotated_text, author_name, publication_year, scc_hash)citation_link_end = f'<a href="{source_url}#:~:text={urllib.parse.quote(annotated_text)}" data-hash="{scc_hash}">({author_name}, {publication_year})</a>'metadata_link = format_metadata_html(source_url, author_name, publication_year, scc_hash, username, task_name, current_date, current_time)col_html1, col_html2 = st.columns(2)96 unmodified lines97989910010110210310410510610710810962 unmodified lines17217317417517617717842 unmodified lines22122222322422522622731 unmodified lines25926026126226326426576 unmodified lines34234334434534634734896 unmodified linesreturn hashlib.sha256(data.encode('utf-8')).hexdigest()def format_citation_html(url, fragment_text, author, year, scc_hash):encoded_fragment = urllib.parse.quote_plus(fragment_text)full_url = f"{url}#:~:text={encoded_fragment}"return f'<a href="{full_url}" data-hash="{scc_hash}">{author} ({year})</a>'def format_metadata_html(url, author, year, scc_hash, username, task_name, current_date, current_time):metadata = f"{username}—{task_name}—{current_date}—{current_time}"encoded_metadata = urllib.parse.quote_plus(metadata)full_url = f"{url}#:~:text={encoded_metadata}"return f'<a href="{full_url}" data-hash="{scc_hash}">{author} ({year}). {scc_hash}</a>'62 unmodified linesconst date = `${parts[4].value}-${parts[2].value}-${parts[0].value}`;const time = `${parts[6].value}:${parts[8].value}:${parts[10].value}`;const datetimeElement = document.getElementById('live_datetime');if datetimeElement) {datetimeElement.innerText = `${date} ${time}`;}}42 unmodified lines<ul><li><strong>Citation (Start of Text):</strong> <span style="font-size: 1.2rem;">Abuseif et al. (2023)</span> (hyperlinked to <code>https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=A%20proposed%20design%20framework%20for%20green%20roof%20settings%20in%20general%20and%20trees%20on%20buildings%20in%20particular</code>)</li><li><strong>Citation (End of Text):</strong> <span style="font-size: 1.2rem;">(Abuseif et al., 2023)</span> (hyperlinked to <code>https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=A%20proposed%20design%20framework%20for%20green%20roof%20settings%20in%20general%20and%20trees%20on%20buildings%20in%20particular</code>)</li><li><strong>SCC Index:</strong> <span style="font-size: 0.85rem;">Abuseif et al. (2023). cda7ba19e51e430107e58696758fdf79b8f016d8f27e8f8691ad713e7c8bc668</span> (hyperlinked to <code>https://www.sciencedirect.com/science/article/pii/S2772411523000046#:~:text=Majed%252DE2%252D80%252D94Design%252520Strategies%252520for%252520Trees%252520on%252520Buildings%252DE2%252D80%252D942025-08-06%252DE2%252D80%252D9420%3A41%3A11</code>)</li></ul></div>""", unsafe_allow_html=True)31 unmodified lines</li></ol><h4>Using References and the SCC Index in Your Document</h4><ul><li>Paste the reference directly in the appropriate place within your document.</li><li>Create an SCC Index (instead of a traditional reference list), and paste the corresponding SCC Index entry for each reference you’ve used.</li></ul>76 unmodified lineselse:scc_hash = generate_citation_hash(author_name, publication_year, source_url, annotated_text, annotated_text, username, task_name, current_date, current_time)citation_link_start = format_citation_html(source_url, annotated_text, author_name, publication_year, scc_hash)citation_link_end = f'<a href="{source_url}#:~:text={urllib.parse.quote_plus(annotated_text)}" data-hash="{scc_hash}">({author_name}, {publication_year})</a>'metadata_link = format_metadata_html(source_url, author_name, publication_year, scc_hash, username, task_name, current_date, current_time)col_html1, col_html2 = st.columns(2)
app.py+6-6