GithubHelp home page GithubHelp logo

ngirard / org-noweb Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 1.0 84 KB

Easier Literate Programming using Org mode

License: GNU General Public License v3.0

Shell 92.51% Makefile 7.49%
literate-programming org-mode org-babel

org-noweb's Introduction

Humanity is The Big Story, which, in turn, is broken down into very many sub-Stories. We're Story-oriented. Code so far is not. Code is like networks of tunnels where, for all intents and purposes, most of the tunneling has already collapsed, the tunnel paths mostly unknowable.

What makes me so excited about org mode is that it's the first time I've seen literate programming move a tick up into the realm of actually creating a tellable Story.

โ€“ Lawrence Bottorff, Feb 2014

What is it ?

org-noweb is a couple of programs who make literate programming with Org easier.

  • org-tangle takes one or several org files as arguments and produces programs
  • org-weave takes an org file as an argument and produces, on standard output, source code for typeset documentation.

Org already comes "batteries included" with (some) literate programming abilities, thanks to Eric Schulte and Dan Davison ; but these features are meant for interactive use, with a running Emacs instance.

org-noweb brings these features to the command line, allowing code and documentation to be generated non-interactively. If you care about build automation, that's just what you want.

org-tangle and org-weave themselves are written in literate Org documents, and this repository is managed using these GNU Makefile rules:

What is Literate Programming ? Why should I care ?

I'd personnaly recommend these two resources:

How does it work ?

Consider an Org document (source.org) containing source code interleaved with documentation:

Source code

Running org-tangle source.org will extract the source code blocks according to the :tangle directives within the source.org and generate, for instance:

Tangled code

Then, running org-weave -f gfm source.org > source.md will generate documentation in GitHub flavored Markdown.

Generated documentation

How to install it ?

  1. Clone this repository

    git clone https://github.com/ngirard/org-noweb
  2. Install org-tangle org-weave in a directory belonging to your $PATH

    cd org-noweb
    install -m 755 org-tangle org-weave /dest/dir

org-weave currently does nothing else than exporting to GitHub flavored Markdown ; it needs the ox-gfm package that was contributed by Lars Tveito. ox-gfm currently doesn't belong to the org / org-plus-contrib packages yet; so until then you'll need to

  • grab it from Gmane into a directory dir;

  • run org-weave using

    org-weave -f gfm -O '-Q --batch -L dir' file.org > file.md

The Makefile used

This is the Makefile file I'm using on my system to manage this repository.

PROGRAMS=org-tangle org-weave
TARGETS=$(PROGRAMS) README.md org-tangle.md org-weave.md

all: $(TARGETS)

%: %.org
	org-tangle -l emacs-lisp,org $<

%.md: %.org
	org-weave -f gfm -O '-Q --batch -L ~/.emacs.d/local-packages' $< > $@

DESTDIR=/home/soft/bin
install: all
	install -m 755 $(PROGRAMS) $(DESTDIR)

org-noweb's People

Contributors

ngirard avatar vaibhavkarve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vaibhavkarve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.