mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-31 07:45:44 +00:00
Dynamically set final punctuation of bib entries
Fullcite does not need the punct.
This commit is contained in:
parent
53654b430e
commit
dbbefcd321
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Author: Richard Heck <rgheck@comcast.net>
|
# Author: Richard Heck <rgheck@comcast.net>
|
||||||
|
|
||||||
Format 62
|
Format 63
|
||||||
|
|
||||||
CiteFormat default
|
CiteFormat default
|
||||||
# translatable bits
|
# translatable bits
|
||||||
@ -12,7 +12,7 @@ CiteFormat default
|
|||||||
_numtext no.
|
_numtext no.
|
||||||
_in in
|
_in in
|
||||||
|
|
||||||
# macros
|
# Macros
|
||||||
!pages {%pages%[[, %_pptext% %pages%]]}
|
!pages {%pages%[[, %_pptext% %pages%]]}
|
||||||
!authoredit {%author%[[%author%, ]][[{%editor%[[%editor%, %_edtext%, ]]}]]}
|
!authoredit {%author%[[%author%, ]][[{%editor%[[%editor%, %_edtext%, ]]}]]}
|
||||||
!volnum {%volume%[[ %_voltext% %volume%, {%number%[[%_numtext% %number%]]}]]}
|
!volnum {%volume%[[ %_voltext% %volume%, {%number%[[%_numtext% %number%]]}]]}
|
||||||
@ -21,11 +21,13 @@ CiteFormat default
|
|||||||
!emphjournal {!<i>!}{%journal%[[%journal%]][[{%journaltitle%[[%journaltitle%]]}]]}{!</i>!}
|
!emphjournal {!<i>!}{%journal%[[%journal%]][[{%journaltitle%[[%journaltitle%]]}]]}{!</i>!}
|
||||||
!location {%address%[[%address%: ]][[{%location%[[%location%: ]]}]]}
|
!location {%address%[[%address%: ]][[{%location%[[%location%: ]]}]]}
|
||||||
|
|
||||||
!insomething %author%, %!quotetitle%, %_in%{%editor%[[ %editor%, %_edtext%,]]} {!<i>!}%booktitle%{!</i>!}%!volnum%{%edition%[[ %edition%]]} (%!location%%publisher%, %year%)%!pages%.{%note%[[ %note%]]}
|
# Entry types. Note that final punctuation will be added later, if needed.
|
||||||
|
|
||||||
article %author%, %!quotetitle%, %!emphjournal% {%volume%[[ %volume%{%number%[[, %number%]]}]]} (%year%)%!pages%.{%note%[[ %note%]]}
|
!insomething %author%, %!quotetitle%, %_in%{%editor%[[ %editor%, %_edtext%,]]} {!<i>!}%booktitle%{!</i>!}%!volnum%{%edition%[[ %edition%]]} (%!location%%publisher%, %year%)%!pages%{%note%[[. %note%]]}
|
||||||
|
|
||||||
!booklike %!authoredit%%!emphtitle%%!volnum%{%edition%[[ %edition%]]} (%!location%%publisher%, %year%).{%note%[[ %note%]]}
|
article %author%, %!quotetitle%, %!emphjournal% {%volume%[[ %volume%{%number%[[, %number%]]}]]} (%year%)%!pages%{%note%[[. %note%]]}
|
||||||
|
|
||||||
|
!booklike %!authoredit%%!emphtitle%%!volnum%{%edition%[[ %edition%]]} (%!location%%publisher%, %year%){%note%[[. %note%]]}
|
||||||
book %!booklike%
|
book %!booklike%
|
||||||
collection %!booklike%
|
collection %!booklike%
|
||||||
proceedings %!booklike%
|
proceedings %!booklike%
|
||||||
@ -33,7 +35,7 @@ CiteFormat default
|
|||||||
incollection %!insomething%
|
incollection %!insomething%
|
||||||
inproceedings %!insomething%
|
inproceedings %!insomething%
|
||||||
|
|
||||||
!theses %author%, %title% (%!location%{%school%[[%school%]][[%institution%]]}, %year%).{%note%[[ %note%]]}
|
!theses %author%, %title% (%!location%{%school%[[%school%]][[%institution%]]}, %year%){%note%[[. %note%]]}
|
||||||
thesis %!theses%
|
thesis %!theses%
|
||||||
phdthesis %!theses%
|
phdthesis %!theses%
|
||||||
mastersthesis %!theses%
|
mastersthesis %!theses%
|
||||||
|
@ -788,7 +788,7 @@ docstring BibTeXInfo::getValueForKey(string const & oldkey, Buffer const & buf,
|
|||||||
CiteEngineType const engine_type = buf.params().citeEngineType();
|
CiteEngineType const engine_type = buf.params().citeEngineType();
|
||||||
DocumentClass const & dc = buf.params().documentClass();
|
DocumentClass const & dc = buf.params().documentClass();
|
||||||
docstring const & format =
|
docstring const & format =
|
||||||
from_utf8(dc.getCiteFormat(engine_type, to_utf8(entry_type_)));
|
from_utf8(dc.getCiteFormat(engine_type, to_utf8(entry_type_), false));
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
ret = expandFormat(format, xrefs, counter, buf, ci, false, false);
|
ret = expandFormat(format, xrefs, counter, buf, ci, false, false);
|
||||||
} else if (key == "textbefore")
|
} else if (key == "textbefore")
|
||||||
@ -1000,7 +1000,7 @@ docstring const BiblioInfo::getLabel(vector<docstring> keys,
|
|||||||
|
|
||||||
CiteEngineType const engine_type = buf.params().citeEngineType();
|
CiteEngineType const engine_type = buf.params().citeEngineType();
|
||||||
DocumentClass const & dc = buf.params().documentClass();
|
DocumentClass const & dc = buf.params().documentClass();
|
||||||
docstring const & format = from_utf8(dc.getCiteFormat(engine_type, style, "cite"));
|
docstring const & format = from_utf8(dc.getCiteFormat(engine_type, style, true, "cite"));
|
||||||
docstring ret = format;
|
docstring ret = format;
|
||||||
vector<docstring>::const_iterator key = keys.begin();
|
vector<docstring>::const_iterator key = keys.begin();
|
||||||
vector<docstring>::const_iterator ken = keys.end();
|
vector<docstring>::const_iterator ken = keys.end();
|
||||||
|
@ -1815,10 +1815,12 @@ Layout const & DocumentClass::htmlTOCLayout() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const & DocumentClass::getCiteFormat(CiteEngineType const & type,
|
string const DocumentClass::getCiteFormat(CiteEngineType const & type,
|
||||||
string const & entry, string const & fallback) const
|
string const & entry, bool const punct, string const & fallback) const
|
||||||
{
|
{
|
||||||
static string default_format = "{%author%[[%author%, ]][[{%editor%[[%editor%, ed., ]]}]]}\"%title%\"{%journal%[[, {!<i>!}%journal%{!</i>!}]][[{%publisher%[[, %publisher%]][[{%institution%[[, %institution%]]}]]}]]}{%year%[[ (%year%)]]}{%pages%[[, %pages%]]}.";
|
string default_format = "{%author%[[%author%, ]][[{%editor%[[%editor%, ed., ]]}]]}\"%title%\"{%journal%[[, {!<i>!}%journal%{!</i>!}]][[{%publisher%[[, %publisher%]][[{%institution%[[, %institution%]]}]]}]]}{%year%[[ (%year%)]]}{%pages%[[, %pages%]]}";
|
||||||
|
if (punct)
|
||||||
|
default_format += ".";
|
||||||
|
|
||||||
map<CiteEngineType, map<string, string> >::const_iterator itype = cite_formats_.find(type);
|
map<CiteEngineType, map<string, string> >::const_iterator itype = cite_formats_.find(type);
|
||||||
if (itype == cite_formats_.end())
|
if (itype == cite_formats_.end())
|
||||||
@ -1828,6 +1830,8 @@ string const & DocumentClass::getCiteFormat(CiteEngineType const & type,
|
|||||||
it = itype->second.find(fallback);
|
it = itype->second.find(fallback);
|
||||||
if (it == itype->second.end())
|
if (it == itype->second.end())
|
||||||
return default_format;
|
return default_format;
|
||||||
|
if (punct)
|
||||||
|
return it->second + ".";
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,8 +485,9 @@ public:
|
|||||||
/// returns true if the class has a ToC structure
|
/// returns true if the class has a ToC structure
|
||||||
bool hasTocLevels() const;
|
bool hasTocLevels() const;
|
||||||
///
|
///
|
||||||
std::string const & getCiteFormat(CiteEngineType const & type,
|
std::string const getCiteFormat(CiteEngineType const & type,
|
||||||
std::string const & entry, std::string const & fallback = "") const;
|
std::string const & entry, bool const punct = true,
|
||||||
|
std::string const & fallback = "") const;
|
||||||
///
|
///
|
||||||
std::string const & getCiteMacro(CiteEngineType const & type,
|
std::string const & getCiteMacro(CiteEngineType const & type,
|
||||||
std::string const & macro) const;
|
std::string const & macro) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user