summaryrefslogtreecommitdiff
path: root/mkslice-default
blob: ee4d9803c37e3466336485a5ba74e6fb242dfbba (plain)
  1. #!/bin/sh
  2. # create slices of text
  3. set -e
  4. # resolve options
  5. eval set -- "$(getopt -s sh -o f -- "$@")"
  6. while true; do case "$1" in -f) force=1; shift;; --) shift; break;; esac; done
  7. . /lib/lsb/init-functions
  8. # actual slicing: first argument is variant, others are csplice patterns
  9. doit() {
  10. variant=$1; shift
  11. csplit -s -f $stem -b "-$variant-%03d.mdwn" $stem.mdwn "$@"
  12. }
  13. log_action_begin_msg "Create slices"
  14. for stem in "$@"; do
  15. log_action_cont_msg $stem
  16. doit rec \
  17. '/^# \(Title\|Article\)/' '{*}'
  18. done
  19. log_action_end_msg $?