Bugzilla – Attachment 70394 Details for
Bug 11046
Better handling of uncertain years for publicationyear/copyrightdate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11046: Improve the readability of the regex using named capture
Bug-11046-Improve-the-readability-of-the-regex-usi.patch (text/plain), 1.38 KB, created by
Jonathan Druart
on 2018-01-09 20:14:17 UTC
(
hide
)
Description:
Bug 11046: Improve the readability of the regex using named capture
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-01-09 20:14:17 UTC
Size:
1.38 KB
patch
obsolete
>From 0f874c44dcd56b1ee0f9cc5150d7d41f3170dae9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Jan 2018 17:13:41 -0300 >Subject: [PATCH] Bug 11046: Improve the readability of the regex using named > capture > >The tests tell me I am good >--- > C4/Biblio.pm | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index b910f40d1f..b9c46554b1 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2700,12 +2700,15 @@ sub _adjust_pubyear { > $retval = $1; > } elsif( $retval =~ m/(\d\d\d\d)/ && $1 > 0 ) { > $retval = $1; >- } elsif( $retval =~ m/(\d)[.Xx?]{3}|(\d\d)[.Xx?]{2}|(\d{3})[.Xx?]/ ) { >- my $digits = $1 || $2 || $3; >- $retval = $digits * ( 10 ** ( 4 - length($digits) )); >- } elsif( $retval =~ m/(\d)[-]{3}\?|(\d\d)[-]{2}\?|(\d{3})[-]\?/ ) { >- # the form 198-? occurred in Dutch ISBD rules >- my $digits = $1 || $2 || $3; >+ } elsif( $retval =~ m/ >+ (?<year>\d)[-]?[.Xx?]{3} >+ |(?<year>\d{2})[.Xx?]{2} >+ |(?<year>\d{3})[.Xx?] >+ |(?<year>\d)[-]{3}\? >+ |(?<year>\d\d)[-]{2}\? >+ |(?<year>\d{3})[-]\? >+ /xms ) { # the form 198-? occurred in Dutch ISBD rules >+ my $digits = $+{year}; > $retval = $digits * ( 10 ** ( 4 - length($digits) )); > } > return $retval; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11046
:
66549
|
66552
|
68349
|
68350
|
70235
|
70236
| 70394