Skip to content
Snippets Groups Projects
Commit 95c18782 authored by Said Fathalla's avatar Said Fathalla
Browse files

add python script and a pipeline to export resources list in readme to html

parent 11a1f6ac
Branches
No related tags found
1 merge request!2Resolve "generate the HTML for the list of resources from the README for the MatWerk homepage-tools"
stages:
- md2html
test:
stage: md2html
image: python:3.9
script:
- pip install markdown2
- python scripts/extract-resources.py
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
changes:
- README.md
artifacts:
paths:
- resources.html
import markdown2
def main():
#http = urllib3.PoolManager()
#response = http.request('GET', "https://git.rwth-aachen.de/nfdi-matwerk/ta-oms/mste/-/raw/main/README.md")
#text = response.data.decode('utf-8')
with open("README.md", "r") as file:
text = file.read()
text_intro="Do you have a schema that you would like to share?</br> Please visit the <a href=\"https://git.rwth-aachen.de/nfdi-matwerk/ta-oms/mste\">NFDI MatWerk Schema and Terminology Exchange</a> to see how your resource can be added.</br>"
text_split_intro = text.split("description/keywords.", 1)
text_split_ack = text_split_intro[1].split("## Acknowledgements", 1)
converter = markdown2.Markdown(extras=["tables"]) # <-- here
html = converter.convert(text_split_ack[0])
html=text_intro+html
with open('resources.html', 'w') as f:
f.write(html)
if __name__ == "__main__":
main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment