5
5
6
6
ISSN = Hash . new { |h , k | h [ k ] = [ ] }
7
7
TITLES = Hash . new { |h , k | h [ k ] = [ ] }
8
-
9
- # These ISSNs are ignored when checking for duplicate ISSNs
10
- ISSN_FILTER = %w{
11
- 1662-453X 1663-9812 1664-042X 1664-0640 1664-1078 1664-2295
12
- 1664-2392 1664-302X 1664-3224 1664-462X 1664-8021 2234-943X
13
- 0036-8075 1095-9203 1359-4184 1476-5578 1097-6256 1047-7594
14
- 1546-1726 2108-6419 0035-2969 1958-5691 0943-8610 2194-508X
15
- 0223-5099 0322-8916 1805-6555 1899-0665 0305-1048 1362-4962
16
- 0042-7306 1783-1830 1438-5627 0353-6483 1855-8399 0001-4966
17
- 1520-8524
18
- }
19
-
20
- # These titles are ignored when checking for duplicate titles
21
- TITLES_FILTER = [
22
- # 'example title 1',
23
- # 'example title 2'
24
- ]
25
-
26
- # These styles are ignored when checking for valid citation-formats
27
- CITATION_FORMAT_FILTER = %w{
28
- bibtex blank national-archives-of-australia
29
- }
30
-
31
- # These styles are ignored when checking for unused macros
32
- UNUSED_MACROS_FILTER = %w{
33
- apa-annotated-bibliography
34
- apa-cv
35
- apa-numeric-superscript
36
- apa-numeric-superscript-brackets
37
- apa-with-abstract
38
- chicago-annotated-bibliography chicago-author-date chicago-author-date-16th-edition
39
- chicago-library-list chicago-note-bibliography-16th-edition
40
- chicago-note-bibliography-with-ibid
41
- chicago-note-bibliography taylor-and-francis-chicago-author-date
42
- turabian-author-date
43
- }
44
-
45
- # These files and directories are ignored when checking for extra files
46
- EXTRA_FILES_FILTER = [
47
- 'CONTRIBUTING.md' , 'Gemfile' , 'Gemfile.lock' , 'README.md' ,
48
- 'dependent' , 'Rakefile' , 'renamed-styles.json' , 'REQUESTING.md' , 'STYLE_DEVELOPMENT.md' ,
49
- 'STYLE_REQUIREMENTS.md' , 'QUALITY_CONTROL.md'
50
- ]
51
-
52
- # These directories and their contents are ignored when checking for extra files
53
- EXTRA_FILES_DIRECTORY_FILTER = [
54
- 'spec' , 'vendor'
55
- ]
8
+ FILTER = YAML . load_file ( File . join ( File . dirname ( __FILE__ ) , 'filters.yaml' ) )
56
9
57
10
EXTRA_FILES = Dir [ File . join ( STYLE_ROOT , '**' , '*' ) ] . reject do |file |
58
11
basedir = file . sub ( STYLE_ROOT + "/" , "" ) . partition ( "/" ) [ 0 ]
59
12
name = File . basename ( file )
60
- File . extname ( file ) == '.csl' || EXTRA_FILES_FILTER . any? { |f | f === name } || EXTRA_FILES_DIRECTORY_FILTER . any? { |d | d === basedir }
13
+ File . extname ( file ) == '.csl' || FILTER [ 'EXTRA_FILES' ] . any? { |f | f === name } || FILTER [ 'EXTRA_FILES_DIRECTORY' ] . any? { |d | d === basedir }
61
14
end
62
15
63
16
# License URL and text
@@ -79,19 +32,19 @@ def load_style(path)
79
32
begin
80
33
if style . info . has_issn?
81
34
[ style . info . issn ] . flatten ( 1 ) . each do |issn |
82
- ISSN [ issn . to_s ] << basename unless ISSN_FILTER . include? ( issn . to_s )
35
+ ISSN [ issn . to_s ] << basename unless FILTER [ 'ISSN' ] . include? ( issn . to_s )
83
36
end
84
37
end
85
38
86
39
if style . info . has_eissn?
87
40
[ style . info . eissn ] . flatten ( 1 ) . each do |issn |
88
- ISSN [ issn . to_s ] << basename unless ISSN_FILTER . include? ( issn . to_s )
41
+ ISSN [ issn . to_s ] << basename unless FILTER [ 'ISSN' ] . include? ( issn . to_s )
89
42
end
90
43
end
91
44
92
45
if style . has_title?
93
46
title = style . title . to_s . downcase
94
- TITLES [ title ] << basename unless TITLES_FILTER . include? ( title )
47
+ TITLES [ title ] << basename unless FILTER [ 'TITLES' ] . include? ( title )
95
48
end
96
49
rescue
97
50
warn "Failed to extract ISSN of style #{ basename } "
0 commit comments