summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2018-09-12 22:28:11 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2018-09-12 22:28:11 -0700
commit512d44cf2f60013d8dbbfb31e23a83ec2bedfde9 (patch)
tree0bd5417b77a219c55c7b2ed479c029e60b882f37
parentdefc7571e7b261a2e8bc63f45b9472ccb81379b7 (diff)
downloadjournal-512d44cf2f60013d8dbbfb31e23a83ec2bedfde9.tar.gz
journal-512d44cf2f60013d8dbbfb31e23a83ec2bedfde9.tar.xz
various display changes
-rw-r--r--journal.c17
-rw-r--r--style.css29
2 files changed, 39 insertions, 7 deletions
diff --git a/journal.c b/journal.c
index 4a07261..7feae8b 100644
--- a/journal.c
+++ b/journal.c
@@ -10,7 +10,8 @@
static char *entries[MAX_ENTRIES];
static int num_entries;
-static void load_entries() {
+static void load_entries()
+{
DIR *d = opendir(ENTRY_DIR);
if (!d) exit(1);
@@ -28,7 +29,8 @@ static void load_entries() {
closedir(d);
}
-static void print_entry(char *entry) {
+static void print_entry(char *entry)
+{
size_t len = strlen(entry) + 1;
char *path = malloc(sizeof(ENTRY_DIR) + len);
memcpy(path, ENTRY_DIR"/", sizeof(ENTRY_DIR));
@@ -60,11 +62,13 @@ static void print_entry(char *entry) {
printf("</p></div>\n");
}
-static int entry_cmp(const void *a, const void *b) {
+static int entry_cmp(const void *a, const void *b)
+{
return atoi(*(const char **)b) - atoi(*(const char **)a);
}
-int main() {
+int main()
+{
load_entries();
qsort(entries, num_entries, sizeof(char *), entry_cmp);
@@ -73,12 +77,12 @@ int main() {
"<html lang='en'>\n"
"<head>\n"
"<meta charset='utf-8'>\n"
- "<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet'>\n"
+ "<meta name='viewport' content='width=device-width, initial-scale=1'>\n"
+ "<link href='https://fonts.googleapis.com/css?family=Source+Serif+Pro:400,700' rel='stylesheet'>\n"
"<link href='style.css' rel='stylesheet'>\n"
"<title>david's journal</title>\n"
"</head>\n"
"<body>\n"
- "<div id='content'>\n"
"<h1>david's journal</h1>\n");
for (int i = 0; i < num_entries; ++i) {
@@ -87,7 +91,6 @@ int main() {
}
printf(
- "</div>\n"
"</body>\n"
"</html>\n");
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..60132b1
--- /dev/null
+++ b/style.css
@@ -0,0 +1,29 @@
+body {
+ color: #eee;
+ background-color: #111;
+ font-family: 'Source Serif Pro', serif;
+ font-size: 1.2em;
+ max-width: 42em;
+ margin: 1em;
+ padding: 0;
+}
+
+h1 {
+ color: #999;
+ font-size: 2em;
+ font-weight: bold;
+ margin: 0.5em 0;
+}
+
+.entry {
+ margin: 1em 0;
+}
+
+.entry p {
+ line-height: 1.4;
+ margin: 0.5em 0;
+}
+
+.entry p .date {
+ font-weight: bold;
+}