raannakasturi commited on
Commit
3294248
·
1 Parent(s): b80eb1d

Update .gitignore to exclude .html and .js files along with BLOGGER directory

Browse files
Files changed (2) hide show
  1. .gitignore +3 -1
  2. post_blog.py +53 -44
.gitignore CHANGED
@@ -1,4 +1,6 @@
1
  .env
2
  /__*
3
  *.json
4
- /BLOGGER
 
 
 
1
  .env
2
  /__*
3
  *.json
4
+ /BLOGGER
5
+ .html
6
+ .js
post_blog.py CHANGED
@@ -16,15 +16,6 @@ refresh_token = os.getenv('REFRESH_TOKEN')
16
  blog_id = os.getenv('BLOG_ID')
17
  imgbb_api_key = os.getenv('IMGBB_API_KEY')
18
 
19
- def generate_mindmap_svg(title, mindmap):
20
- data = "# " + title + "\n" + mindmap
21
- client = Client("raannakasturi/MarkdownToSVG")
22
- result = client.predict(
23
- markdown_text=data,
24
- api_name="/markdown_svg_generator"
25
- )
26
- return result.strip()
27
-
28
  def generate_post_html(doi, title, category, summary, mindmap, citation):
29
  doi = doi.split("https://")[-1]
30
  print(f"Generating post for {doi}")
@@ -35,23 +26,63 @@ def generate_post_html(doi, title, category, summary, mindmap, citation):
35
  citation = citation.replace("{", r'{').replace("}", r'}')
36
  citation = mistune.html(citation.replace("&", "&").strip())
37
  image = fetch_image(title, summary, imgbb_api_key)
38
- # svg_url = generate_mindmap_svg(title, mindmap)
39
  html_summary = mistune.html(summary)
40
  post = f"""
41
- <div id="paper_post">
42
- <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader"></script>
43
- <script src="https://cdn.jsdelivr.net/npm/markmap-toolbar"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  <style>
45
  .markmap {{
46
  position: relative;
47
  }}
 
48
  .markmap > svg {{
49
  width: 100%;
50
  border: 2px solid #000;
51
  height: 80dvh;
52
  }}
53
  </style>
54
- <img style="display:block; width:100%; height:100%;" id="paper_image" src="{image.strip()}" alt="{title.strip()}">
 
 
55
  <br>
56
  <b>{{getToc}} $title={{Table of Contents}}</b>
57
  <br>
@@ -60,11 +91,12 @@ def generate_post_html(doi, title, category, summary, mindmap, citation):
60
  </div>
61
  <br>
62
  <h2>Mindmap</h2>
63
- <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>
64
- <div class="markmap" id="paper_mindmap" data-markmap-url="{{svg_url}}">
 
65
  <script type="text/template">
66
- {mindmap.replace("&amp;", "&").replace(":", "=>").strip()}
67
- </script>
68
  </div>
69
  <br>
70
  <h2>Citation</h2>
@@ -73,29 +105,6 @@ def generate_post_html(doi, title, category, summary, mindmap, citation):
73
  </div>
74
  </div>
75
  """
76
- # post = f"""
77
- # <div id="paper_post" data={doi}>
78
- # <h1 id="paper_title">{title}</h1>
79
- # <small><em>DOI: <a href="https://{doi}" target="_blank">{doi}</a></em></small>
80
- # <em>Category: {category}</em>
81
- # <br>
82
- # <img style="display:block; width:100%; height:100%;" id="paper_image" src="{image.strip()}" alt="{title.strip()}">
83
- # <br>
84
- # <div id="paper_summary">
85
- # {html_summary.replace("&amp;", "&").strip()}
86
- # </div>
87
- # <br>
88
- # <h2>Mindmap</h2>
89
- # <div id="paper_mindmap">
90
- # {repr(mindmap.replace("&amp;", "&").strip())}
91
- # </div>
92
- # <br>
93
- # <h2>Citation</h2>
94
- # <div id="paper_citation">
95
- # {citation.replace("&amp;", "&").strip()}
96
- # </div>
97
- # </div>
98
- # """
99
  return post, image
100
 
101
  def create_post(doi, title, category, summary, mindmap, citation):
@@ -103,9 +112,9 @@ def create_post(doi, title, category, summary, mindmap, citation):
103
  post_category = f"{category}"
104
  try:
105
  post_body, post_image = generate_post_html(doi, title, category, summary, mindmap, citation)
106
- with open('post.html', 'w') as f:
107
- f.write(post_body)
108
- exit(code=0)
109
  except Exception as e:
110
  print(f"Error generating post: {e}")
111
  return None, None, None, None
 
16
  blog_id = os.getenv('BLOG_ID')
17
  imgbb_api_key = os.getenv('IMGBB_API_KEY')
18
 
 
 
 
 
 
 
 
 
 
19
  def generate_post_html(doi, title, category, summary, mindmap, citation):
20
  doi = doi.split("https://")[-1]
21
  print(f"Generating post for {doi}")
 
26
  citation = citation.replace("{", r'{').replace("}", r'}')
27
  citation = mistune.html(citation.replace("&amp;", "&").strip())
28
  image = fetch_image(title, summary, imgbb_api_key)
 
29
  html_summary = mistune.html(summary)
30
  post = f"""
31
+ <div id="paper_post">
32
+ <script>
33
+ window.markmap = {{
34
+ autoLoader: {{
35
+ toolbar: true,
36
+ }},
37
+ }};
38
+ </script>
39
+ <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
40
+ <script>
41
+ window.addEventListener('load', function() {{
42
+ setTimeout(function() {{
43
+ const element = document.querySelector('div.mm-toolbar-item[title="Fit window size"]');
44
+ console.log(element);
45
+ if (element) {{
46
+ element.click();
47
+ }} else {{
48
+ console.log('Element not found');
49
+ }}
50
+ }}, 0);
51
+ }});
52
+ </script>
53
+ <script>
54
+ window.addEventListener('load', function() {{
55
+ const anchor = document.querySelector('a.mm-toolbar-brand');
56
+ if (anchor) {{
57
+ anchor.href = '/';
58
+ const img = anchor.querySelector('img');
59
+ if (img) {{
60
+ img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAFe1JREFUaIF9mtmvZMlx3n8RmWepU8vde+/pWTkiKVHUiIL0YgmSYcCA7P/WDwZswaQNGRRNmZIoixouMz29375brWfLJfxQt0laIp2Fesk6hRPrlxFfpPD/WYLipHAYRWTIwPjutyN/yof1t49P9aOPJpy8P7HThwu5eza1kyPNbhFymMYUKjPFqx+86s40rHd2ebOyNxetXr8cZfn00r78xRfDj65v4uWvv7r0VIoQkoVk5N8qo/9togNiZIs2JJDk8DgpnJOiKmmaM/nwzizdeziheTT17v7c57PDYjicunZRiJtmjRMjFSCo+EB2k2hxUkWbFKlo1qlu2jibjfHO4V338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fkYNvmdKUR039jcjll/2XGYxdtKVfc9JZm2u4htd/Fiu3v9pu0vfzbG9sshbs9nkzt/7NQ9yTnNUs4OccQoGoeJdW3WXYnsPCzc/mrFMlW8jlNejDM7DxNbJWHIQ8Y6XNikfrjappy+2nZv/+b6+vPvnb/92x9cXP79q137Ov7KwIqI2d7yv272f7UUESeQ1fbDPwCm0wcs5k8eTqf3vjapjj6ZNmeP6+rkji/mh841M++ns2lR1QeFTo58qA61L2oZHUBnZVrlSbiOxbAac9+mvotxu02x24awuen7q4u2u3jeDTc/2+3e/HS9+erlbvfqV0KKc6AZS/YvL378BgV+uS2/um0hiDicK51qUXs/aY4PP753dPjp4+n0/qOyXNypqqOzZnJy0NSLg0J1KhYn5FjubVKMGd+FnHZtv163/dVyGG4uxnF9vtu9enFz89MXN6ufv4mxa3MOfUpjMku86172abtvCf7l+i23VQzARBTVwplR5jzEGGMAduO42mF2UZSLC/XVCrGNL4rW5OA0qO87rQ66aLMxpwqgEjfUKlunwypLuIl5ezGG1etuuPlq2775+fXyZ2+77vzXBShUKydCyDkks/yvJb9d/xfNailUP1oiJgAAAABJRU5ErkJggg==';
61
+ img.alt = 'ReXplore';
62
+ }}
63
+ const span = anchor.querySelector('span');
64
+ if (span) {{
65
+ span.textContent = 'ReXplore';
66
+ }}
67
+ }} else {{
68
+ console.log('Anchor element not found');
69
+ }}
70
+ }});
71
+ </script>
72
  <style>
73
  .markmap {{
74
  position: relative;
75
  }}
76
+
77
  .markmap > svg {{
78
  width: 100%;
79
  border: 2px solid #000;
80
  height: 80dvh;
81
  }}
82
  </style>
83
+ <img style="display:block; width:100%; height:100%;" id="paper_image"
84
+ src="{image.strip()}"
85
+ alt="{title.strip()}">
86
  <br>
87
  <b>{{getToc}} $title={{Table of Contents}}</b>
88
  <br>
 
91
  </div>
92
  <br>
93
  <h2>Mindmap</h2>
94
+ <p><small><em>If MindMap doesn't load, go to the <a href="/">Homepage</a> and visit blog again or <a
95
+ href="/#">Switch to Android App (Under Development)</a>.</em></small></p>
96
+ <div class="markmap" id="paper_mindmap">
97
  <script type="text/template">
98
+ {mindmap.replace("&amp;", "&").replace(":", "=>").strip()}
99
+ </script>
100
  </div>
101
  <br>
102
  <h2>Citation</h2>
 
105
  </div>
106
  </div>
107
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  return post, image
109
 
110
  def create_post(doi, title, category, summary, mindmap, citation):
 
112
  post_category = f"{category}"
113
  try:
114
  post_body, post_image = generate_post_html(doi, title, category, summary, mindmap, citation)
115
+ # with open('post.html', 'w') as f:
116
+ # f.write(post_body)
117
+ # exit(code=0)
118
  except Exception as e:
119
  print(f"Error generating post: {e}")
120
  return None, None, None, None