Skip to content

Commit

Permalink
Merge pull request #2 from kwatsen/master
Browse files Browse the repository at this point in the history
Now supports drafts authored using outline.el (i.e. draft-*.org)
  • Loading branch information
martinthomson committed Oct 15, 2014
2 parents 056169d + 3744cdc commit cb25dc4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# In case your system doesn't have any of these tools:
# https://pypi.python.org/pypi/xml2rfc
# https://github.com/cabo/kramdown-rfc2629
# https://github.com/Juniper/libslax/tree/master/doc/oxtradoc
# https://tools.ietf.org/tools/idnits/

xml2rfc ?= xml2rfc
kramdown-rfc2629 ?= kramdown-rfc2629
oxtradoc ?= oxtradoc.in
idnits ?= idnits

draft := $(basename $(lastword $(sort $(wildcard draft-*.xml)) $(sort $(wildcard draft-*.md))))
draft := $(basename $(lastword $(sort $(wildcard draft-*.xml)) $(sort $(wildcard draft-*.md)) $(sort $(wildcard draft-*.org)) ))

ifeq (,$(draft))
$(warning No file named draft-*.md or draft-*.xml)
$(warning No file named draft-*.md or draft-*.xml or draft-*.org)
$(error Read README.md for setup instructions)
endif

draft_type := $(suffix $(firstword $(wildcard $(draft).md $(draft).xml)))
draft_type := $(suffix $(firstword $(wildcard $(draft).md $(draft).org $(draft).xml) ))

current_ver := $(shell git tag | grep '$(draft)-[0-9][0-9]' | tail -1 | sed -e"s/.*-//")
ifeq "${current_ver}" ""
Expand All @@ -35,6 +42,9 @@ clean:
ifeq (md,$(draft_type))
-rm -f $(draft).xml
endif
ifeq (org,$(draft_type))
-rm -f $(draft).xml
endif

$(next).xml: $(draft).xml
sed -e"s/$(basename $<)-latest/$(basename $@)/" $< > $@
Expand All @@ -43,6 +53,9 @@ $(next).xml: $(draft).xml
%.xml: %.md
$(kramdown-rfc2629) $< > $@

%.xml: %.org
$(oxtradoc) -m outline-to-xml -n "$@" $< > $@

%.txt: %.xml
$(xml2rfc) $< -o $@ --text

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Copy the contents of this respository in:
$ cd unicorn-protocol
$ git pull https://github.com/martinthomson/i-d-template.git master
```
Choose whether you want to use markdown or xml as your input form. If you
already have a draft, then that decision is already made for you.
Choose whether you want to use markdown, outline, or xml as your input form.
If you already have a draft, then that decision is already made for you.

Move the template file into place.
```sh
Expand Down

0 comments on commit cb25dc4

Please sign in to comment.