aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--posts/new-blog.org74
-rw-r--r--project-config.el34
2 files changed, 95 insertions, 13 deletions
diff --git a/posts/new-blog.org b/posts/new-blog.org
index 581d525..6b0358b 100644
--- a/posts/new-blog.org
+++ b/posts/new-blog.org
@@ -7,4 +7,76 @@ It's that time again... I've started a new project to build and maintain my site
and of course it has to come with a new blog post. I'm trying to have it
generate an index based on the files in this directory.
-I don't want it to include anything beyond the first paragraph, though.
+I don't want it to include anything beyond the first paragraph, though. Now I
+need to write some content so that it doesn't stay at a 1 minute read. If the
+average reading speed is 225 words per minute (it's probably not, but that's
+just what I've set my value to right now), I need at least 450 words to go above
+the 2 minutes. This means I have to write more nonsense into this post.
+
+It was fun getting the dynamic block up and working, although I still need to
+get rid of the =#+BEGIN: blog-posts= from the export. It's really hard to write
+enough words for this.
+
+I'm just going to add some Riker ipsum...
+
+I I am your worst nightmare! Damage report! Talk about going nowhere fast.
+Commander William Riker of the Starship Enterprise. Your shields were failing,
+sir. You bet I'm agitated! I may be surrounded by insanity, but I am not insane.
+Now, how the hell do we defeat an enemy that knows us better than we know
+ourselves? Sorry, Data. When has justice ever been as simple as a rule book?
+Some days you get the bear, and some days the bear gets you. Maybe if we felt
+any human loss as keenly as we feel one of those close to us, human history
+would be far less bloody. You're going to be an interesting companion, Mr. Data.
+Fate. It protects fools, little children, and ships named "Enterprise." Well,
+that's certainly good to know. The look in your eyes, I recognize it. You used
+to have it for me. How long can two people talk about nothing? Your head is not
+an artifact! I recommend you don't fire until you're within 40,000 kilometers. A
+surprise party? Mr. Worf, I hate surprise parties. I would *never* do that to you.
+Sure. You'd be surprised how far a hug goes with Geordi, or Worf. We have a
+saboteur aboard. Worf, It's better than music. It's jazz. I think you've let
+your personal feelings cloud your judgement. The Federation's gone; the Borg is
+everywhere! The game's not big enough unless it scares you a little. What? We're
+not at all alike! They were just sucked into space. I will obey your orders. I
+will serve this ship as First Officer. And in an attack against the Enterprise,
+I will die with this crew. But I will not break my oath of loyalty to Starfleet.
+My oath is between Captain Kargan and myself. Your only concern is with how you
+obey my orders. Or do you prefer the rank of prisoner to that of lieutenant?
+Computer, belay that order. I can't. As much as I care about you, my first duty
+is to the ship. Maybe if we felt any human loss as keenly as we feel one of
+those close to us, human history would be far less bloody. Shields up! Rrrrred
+alert! Mr. Crusher, ready a collision course with the Borg ship. Yes,
+absolutely, I do indeed concur, wholeheartedly! What's a knock-out like you
+doing in a computer-generated gin joint like this? Ensign Babyface! Well, I'll
+say this for him - he's sure of himself. Why don't we just give everybody a
+promotion and call it a night - 'Commander'? I suggest you drop it, Mr. Data.
+Travel time to the nearest starbase? This is not about revenge. This is about
+justice. About four years. I got tired of hearing how young I looked. and attack
+the Romulans. I'm afraid I still don't understand, sir. Then maybe you should
+consider this: if anything happens to them, Starfleet is going to want a full
+investigation. A lot of things can change in twelve years, Admiral. Computer,
+lights up! We know you're dealing in stolen ore. But I wanna talk about the
+assassination attempt on Lieutenant Worf. Some days you get the bear, and some
+days the bear gets you. I'd like to think that I haven't changed those things,
+sir. Is it my imagination, or have tempers become a little frayed on the ship
+lately? Besides, you look good in a dress. When has justice ever been as simple
+as a rule book? Wouldn't that bring about chaos? But the probability of making a
+six is no greater than that of rolling a seven. Did you come here for something
+in particular or just general Riker-bashing? Captain, why are we out here
+chasing comets? In all trust, there is the possibility for betrayal. Wait a
+minute - you've been declared dead. You can't give orders around here. Not if I
+weaken first. I've had twelve years to think about it. And if I had it to do
+over again, I would have grabbed the phaser and pointed it at you instead of
+them. We could cause a diplomatic crisis. Take the ship into the Neutral Zone
+Fear is the true enemy, the only enemy. Now we know what they mean by 'advanced'
+tactical training. And blowing into maximum warp speed, you appeared for an
+instant to be in two places at once. Fate protects fools, little children and
+ships named Enterprise. The Enterprise computer system is controlled by three
+primary main processor cores, cross-linked with a redundant melacortz ramistat,
+fourteen kiloquad interface modules. For an android with no feelings, he sure
+managed to evoke them in others. Could someone survive inside a transporter
+buffer for 75 years? Our neural pathways have become accustomed to your sensory
+input patterns. That might've been one of the shortest assignments in the
+history of Starfleet. I guess it's better to be lucky than good. Mr. Worf, you
+do remember how to fire phasers? The unexpected is our normal routine. Yesterday
+I did not know how to eat gagh. Earl Grey tea, watercress sandwiches... and
+Bularian canapés? Are you up for promotion?
diff --git a/project-config.el b/project-config.el
index bc27ee7..5c08262 100644
--- a/project-config.el
+++ b/project-config.el
@@ -38,10 +38,10 @@
(defun project-config-parse-element (org-element)
(pcase org-element
- (`(keyword ,something) (cons (plist-get something :key)
+ (`(keyword ,something) (cons (intern (plist-get something :key))
(plist-get something :value)))
(`(paragraph ,something) (cons
- "BODY"
+ 'BODY
(buffer-substring-no-properties
(plist-get something :contents-begin)
(plist-get something :contents-end))))))
@@ -50,21 +50,31 @@
(with-current-buffer (find-file document)
(goto-char (point-min))
(let (alist)
- (while (not (alist-get "BODY" alist nil nil #'equal))
+ (while (not (alist-get 'BODY alist nil nil #'equal))
(setq alist (cons (project-config-parse-element (org-element-at-point))
alist))
(org-forward-element))
alist)))
-(defun project-config-print-element (filename alist)
- (format "* %s\n :PROPERTIES:\n :ID: %s\n :PUBDATE: %s\n :END:\n\n %s\n[[file:%s][Read more]]\n"
- (alist-get "TITLE" alist nil nil #'equal)
- (alist-get "ID" alist nil nil #'equal)
- (alist-get "PUBDATE" alist nil nil #'equal)
- (alist-get "BODY" alist nil nil #'equal)
- filename))
+(defun project-config-print-element (alist)
+ (format "* %s\n :PROPERTIES:\n :ID: %s\n :PUBDATE: %s\n :END:\n\n %s\n[[file:%s][Read more (%d minutes)]]\n"
+ (alist-get 'TITLE alist)
+ (alist-get 'ID alist)
+ (alist-get 'PUBDATE alist)
+ (alist-get 'BODY alist)
+ (alist-get 'NAME alist)
+ (alist-get 'LENGTH alist)))
+
+(defun project-config-reading-time (file)
+ (with-current-buffer (find-file file)
+ (max 1 (/ (count-words (point-min) (point-max)) 225))))
+
+(defun project-config-print-file (file)
+ (project-config-print-element
+ (append `((NAME . ,(concat "posts/" file))
+ (LENGTH . ,(project-config-reading-time (concat "posts/" file))))
+ (project-config-parse-document (concat "posts/" file)))))
(defun org-dblock-write:blog-posts (params)
(let ((files (cl-remove-if (lambda (item) (string-prefix-p "." item)) (directory-files "posts"))))
- (insert (format "%s" (apply #'concat (mapcar (lambda (file) (project-config-print-element (concat "posts/" file) (project-config-parse-document (concat "posts/" file))))
- files))))))
+ (insert (format "%s" (apply #'concat (mapcar #'project-config-print-file files))))))