Project

General

Profile

« Previous | Next » 

Revision 957a9a67

Added by Andreas Müller almost 3 years ago

fix #9530, ref #6499 add pages for book sections

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/reference/ReferenceDefaultCacheStrategy.java
236 236
        if (title.matches(".*[.!\\?]")){
237 237
            title = title.substring(0, title.length() - 1);
238 238
        }
239
        String pages = getPages(reference);
240
        if (isNotBlank(pages)){
241
            title = CdmUtils.concat(", ", title, pages);
242
        }
239 243
        if (title.length() > 0){
240 244
            result = title.trim() + "." + blank + result;
241 245
        }
......
275 279
        return result;
276 280
    }
277 281

  
282
    private static final String pageNoRe = "[0-9iIvVxXlLcCdDmM]+";
283
    private String getPages(Reference reference) {
284

  
285
        if (isBlank(reference.getPages())){
286
            return null;
287
        }else if (reference.getPages().matches(pageNoRe + "\\s*[-"+UTF8.EN_DASH+"]\\s*"+ pageNoRe)){
288
            return "pp. " + reference.getPages();
289
        }else if (reference.getPages().matches(pageNoRe)){
290
            return "p. " + reference.getPages();
291
        }else{
292
            return reference.getPages();
293
        }
294
    }
295

  
278 296
    private String titleCacheJournal(Reference reference, boolean isAbbrev) {
279 297
        String result;
280 298
        //copied from Journal

Also available in: Unified diff