bugfixes
This commit is contained in:
parent
4b497a8185
commit
9031c268c9
@ -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 != ' ' {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -121,18 +121,18 @@ a {
|
||||
<a is="about-toggler"></a>
|
||||
<a is="theme-toggler"></a>
|
||||
</p>
|
||||
<p id="about">
|
||||
<div>
|
||||
<div id="about">
|
||||
<p>
|
||||
HELLO. THIS IS A <a href="https://github.com/vilmibm/trunkless">SOFT WARE</a> FOR MAKING <a href="https://en.wikipedia.org/wiki/Cut-up_technique">CUT-UP POETRY</a>. THERE ARE A VARIETY OF CORPORA TO CHOOSE FROM:
|
||||
</div>
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>gutenberg</code>, THE ENTIRE ENGLISH CONTENT OF <a href="https://gutenberg.org">PROJECT GUTENBERG</a>. IT IS UNABRIDGED: BE WARNED.</li>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
<p>
|
||||
THE AUTHOR OF THIS SOFT WARE IS <a href="https://tilde.town/~vilmibm">~VILMIBM</a>.
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<button is="poem-resetter"></button>
|
||||
<form is="corpus-picker" style="display:inline">
|
||||
|
Loading…
x
Reference in New Issue
Block a user