summaryrefslogtreecommitdiff
path: root/pandoc-todo
diff options
context:
space:
mode:
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 };
}
};