Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wallyqs/org-hexagon

Minimal Sinatra app that can be used to publish texts written in org-mode using org-ruby for rendering.
https://github.com/wallyqs/org-hexagon

Last synced: 8 days ago
JSON representation

Minimal Sinatra app that can be used to publish texts written in org-mode using org-ruby for rendering.

Awesome Lists containing this project

README

        

* OrgHexagon

#+BEGIN_QUOTE
The universe (which others call the Library) is composed of an
indefinite and perhaps infinite number of hexagonal galleries, with
vast air shafts between, surrounded by very low railings. (...)
The idealists argue that the hexagonal rooms are a necessary form of
absolute space or, at least, of our intuition of space.

- Jorge Luis Borges, The Library of Babel
#+END_QUOTE

#+BEGIN_CENTER

[[http://orgmode.org/worg/images/babel/library-of-babel.png]]

The Library of Babel, by Pierre Clayette
#+END_CENTER

** Introduction

OrgHexagon is a simple Sinatra application that features an API
which can be called through Emacs to publish texts written in org-mode.

This is still pretty much a work in progress,
so many things will be broken... But if you find something like this useful
any feedback will be very welcome!

** Motivation/Objectives

- Have an application to test OrgRuby parsing output quickly

- Have a place to archive and publish whatever I write in org-mode.
These could be drafts, bookmarks, ideas etc...

- Make it relatively simple to deploy (e.g. not having to setup Emacs on the server)

- Minimal layout design

** How to setup

Clone this repository:

#+BEGIN_SRC sh
git clone git://github.com/wallyqs/org-hexagon
bundle install
bundle package

bundle exec rackup
#+END_SRC

...then run MongoDB on the default port to save your texts.

Some notes about the setup:

- It uses the =org-ruby= gem to render the org-mode texts to HTML. This saves
having to install a full Emacs instance on your server.

- By default it is going to use =Coderay= to highlight the source blocks.
In case you want to use =pygments.rb= you need to include this gem
in the Gemfile, as well as the stylesheets you might need in public.

- It includes some built-in support to run it on Cloudfoundry.
Just =vmc create-service mongodb= and =vmc bind-service= your MongoDB to save the texts.

A demo can be seen here: [[http://org-hexagon-demo.cloudfoundry.com/]]

** Setting up the client

- Load the =org-hexagon.el= client included in this repo.

#+BEGIN_SRC emacs-lisp
(add-to-list 'load-path "~/org-hexagon/lisp")
(require 'org-hexagon)

;; set the url to your instance of the app
(setq org-hexagon-api-url "http://127.0.0.1:9393/api/")

;; ...or I have an instance set up in Cloudfoundry which can be used by anyone to try it
(setq org-hexagon-api-url "http://org-hexagon-demo.cloudfoundry.com/api/")
#+END_SRC

** How to use

Open a buffer with some org-mode text:

#+BEGIN_SRC org
* Hello world

Writing using =org-mode= markup to be published.

#+END_SRC

Select the region, and then use =M-x org-hexagon-sync-text-region= in the buffer to save this org-mode text.

You will be able to view your post online at =http://your-url.com/texts=.

Or you can also fetch create a buffer with all of your posted texts
by calling =M-x org-hexagon-texts=.

** Using :PROPERTIES: drawer to add metadata to your texts

You can use the =PROPERTIES= drawer from org-mode to configure
the way you want to publish the text.

For example, if you post a text with the following properties:

#+BEGIN_SRC org
* Hello world
  :PROPERTIES:
  :id: 1234567
  :shelf: drafts
  :END:
#+END_SRC

It will try to update the text with that id, and tag the text with the property =shelf: drafts=.
Texts with this property can be obtained using =M-x org-hexagon-shelf= and then typing 'drafts'.

* LICENSE

#+BEGIN_QUOTE
Copyright (C) 2012 Quevedo, Waldemar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#+END_QUOTE