summaryrefslogtreecommitdiff
path: root/pandoc-todo
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-12-31 21:27:23 +0100
committerJonas Smedegaard <dr@jones.dk>2014-12-31 21:27:23 +0100
commitcfec7bb4177089aeb1b810ee1e6c4bc36091ae39 (patch)
tree42610430e63a7bbbcd4c56255daed4167ff35ae8 /pandoc-todo
parentf0ef82f0624c580b4dd652ac2ef89915756bdc0a (diff)
Rephrase hyphen and quote notes. Refine hyphen/break/range detection. Add list detection.
Diffstat (limited to 'pandoc-todo')
-rwxr-xr-xpandoc-todo20
1 files changed, 16 insertions, 4 deletions
diff --git a/pandoc-todo b/pandoc-todo
index bc0590f..8317048 100755
--- a/pandoc-todo
+++ b/pandoc-todo
@@ -21,6 +21,8 @@ my $doublequote_chars = qr/[\x{00AB}\x{00BB}\x{201C}-\x{201F}\x{300C}-\x{300F}\x
my $singlequote_chars = qr/[\x{0060}\x{2018}\x{2019}\x{201A}\x{201B}\x{2039}\x{203A}\x{FF07}]/;
my $odd_singlequote_chars = qr/[\x{2019}]/;
+my $inline_count;
+
pandoc_filter(
\&todo,
);
@@ -44,16 +46,26 @@ sub mark_inside {
sub todo {
my $self = shift;
+ $inline_count = 0 if ( $self->is_block );
return unless ( $self->name eq 'Str' );
given ($self->content) {
+ $inline_count++;
when (/^(-)$/) {
- return mark_inside( '', $1, '', 'double dash?' ) };
+ return mark_inside( '', $1, '', 'maybe break' ) };
+ when (/^(---+)(.+?)$/) {
+ return mark_inside( '', $1, $2, 'maybe break' ) };
+ when (/^(.+?)(--+)(.+?)$/) {
+ return mark_inside( $1, $2, $3, 'maybe range' ) };
when ( /^(.*?)($hyphen_chars(?:.*$hyphen_chars)?)(.*?)$/ ) {
- return mark_inside( $1, $2, $3, 'bad dash/hyphen' ) };
+ return mark_inside( $1, $2, $3, 'fancy hyphen' ) };
when ( /^(.*?)($doublequote_chars(?:.*$doublequote_chars)?)(.*?)$/ ) {
- return mark_inside( $1, $2, $3, 'bad quote' ) };
+ return mark_inside( $1, $2, $3, 'fancy quote' ) };
when ( /^(.*?)($singlequote_chars(?:.*$singlequote_chars)?)(.*?)$/ ) {
- return mark_inside( $1, $2, $3, 'Bad quote/apostrophe' ) };
+ return mark_inside( $1, $2, $3, 'fancy quote' ) };
+ when ( $inline_count == 1 and /^(\(?\d+\)|\d+\.)$/ ) {
+ return mark_inside( '', $1, '', 'maybe list' ) };
+ when ( $inline_count == 1 and /^(\(?[ivxc]+\)|\d+\.[\d.]+)$/ ) {
+ return mark_inside( '', $1, '', 'maybe fancy list' ) };
default { return };
}
};