From 49217626ab947b7bc8cf2f5b9d8bc821cc565358 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Tue, 19 Oct 2021 16:21:13 +0300 Subject: sentences: support vimwiki headers --- .local/bin/sentences | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to '.local/bin') diff --git a/.local/bin/sentences b/.local/bin/sentences index 75314f5..cc21d3b 100755 --- a/.local/bin/sentences +++ b/.local/bin/sentences @@ -4,15 +4,17 @@ use strict; my $pont = qr{[.!?]+}; ## punctuation my $abrev = qr{\b(?:Pr|Dr|Mr|[A-Z])\.}; ## abbreviations +my $header = qr{(=+ .*? =+)}; $/ = ""; while(<>) { - chomp; ## for each paragraph, + chomp; ## for each paragraph, - s/\h*\n\h*/ /g; ## remove \n - s/($pont)\h+(\S)/$1\n$2/g; ## punctuation+space - s/($abrev)\n/$1 /g; ## undo \n after abbreviations + s/\h*\n\h*/ /g; ## remove \n + s/($pont)\h+(\S)/$1\n$2/g; ## punctuation+space + s/($abrev)\n/$1 /g; ## undo \n after abbreviations + s/$header\h+(\S)/$1\n$2/g; ## vimwiki headers print "$_\n"; } -- cgit v1.2.3-70-g09d2