Skip to content

Commit 498893b

Browse files
committed
get rid of R"()" strings
1 parent 712d8a9 commit 498893b

File tree

1 file changed

+85
-81
lines changed

1 file changed

+85
-81
lines changed

static-site-gen/site.cpp

+85-81
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
/* TODO(lcf, Jan 01 2025)
22
* Get code compiling on latest lcf
33
* cleanup string stuff with new primitives
4+
* Fix article index sorting
5+
* Uses file creation times atm, this info is not saved by git
6+
* Just give articles a number and sort by that?
47
* Implement math expressions using mathml
58
* Browsers now have support
69
* Fallback: https://github.com/fred-wang/mathml.css
710
* Just make a little custom lang for this, can fallback to mathml if needed :vomit:
11+
12+
TODO(lcf, Jan 04 2025)
13+
* change footer
14+
- move light/night switch to left bar (left = site internal, right = external links)
15+
- add to right bar
16+
- bluesky https://bsky.app/profile/dev-dwarf.itch.io
17+
- steam https://store.steampowered.com/developer/dd
18+
* update projects page for 2025
819
*/
920

1021
#include "../../lcf/lcf.h"
@@ -24,76 +35,68 @@ global StrNode wildcard = {0, strl("*.md")};
2435
global StrNode filename = {};
2536
global PageList allPages = {};
2637

27-
str HEADER = strl(
28-
R"(
29-
<!DOCTYPE html>
30-
<!-- GENERATED -->
31-
<html lang="en-US">
32-
<head>
33-
<meta charset="utf-8">
34-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
35-
<meta property="og:title" content="Logan Forman" />
36-
<meta property="og:locale" content="en_US" />
37-
<meta property="og:image" content="/assets/dd.png" />
38-
<link rel="canonical" href="http://loganforman.com/" />
39-
<meta property="og:url" content="http://loganforman.com/"/>
40-
<meta property="og:site_name" content="Logan Forman / Dev-Dwarf" />
41-
<meta property="og:type" content="website" />
42-
<meta name="twitter:card" content="summary" />
43-
<meta property="twitter:title" content="Logan Forman" />
44-
<script type="application/ld+json">
45-
{"@context":"https://schema.org","@type":"WebSite","headline":"Logan Forman / Dev-Dwarf","name":"Logan Forman / Dev-Dwarf","url":"http://loganforman.com/"}</script>
46-
<link rel="stylesheet" href="/dwarf.css">
47-
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico">
48-
</head>
49-
50-
<body>
51-
<script>
52-
var theme = localStorage.getItem('theme') || 'light';
53-
54-
// window.onload = function() {
55-
document.querySelector('body').setAttribute('data-theme', theme);
56-
// }
57-
58-
function toggleNight() {
59-
console.log('toggle');
60-
theme = (theme == 'light')? 'night' : 'light';
61-
localStorage.setItem('theme', theme);
62-
document.querySelector('body').setAttribute('data-theme', theme);
63-
}
64-
65-
</script>
66-
<div class="wrapper">
67-
<main class="page-content" aria-label="Content">
68-
69-
)");
70-
71-
str FOOTER = strl(R"(
72-
</main>
73-
</div>
74-
</body>
75-
<div>
76-
<hr>
77-
<nav>
78-
<table class="w33 left"><tr>
79-
<td><a href="/index.html">home</a></td>
80-
<td><a href="/projects.html">projects</a></td>
81-
<td><a href="/writing.html">writing</a></td>
82-
<td><a style="text-decoration-color: #EE802F !important" href='/rss.xml'>rss</a></td>
83-
</tr></table>
84-
85-
<table class="w33 right"><tr>
86-
<td><a href="https://github.com/dev-dwarf">github</a></td>
87-
<td><a href="https://twitter.com/dev_dwarf">twitter</a></td>
88-
<td><a href="https://dev-dwarf.itch.io">games</a></td>
89-
<td class="light"><a class="light" onClick='toggleNight()'>light</a></td>
90-
<td class="night"><a class="night" onClick='toggleNight()'>night</a></td>
91-
</tr></table>
92-
<p><br><br><br></p>
93-
</nav>
94-
95-
</div>
96-
</html>)");
38+
str HEADER = strl(""
39+
"<!DOCTYPE html\n"
40+
"<!-- GENERATED --\n"
41+
"<html lang='en-US'\n"
42+
"<head\n"
43+
"<meta charset='utf-8'\n"
44+
"<meta name='viewport' content='width=device-width, initial-scale=1.0'\n"
45+
"<meta property='og:title' content='Logan Forman' /\n"
46+
"<meta property='og:locale' content='en_US' /\n"
47+
"<meta property='og:image' content='/assets/dd.png' /\n"
48+
"<link rel='canonical' href='http://loganforman.com/' /\n"
49+
"<meta property='og:url' content='http://loganforman.com/'/\n"
50+
"<meta property='og:site_name' content='Logan Forman / Dev-Dwarf' /\n"
51+
"<meta property='og:type' content='website' /\n"
52+
"<meta name='twitter:card' content='summary' /\n"
53+
"<meta property='twitter:title' content='Logan Forman' /\n"
54+
"<script type='application/ld+json'\n"
55+
"{'@context':'https://schema.org','@type':'WebSite','headline':'Logan Forman / Dev-Dwarf','name':'Logan Forman / Dev-Dwarf','url':'http://loganforman.com/'}</script\n"
56+
"<link rel='stylesheet' href='/dwarf.css'\n"
57+
"<link rel='icon' type='image/x-icon' href='/assets/favicon.ico'\n"
58+
"</head\n"
59+
"<body\n"
60+
"<script\n"
61+
"var theme = localStorage.getItem('theme') || 'light'\n"
62+
"// window.onload = function() \n"
63+
"document.querySelector('body').setAttribute('data-theme', theme)\n"
64+
"// \n"
65+
"function toggleNight() {\n"
66+
"console.log('toggle')\n"
67+
"theme = (theme == 'light')? 'night' : 'light'\n"
68+
"localStorage.setItem('theme', theme)\n"
69+
"document.querySelector('body').setAttribute('data-theme', theme); \n"
70+
"}\n"
71+
"</script\n"
72+
"<div class='wrapper'\n"
73+
"<main class='page-content' aria-label='Content'\n"
74+
);
75+
76+
str FOOTER = strl(""
77+
"</main>\n"
78+
"</div\n"
79+
"</body\n"
80+
"<div\n"
81+
"<hr\n"
82+
"<nav\n"
83+
"<table class='w33 left'><tr\n"
84+
"<td><a href='/index.html'>home</a></td\n"
85+
"<td><a href='/projects.html'>projects</a></td\n"
86+
"<td><a href='/writing.html'>writing</a></td\n"
87+
"<td><a style='text-decoration-color: #EE802F !important' href='/rss.xml'>rss</a></td\n"
88+
"</tr></table\n"
89+
"<table class='w33 right'><tr\n"
90+
"<td><a href='https://github.com/dev-dwarf'>github</a></td\n"
91+
"<td><a href='https://twitter.com/dev_dwarf'>twitter</a></td\n"
92+
"<td><a href='https://dev-dwarf.itch.io'>games</a></td\n"
93+
"<td class='light'><a class='light' onClick='toggleNight()'>light</a></td\n"
94+
"<td class='night'><a class='night' onClick='toggleNight()'>night</a></td>\n"
95+
"</tr></table\n"
96+
"<p><br><br><br></p\n"
97+
"</nav\n"
98+
"</div\n"
99+
"</html>\n");
97100

98101
/* Swap between 'src' and 'deploy' folders of project directory. */
99102
void switch_to_dir(StrNode *new_folder_node) {
@@ -324,17 +327,18 @@ void compile_page(Arena *longa, Arena *tempa, Page *page) {
324327
StrList_pop(&dir, page->base_dir.count);
325328
}
326329

327-
global str RSS_HEADER = strl(R"(<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
328-
<channel>
329-
<title>Logan Forman</title>
330-
<link>http://loganforman.com/</link>
331-
<atom:link href="http://loganforman.com/rss.xml" rel="self" type="application/rss+xml" />
332-
<description>Journey to the competence.</description>
333-
)");
334-
global str RSS_FOOTER = strl(R"(
335-
</channel>
336-
</rss>
337-
)");
330+
global str RSS_HEADER = strl(
331+
"<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'\n"
332+
"<channel\n"
333+
"<title>Logan Forman</title\n"
334+
"<link>http://loganforman.com/</link\n"
335+
"<atom:link href='http://loganforman.com/rss.xml' rel='self' type='application/rss+xml' /\n"
336+
"<description>Journey to the competence.</description\n"
337+
);
338+
global str RSS_FOOTER = strl(
339+
"</channel\n"
340+
"</rss\n"
341+
);
338342
void compile_feeds(Arena *arena, PageList pages) {
339343
printf("RSS Feed:\n");
340344
StrList rss = {0};

0 commit comments

Comments
 (0)