Skip to content

Commit

Permalink
Blogging in ord draft
Browse files Browse the repository at this point in the history
  • Loading branch information
peterewills committed Sep 23, 2019
1 parent e5974b2 commit 374d9d5
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 81 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_site
.sass-cache
.jekyll-metadata
ltximg
3 changes: 1 addition & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ TODO items for pwills.com.
- Add social media links in footer

## Content
- Work on Portfolio
- Post about latex in emacs


## Other
- reorganize /assets/images/
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exclude:
- TODO.md
- README.md
- "*.org"
- "*ltximg*"

plugins:
- jekyll-feed
Expand Down
36 changes: 0 additions & 36 deletions _drafts/2019-09-07-org.md

This file was deleted.

42 changes: 0 additions & 42 deletions _drafts/2019-09-07-org.org

This file was deleted.

128 changes: 128 additions & 0 deletions _drafts/2019-09-22-blogging-in-org.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
title: "Blogging in Org"
excerpt: "My workflow for blogging in org mode."
date: 2019-09-22
categories:
- post
tags:
comments: true
---

{% if jekyll.environment == "development" %}
IN DEV ENV
{% endif %}


{% if jekyll.environment == "production" %}
IN PROD ENV
{% endif %}


Basic idea is to rework [ox-jekyll](file:///Users/peterwills/.emacs.d/lisp/ox-jekyll-md/ox-jekyll-md.el) to fit my purposes. It's derived from ox-md which is
derived from ox-html.

[ox-jekyll source code](https://github.com/gonsie/ox-jekyll-md)

[ox-md source code](https://github.com/emacsmirror/org/blob/master/lisp/ox-md.el)

[ox-html source code](https://github.com/emacsmirror/org/blob/master/lisp/ox-html.el)


# TODO <code>[5/7]</code>

Schedules get ignored, which is correct. Can schedule or deadline parts of the post if
you want to.

- [X] Fix underlining things
- [X] Fix links
- [ ] Fix equation delimiter rendering
- [X] Ignore `ltximg` directories
- [X] Get preamble export working
- [X] Pass subtitle in as excerpt
- [X] Set category as "post", don't set layout
- [X] Get footnotes exporting properly
- [ ] Insert disqus block at bottom of the page (or better yet, get disqus working as it should via jekyll)

Might put off the footnotes one, since it's mostly asthetic. Equation rendering is the
top priority at the moment.


## Fixing Equations

Look through [the code for ox-html](https:github.com/emacsmirror/org/blob/master/lisp/ox-html.el) and search for "latex" to find the parts where they
render latex. It's pretty complicated, which makes sense. We just need to change the
delimiters it uses.


## Fixing links

I need to go digging through the section where it generates links. I want to set up a
thing that specifically handles http links in there.

UPDATE: Actually, you can just write your links as `https://` instead of `https:`, and then
it works fine. I will start doing this in general, I think.


# Blogging in Org!

use `ox-jekyll`, which can be found [here](https://github.com/gonsie/ox-jekyll-md).

but I need to redefine the way it exports equations

So I change the `translate-alist` to include something additional for equations. But I
don't know how to figure out the right "key" for a latex chunk, and how to get its
contents. I need to better understand what the `translate-alist` is actually doing.

[See this code.](file:///Users/peterwills/.emacs.d/elpa/ox-gfm-1.0/ox-gfm.el)

second level shit

how about <span class="underline">underlined stuff</span>

how about *italicized stuff*

how about **bolded stuff**

How about footnotes?[^fn1] These are a little weird, because they don't get exported in
the correct markdown way - it's kind of an HTML hack, which doesn't inherit all the nice
formatting from Jekyll.


## Here's some content

third level shit

[here's a link](https://google.com)

Here's an equation:

\[ f(x) = \oint g(p) dp \]

Here's some inline math: \(x = y^2\).

The problem is that it renders `\[`, when markdown needs it to render `\\[`. The former just
renders to an open square bracket in the HTML.


# Does code work?

```python
import numpy as np
np.min(x for x in range(10))
```


# Here's a table

| Name | Age | Phone |
|---|---|---|
| Peter Wills | 31 | 585 |
| Kathleen Finlinson | 29 | 435 |

Okay looks pretty good there.


<!----- Footnotes ----->

[^fn1]: Schwink!

115 changes: 115 additions & 0 deletions _drafts/2019-09-22-blogging-in-org.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#+STARTUP: showall indent
#+OPTIONS: toc:nil
#+OPTIONS: tex:t

#+TITLE: Blogging in Org
#+SUBTITLE: My workflow for blogging in org mode.
#+DATE: 2019-09-22

Basic idea is to rework [[file:~/.emacs.d/lisp/ox-jekyll-md/ox-jekyll-md.el::;;;%20ox-jekyll-md.el%20---%20Export%20Jekyll%20on%20Markdown%20articles%20using%20org-mode.%20-*-%20lexical-binding:%20t;%20-*-][ox-jekyll]] to fit my purposes. It's derived from ox-md which is
derived from ox-html.

[[https://github.com/gonsie/ox-jekyll-md][ox-jekyll source code]]

[[https://github.com/emacsmirror/org/blob/master/lisp/ox-md.el][ox-md source code]]

[[https://github.com/emacsmirror/org/blob/master/lisp/ox-html.el][ox-html source code]]

* TODO [5/7]
SCHEDULED: <2019-09-21 Sat>

Schedules get ignored, which is correct. Can schedule or deadline parts of the post if
you want to.

- [X] Fix underlining things
- [X] Fix links
- [ ] Fix equation delimiter rendering
- [X] Ignore =ltximg= directories
- [X] Get preamble export working
- [X] Pass subtitle in as excerpt
- [X] Set category as "post", don't set layout
- [X] Get footnotes exporting properly
- [ ] Insert disqus block at bottom of the page (or better yet, get disqus working as it should via jekyll)

Might put off the footnotes one, since it's mostly asthetic. Equation rendering is the
top priority at the moment.

** Fixing Equations

Look through [[https:github.com/emacsmirror/org/blob/master/lisp/ox-html.el][the code for ox-html]] and search for "latex" to find the parts where they
render latex. It's pretty complicated, which makes sense. We just need to change the
delimiters it uses.

** Fixing links

I need to go digging through the section where it generates links. I want to set up a
thing that specifically handles http links in there.

UPDATE: Actually, you can just write your links as =https://= instead of =https:=, and then
it works fine. I will start doing this in general, I think.

** Comments in Disqus

Right now we put a phat HTML blob at the bottom of the page. This is, obviously, less
than ideal.

* Blogging in Org!

use =ox-jekyll=, which can be found [[https://github.com/gonsie/ox-jekyll-md][here]].

but I need to redefine the way it exports equations

So I change the =translate-alist= to include something additional for equations. But I
don't know how to figure out the right "key" for a latex chunk, and how to get its
contents. I need to better understand what the =translate-alist= is actually doing.

[[file:~/.emacs.d/elpa/ox-gfm-1.0/ox-gfm.el:::translate-alist%20'((inner-template%20.%20org-gfm-inner-template)%20(paragraph%20.%20org-gfm-paragraph)%20(strike-through%20.%20org-gfm-strike-through)%20(src-block%20.%20org-gfm-src-block)%20(table-cell%20.%20org-gfm-table-cell)%20(table-row%20.%20org-gfm-table-row)%20(table%20.%20org-gfm-table)))][See this code.]]

second level shit

how about _underlined stuff_

how about /italicized stuff/

how about *bolded stuff*

How about footnotes?[fn:1]

** Here's some content

third level shit

[[https://google.com][here's a link]]

Here's an equation:

$$ f(x) = \oint g(p) dp $$

Here's some inline math: $x = y^2$.

The problem is that it renders =\[=, when markdown needs it to render =\\[=. The former just
renders to an open square bracket in the HTML.


* Does code work?


#+BEGIN_SRC python
import numpy as np
np.min(x for x in range(10))
#+END_SRC

* Here's a table

| Name | Age | Phone |
|--------------------+-----+-------|
| Peter Wills | 31 | 585 |
| Kathleen Finlinson | 29 | 435 |

Okay looks pretty good there.

* Footnotes

[fn:1] Schwink!


2 changes: 1 addition & 1 deletion _includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

{% if page.mathjax %}
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
{% endif %}

Expand Down

0 comments on commit 374d9d5

Please sign in to comment.