File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,8 @@ def check_badchars
317
317
next
318
318
end
319
319
320
+ # XXX: note that this is all very fragile and regularly incorrectly parses
321
+ # the author
320
322
#
321
323
# Mark our 'Author' block
322
324
#
@@ -328,10 +330,12 @@ def check_badchars
328
330
329
331
330
332
#
331
- # While in 'Author' block, check for Twitter handles
333
+ # While in 'Author' block, check for malformed authors
332
334
#
333
335
if in_super and in_author
334
- if line =~ /Author/
336
+ if line =~ /Author['"]\s *=>\s *['"](.*)['"],/
337
+ author_name = Regexp . last_match ( 1 )
338
+ elsif line =~ /Author/
335
339
author_name = line . scan ( /\[ [[:space:]]*['"](.+)['"]/ ) . flatten [ -1 ] || ''
336
340
else
337
341
author_name = line . scan ( /['"](.+)['"]/ ) . flatten [ -1 ] || ''
@@ -344,6 +348,14 @@ def check_badchars
344
348
if not author_name . ascii_only?
345
349
error ( "Please avoid unicode or non-printable characters in Author" )
346
350
end
351
+
352
+ unless author_name . empty?
353
+ author_open_brackets = author_name . scan ( '<' ) . size
354
+ author_close_brackets = author_name . scan ( '>' ) . size
355
+ if author_open_brackets != author_close_brackets
356
+ error ( "Author has unbalanced brackets: #{ author_name } " )
357
+ end
358
+ end
347
359
end
348
360
end
349
361
end
You can’t perform that action at this time.
0 commit comments