feat(blog): Configure org-mode's HTML export to match blog theme
This gets elblog close, but not quite there, to my previous blog theme. Comparison screenshot: http://i.imgur.com/UK49Fhi.png
This commit is contained in:
		
							parent
							
								
									b4dad1526d
								
							
						
					
					
						commit
						040c348780
					
				
					 3 changed files with 59 additions and 1 deletions
				
			
		
							
								
								
									
										37
									
								
								blog.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								blog.css
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,37 @@
 | 
				
			||||||
 | 
					<style type="text/css">
 | 
				
			||||||
 | 
					body {
 | 
				
			||||||
 | 
					    margin: 40px auto;
 | 
				
			||||||
 | 
					    max-width: 650px;
 | 
				
			||||||
 | 
					    line-height: 1.6;
 | 
				
			||||||
 | 
					    font-size: 18px;
 | 
				
			||||||
 | 
					    color: #383838;
 | 
				
			||||||
 | 
					    padding: 0 10px
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					h1, h2, h3 {
 | 
				
			||||||
 | 
					    line-height: 1.2
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.footer {
 | 
				
			||||||
 | 
					    text-align: right;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.lod {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.unstyled-link {
 | 
				
			||||||
 | 
					    color: inherit;
 | 
				
			||||||
 | 
					    text-decoration: none;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.uncoloured-link {
 | 
				
			||||||
 | 
					    color: inherit;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.date {
 | 
				
			||||||
 | 
					    text-align: right;
 | 
				
			||||||
 | 
					    font-style: italic;
 | 
				
			||||||
 | 
					    float: right;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.inline {
 | 
				
			||||||
 | 
					    display: inline;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.navigation {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
							
								
								
									
										14
									
								
								blog.el
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								blog.el
									
										
									
									
									
								
							| 
						 | 
					@ -20,6 +20,17 @@
 | 
				
			||||||
  :group 'elblog
 | 
					  :group 'elblog
 | 
				
			||||||
  :type 'string)
 | 
					  :type 'string)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; org-mode settings need to be configured a certain way for elblog's HTML
 | 
				
			||||||
 | 
					;; templating to work correctly.
 | 
				
			||||||
 | 
					(defun configure-org-html-export ()
 | 
				
			||||||
 | 
					  (setq org-html-postamble t)
 | 
				
			||||||
 | 
					  (setq org-html-doctype "html5")
 | 
				
			||||||
 | 
					  (setq org-html-head-include-scripts nil)
 | 
				
			||||||
 | 
					  (setq org-html-style-default (f-read-text "blog.css"))
 | 
				
			||||||
 | 
					  (setq org-html-preamble-format
 | 
				
			||||||
 | 
					        '(("en" "<header><h1><a class=\"unstyled-link\" href=\"/\">Tazjin's blog</a></h1><hr></header>")))
 | 
				
			||||||
 | 
					  (setq org-html-postamble-format `(("en" ,(f-read-text "postamble.html")))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Article fetching & rendering functions
 | 
					;; Article fetching & rendering functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun render-org-buffer (buffer &optional force)
 | 
					(defun render-org-buffer (buffer &optional force)
 | 
				
			||||||
| 
						 | 
					@ -46,7 +57,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun render-article (article)
 | 
					(defun render-article (article)
 | 
				
			||||||
  "Renders an article, if it exists."
 | 
					  "Renders an article, if it exists."
 | 
				
			||||||
  (let ((output-buffer (render-org-buffer (concat article ".org"))))
 | 
					  (let ((output-buffer (render-org-buffer (concat article ".org") t)))
 | 
				
			||||||
    (if output-buffer `(200 . ,(get-buffer-string output-buffer))
 | 
					    (if output-buffer `(200 . ,(get-buffer-string output-buffer))
 | 
				
			||||||
      article-not-found)))
 | 
					      article-not-found)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +77,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun start-elblog ()
 | 
					(defun start-elblog ()
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
 | 
					  (configure-org-html-export)
 | 
				
			||||||
  (elnode-start 'elblog-handler
 | 
					  (elnode-start 'elblog-handler
 | 
				
			||||||
              :port elblog-port
 | 
					              :port elblog-port
 | 
				
			||||||
              :host elblog-host))
 | 
					              :host elblog-host))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										9
									
								
								postamble.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								postamble.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,9 @@
 | 
				
			||||||
 | 
					<hr>
 | 
				
			||||||
 | 
					<footer><p class="footer">Served with <a class="uncoloured-link" href="https://github.com/tazjin/elblog">Emacs</a>.</p>
 | 
				
			||||||
 | 
					  <p class="footer">
 | 
				
			||||||
 | 
					    <a class="uncoloured-link" href="https://twitter.com/tazjin">Twitter</a>
 | 
				
			||||||
 | 
					    |
 | 
				
			||||||
 | 
					    <a class="uncoloured-link" href="mailto:blog@tazj.in">Mail</a>
 | 
				
			||||||
 | 
					  </p>
 | 
				
			||||||
 | 
					  <p class="lod">ಠ_ಠ</p>
 | 
				
			||||||
 | 
					</footer>
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue