This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #12 from roller/master

Fix for issue #7, misaligned docs/code blocks on GNU systems
  • Loading branch information...
2 parents f8c244c + b389f6f commit a1ee000613946335f54a8f236ee9fe6f7f22bcb8 @rtomayko committed Nov 19, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 shocco.sh
View
@@ -73,6 +73,9 @@ file="$1"
MARKDOWN='@@MARKDOWN@@'
PYGMENTIZE='@@PYGMENTIZE@@'
+# On GNU systems, csplit doesn't elide empty files by default:
+CSPLITARGS=$( (csplit --version 2>/dev/null | grep -i gnu >/dev/null) && echo "--elide-empty-files" || true )
+
# We're going to need a `markdown` command to run comments through. This can
# be [Gruber's `Markdown.pl`][md] (included in the shocco distribution) or
# Discount's super fast `markdown(1)` in C. Try to figure out if either are
@@ -275,6 +278,7 @@ $MARKDOWN |
# the source code.
(
csplit -sk \
+ $CSPLITARGS \
-f docs \
-n 4 \
- '/<h5>DIVIDER<\/h5>/' '{9999}' \
@@ -319,6 +323,7 @@ sed '
(
DIVIDER='/<span class="c"># DIVIDER</span>/'
csplit -sk \
+ $CSPLITARGS \
-f code \
-n 4 - \
"$DIVIDER" '{9999}' \

0 comments on commit a1ee000

Please sign in to comment.