| |
Line 1: | Line 1: |
| | --[[ |
| | History of changes since last sync: 2025-04-12 |
| |
|
| | ]] |
| |
|
| require ('strict'); | | require ('strict'); |
|
| |
|
Line 2,721: | Line 2,726: |
| utilities.set_message ('maint_publisher_location'); -- set a maint message | | utilities.set_message ('maint_publisher_location'); -- set a maint message |
| return; -- and done | | return; -- and done |
| | end |
| | end |
| | end |
| |
|
| |
|
| | --[[--------------------------< I S _ P A G E _ A R T _ N U M >------------------------------------------------ |
| |
|
| | compare the trailing (rightmost) characters of the |doi= value against the whole value assigned to |page(s)=. |
| |
|
| | return boolean true when: |
| | |page(s)= has exactly 8 digits and a dot between the fourth and fifth digits matches the trailing 9 characters |
| | of the |doi= value: |page=12345678 → |page=1234.5678 matches |doi=10.xxxx/yyyy1234.5678 |
| | |page(s)= is 5 or more characters and matches |doi= values's trailing characters |
| | |page(s)= begins with a lowercase 'e' and |page(s)= without the 'e' matches |doi= values's trailing |
| | characters: |page=e12345 → |page=12345 matches |doi=10.xxxx/yyyy12345 |
| | |page(s)= begins with a uppercase 'CD' followed by (typically) six digits matches |doi= values that ends with |
| | 'CDxxxxxx.pubx' (where 'x' is any single digit) |
| |
|
| | return nil when |page(s)= values: |
| | are ranges separated by underscore, hyphen, emdash, endash, figure dash, or minus character |
| | are comma- or semicolon-separated lists of pages |
| | have external urls (has text 'http') |
| | are digit-only values less than 10000 |
| | do not match |doi= values's trailing characters |
| |
|
| | ]] |
| |
|
| | local function is_page_art_num (page, doi) |
| | if not (utilities.is_set (page) and utilities.is_set (doi)) then -- both required |
| | return; -- abandon; nothing to do |
| | end |
| |
|
| | if page:match ('[,;_−–—‒%-]') then -- when |page(s)= might be a page range or a separated list of pages |
| | return; -- abandon |
| | end |
| |
|
| | page = page:lower(); -- because doi names are case insensitive |
| | doi = doi:lower(); -- force these to lowercase for testing |
| | |
| | if page:match ('http') then -- when |page(s)= appears to hold a url |
| | return; -- abandon |
| | end |
| |
|
| | if tonumber (page) then -- is |page(s)= digits only |
| | if 10000 > tonumber (page) then -- when |page(s)= less than 10000 |
| | return; -- abandon |
| | end |
| | |
| | if doi:match (page .. '$') then -- digits only page number match the last digits in |doi=? |
| | return true; |
| | end |
| |
|
| | if 8 == page:len() then -- special case when |page(s)= is exactly 8 digits |
| | local dot_page = page:gsub ('(%d%d%d%d)(%d%d%d%d)', '%1.%2'); -- make a |page=xxxx.yyyy version commonly used in |doi= |
| | if doi:match (dot_page .. '$') then -- 8-digit dotted page number match the last characters in |doi=? |
| | return true; |
| | end |
| | end |
| | |
| | else -- here when |page(s)= is alpha-numeric |
| | if 4 < page:len() then -- when |page(s)= is five or more characters |
| | if doi:match (page .. '$') then -- alpha-numeric page match the last characters in |doi=? |
| | return true; |
| | end |
| | |
| | local epage = page:match ('^e([%w]+)$'); -- if first character of |page= is 'e', remove it |
| | if epage and doi:match (epage .. '$') then -- page number match the last characters in |doi=? |
| | return true; |
| | end |
| | |
| | local cdpage = page:match ('^cd%d+$'); -- if first characters of |page= are 'CD' and last characters are digits (typically 6 digits) |
| | if cdpage and doi:match (cdpage .. '%.pub%d$') then -- page number matches doi 'CDxxxxxx.pubx' where 'x' is a digit |
| | return true; |
| | end |
| end | | end |
| end | | end |
Line 3,460: | Line 3,539: |
| Title = ''; -- set title to empty string | | Title = ''; -- set title to empty string |
| utilities.set_message ('maint_untitled'); -- add maint cat | | utilities.set_message ('maint_untitled'); -- add maint cat |
| | end |
| |
|
| | if 'journal' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then |
| | if is_page_art_num (Page or Pages, ID_list_coins['DOI']) then -- does |page(s)= look like it holds an article number |
| | utilities.set_message ('maint_page_art_num'); -- add maint cat |
| | end |
| end | | end |
|
| |
|