A search interface for the Performing Patents Otherwise publication as part of the Politics of Patents case study (part of Copim WP6): this parses data from the archive of RTF files and provides additional data from the European Patent Office OPS API. https://patents.copim.ac.uk
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

41 行
1.3KB

  1. # @name: main.py
  2. # @creation_date: 2022-09-07
  3. # @license: The MIT License <https://opensource.org/licenses/MIT>
  4. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  5. # @purpose: Main route for index page, contents, frontmatter, and other miscellaneous pages
  6. # @acknowledgements:
  7. # https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login
  8. from flask import Blueprint, render_template
  9. import markdown
  10. main = Blueprint('main', __name__)
  11. # route for index page
  12. @main.route('/')
  13. def index():
  14. return render_template('index.html')
  15. # route for table of contents page
  16. @main.route('/contents/')
  17. def contents():
  18. with open('content/TOC.md', 'r') as f:
  19. text = f.read()
  20. text = markdown.markdown(text)
  21. return render_template('text.html', text=text)
  22. # route for introduction page
  23. @main.route('/introduction/')
  24. def foreword():
  25. with open('content/introduction.md', 'r') as f:
  26. text = f.read()
  27. text = markdown.markdown(text)
  28. return render_template('text.html', text=text)
  29. # route for frontmatter page
  30. @main.route('/frontmatter/')
  31. def frontmatter():
  32. with open('content/frontmatter.md', 'r') as f:
  33. text = f.read()
  34. text = markdown.markdown(text)
  35. return render_template('text.html', text=text)