From 07e1234c3bbedea38793891215006c0e03d6582c Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Sun, 15 Nov 2015 08:17:09 -0800
Subject: [PATCH] Added 'make changes' target.

This copies to osx clipboard a github-markdown version of the
changes from the latest release in the changelog.
---
 Makefile           | 5 ++++-
 extract-changes.hs | 9 +++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 extract-changes.hs

diff --git a/Makefile b/Makefile
index e4c792b2a..aa11fd363 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,9 @@ test:
 bench:
 	cabal bench
 
+changes:
+	pandoc --filter extract-changes.hs changelog -t markdown_github | pbcopy
+
 install: full
 	cabal copy
 	cabal register
@@ -58,4 +61,4 @@ download_stats:
 clean:
 	cabal clean
 
-.PHONY: deps quick full install clean test bench osxpkg dist prof download_stats
+.PHONY: deps quick full install clean test bench changes osxpkg dist prof download_stats
diff --git a/extract-changes.hs b/extract-changes.hs
new file mode 100644
index 000000000..8c8160c2c
--- /dev/null
+++ b/extract-changes.hs
@@ -0,0 +1,9 @@
+-- Extract changes from latest version in changelog.
+import Text.Pandoc.JSON
+
+main = toJSONFilter extractFirst
+
+extractFirst :: Pandoc -> Pandoc
+extractFirst (Pandoc meta (Para{} : BulletList bs : _)) =
+  Pandoc meta [BulletList bs]
+extractFirst x = x