diff options
Diffstat (limited to 'biblio/bibtex/contrib/iran-bibtex/iran.bst')
-rw-r--r-- | biblio/bibtex/contrib/iran-bibtex/iran.bst | 4728 |
1 files changed, 2527 insertions, 2201 deletions
diff --git a/biblio/bibtex/contrib/iran-bibtex/iran.bst b/biblio/bibtex/contrib/iran-bibtex/iran.bst index 5d8ee98fa4..e1575ba6be 100644 --- a/biblio/bibtex/contrib/iran-bibtex/iran.bst +++ b/biblio/bibtex/contrib/iran-bibtex/iran.bst @@ -1,13 +1,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% -%% This file is “iran.bst”, v0.3.0 (2023/12/18) +%% This file is “iran.bst”, v0.4.0 (2024/01/8) %% generated with the DOCSTRIP utility, then modified to support -%% bilingual (English/Latin, and Persian) and be compatible with the +%% bilingual (English/Latin, and Persian/Farsi) in accordance with the %% “Iran Manual of Style Citation Guide” (1st edn., 2016). %% %% %% -%% Copyright (c) 2023 Farshad Rasuli <farshad.rasuli@gmail.com> +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> %% %% This file can be redistributed and/or modified under the terms %% of the LaTeX Project Public License version 1.3c, or any later version. @@ -16,40 +16,40 @@ %% This BibTeX bibliography style (bst) file is part of %% the “iran-bibtex” package. %% -%% CTAN: https://ctan.org/pkg/iran-bibtex -%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex -%% Repository: https://github.com/farshadrasuli/iran-bibtex -%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%------------------------------------------------------------------------------ -% This bibliography style file is intended for texts in ENGLISH, and Persian. -% This is an author-year citation style bibliography. This style file is based -% on natbib.sty package by Patrick W. Daly. -% The form of the \bibitem entries is -% \bibitem[Jones et al.(1990)]{key}... -% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... -% The essential feature is that the label (the part in brackets) consists -% of the author names, as they should appear in the citation, with the year -% in parentheses following. There must be no space before the opening -% parenthesis! -% -% The \cite command functions as follows (\cite is equal to \citep command): -% \citep{key} => (Jones et al., 1990) -% \citep*{key} => (Jones, Baker, and Smith, 1990) -% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) -% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) -% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) -% \citet{key} => Jones et al. (1990) -% \citet*{key} => Jones, Baker, and Smith (1990) -% \citeauthor{key} => Jones et al. -% \citeauthor*{key} => Jones, Baker, and Smith -% \citeyear{key} => 1990 -%------------------------------------------------------------------------------ +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in Persian. +%% This is an author-year citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they should appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => (Jones et al., 1990) +%% \citep*{key} => (Jones, Baker, and Smith, 1990) +%% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) +%% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) +%% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) +%% \citet{key} => Jones et al. (1990) +%% \citet*{key} => Jones, Baker, and Smith (1990) +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- @@ -115,7 +115,7 @@ ENTRY -% Basic boolean functions +% Logical operators FUNCTION {not} { @@ -143,12 +143,12 @@ FUNCTION {or} -% check for language of entry +% Check for language entry FUNCTION {is.language.persian} { language missing$ - {#0} + { #0 } { language "l" change.case$ "persian" = } if$ } @@ -176,22 +176,6 @@ FUNCTION {bbl.and} if$ } -FUNCTION {bbl.annotator} -{ - is.language.persian - {"حاشیهنویس"} - {"ann."} - if$ -} - -FUNCTION {bbl.annotatedby} -{ - is.language.persian - {"با حاشیهی"} - {"annotated by"} - if$ -} - FUNCTION {bbl.andothers} { is.language.persian @@ -216,14 +200,6 @@ FUNCTION {bbl.chapter} if$ } -FUNCTION {bbl.collaboration} -{ - is.language.persian - {"همکار"} - {"coll."} - if$ -} - FUNCTION {bbl.comma} { is.language.persian @@ -304,7 +280,7 @@ FUNCTION {bbl.editors} if$ } -FUNCTION {bbl.edby} +FUNCTION {bbl.editedby} { is.language.persian {"ویراستهی"} @@ -334,7 +310,6 @@ FUNCTION {bbl.etal} {"و~همکاران"} {"et~al."} if$ - } FUNCTION {bbl.forewordby} @@ -393,14 +368,6 @@ FUNCTION {bbl.issn} if$ } -FUNCTION {bbl.thesis} -{ - is.language.persian - {"پایاننامه"} - {"Thesis"} - if$ -} - FUNCTION {bbl.mthesis} { is.language.persian @@ -409,7 +376,7 @@ FUNCTION {bbl.mthesis} if$ } -FUNCTION {bbl.number} +FUNCTION {bbl.nr} { is.language.persian {"ش."} @@ -417,7 +384,7 @@ FUNCTION {bbl.number} if$ } -FUNCTION {bbl.nr} +FUNCTION {bbl.number} { is.language.persian {"ش."} @@ -436,16 +403,16 @@ FUNCTION {bbl.of} FUNCTION {bbl.page} { is.language.persian - {""} - {""} + {"ص"} + {"p."} if$ } FUNCTION {bbl.pages} { is.language.persian - {""} - {""} + {"صص"} + {"pp."} if$ } @@ -489,6 +456,14 @@ FUNCTION {bbl.techrep} if$ } +FUNCTION {bbl.thesis} +{ + is.language.persian + {"پایاننامه"} + {"Thesis"} + if$ +} + FUNCTION {bbl.translator} { is.language.persian @@ -541,6 +516,36 @@ FUNCTION {bbl.volumes} +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + % Functions to declare position INTEGERS { output.state before.all mid.sentence after.sentence after.block } @@ -574,7 +579,7 @@ FUNCTION {output.nonnull} { output.state before.all = 'write$ - { add.period$ " " * write$ } + { add.period$ write$ " " write$ } if$ } if$ @@ -605,7 +610,68 @@ FUNCTION {output.check} -% Functions to control format of entry +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries FUNCTION {new.block} { @@ -615,6 +681,20 @@ FUNCTION {new.block} if$ } + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + FUNCTION {new.sentence} { output.state after.block = @@ -637,10 +717,8 @@ FUNCTION {add.blank} -FUNCTION {no.blank.or.punct} -{ - "\hspace{0pt}" * before.all 'output.state := -} +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } @@ -651,6 +729,33 @@ FUNCTION {date.block} +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + FUNCTION {non.stop} { duplicate$ @@ -691,35 +796,13 @@ FUNCTION {remove.dots} -FUNCTION {new.block.checkb} -{ - empty$ - swap$ empty$ - and - 'skip$ - 'new.block - if$ -} - - - -FUNCTION {field.or.null} -{ - duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ -} +FUNCTION {separate.by.space} +{ " " swap$ * " " * } -FUNCTION {emphasize} -{ - duplicate$ empty$ - { pop$ "" } - { "{\it " swap$ * "}" * } - if$ -} +FUNCTION {space.word} +{ " " swap$ * " " * } @@ -734,97 +817,11 @@ FUNCTION {tie.or.space.prefix} -FUNCTION {capitalize} -{ "u" change.case$ "t" change.case$ } - - - -FUNCTION {space.word} -{ " " swap$ * " " * } - - - -FUNCTION {separate.by.space} -{ " " swap$ * " " * } - - - - - -% Macro for abbreviation of month - -MACRO {jan} {"Jan"} - -MACRO {feb} {"Feb"} - -MACRO {mar} {"Mar"} - -MACRO {apr} {"Apr"} - -MACRO {may} {"May"} - -MACRO {jun} {"Jun"} - -MACRO {jul} {"Jul"} - -MACRO {aug} {"Aug"} - -MACRO {sep} {"Sep"} - -MACRO {oct} {"Oct"} - -MACRO {nov} {"Nov"} - -MACRO {dec} {"Dec"} - - - - - -% Functions to check and warn bibinfo - -FUNCTION {bibinfo.check} -{ - swap$ - duplicate$ missing$ - { - pop$ pop$ - "" - } - { - duplicate$ empty$ - { - swap$ pop$ - } - { - swap$ - pop$ - } - if$ - } - if$ -} - - -FUNCTION {bibinfo.warn} +FUNCTION {word.in} { - swap$ - duplicate$ missing$ - { - swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ - "" - } - { - duplicate$ empty$ - { - swap$ "empty " swap$ * " in " * cite$ * warning$ - } - { - swap$ - pop$ - } - if$ - } + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } if$ } @@ -832,7 +829,7 @@ FUNCTION {bibinfo.warn} -% Functions to format fields +% Functions to format names INTEGERS { nameptr namesleft numnames } @@ -965,184 +962,465 @@ FUNCTION {format.key} -FUNCTION {format.authors} -{ author "author" format.names } +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} -FUNCTION {get.bbl.editor} +STRINGS {oldname} + +FUNCTION {name.or.dash} { - editor num.names$ #1 > - 'bbl.editors - 'bbl.editor + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } if$ } -FUNCTION {format.editors} + + + + +% Functions to create the short name label for the entry + +FUNCTION {label.and} { - editor "editor" format.names - duplicate$ empty$ - 'skip$ + is.language.persian + { "و" } { - bbl.comma * " " * get.bbl.editor * + authorfa missing$ + { "and" } + { "و" } + if$ } if$ } -FUNCTION {get.bbl.compiler} +FUNCTION {label.andothers} { - compiler num.names$ #1 > - 'bbl.compilers - 'bbl.compiler + is.language.persian + { "و~دیگران" } + { + authorfa missing$ + { "and~others" } + { "و~دیگران" } + if$ + } if$ } -FUNCTION {format.compilers} + + +FUNCTION {label.comma} { - compiler "compiler" format.names - duplicate$ empty$ - 'skip$ + is.language.persian + { "،" } { - bbl.comma * " " * get.bbl.compiler * + authorfa missing$ + { "," } + { "،" } + if$ } if$ } -FUNCTION {get.bbl.translator} +FUNCTION {label.etal} { - translator num.names$ #1 > - 'bbl.translators - 'bbl.translator + is.language.persian + { "و~همکاران" } + { + authorfa missing$ + { "et~al." } + { "و~همکاران" } + if$ + } if$ } -FUNCTION {format.translators} + + +INTEGERS { is.authorfa.exist } + +FUNCTION {format.short.label.names} { - translator "translator" format.names - duplicate$ empty$ - 'skip$ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > { - bbl.comma * " " * get.bbl.translator * + " " * label.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * label.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * " " * s #2 "{vv~}{ll}" format.name$ * + label.comma * label.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.eprint} +FUNCTION {author.key.short.label.names} { - eprint duplicate$ empty$ - 'skip$ + authorfa empty$ not + { authorfa format.short.label.names } { - "\eprint" - archive empty$ - 'skip$ - { "[" * archive * "]" * } + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } if$ - "{" * swap$ * "}" * } if$ } -FUNCTION {format.url} +FUNCTION {author.editor.key.short.label.names} { - url duplicate$ empty$ - { pop$ "" } + authorfa empty$ not + { authorfa format.short.label.names } { - bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.urldate} +FUNCTION {editor.key.short.label.names} { - urldate duplicate$ empty$ - { pop$ "" } - { bbl.retrieved capitalize " " * swap$ * } + authorfa empty$ not + { authorfa format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } if$ } -FUNCTION {format.isbn} +FUNCTION {book.short.label.names} { - isbn "isbn" bibinfo.check - duplicate$ empty$ - 'skip$ + authorfa empty$ not + { authorfa format.short.label.names } { - bbl.isbn "u" change.case$ ": " * swap$ * + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.issn} +FUNCTION {incoll.short.label.names} { - issn "issn" bibinfo.check - duplicate$ empty$ - 'skip$ - { - bbl.issn "u" change.case$ ": " * swap$ * - } + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } if$ } -FUNCTION {format.doi} + + +FUNCTION {article.short.label.names} { - doi empty$ - { "" } + authorfa empty$ not + { authorfa format.short.label.names } { - bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.note} +FUNCTION {proc.short.label.names} { - note empty$ not + authorfa empty$ not + { authorfa format.short.label.names } { - note #1 #1 substring$ - duplicate$ "{" = - 'skip$ + editor empty$ not + { editor format.short.label.names } { - output.state mid.sentence = - { "l" } - { "u" } + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } if$ - change.case$ } if$ - note #2 global.max$ substring$ * "note" bibinfo.check } - { "" } if$ } -FUNCTION {format.title} +FUNCTION {inproc.short.label.names} { - title - duplicate$ empty$ - 'skip$ - { bbl.dquote } + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } if$ + 'short.list := } -FUNCTION {format.full.names} + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} { 's := "" 't := @@ -1160,7 +1438,7 @@ FUNCTION {format.full.names} { namesleft #1 > { - bbl.comma * " " * t * + label.comma * " " * t * } { s nameptr "{ll}" format.name$ @@ -1174,10 +1452,10 @@ FUNCTION {format.full.names} } { numnames #2 > - { bbl.comma * } + { label.comma * } 'skip$ if$ - bbl.and + label.and separate.by.space * t * } if$ @@ -1193,74 +1471,100 @@ FUNCTION {format.full.names} } -FUNCTION {author.editor.key.full} + +FUNCTION {author.key.full.label.names} { - author empty$ + authorfa empty$ not + { authorfa format.full.label.names } { - editor empty$ + author empty$ not + { author format.full.label.names } { - key empty$ - { cite$ #1 #3 substring$ } + key empty$ not 'key + { cite$ #1 #3 substring$ } if$ } - { - editor format.full.names - } if$ } - { - author format.full.names - } if$ } -FUNCTION {author.key.full} +FUNCTION {author.editor.key.full.label.names} { - author empty$ + authorfa empty$ not + { authorfa format.full.label.names } { - key empty$ - { cite$ #1 #3 substring$ } - 'key + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } if$ } - { - author format.full.names - } if$ } -FUNCTION {editor.key.full} +FUNCTION {editor.key.full.label.names} { - editor empty$ + authorfa empty$ not + { authorfa format.full.label.names } { - key empty$ - { cite$ #1 #3 substring$ } - 'key + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } if$ } - { - editor format.full.names - } if$ } -FUNCTION {make.full.names} +FUNCTION {book.full.label.names} { - type$ "book" = - type$ "inbook" = - or - 'author.editor.key.full + authorfa empty$ not + { authorfa format.full.label.names } { - type$ "proceedings" = - 'editor.key.full - 'author.key.full + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } if$ } if$ @@ -1268,224 +1572,658 @@ FUNCTION {make.full.names} -FUNCTION {n.dashify} +FUNCTION {incoll.full.label.names} { - 't := - "" - { - t empty$ not - } - { - t #1 #1 substring$ - "-" = - { - t #1 #2 substring$ - "--" = not - { - "--" * - t #2 global.max$ substring$ 't := - } - { - { - t #1 #1 substring$ "-" = - } + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } { - "-" * - t #2 global.max$ substring$ 't := + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ } - while$ - } - if$ - } - { - t #1 #1 substring$ * - t #2 global.max$ substring$ 't := - } - if$ - } - while$ + if$ + } + if$ + } + if$ } -FUNCTION {word.in} +FUNCTION {article.full.label.names} { - bbl.in capitalize " " * + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ } -FUNCTION {format.date} +FUNCTION {proc.full.label.names} { - year "year" bibinfo.check - duplicate$ empty$ + authorfa empty$ not + { authorfa format.full.label.names } { + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } - 'skip$ if$ - extra.label * - before.all 'output.state := - after.sentence 'output.state := } -FUNCTION {format.comment} +FUNCTION {inproc.full.label.names} { - comment + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } -FUNCTION {format.article.journal} +FUNCTION {conf.full.label.names} { - journal remove.dots emphasize + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } -FUNCTION {format.article.jour.iss.vol.num.pp} +FUNCTION {make.full.label.names} { - journal empty$ not + type$ "book" = + 'book.full.label.names { - issue empty$ not - { issue bbl.comma * " " *} - { "" } - if$ - format.article.journal * - volume empty$ not + type$ "incollection" = + 'incoll.full.label.names { - number empty$ not - { - pages empty$ not - { - " " * volume * "~" * - "(" * number * ")" * ": " * - pages * - } - { - " " * volume * bbl.comma * - " " * bbl.number * "~" * number * - } - if$ - } + type$ "article" = + 'article.full.label.names { - pages empty$ not - { - " " * volume * ": " * - pages * - } + type$ "proceedings" = + 'proc.full.label.names { - " " * volume * + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ } if$ } if$ } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + translateyear empty$ + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + author empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } { - number empty$ not + compiler empty$ not { - pages empty$ not - { - bbl.comma * " " * bbl.number * "~" * number * ": " * - pages * - } - { - bbl.comma * " " * bbl.number * "~" * number * - } + year duplicate$ empty$ + { pop$ "" } + 'skip$ if$ } { - pages empty$ not + editor empty$ not { - bbl.comma * " " * pages * + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + translateyear duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ } - 'skip$ if$ } if$ } if$ } + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + is.language.persian + { + "\bibitem[{" write$ + } { - "journal" output.check + "\begin{LTRbibitems}\resetlatinfont" write$ + newline$ + "\bibitem[{" write$ } if$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := } -FUNCTION {format.article.iss.vol.num.pp} +FUNCTION {end.bibitem} { - journal empty$ not + add.period$ write$ + newline$ + is.language.persian + 'skip$ { - issue empty$ not - { issue bbl.comma * " " *} - { "" } + "\end{LTRbibitems}" write$ + newline$ + } + if$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } if$ - volume empty$ not + change.case$ + "edition" bibinfo.check + is.language.persian + { bbl.edition " " * swap$ * } + { " " * bbl.edition * } + if$ + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + is.language.persian + { bbl.impression " " * swap$ * } + { " " * bbl.impression * } + if$ + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ { - number empty$ not - { - pages empty$ not - { - bbl.comma * " " * bbl.volume * "~" * volume * "~" * - "(" * number * ")" * ": " * - pages * - } - { - bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * - " " * bbl.number * "~" * number * - } - if$ - } - { - pages empty$ not - { - bbl.comma * " " * bbl.volume * "~" * volume * ":~" * - pages * - } - { - bbl.comma * " " * bbl.volume * "~" * volume * - } - if$ - } + output.state mid.sentence = + { "l" } + { "u" } if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify } { - number empty$ not - { - pages empty$ not - { - bbl.number * "~" * number * ": " * - pages * - } - { - bbl.number * "~" * number * - } - if$ - } - { - pages empty$ not - { - pages * - } - 'skip$ - if$ - } - if$ } if$ + "pages" bibinfo.check } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not { - "journal" output.check + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } if$ } -FUNCTION {format.btitle} +FUNCTION {field.btitle} { title "title" bibinfo.check duplicate$ empty$ @@ -1496,27 +2234,98 @@ FUNCTION {format.btitle} -FUNCTION {format.title.in.books} +FUNCTION {field.title.dqoute} { title duplicate$ empty$ 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ { emphasize } if$ } -FUNCTION {either.or.check} +FUNCTION {get.bbl.translator} { - empty$ - 'pop$ - { "can't use both " swap$ * " fields in " * cite$ * warning$ } + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator if$ } +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} -FUNCTION {format.bvolume} + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} { volume empty$ { "" } @@ -1534,7 +2343,102 @@ FUNCTION {format.bvolume} } -FUNCTION {format.number.series} + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} { volume empty$ { @@ -1562,7 +2466,139 @@ FUNCTION {format.number.series} -FUNCTION {format.book.volume.series.number} +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} { volume empty$ not { @@ -1691,22 +2727,14 @@ FUNCTION {format.book.volume.series.number} -FUNCTION {format.booktitle} -{ - booktitle "booktitle" bibinfo.check - emphasize -} - - - -FUNCTION {format.incoll.chapter.booktitle.volume.pages} +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} { booktitle empty$ not { chapter empty$ not { bbl.chapter capitalize "~" * chapter * - " " * bbl.in * " " * format.booktitle * + " " * bbl.in * " " * field.booktitle * pages empty$ not { bbl.comma * " " * pages * add.period$ @@ -1739,7 +2767,7 @@ FUNCTION {format.incoll.chapter.booktitle.volume.pages} if$ } { - word.in format.booktitle * + word.in field.booktitle * pages empty$ not { volume empty$ not @@ -1805,13 +2833,13 @@ FUNCTION {format.incoll.chapter.booktitle.volume.pages} -INTEGERS { emph.series } -FUNCTION {format.incoll.series.number} +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} { author empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1821,7 +2849,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1829,7 +2857,7 @@ FUNCTION {format.incoll.series.number} compiler empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1839,7 +2867,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1847,7 +2875,7 @@ FUNCTION {format.incoll.series.number} editor empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1857,7 +2885,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1870,7 +2898,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1879,7 +2907,7 @@ FUNCTION {format.incoll.series.number} if$ series empty$ not { - emph.series #0 > + field.series.emph #0 > { number empty$ not { series emphasize " " * number * } @@ -1905,7 +2933,221 @@ FUNCTION {format.incoll.series.number} -FUNCTION {format.inproc.booktitle.volume.pages} +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} { booktitle empty$ not { @@ -1915,12 +3157,12 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * volume * ": " * pages * add.period$ " " * volumes * "~" * bbl.volumes * } { - format.booktitle add.period$ + field.booktitle add.period$ " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * } if$ @@ -1928,11 +3170,11 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * volume * ": " * pages * } { - format.booktitle add.period$ + field.booktitle add.period$ " " * bbl.volume * "~" * volume * } if$ @@ -1944,12 +3186,12 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * bbl.comma * " " * pages * add.period$ volumes * "~" * bbl.volumes } { - format.booktitle " " * add.period$ + field.booktitle " " * add.period$ " " * volumes * "~" * bbl.volumes * } if$ @@ -1957,11 +3199,11 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * bbl.comma * " " * pages * } { - format.booktitle + field.booktitle } if$ } @@ -1977,12 +3219,12 @@ FUNCTION {format.inproc.booktitle.volume.pages} -FUNCTION {format.inproc.series.number} +FUNCTION {inproc.fields.series.number} { author empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1992,7 +3234,7 @@ FUNCTION {format.inproc.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -2005,12 +3247,12 @@ FUNCTION {format.inproc.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ series empty$ not { - emph.series #0 > + field.series.emph #0 > { number empty$ not { series emphasize " " * number * } @@ -2036,7 +3278,11 @@ FUNCTION {format.inproc.series.number} -FUNCTION {format.conf.series.number.pages} +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} { series empty$ not { @@ -2071,62 +3317,24 @@ FUNCTION {format.conf.series.number.pages} -FUNCTION {format.conf.org.publisher.address} +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} { - organization empty$ not - { - publisher empty$ not - { - address empty$ not - { - organization add.period$ - address * ": " * publisher * - } - { - organization add.period$ - publisher * - } - if$ - } - { - address empty$ not - { - organization - bbl.comma * " " * address * - } - { - organization - } - if$ - } - if$ - } + type duplicate$ empty$ + 'pop$ { - publisher empty$ not - { - address empty$ not - { address ": " * publisher *} - { publisher } - if$ - } - { - address empty$ not - { address } - { "" } - if$ - } - if$ + swap$ pop$ + "t" change.case$ "type" bibinfo.check } if$ } -FUNCTION {format.proc.org.publisher.address} { format.conf.org.publisher.address } - - - -FUNCTION {format.thesis.school.type.address} +FUNCTION {thesis.fields.school.type.address} { type empty$ { @@ -2196,538 +3404,21 @@ FUNCTION {format.thesis.school.type.address} -FUNCTION {format.edition} -{ - edition duplicate$ empty$ - 'skip$ - { - output.state mid.sentence = - { "l" } - { "t" } - if$ - change.case$ - "edition" bibinfo.check - is.language.persian - { bbl.edition " " * swap$ * } - { " " * bbl.edition * } - if$ - } - if$ -} - - - -FUNCTION {format.impression} +FUNCTION {unpub.field.title} { - impression duplicate$ empty$ not - { - output.state mid.sentence = - { "l" } - { "t" } - if$ - change.case$ - is.language.persian - { bbl.impression " " * swap$ * } - { " " * bbl.impression * } - if$ - } - 'skip$ - if$ -} - - - -INTEGERS { multiresult } - -FUNCTION {multi.page.check} -{ - 't := - #0 'multiresult := - { - multiresult not - t empty$ not - and - } - { - t #1 #1 substring$ - duplicate$ "-" = - swap$ duplicate$ "," = - swap$ "+" = - or or - { #1 'multiresult := } - { t #2 global.max$ substring$ 't := } - if$ - } - while$ - multiresult -} - - - -FUNCTION {format.pages} -{ - pages duplicate$ empty$ - 'skip$ - { - duplicate$ multi.page.check - { - n.dashify - } - { - } - if$ - "pages" bibinfo.check - } - if$ -} - - - -FUNCTION {format.journal.pages} -{ - pages duplicate$ empty$ 'pop$ - { - swap$ duplicate$ empty$ - { - pop$ pop$ format.pages - } - { - ": " * - swap$ - n.dashify - "pages" bibinfo.check - * - } - if$ - } - if$ -} - - - -FUNCTION {format.journal.eid} -{ - eid "eid" bibinfo.check - duplicate$ empty$ - 'pop$ - { - swap$ - duplicate$ empty$ - 'skip$ - { - ": " * - } - if$ - swap$ * - numpages empty$ - 'skip$ - { - bbl.eidpp numpages tie.or.space.prefix - "numpages" bibinfo.check * * - " (" swap$ * ")" * * - } - if$ - } - if$ -} - - - -FUNCTION {format.vol.num.pages} -{ - volume field.or.null - duplicate$ empty$ - 'skip$ - { - "volume" bibinfo.check - } - if$ - number "number" bibinfo.check - duplicate$ empty$ - 'skip$ - { - swap$ - duplicate$ empty$ - { "there's a number but no volume in " cite$ * warning$ } - 'skip$ - if$ - swap$ - "~(" swap$ * ")" * - } - if$ - * - eid empty$ - { format.journal.pages } - { format.journal.eid } - if$ -} - - - -FUNCTION {format.chapter.pages} -{ - chapter empty$ - 'format.pages - { - type empty$ - { bbl.chapter } - { - type "l" change.case$ - "type" bibinfo.check - } - if$ - chapter tie.or.space.prefix - "chapter" bibinfo.check - * * - pages empty$ - 'skip$ - { bbl.comma * " " * format.pages * } - if$ - } - if$ -} - - - -FUNCTION {format.in.ed.booktitle} -{ - format.booktitle - duplicate$ empty$ - 'skip$ - { - format.bvolume - duplicate$ empty$ - 'pop$ - { bbl.comma " " * swap$ * * } - if$ - editor "editor" format.names.ed - duplicate$ empty$ - 'pop$ - { - bbl.edby capitalize " " * swap$ * - swap$ - add.period$ " " * swap$ * - } - if$ - word.in swap$ * - } - if$ -} - - - -FUNCTION {format.by} -{ - by empty$ not - { - by "by" format.names.ed - bbl.by " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.incollaborationwith} -{ - collaboration empty$ not - { - collaboration "collaboration" format.names.ed - bbl.incollaborationwith capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.commentatedby} -{ - commentator empty$ not - { - commentator "commentator" format.names.ed - bbl.commentatedby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.compiledby} -{ - compiler empty$ not - { - compiler "compiler" format.names.ed - bbl.compiledby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.edby} -{ - editor empty$ not - { - editor "editor" format.names.ed - bbl.edby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.translatedby} -{ - translator empty$ not - { - translator "translator" format.names.ed - bbl.translatedby capitalize " " * swap$ * - } - { "" } - if$ -} - - -FUNCTION {format.translateyear} -{ - translateyear empty$ not - { - translateyear - } - { "" } - if$ - before.all 'output.state := - after.sentence 'output.state := -} - - - -FUNCTION {format.introby} -{ - introduction empty$ not - { - introduction "introduction" format.names.ed - bbl.introby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.prefaceby} -{ - preface empty$ not - { - preface "preface" format.names.ed - bbl.prefaceby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.afterwordby} -{ - afterword empty$ not - { - afterword "afterword" format.names.ed - bbl.afterwordby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.thesis.type} -{ - type duplicate$ empty$ - 'pop$ - { - swap$ pop$ - "t" change.case$ "type" bibinfo.check - } - if$ -} - - - -FUNCTION {format.tr.number} -{ - number "number" bibinfo.check - type duplicate$ empty$ - { pop$ bbl.techrep } - 'skip$ - if$ - "type" bibinfo.check - swap$ duplicate$ empty$ - { pop$ "t" change.case$ } - { tie.or.space.prefix * * } - if$ -} - - - -FUNCTION {format.article.crossref} -{ - word.in - " \cite{" * crossref * "}" * -} - - - -FUNCTION {format.book.crossref} -{ - volume duplicate$ empty$ - { - "empty volume in " cite$ * "'s crossref of " * crossref * warning$ - pop$ word.in - } - { - bbl.volume - capitalize - swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * - } - if$ - " \cite{" * crossref * "}" * -} - - - -FUNCTION {format.incoll.inproc.crossref} -{ - word.in " \cite{" * crossref * "}" * -} - - - -FUNCTION {format.org.or.pub} -{ - 't := - "" - address empty$ t empty$ and + title empty$ not + { title bbl.dquote } 'skip$ - { - address "address" bibinfo.check * - t empty$ - 'skip$ - { - address empty$ - 'skip$ - { ": " * } - if$ - t * - } - if$ - } if$ } -FUNCTION {format.publisher.address} -{ - publisher "publisher" bibinfo.check format.org.or.pub -} - - - -FUNCTION {format.organization.address} -{ - organization "organization" bibinfo.check format.org.or.pub -} - - - -FUNCTION {format.organization} +FUNCTION {misc.field.title} { - organization "organization" bibinfo.check -} - - - -STRINGS {oldname} - -FUNCTION {name.or.dash} -{ - 's := - oldname empty$ - { s 'oldname := s } - { - s oldname = - { "---{}---{}---" } - { s 'oldname := s } - if$ - } - if$ -} - - - - - -% Functions to open, and close the bibitem - -INTEGERS { is.authorfa.exist } - -FUNCTION {begin.bibitem} -{ - #0 'is.authorfa.exist := - newline$ - is.language.persian - { - "\bibitem[{" write$ - label write$ - ")" make.full.names - duplicate$ short.list = - { pop$ } - { * } - if$ - "}]{" * write$ - cite$ write$ - "}" write$ - newline$ - } - { - "\begin{LTRbibitems}" write$ - "\resetlatinfont" write$ - newline$ - "\bibitem[{" write$ - label write$ - ")" make.full.names - duplicate$ short.list = - { pop$ } - { * } - if$ - "}]{" * write$ - cite$ write$ - "}" write$ - newline$ - } - if$ - "" - before.all 'output.state := -} - - - -FUNCTION {end.bibitem} -{ - add.period$ write$ - newline$ - is.language.persian + title empty$ not + { title } 'skip$ - { - "\end{LTRbibitems}" write$ - newline$ - } if$ } @@ -2735,117 +3426,172 @@ FUNCTION {end.bibitem} -% Function to format entries +% Functions to format entries based on type (compatible entries) -FUNCTION {article} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE -{ +FUNCTION {book} +{ begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check crossref missing$ { - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.edby output - new.sentence format.article.jour.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.article.crossref output.nonnull - format.pages output + new.block book.field.crossref output.nonnull } if$ } - { %%% if author is empty, proceeds with editor - editor empty$ not + { %%% if author field is empty, proceeds with compiler + compiler empty$ not { - format.editors output.nonnull + field.compiler output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check crossref missing$ { - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.article.jour.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.article.crossref output.nonnull - format.pages output + new.block book.field.crossref output.nonnull } if$ } - { %%% if author, and editor are empty, proceeds with translator - translator empty$ not + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not { - format.translators output.nonnull + field.editor output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check crossref missing$ { - new.sentence format.edby output - new.sentence format.article.jour.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.article.crossref output.nonnull - format.pages output + new.block book.field.crossref output.nonnull } if$ } - { %%% if author, editor, and translator are empty, proceeds with key - key empty$ not + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not { - format.article.journal output.nonnull + field.translator output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.by output - crossref missing$ + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not { - new.sentence format.edby output - new.sentence format.article.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ } { - format.article.crossref output.nonnull - format.pages output + "author, compiler, editor, translator, and key" output.check } if$ } - { - "author, translator, and key" output.check - } if$ } if$ @@ -2858,162 +3604,146 @@ FUNCTION {article} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE -FUNCTION {book} +FUNCTION {incollection} { begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } { %%% if author field is empty, proceeds with compiler compiler empty$ not { - format.compilers output.nonnull + field.compiler output.nonnull name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.edby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } { %%% if author, and compiler fields are empty, proceeds with editor editor empty$ not { - format.editors output.nonnull + field.editor output.nonnull name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } - { %%% if author, compiler, and editor fields are empty, proceeds with translator + { %%% if author, compiler, and editor fields are empty, proceeds with translator translator empty$ not { - format.translators output.nonnull + field.translator output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } - { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key key empty$ not { - format.title.in.books "title" output.check + field.title.emph output name.or.dash - format.date "year" output.check + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } @@ -3034,226 +3764,208 @@ FUNCTION {book} -FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE -{ - begin.bibitem - format.authors output - author format.key output - name.or.dash - format.date "year" output.check - date.block - format.title "title" output.check - new.block - howpublished "howpublished" bibinfo.check output - address "address" bibinfo.check output - format.isbn output - format.doi output - new.block - format.note output - format.eprint output - format.url output - end.bibitem -} - - - -FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +FUNCTION {article} { begin.bibitem - author empty$ - { format.editors "author and editor" output.check - editor format.key output - name.or.dash - } - { format.authors output.nonnull - name.or.dash - crossref missing$ - { "author and editor" editor either.or.check } - 'skip$ - if$ - } - if$ - format.date "year" output.check - date.block - format.btitle "title" output.check - crossref missing$ - { - format.bvolume output - format.chapter.pages output%"chapter and pages" output.check - new.block - format.number.series output - format.edition output - new.sentence - format.publisher.address output - } - { - format.chapter.pages "chapter and pages" output.check - new.block - format.book.crossref output.nonnull - } - if$ - crossref missing$ - { format.isbn output } - 'skip$ - if$ - format.doi output - new.block - format.note output - format.eprint output - format.url output - end.bibitem -} - - - -FUNCTION {incollection} -{ - begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.comment output + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output crossref missing$ { - new.sentence format.by output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.incoll.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.incoll.inproc.crossref output.nonnull + article.field.crossref output.nonnull + field.pages output } if$ } - { %%% if author field is empty, proceeds with compiler - compiler empty$ not + { %%% if author is empty, proceeds with editor + editor empty$ not { - format.compilers output.nonnull + field.editor output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.comment output + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output crossref missing$ { - new.sentence format.by output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.incoll.series.number output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.incoll.inproc.crossref output.nonnull + article.field.crossref output.nonnull + field.pages output } if$ } - { %%% if author, and compiler fields are empty, proceeds with editor - editor empty$ not + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not { - format.editors output.nonnull + field.translator output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.comment output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output crossref missing$ { - new.sentence format.by output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.incoll.series.number output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.incoll.inproc.crossref output.nonnull + article.field.crossref output.nonnull + field.pages output } if$ } - { %%% if author, compiler, and editor fields are empty, proceeds with translator - translator empty$ not + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not { - format.translators output.nonnull + article.field.journal output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title "title" output.check - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.incoll.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if author, compiler, editor, and translator fields are empty, proceeds with key - key empty$ not + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ { - format.title.in.books output - name.or.dash - format.date "year" output.check - new.sentence format.comment output - new.sentence format.by output - crossref missing$ - { - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.incoll.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { - new.block format.incoll.inproc.crossref output.nonnull - } - if$ + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - "author, compiler, editor, translator, and key" output.check + article.field.crossref output.nonnull + field.pages output } if$ } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } if$ } if$ @@ -3271,92 +3983,92 @@ FUNCTION {inproceedings} begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.inproc.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.inproc.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author field is empty, proceeds with translator translator empty$ not { - format.translators output.nonnull + field.translator output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title "title" output.check - new.sentence format.by output - new.sentence format.date output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output crossref missing$ { - new.sentence format.inproc.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.inproc.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author, and translator fields are empty, proceeds with key key empty$ not { - format.title.in.books output + field.title.emph output name.or.dash - format.date "year" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.inproc.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.inproc.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } @@ -3378,77 +4090,77 @@ FUNCTION {conference} begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.conf.series.number.pages output - new.sentence format.edby output - new.sentence format.conf.org.publisher.address output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author is empty, proceeds with translator translator empty$ not { - format.translators output.nonnull + field.translator output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title "title" output.check - new.sentence format.by output - new.sentence format.date output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output crossref missing$ { - new.sentence format.conf.series.number.pages output - new.sentence format.edby output - new.sentence format.conf.org.publisher.address output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author, and translator are empty, proceeds with key key empty$ not { - format.title.in.books output + field.title.emph output name.or.dash - format.date "year" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.conf.series.number.pages output - new.sentence format.edby output - new.sentence format.conf.org.publisher.address output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } @@ -3461,83 +4173,109 @@ FUNCTION {conference} } if$ end.bibitem - } -FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +FUNCTION {thesis} { begin.bibitem - format.authors output - author format.key output - name.or.dash - format.date "year" output.check - date.block - format.btitle "title" output.check - organization address new.block.checkb - organization "organization" bibinfo.check output - address "address" bibinfo.check output - format.edition output - format.doi output - new.block - format.note output - format.eprint output - format.url output + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ end.bibitem } -FUNCTION {format.misc.title} -{ - title empty$ not - { title } - 'skip$ - if$ -} +FUNCTION {mastersthesis} { thesis } -FUNCTION {format.howpublished} -{ - howpublished -} +FUNCTION {phdthesis} { thesis } -FUNCTION {misc} +FUNCTION {unpublished} { begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.misc.title output - new.sentence format.by output - new.sentence format.howpublished output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.year extra.label * "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } - { %%% if author is empty, proceeds with key - key empty$ not + { %%% if author is empty, proceeds with translator + translator empty$ not { - format.title.in.books output + field.translator output.nonnull name.or.dash - format.date "year" output.check - new.sentence format.by output - new.sentence format.howpublished output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translateyear extra.label * output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ } - { "author, and key" output.check } if$ } if$ @@ -3546,33 +4284,36 @@ FUNCTION {misc} -FUNCTION {thesis} +FUNCTION {misc} { begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.thesis.school.type.address output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.year extra.label * "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { %%% if author is empty, proceeds with key key empty$ not { - format.title.in.books output + field.title.emph output name.or.dash - format.date "year" output.check - new.sentence format.comment output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.year extra.label * "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { "author, and key" output.check } if$ @@ -3583,202 +4324,132 @@ FUNCTION {thesis} -FUNCTION {mastersthesis} { thesis } +% Functions to format entries based on type (incompatible entries) -FUNCTION {phdthesis} { thesis } +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} -FUNCTION {proceedings} +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE { begin.bibitem - editor empty$ not - { - format.editors output.nonnull + author empty$ + { field.editor "author and editor" output.check + editor format.key output name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.compiledby output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output } - { %%% if editor field is empty, proceeds with compiler - compiler empty$ not - { - format.compilers output.nonnull - name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if editor, and compiler fields are empty, proceeds with translator - translator empty$ not - { - format.translators output.nonnull - name.or.dash - new.sentence format.translateyear output - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.book.volume.series.number output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { - key empty$ not - { - format.title.in.books "title" output.check - name.or.dash - format.date "year" output.check - new.block format.edition output - new.sentence format.impression output - new.sentence format.book.volume.series.number output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { - "editor, compiler, translator, and key" output.check - } - if$ - } - if$ - } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ if$ } if$ + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output end.bibitem } -FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE { begin.bibitem - format.authors "author" output.check + field.author output author format.key output name.or.dash - format.date "year" output.check + field.year extra.label * "year" output.check date.block - format.btitle - "title" output.check - new.block - format.tr.number output.nonnull - institution "institution" bibinfo.warn output + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output address "address" bibinfo.check output - format.doi output + field.edition output + field.doi output new.block - format.note output - format.eprint output - format.url output + field.note output + field.eprint output + field.url output end.bibitem } -FUNCTION {format.unpub.title} +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE { - title empty$ not - { title bbl.dquote } - 'skip$ - if$ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem } -FUNCTION {unpublished} -{ - begin.bibitem - author empty$ not - { - format.authors output.nonnull - name.or.dash - format.date "year" output.check - new.block format.unpub.title output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.howpublished output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if author is empty, proceeds with translator - translator empty$ not - { - format.translators output.nonnull - name.or.dash - new.sentence format.translateyear output - new.block format.unpub.title output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.howpublished output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if author, and translator are empty, proceeds with key - key empty$ not - { - format.title.in.books output - name.or.dash - format.date "year" output.check - new.sentence format.comment output - new.sentence format.by output - new.sentence format.howpublished output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { "author, translator, and key" output.check } - if$ - } - if$ - } - if$ - end.bibitem -} +% Function to format entry if the type is not recognized FUNCTION {default.type} { misc } @@ -3806,6 +4477,7 @@ FUNCTION {default.type} { misc } READ +% Function to generate a string that is suitable for sorting purposes FUNCTION {sortify} { @@ -3815,7 +4487,7 @@ FUNCTION {sortify} -% Length of the label name of the entry +% Length of the short name label of the entry INTEGERS { len } @@ -3831,390 +4503,9 @@ FUNCTION {chop.word} -% Function to create the label name of the entry - -FUNCTION {label.and} -{ - is.language.persian - { "و" } - { - authorfa missing$ - { "and" } - { "و" } - if$ - } - if$ -} - -FUNCTION {label.etal} -{ - is.language.persian - { "و~همکاران" } - { - authorfa missing$ - { "et~al." } - { "و~همکاران" } - if$ - } - if$ -} - - - -FUNCTION {format.lab.names} -{ - 's := - authorfa empty$ - { - #0 'is.authorfa.exist := - } - { - authorfa 's := - #1 'is.authorfa.exist := - } - if$ - "" 't := - s #1 "{vv~}{ll}" format.name$ - s num.names$ #3 > - { - " " * label.etal * - } - { - s num.names$ #2 < - 'skip$ - { - s num.names$ #3 < - { - s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = - { - " " * label.etal * - } - { - bbl.comma * " " * label.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * - } - if$ - } - { - s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = - { - " " * label.etal * - } - { - bbl.comma * " " * s #2 "{vv~}{ll}" format.name$ * - bbl.comma * " " * label.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * - } - if$ - } - if$ - } - if$ - } - if$ - #0 'is.authorfa.exist := -} - - - -FUNCTION {author.key.label} -{ - author empty$ - { - key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { author format.lab.names } - if$ -} - -FUNCTION {author.editor.key.label} -{ - author empty$ - { - editor empty$ - { - key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { editor format.lab.names } - if$ - } - { author format.lab.names } - if$ -} - - - -FUNCTION {editor.key.label} -{ - editor empty$ - { - key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { - editor format.lab.names - } - if$ -} - - - -FUNCTION {article.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - editor empty$ not - { editor format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {book.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - compiler empty$ not - { compiler format.lab.names } - { - editor empty$ not - { editor format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {incoll.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - compiler empty$ not - { compiler format.lab.names } - { - editor empty$ not - { editor format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {proc.creator.label.order} -{ - editor empty$ not - { editor format.lab.names } - { - compiler empty$ not - { compiler format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ -} - -FUNCTION {conf.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {inproc.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {calc.short.authors} -{ - type$ "article" = - 'article.creator.label.order - { - type$ "book" = - 'book.creator.label.order - { - type$ "incollection" = - 'incoll.creator.label.order - { - type$ "proceedings" = - 'proc.creator.label.order - { - type$ "conference" = - 'conf.creator.label.order - { - type$ "inproceedings" = - 'inproc.creator.label.order - { - type$ "inbook" = - 'author.editor.key.label - 'author.key.label - if$ - } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - 'short.list := -} - - - -FUNCTION {calc.label} -{ - calc.short.authors - short.list - "(" - * - author empty$ not - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - compiler empty$ not - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - editor empty$ not - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - translator empty$ not - { - translateyear duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - if$ - } - if$ - } - if$ - } - if$ - * - 'label := -} - - - - - -% Functions for sort +% Functions for sorting purposes FUNCTION {sort.format.names} { @@ -4253,7 +4544,7 @@ FUNCTION {sort.format.names} -FUNCTION {sort.format.title} +FUNCTION {sort.field.title} { 't := "A " #2 @@ -4331,30 +4622,37 @@ FUNCTION {editor.sort} -FUNCTION {article.creator.sort.order} +FUNCTION {book.sort} { author empty$ not { author sort.format.names } { - editor empty$ not + compiler empty$ not { - editor sort.format.names + compiler sort.format.names } { - translator empty$ not + editor empty$ not { - translator sort.format.names + editor sort.format.names } { - key empty$ not + translator empty$ not { - key sortify + translator sort.format.names } { - "to sort, need author, editor, translator, or key in " cite$ * warning$ - "" + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ } if$ } @@ -4367,7 +4665,7 @@ FUNCTION {article.creator.sort.order} -FUNCTION {book.creator.sort.order} +FUNCTION {incoll.sort} { author empty$ not { @@ -4410,37 +4708,30 @@ FUNCTION {book.creator.sort.order} -FUNCTION {incoll.creator.sort.order} +FUNCTION {article.sort} { author empty$ not { author sort.format.names } { - compiler empty$ not + editor empty$ not { - compiler sort.format.names + editor sort.format.names } { - editor empty$ not + translator empty$ not { - editor sort.format.names + translator sort.format.names } { - translator empty$ not + key empty$ not { - translator sort.format.names + key sortify } { - key empty$ not - { - key sortify - } - { - "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ - "" - } - if$ + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" } if$ } @@ -4453,7 +4744,7 @@ FUNCTION {incoll.creator.sort.order} -FUNCTION {proc.creator.sort.order} +FUNCTION {proc.sort} { editor empty$ not { editor sort.format.names } @@ -4478,7 +4769,7 @@ FUNCTION {proc.creator.sort.order} -FUNCTION {conf.creator.sort.order} +FUNCTION {inproc.sort} { author empty$ not { author sort.format.names } @@ -4498,7 +4789,7 @@ FUNCTION {conf.creator.sort.order} -FUNCTION {inproc.creator.sort.order} +FUNCTION {conf.sort} { author empty$ not { author sort.format.names } @@ -4524,23 +4815,23 @@ FUNCTION {presort} label sortify " " * - type$ "article" = - 'article.creator.sort.order + type$ "book" = + 'book.sort { - type$ "book" = - 'book.creator.sort.order + type$ "incollection" = + 'incoll.sort { - type$ "incollection" = - 'incoll.creator.sort.order + type$ "article" = + 'article.sort { type$ "proceedings" = - 'proc.creator.sort.order + 'proc.sort { - type$ "conference" = - 'conf.creator.sort.order + type$ "inproceedings" = + 'inproc.sort { - type$ "inproceedings" = - 'inproc.creator.sort.order + type$ "conference" = + 'conf.sort { type$ "inbook" = 'author.editor.sort @@ -4564,8 +4855,7 @@ FUNCTION {presort} * " " * - title field.or.null - sort.format.title + title field.or.null sort.field.title * #1 entry.max$ substring$ 'sort.key$ := @@ -4573,10 +4863,16 @@ FUNCTION {presort} + + +% Sort process + ITERATE {presort} SORT + + STRINGS { last.label next.extra } INTEGERS { last.extra.num last.extra.num.extended last.extra.num.blank number.label } @@ -4648,49 +4944,78 @@ FUNCTION {reverse.pass} } + EXECUTE {initialize.extra.label.stuff} ITERATE {forward.pass} REVERSE {reverse.pass} + + FUNCTION {bib.sort.order} { sort.label " " * - year field.or.null sortify + translateyear empty$ + { year field.or.null sortify } + { + author empty$ not + { year field.or.null sortify } + { + compiler empty$ not + { year field.or.null sortify } + { + editor empty$ not + { year field.or.null sortify } + { + translator empty$ not + { translateyear field.or.null sortify } + { year field.or.null sortify } + if$ + } + if$ + } + if$ + } + if$ + } + if$ * " " * - title field.or.null - sort.format.title + title field.or.null sort.field.title * #1 entry.max$ substring$ 'sort.key$ := } + ITERATE {bib.sort.order} SORT + + +% Functions to create bibliography FUNCTION {begin.bib} { preamble$ empty$ 'skip$ { preamble$ write$ newline$ } if$ - "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ - "% generated by iran.bst," write$ + "% Generated by `iran.bst`." write$ newline$ - "% this bibliography style is part of the `iran-bib` package." write$ + "% This bibliography style is part of the `iran-bibtex` package." write$ newline$ - "% copyright (c) 2023 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ newline$ - "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ newline$ newline$ @@ -4699,15 +5024,15 @@ FUNCTION {begin.bib} } -EXECUTE {begin.bib} +EXECUTE {begin.bib} EXECUTE {init.state.consts} - ITERATE {call.type$} + FUNCTION {end.bib} { newline$ @@ -4716,6 +5041,7 @@ FUNCTION {end.bib} } + EXECUTE {end.bib} |