diff --git a/app.py b/app.py index a15013428..de23956bb 100644 --- a/app.py +++ b/app.py @@ -4,7 +4,7 @@ from functions import build_data_dict, fetch_contributions_for_the_single_contributor, generate_table_of_contents, get_breadcrumbs, find_related_articles, calculate_reading_time, fetch_meta_data, recently_published import os from models import db, articles, Contributors, blogs, Topics -from html_parser import htmlize +from html_parser import htmlize, r_to_html_plaintext from redirectstsh import setup_redirects from utils import get_git_commit_hash import redirects_config @@ -144,7 +144,17 @@ def topic_single(first_level_topic_path, second_level_topic_path, third_level_to article = articles.query.filter_by(path=article_path).first() meta_data = fetch_meta_data(article) related_articles = None - if article: + table_of_contents = None + content = None + reading_time = 0 + if article is None: + file_path = 'content/topics/' + first_level_topic_path + '/' + second_level_topic_path + '/' + third_level_topic_path + '/' + article_path + ## open file and retrieve R code content + with open(file_path, 'r', encoding='utf-8') as file: + content = file.read() + code_content = r_to_html_plaintext(content) + return render_template('code_topic.html', content=code_content) + else: related_articles = find_related_articles(article_path, articles, Topics) content = htmlize(article.content) table_of_contents = generate_table_of_contents(content) diff --git a/content/topics/Analyze/causal-inference/did/canonical-did-table.md b/content/topics/Analyze/causal-inference/did/canonical-did-table.md index b6ac7e705..26f3f02d0 100644 --- a/content/topics/Analyze/causal-inference/did/canonical-did-table.md +++ b/content/topics/Analyze/causal-inference/did/canonical-did-table.md @@ -4,7 +4,7 @@ description: "This topic provides background and motivation for the difference-i keywords: "causal inference, difference-in-difference, DID, R, regression, model, canonical DiD, difference in means table, potential outcomes framework, average treatment effect, ATE, ATT, ATU, treatment effects" draft: false weight: 1 -author: "Roshini Sudhaharan, Valerie Vossen" +author: "Roshini Sudhaharan,Valerie Vossen" aliases: - /canonical-DiD --- diff --git a/content/topics/Collaborate-share/Project-management/contribute-to-tilburg-science-hub/style-guide.md b/content/topics/Collaborate-share/Project-management/contribute-to-tilburg-science-hub/style-guide.md index 2671da9de..13cfe72ad 100644 --- a/content/topics/Collaborate-share/Project-management/contribute-to-tilburg-science-hub/style-guide.md +++ b/content/topics/Collaborate-share/Project-management/contribute-to-tilburg-science-hub/style-guide.md @@ -23,7 +23,7 @@ Please develop your content in English. ### Start Your Content With Our Templates -Please use our [building block templates](https://raw.githubusercontent.com/tilburgsciencehub/tsh-website/master/content/topics/more-tutorials/contribute-to-tilburg-science-hub/building-block-shell.md) or [tutorial template](https://raw.githubusercontent.com/tilburgsciencehub/tsh-website/master/content/topics/more-tutorials/contribute-to-tilburg-science-hub/tutorial-shell.md) when developing new building blocks or tutorials. +Please use our [building block templates](https://raw.githubusercontent.com/tilburgsciencehub/tsh-website/master/content/topics/Collaborate-share/Project-management/engage-open-science/contribute-to-tilburg-science-hub/building-block-shell.md) or [tutorial template](https://raw.githubusercontent.com/tilburgsciencehub/tsh-website/master/content/topics/Collaborate-share/Project-management/engage-open-science/contribute-to-tilburg-science-hub/tutorial-shell.md) when developing new building blocks or tutorials.