Skip to content

Commit 2702a1c

Browse files
authored
Merge pull request #3 from NFDI4Energy/develop-mkdocs
fix: remove trailing whitespace in anchor tags, wrap matched terms with links, and update GitHub Pages trigger branch
2 parents 470c1d8 + 68d98dd commit 2702a1c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Deploy MkDocs to GitHub Pages
33
on:
44
push:
55
branches:
6-
- develop-mkdocs # Trigger this workflow on push to the develop branch
6+
- main
77
pull_request:
88
branches:
9-
- develop-mkdocs # Also trigger on pull requests to the develop branch
9+
- main
1010

1111
jobs:
1212
deploy:

hooks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_ontology_annotations(config, ontology_id, text):
3333

3434
response.raise_for_status()
3535
response_data = response.json()
36-
print(f"Response from {ontology_id} ontology: {response_data}")
36+
# print(f"Response from {ontology_id} ontology: {response_data}")
3737

3838
if 'matches' in response_data and isinstance(response_data['matches'], list):
3939
text_with_spans = wrap_terms_in_span(text, response_data['matches'])
@@ -49,7 +49,7 @@ def get_ontology_annotations(config, ontology_id, text):
4949

5050
def wrap_terms_in_span(text, matches):
5151

52-
cleaner_matches = [{'matched_term': m['matched_term'], 'start': m['start'], 'end': m['end'], 'iri': m['iri']} for m in matches]
52+
cleaner_matches = [{'term': m['token'],'matched_term': m['matched_term'], 'start': m['start'], 'end': m['end'], 'iri': m['iri']} for m in matches]
5353
sorted_matches = sorted(cleaner_matches, key=lambda m: (-len(m['matched_term']), -m['start']))
5454

5555
modified_positions = set()
@@ -80,8 +80,8 @@ def wrap_terms_in_span(text, matches):
8080

8181
for match in modifications:
8282
result += text[last_end:match['start']]
83-
result += f"<a href={match['iri']} style='border-bottom: 1px dotted #666; text-decoration: none;'>{match['matched_term']}</a> "
84-
last_end = match['end'] + 1
83+
result += f"<a href={match['iri']} style='border-bottom: 1px dotted #666; text-decoration: none;'>{match['term']}</a>"
84+
last_end = match['end']
8585

8686
result += text[last_end:]
8787

0 commit comments

Comments
 (0)