summaryrefslogtreecommitdiff
path: root/mkslice-2
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2013-05-10 20:46:04 +0200
committerJonas Smedegaard <dr@jones.dk>2013-05-10 20:46:04 +0200
commit27d338dec0428bc22e2838eb8641c6e0d1681e22 (patch)
tree18eeb76e189ce03838dd9b23194f1c707b1eabbb /mkslice-2
Include mk* scripts
Diffstat (limited to 'mkslice-2')
-rwxr-xr-xmkslice-230
1 files changed, 30 insertions, 0 deletions
diff --git a/mkslice-2 b/mkslice-2
new file mode 100755
index 0000000..507f0c5
--- /dev/null
+++ b/mkslice-2
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# create slices of text
+
+set -e
+
+# resolve options
+eval set -- "$(getopt -s sh -o f -- "$@")"
+while true; do case "$1" in -f) force=1; shift;; --) shift; break;; esac; done
+
+. /lib/lsb/init-functions
+
+# actual slicing: first argument is variant, others are csplice patterns
+doit() {
+ variant=$1; shift
+ csplit -s -f $stem -b "-$variant-%03d.mdwn" $stem.mdwn "$@"
+}
+
+log_action_begin_msg "Create slices"
+for stem in "$@"; do
+ log_action_cont_msg $stem
+# doit preamble \
+# '%Proposal for a REGULATION OF THE EUROPEAN PARLIAMENT AND OF THE COUNCIL%' \
+# '/HAVE ADOPTED THIS REGULATION:/' \
+# '%%' '{*}'
+ doit rec \
+ '/^# \(Title\|Article\)/' '{25}' \
+ '%%' '{*}'
+done
+log_action_end_msg $?