1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
Org-Quotes
==========
This was a quick weekend (well, two Fridays and a Sunday) project to
do some org-mode file parsing to get some useful work done.
make-post.php
-------------
This was the original Friday hack.
The idea is that we have an org-mode file with a specific structure:
* Root Element
** Reporter One Name
*** First Source-Person Name
Quote body text
*** Second Source-Person Name
Quote body text
** Reporter Two Name
We parse that, offer an HTML form to select one quote from each
reporter, then dump all the selected quotes to a (partial) HTML file
that we can use as a Wordpress post.
word2org.sh
-----------
This happened later that Friday, when I had to deal with some quotes
that had already been typed by an assistant.
The assistant had typed up a bunch of quotes into Microsoft Word.
Blech. Fortunately for me she(? I haven't actually met said person)
did it in a fairly disciplined structure, so that after copy/pasting
into a text-file, I could parse it into an org-mode file with the
above structure. I wrote a quickie bash script to do this.
For reference, the format of this text is:
“Quote body”
- Quote Source
“Quote body”
- Quote Source
Reporter: Reporter Name
upload-org.php/upload-ms-word.php
---------------------------------
The next week I discovered that the proxy I had to work behind had
been reconfigured, and I couldn't figure out tunnel SSH through it.
So I couldn't SSH in, paste the MS Word data into an Emacs buffer,
then run it through `word2org.sh`, then `mv` it to the location looked
for by [what is now named] `make-post.php`. So, when I got home I
make `upload-msword.php` and `upload-org.php` so that I could paste in
either org-mode or MS Word formatted quotes from a browser behind the
proxy, and still get work done /at work/.
So yeah, `upload-msword.php` uses the system() PHP call to run
word2org. Go ahead, shoot me, but this was never meant to be a
polished project.
Other Notes
-----------
Yeah, I did all the bad-practice spitting-out-HTML-from-logic-code
and using globals stuff. This was a quickie hack. It's basically
just one PHP script (at least on the PHP side). Don't worry, my other
projects use MVC and all that.
|