diff --git a/cutup/cutup.go b/cutup/cutup.go index 24aa8f2..21937e1 100644 --- a/cutup/cutup.go +++ b/cutup/cutup.go @@ -139,7 +139,7 @@ func worker(opts CutupOpts, paths <-chan string, sources chan<- string) { } } for i, r := range text { - if v := shouldBreak(phraseBuff, r); v > 0 { + if v := shouldBreak(phraseBuff, r); v >= 0 { if len(phraseBuff) > 0 { phraseBuff = phraseBuff[0 : len(phraseBuff)-v] } @@ -198,7 +198,7 @@ const maxSuffixLen = 8 // magic number based on longest suffix func shouldBreak(phraseBuff []byte, r rune) int { if ok := phraseMarkers[r]; ok { - return 1 + return 0 } if r != ' ' { diff --git a/cutup/cutup_test.go b/cutup/cutup_test.go index ce2700c..231fc7a 100644 --- a/cutup/cutup_test.go +++ b/cutup/cutup_test.go @@ -82,6 +82,11 @@ func Test_shouldBreak(t *testing.T) { args: args{[]byte("whether good or"), ' '}, expected: 2, }, + { + name: "phrase marker", + args: args{[]byte("whither good"), ';'}, + expected: 1, + }, // TODO test phrasemarkers } diff --git a/templates/index.tmpl b/templates/index.tmpl index a7d5cd3..3ee7569 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -121,18 +121,18 @@ a {

-

-

+
+

HELLO. THIS IS A SOFT WARE FOR MAKING CUT-UP POETRY. THERE ARE A VARIETY OF CORPORA TO CHOOSE FROM: -

+

-
+

THE AUTHOR OF THIS SOFT WARE IS ~VILMIBM. -

+