Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Render text into markup through local and zeromq endpoints

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 client-ruby
Octocat-spinner-32 server-py
Octocat-spinner-32 LICENSE.md
Octocat-spinner-32 README.md
README.md

Markup Cloud

Spin up a markup rendering cluster, in the cloud!

This is simply an experiment in breaking the github/markup up into smaller pieces. Formats without a good Ruby library are now accessed through remote ZeroMQ sockets instead of shelling out with new processes.

This is considered alpha code until it's been pushed to a gem. Anything can change!

USAGE

It's very similar to github/markup. First. setup a MarkupCloud and add some renderers:

require 'markup_cloud'
cloud = MarkupCloud.new
cloud.local_markup :md, :redcarpet do |content|
  RedcarpetCompat.new(content).to_html
end

You can get going with a standard set of local Ruby libraries (provided you have the necessary gems installed).

require 'markup_cloud/clients'
cloud = MarkupCloud.new
cloud.setup_local_clients!

cloud.render 'README.md', IO.read('README.md')

You can setup remote renderers that access a ZeroMQ REP server.

require 'markup_cloud'
cloud = MarkupCloud.new
cloud.remote_markup :rst, 'tcp://127.0.0.1:5555'

cloud.render "README.rst", IO.read("README.rst")

Responding to these ZeroMQ messages is simple:

require 'ffi-rzmq'
context = ZMQ::Context.new
rep = context.socket ZMQ::REP
rep.bind 'tcp://127.0.0.1:5555'

while rep.recv_strings(list = [])
  name, content = list
  rep.send_string Something.render(content)
import zmq
context = zmq.Context()
rep = context.socket(zmq.REP)
rep.bind('tcp://127.0.0.1:5555')

while True:
  (name, content) = rep.recv_multipart()
  rep.send_unicode(Something.render(content))

TODO

  • Write solid ZeroMQ Python/Perl servers for ReST, POD, etc.
  • Add bulk ZeroMQ API for remote markups.
  • Figure out if any of this is worth the hassle.
Something went wrong with that request. Please try again.