Modul:Citation/CS1/Configuration: razlika između inačica

Izvor: Hrvatska internetska enciklopedija
Prijeđi na navigaciju Prijeđi na pretraživanje
mNema sažetka uređivanja
mNema sažetka uređivanja
 
Nije prikazano 5 međuinačica
Redak 3: Redak 3:


local cfg = {}
local cfg = {}
--------------------------------------------------------------------------------
-- OBAVEZNI PARAMETRI PO KLASI
--------------------------------------------------------------------------------
cfg.required_params = {
    book        = {"title"},
    web          = {"title", "url"},
    journal      = {"title", "journal"},
    newspaper    = {"title", "newspaper"},
    encyclopedia = {"title", "encyclopedia"},
    law          = {"title"},
    archive      = {"title", "archive"},
    interview    = {"title"}
}


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Redak 22: Redak 37:
     ['december']  = 'prosinac',
     ['december']  = 'prosinac',


     ['jan'] = 'sij',
     ['jan'] = 'sij', ['feb'] = 'velj', ['mar'] = 'ožu', ['apr'] = 'tra',
    ['feb'] = 'velj',
     ['may'] = 'svi', ['jun'] = 'lip', ['jul'] = 'srp', ['aug'] = 'kol',
    ['mar'] = 'ožu',
     ['sep'] = 'ruj', ['oct'] = 'lis', ['nov'] = 'stu', ['dec'] = 'pro',
    ['apr'] = 'tra',
     ['may'] = 'svi',
    ['jun'] = 'lip',
    ['jul'] = 'srp',
    ['aug'] = 'kol',
     ['sep'] = 'ruj',
    ['oct'] = 'lis',
    ['nov'] = 'stu',
    ['dec'] = 'pro',


     ['jan.'] = 'sij',
     ['jan.'] = 'sij', ['feb.'] = 'velj', ['mar.'] = 'ožu', ['apr.'] = 'tra',
    ['feb.'] = 'velj',
     ['may.'] = 'svi', ['jun.'] = 'lip', ['jul.'] = 'srp', ['aug.'] = 'kol',
    ['mar.'] = 'ožu',
     ['sep.'] = 'ruj', ['oct.'] = 'lis', ['nov.'] = 'stu', ['dec.'] = 'pro',
    ['apr.'] = 'tra',
     ['may.'] = 'svi',
    ['jun.'] = 'lip',
    ['jul.'] = 'srp',
    ['aug.'] = 'kol',
     ['sep.'] = 'ruj',
    ['oct.'] = 'lis',
    ['nov.'] = 'stu',
    ['dec.'] = 'pro',


     ['sept'] = 'ruj',
     ['sept'] = 'ruj', ['sept.'] = 'ruj',
    ['sept.'] = 'ruj',


     local_digits = {
     local_digits = {
         ['٠'] = '0', ['١'] = '1', ['٢'] = '2', ['٣'] = '3', ['٤'] = '4',
         ['٠']='0',['١']='1',['٢']='2',['٣']='3',['٤']='4',
         ['٥'] = '5', ['٦'] = '6', ['٧'] = '7', ['٨'] = '8', ['٩'] = '9',
         ['٥']='5',['٦']='6',['٧']='7',['٨']='8',['٩']='9',
         ['۰'] = '0', ['۱'] = '1', ['۲'] = '2', ['۳'] = '3', ['۴'] = '4',
         ['۰']='0',['۱']='1',['۲']='2',['۳']='3',['۴']='4',
         ['۵'] = '5', ['۶'] = '6', ['۷'] = '7', ['۸'] = '8', ['۹'] = '9',
         ['۵']='5',['۶']='6',['۷']='7',['۸']='8',['۹']='9',
         ['0'] = '0', ['1'] = '1', ['2'] = '2', ['3'] = '3', ['4'] = '4',
         ['0']='0',['1']='1',['2']='2',['3']='3',['4']='4',
         ['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8', ['9'] = '9',
         ['5']='5',['6']='6',['7']='7',['8']='8',['9']='9',
     }
     }
}
}
Redak 70: Redak 66:
     ['translator#'] = true,
     ['translator#'] = true,
     ['others'] = true,
     ['others'] = true,
}
--------------------------------------------------------------------------------
-- ID HANDLERS (ISPRAVNO, MALA SLOVA)
--------------------------------------------------------------------------------
cfg.id_handlers = {
    isbn = {
        parameters = {"isbn"},
        link = "ISBN",
        label = "ISBN",
        mode = "simple"
    },
    doi = {
        parameters = {"doi"},
        link = "DOI",
        label = "DOI",
        mode = "simple"
    },
    oclc = {
        parameters = {"oclc"},
        link = "OCLC",
        label = "OCLC",
        mode = "simple"
    },
    pmid = {
        parameters = {"pmid"},
        link = "PMID",
        label = "PMID",
        mode = "simple"
    }
}
}


Redak 106: Redak 136:


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- ID HANDLERS (ISBN, DOI, PMID…)
-- VALID PARAMETERS (GLOBAL)
--------------------------------------------------------------------------------
 
cfg.id_handlers = {
    ISBN = {
        link = 'https://www.worldcat.org/isbn/$1',
        pattern = '^(%d[%d%-]+%d)$',
    },
    DOI = {
        link = 'https://doi.org/$1',
        pattern = '^10%..+/.+$',
    },
    PMID = {
        link = 'https://pubmed.ncbi.nlm.nih.gov/$1',
        pattern = '^(%d+)$',
    },
}
 
--------------------------------------------------------------------------------
-- WHITELIST (VALID PARAMETERS)
--------------------------------------------------------------------------------
 
cfg.whitelist = {
    ['title'] = true,
    ['url'] = true,
    ['work'] = true,
    ['publisher'] = true,
    ['date'] = true,
    ['year'] = true,
    ['access-date'] = true,
    ['archive-url'] = true,
    ['archive-date'] = true,
    ['language'] = true,
    ['quote'] = true,
    ['author'] = true,
    ['author1'] = true,
    ['author2'] = true,
    ['editor'] = true,
    ['editor1'] = true,
    ['editor2'] = true,
    ['isbn'] = true,
    ['doi'] = true,
    ['pmid'] = true,
}
 
--------------------------------------------------------------------------------
-- VALID PARAMETERS
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


cfg.valid_params = {
cfg.valid_params = {
    -- zajednički
     author = true, author1 = true, author2 = true, author3 = true,
     author = true, author1 = true, author2 = true, author3 = true,
     editor = true, editor1 = true,
     editor = true, editor1 = true,
Redak 175: Redak 158:
     doi = true,
     doi = true,
     pmid = true,
     pmid = true,
     ['CitationClass'] = true,
     CitationClass = true,
     type = true,
     type = true,
}
}


cfg.required_params = {
--------------------------------------------------------------------------------
    web = { 'title', 'url' },
-- PARAMETRI PO KLASI (USKLAĐENO)
    book = { 'title' },
--------------------------------------------------------------------------------
    journal = { 'title', 'journal' },
}


cfg.class_params = {
cfg.class_params = {
    web = {
 
        'title', 'url', 'work', 'publisher', 'date', 'year',
web = {
        'author', 'author1', 'author2', 'access-date', 'language', 'quote',
    'title', 'url', 'work', 'website', 'publisher', 'date', 'year',
        "autor", "autor1", "autor2", "autor3", "naslov", "mjesto", "place", "godina", "stranica", "stranice",
 
    },
    -- autori
    'author', 'author1', 'author2', 'author3',
    'first', 'last', 'first2', 'last2', 'first3', 'last3',
 
    -- arhiviranje
    'archive-url',
    'archive-date',
    'url-status',
 
    -- ostalo
    'access-date', 'language', 'quote', 'type',
 
    -- hrvatski aliasi
    'naslov', 'autor', 'autor1', 'autor2', 'autor3',
    'mjesto', 'place', 'godina', 'stranica', 'stranice'
},
 
     book = {
     book = {
         'title', 'author', 'publisher', 'location', 'edition', 'year',
         'title', 'subtitle',
         'isbn', 'language', 'quote',"autor", "autor1", "autor2",  
        'author', 'author1', 'author2', 'author3',
         "autor3", "naslov", "izdavač", "izdavac", "mjesto", "place",  
        'editor', 'editor1',
         "godina", "stranica", "stranice", "urednik", "izdanje","first", "last", "first2", "last2", "first3", "last3","series","type","volume"
        'translator', 'translator1',
        'publisher', 'location', 'place',
        'year', 'date',
        'edition', 'volume', 'series',
        'pages', 'page',
         'isbn', 'doi', 'oclc', 'pmid',
        'language', 'quote', 'type',
        'naslov', 'autor', 'autor1', 'autor2', 'autor3',
         'izdavač', 'izdavac', 'mjesto', 'godina',
         'stranica', 'stranice', 'urednik', 'izdanje',
        'first', 'last', 'first2', 'last2', 'first3', 'last3', 'url'
     },
     },
     journal = {
     journal = {
         'title', 'author', 'journal', 'volume', 'issue', 'pages',
         'title', 'author', 'author1', 'author2', 'author3',
        'journal', 'volume', 'issue', 'pages',
         'year', 'doi', 'language', 'quote',
         'year', 'doi', 'language', 'quote',
         "autor", "autor1", "autor2", "autor3",
         'naslov', 'autor', 'autor1', 'autor2', 'autor3',
        "naslov",
         'godina', 'stranica', 'stranice'
         "godina",
        "stranica", "stranice"
     },
     },
     newspaper = {
     newspaper = {
         "author", "author1", "author2", "author3",
         'author', 'author1', 'author2', 'author3',
         "title",
         'title', 'newspaper',
        "newspaper",
         'publisher', 'location', 'date', 'year',
         "publisher",
         'pages', 'url', 'access-date',
        "location",
         'language', 'format'
        "date",
        "year",
         "pages",
        "url",
        "access-date",
         "language",
        "format"
     },
     },
     encyclopedia = {
     encyclopedia = {
         "author", "author1", "author2", "author3",
         'author', 'author1', 'author2', 'author3',
         "title",
         'title', 'encyclopedia',
        "encyclopedia",
         'publisher', 'location', 'year', 'date',
         "publisher",
         'volume', 'edition', 'pages',
        "location",
         'url', 'access-date',
        "year",
         'language', 'format'
        "date",
    },
         "volume",
 
        "edition",
    law = {
        "pages",
         'title', 'law', 'jurisdiction',
         "url",
         'publisher', 'date', 'year',
        "access-date",
         'section', 'article', 'chapter',
         "language",
         'url', 'access-date',
        "format"
         'language', 'format'
    },
    },
    law = {
 
         "title",
    archive = {
        "law",
         'author', 'author1', 'author2', 'author3',
        "jurisdiction",
         'title', 'archive', 'collection',
         "publisher",
         'location', 'date', 'year',
        "date",
         'identifier', 'pages',
        "year",
         'url', 'access-date',
         "section",
         'language', 'format'
        "article",
    },
        "chapter",
 
         "url",
    interview = {
        "access-date",
         'interviewer',
         "language",
         'author', 'author1', 'author2', 'author3',
        "format"
         'title', 'program', 'publisher',
      },
         'location', 'date', 'year',
    archive = {
         'url', 'access-date',
         "author", "author1", "author2", "author3",
         'language', 'format'
         "title",
    }
        "archive",
        "collection",
         "location",
        "date",
        "year",
         "identifier",
        "pages",
         "url",
        "access-date",
         "language",
        "format"
    },
    interview = {
         "interviewer",
         "author", "author1", "author2", "author3",
         "title",
        "program",
        "publisher",
         "location",
        "date",
        "year",
         "url",
        "access-date",
         "language",
        "format"
      }
}
}



Posljednja izmjena od 20. siječanj 2026. u 11:46

Script error: The function "nonexistent" does not exist.

require('strict')

local cfg = {}

--------------------------------------------------------------------------------
-- OBAVEZNI PARAMETRI PO KLASI
--------------------------------------------------------------------------------

cfg.required_params = {
    book         = {"title"},
    web          = {"title", "url"},
    journal      = {"title", "journal"},
    newspaper    = {"title", "newspaper"},
    encyclopedia = {"title", "encyclopedia"},
    law          = {"title"},
    archive      = {"title", "archive"},
    interview    = {"title"}
}

--------------------------------------------------------------------------------
-- DATE NAMES (HRVATSKI)
--------------------------------------------------------------------------------

cfg.date_names = {
    ['january']   = 'siječanj',
    ['february']  = 'veljača',
    ['march']     = 'ožujak',
    ['april']     = 'travanj',
    ['may']       = 'svibanj',
    ['june']      = 'lipanj',
    ['july']      = 'srpanj',
    ['august']    = 'kolovoz',
    ['september'] = 'rujan',
    ['october']   = 'listopad',
    ['november']  = 'studeni',
    ['december']  = 'prosinac',

    ['jan'] = 'sij', ['feb'] = 'velj', ['mar'] = 'ožu', ['apr'] = 'tra',
    ['may'] = 'svi', ['jun'] = 'lip', ['jul'] = 'srp', ['aug'] = 'kol',
    ['sep'] = 'ruj', ['oct'] = 'lis', ['nov'] = 'stu', ['dec'] = 'pro',

    ['jan.'] = 'sij', ['feb.'] = 'velj', ['mar.'] = 'ožu', ['apr.'] = 'tra',
    ['may.'] = 'svi', ['jun.'] = 'lip', ['jul.'] = 'srp', ['aug.'] = 'kol',
    ['sep.'] = 'ruj', ['oct.'] = 'lis', ['nov.'] = 'stu', ['dec.'] = 'pro',

    ['sept'] = 'ruj', ['sept.'] = 'ruj',

    local_digits = {
        ['٠']='0',['١']='1',['٢']='2',['٣']='3',['٤']='4',
        ['٥']='5',['٦']='6',['٧']='7',['٨']='8',['٩']='9',
        ['۰']='0',['۱']='1',['۲']='2',['۳']='3',['۴']='4',
        ['۵']='5',['۶']='6',['۷']='7',['۸']='8',['۹']='9',
        ['0']='0',['1']='1',['2']='2',['3']='3',['4']='4',
        ['5']='5',['6']='6',['7']='7',['8']='8',['9']='9',
    }
}

--------------------------------------------------------------------------------
-- PUNCTUATION RULES
--------------------------------------------------------------------------------

cfg.punct_skip = {
    ['author#'] = true,
    ['editor#'] = true,
    ['translator#'] = true,
    ['others'] = true,
}

--------------------------------------------------------------------------------
-- ID HANDLERS (ISPRAVNO, MALA SLOVA)
--------------------------------------------------------------------------------

cfg.id_handlers = {
    isbn = {
        parameters = {"isbn"},
        link = "ISBN",
        label = "ISBN",
        mode = "simple"
    },

    doi = {
        parameters = {"doi"},
        link = "DOI",
        label = "DOI",
        mode = "simple"
    },

    oclc = {
        parameters = {"oclc"},
        link = "OCLC",
        label = "OCLC",
        mode = "simple"
    },

    pmid = {
        parameters = {"pmid"},
        link = "PMID",
        label = "PMID",
        mode = "simple"
    }
}

--------------------------------------------------------------------------------
-- ERROR CONDITIONS
--------------------------------------------------------------------------------

cfg.error_conditions = {
    ['err_missing_title'] = true,
    ['err_missing_author'] = true,
    ['err_param_unknown'] = true,
    ['err_param_unknown_empty'] = true,
    ['err_text_ignored'] = true,
    ['err_parameter_ignored'] = true,
    ['err_parameter_ignored_suggest'] = true,
    ['err_extra_text'] = true,
}

--------------------------------------------------------------------------------
-- PARAMETER ALIASES
--------------------------------------------------------------------------------

cfg.param_aliases = {
    ['url'] = 'url',
    ['title'] = 'title',
    ['work'] = 'work',
    ['publisher'] = 'publisher',
    ['date'] = 'date',
    ['year'] = 'year',
    ['access-date'] = 'access-date',
    ['archive-url'] = 'archive-url',
    ['archive-date'] = 'archive-date',
    ['language'] = 'language',
    ['quote'] = 'quote',
}

--------------------------------------------------------------------------------
-- VALID PARAMETERS (GLOBAL)
--------------------------------------------------------------------------------

cfg.valid_params = {
    author = true, author1 = true, author2 = true, author3 = true,
    editor = true, editor1 = true,
    title = true,
    url = true,
    work = true, website = true, journal = true,
    publisher = true,
    date = true, year = true,
    ['access-date'] = true, accessdate = true,
    language = true, lang = true,
    quote = true,
    volume = true,
    issue = true, number = true,
    pages = true, page = true,
    location = true, place = true,
    edition = true,
    isbn = true,
    doi = true,
    pmid = true,
    CitationClass = true,
    type = true,
}

--------------------------------------------------------------------------------
-- PARAMETRI PO KLASI (USKLAĐENO)
--------------------------------------------------------------------------------

cfg.class_params = {

web = {
    'title', 'url', 'work', 'website', 'publisher', 'date', 'year',

    -- autori
    'author', 'author1', 'author2', 'author3',
    'first', 'last', 'first2', 'last2', 'first3', 'last3',

    -- arhiviranje
    'archive-url',
    'archive-date',
    'url-status',

    -- ostalo
    'access-date', 'language', 'quote', 'type',

    -- hrvatski aliasi
    'naslov', 'autor', 'autor1', 'autor2', 'autor3',
    'mjesto', 'place', 'godina', 'stranica', 'stranice'
},

    book = {
        'title', 'subtitle',
        'author', 'author1', 'author2', 'author3',
        'editor', 'editor1',
        'translator', 'translator1',
        'publisher', 'location', 'place',
        'year', 'date',
        'edition', 'volume', 'series',
        'pages', 'page',
        'isbn', 'doi', 'oclc', 'pmid',
        'language', 'quote', 'type',
        'naslov', 'autor', 'autor1', 'autor2', 'autor3',
        'izdavač', 'izdavac', 'mjesto', 'godina',
        'stranica', 'stranice', 'urednik', 'izdanje',
        'first', 'last', 'first2', 'last2', 'first3', 'last3', 'url'
    },

    journal = {
        'title', 'author', 'author1', 'author2', 'author3',
        'journal', 'volume', 'issue', 'pages',
        'year', 'doi', 'language', 'quote',
        'naslov', 'autor', 'autor1', 'autor2', 'autor3',
        'godina', 'stranica', 'stranice'
    },

    newspaper = {
        'author', 'author1', 'author2', 'author3',
        'title', 'newspaper',
        'publisher', 'location', 'date', 'year',
        'pages', 'url', 'access-date',
        'language', 'format'
    },

    encyclopedia = {
        'author', 'author1', 'author2', 'author3',
        'title', 'encyclopedia',
        'publisher', 'location', 'year', 'date',
        'volume', 'edition', 'pages',
        'url', 'access-date',
        'language', 'format'
    },

    law = {
        'title', 'law', 'jurisdiction',
        'publisher', 'date', 'year',
        'section', 'article', 'chapter',
        'url', 'access-date',
        'language', 'format'
    },

    archive = {
        'author', 'author1', 'author2', 'author3',
        'title', 'archive', 'collection',
        'location', 'date', 'year',
        'identifier', 'pages',
        'url', 'access-date',
        'language', 'format'
    },

    interview = {
        'interviewer',
        'author', 'author1', 'author2', 'author3',
        'title', 'program', 'publisher',
        'location', 'date', 'year',
        'url', 'access-date',
        'language', 'format'
    }
}

--------------------------------------------------------------------------------
-- RETURN
--------------------------------------------------------------------------------

return cfg