List for cgit developers and users
 help / color / mirror / Atom feed
From: r at rkm.id.au (Ruben Maher)
Subject: [PATCH] Add about-formatting filter for org-mode.
Date: Tue, 14 Jul 2015 11:20:08 +0930	[thread overview]
Message-ID: <878uajld7z.fsf@ayanami.rkm.id.au> (raw)

Hi list, I have two patches for your consideration.

The first just adds an about-filter for .org files.

It depends on Emacs and Org-mode[0].

I may have formatted this mail correctly.  Please let me know otherwise.

Kind regards,

Ruben

[0] http://orgmode.org/
---
 filters/about-formatting.sh                   |  1 +
 filters/html-converters/org2html              |  2 ++
 filters/html-converters/resources/org2html.el | 43 +++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 100755 filters/html-converters/org2html
 create mode 100755 filters/html-converters/resources/org2html.el

diff --git a/filters/about-formatting.sh b/filters/about-formatting.sh
index d024204..5801d8e 100755
--- a/filters/about-formatting.sh
+++ b/filters/about-formatting.sh
@@ -21,6 +21,7 @@ cd "$(dirname $0)/html-converters/"
 case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in
  *.markdown|*.mdown|*.md|*.mkd) exec ./md2html; ;;
  *.rst) exec ./rst2html; ;;
+	*.org) exec ./org2html; ;;
  *.[1-9]) exec ./man2html; ;;
  *.htm|*.html) exec cat; ;;
  *.txt|*) exec ./txt2html; ;;
diff --git a/filters/html-converters/org2html b/filters/html-converters/org2html
new file mode 100755
index 0000000..62fd136
--- /dev/null
+++ b/filters/html-converters/org2html
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec "$(dirname "$0")/resources/org2html.el" 2>/dev/null
diff --git a/filters/html-converters/resources/org2html.el b/filters/html-converters/resources/org2html.el
new file mode 100755
index 0000000..8cac096
--- /dev/null
+++ b/filters/html-converters/resources/org2html.el
@@ -0,0 +1,43 @@
+#!/usr/bin/emacs --script
+;;; org2html.el ---
+
+;; Copyright (C) 2015  Ruben Maher <r at rkm.id.au>
+
+;; Author: Ruben Maher <r at rkm.id.au>
+;; Keywords: tools
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License
+;; as published by the Free Software Foundation; either version 3
+;; of the License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Read an org file from stdin, convert it to html, and dump it on stdout.
+;; You need a recent version of org-mode's htmlize if you want source code
+;; highlighting in font blocks.  Requires Emacs and Org-mode.
+;; Example usage: ./org2html.el < README.org 2>/dev/null
+
+;;; Code:
+
+(require 'org)
+
+(condition-case nil
+    (let (line)
+      (with-output-to-temp-buffer "*org2html*"
+        (set-buffer-file-coding-system 'utf-8)
+        (while (setq line (read-from-minibuffer ""))
+          (princ (concat line "\n")))))
+  (error nil))
+
+(when (get-buffer "*org2html*")
+  (set-buffer "*org2html*")
+  (princ (org-export-as 'html nil t t)))
--
2.4.5


             reply	other threads:[~2015-07-14  1:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  1:50 r [this message]
2015-07-14  1:58 ` r
2015-07-14 16:20 ` jamie.couture

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878uajld7z.fsf@ayanami.rkm.id.au \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).