Spaces:
Running
Running
Update post_blog.py
Browse files- post_blog.py +6 -4
post_blog.py
CHANGED
@@ -35,25 +35,25 @@ def generate_post_html(title, summary, mindmap, citation):
|
|
35 |
height: 80dvh;
|
36 |
}}
|
37 |
</style>
|
38 |
-
<img style="display:block; width:100%; height:100%;" id="paper_image" src="{image}" alt="{title}">
|
39 |
<br>
|
40 |
<b>{{getToc}} $title={{Table of Contents}}</b>
|
41 |
<br>
|
42 |
<div id="paper_summary">
|
43 |
-
{html_summary.replace("&", "&")}
|
44 |
</div>
|
45 |
<br>
|
46 |
<h2>Mindmap</h2>
|
47 |
<p><small><em>If MindMap doesn't load, go to the <a href="/">Homepage</a> and visit blog again or <a href="/#">Switch to Android App (Under Development)</a>.</em></small></p>
|
48 |
<div class="markmap" id="paper_mindmap">
|
49 |
<script type="text/template">
|
50 |
-
{mindmap.replace("&", "&").replace(":", "=>")}
|
51 |
</script>
|
52 |
</div>
|
53 |
<br>
|
54 |
<h2>Citation</h2>
|
55 |
<div id="paper_citation">
|
56 |
-
{mistune.html(citation.replace("&", "&"))}
|
57 |
</div>
|
58 |
</div>
|
59 |
"""
|
@@ -99,6 +99,8 @@ def post_post(title, category, body, image):
|
|
99 |
"labels": [category, "ZZZZZZZZZ"]
|
100 |
}
|
101 |
response = requests.post(url, headers=headers, json=post_data).json()
|
|
|
|
|
102 |
if response['status'] == 'LIVE':
|
103 |
print(f"The post '{title}' is {response['status']}")
|
104 |
return True
|
|
|
35 |
height: 80dvh;
|
36 |
}}
|
37 |
</style>
|
38 |
+
<img style="display:block; width:100%; height:100%;" id="paper_image" src="{image.strip()}" alt="{title.strip()}">
|
39 |
<br>
|
40 |
<b>{{getToc}} $title={{Table of Contents}}</b>
|
41 |
<br>
|
42 |
<div id="paper_summary">
|
43 |
+
{html_summary.replace("&", "&").strip()}
|
44 |
</div>
|
45 |
<br>
|
46 |
<h2>Mindmap</h2>
|
47 |
<p><small><em>If MindMap doesn't load, go to the <a href="/">Homepage</a> and visit blog again or <a href="/#">Switch to Android App (Under Development)</a>.</em></small></p>
|
48 |
<div class="markmap" id="paper_mindmap">
|
49 |
<script type="text/template">
|
50 |
+
{mindmap.replace("&", "&").replace(":", "=>").strip()}
|
51 |
</script>
|
52 |
</div>
|
53 |
<br>
|
54 |
<h2>Citation</h2>
|
55 |
<div id="paper_citation">
|
56 |
+
{mistune.html(citation.replace("&", "&").strip())}
|
57 |
</div>
|
58 |
</div>
|
59 |
"""
|
|
|
99 |
"labels": [category, "ZZZZZZZZZ"]
|
100 |
}
|
101 |
response = requests.post(url, headers=headers, json=post_data).json()
|
102 |
+
if response['status'] != 'LIVE':
|
103 |
+
print(response)
|
104 |
if response['status'] == 'LIVE':
|
105 |
print(f"The post '{title}' is {response['status']}")
|
106 |
return True
|