mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Compute and output numbers for numerical citations.
This commit is contained in:
parent
183b188ebe
commit
bfc731de45
@ -30,7 +30,7 @@ CiteFormat default
|
||||
!startlink {!<a href='#LyXCite-%clean:key%'>!}
|
||||
!endlink {!</a>!}
|
||||
|
||||
!cite %!startlink%{%label%[[%label%]][[#%key%]]}%!endlink%%!nextcite%
|
||||
!cite %!startlink%{%label%[[%label%]][[{%numericallabel%[[%numericallabel%]][[#%key%]]}]]}%!endlink%%!nextcite%
|
||||
|
||||
!nextcite {%next%[[%!sep% %!cite%]]}
|
||||
!nexthashkey {%next%[[%!sep% #%key%%!nexthashkey%]]}
|
||||
|
@ -89,15 +89,15 @@ CiteFormat numerical
|
||||
!sep ,
|
||||
!close ]
|
||||
|
||||
!citet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%#%key%%!endlink%]]}%!nextcitet%
|
||||
!citealt %!abbrvauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%#%key%%!endlink%]]}%!nextcitealt%
|
||||
!citet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
|
||||
!citealt %!abbrvauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%
|
||||
|
||||
!hashkey {%dialog%[[#ID]][[%!startlink%#%key%%!endlink%%!nexthashkey%]]}
|
||||
!hashkey {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
|
||||
|
||||
!nextcitet {%next%[[%!close%%!sep% %!citet%]]}
|
||||
!nextcitealt {%next%[[%!sep% %!citealt%]]}
|
||||
!nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
|
||||
!nexthashkey {%next%[[%!sep% %!startlink%#%key%%!endlink%%!nexthashkey%]]}
|
||||
!nexthashkey {%next%[[%!sep% %!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
|
||||
|
||||
cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
|
||||
citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
|
||||
|
@ -682,6 +682,8 @@ docstring BibTeXInfo::getValueForKey(string const & oldkey, Buffer const & buf,
|
||||
ret = label_;
|
||||
else if (key == "modifier" && modifier_ != 0)
|
||||
ret = modifier_;
|
||||
else if (key == "numericallabel")
|
||||
ret = cite_number_;
|
||||
else if (key == "abbrvauthor")
|
||||
// Special key to provide abbreviated author names.
|
||||
ret = getAbbreviatedAuthor(buf, false);
|
||||
|
@ -4313,8 +4313,10 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
|
||||
DocumentClass const & textclass = master->params().documentClass();
|
||||
|
||||
// do this only if we are the top-level Buffer
|
||||
if (master == this)
|
||||
if (master == this) {
|
||||
textclass.counters().reset(from_ascii("bibitem"));
|
||||
reloadBibInfoCache();
|
||||
}
|
||||
|
||||
// keep the buffers to be children in this set. If the call from the
|
||||
// master comes back we can see which of them were actually seen (i.e.
|
||||
|
@ -204,6 +204,9 @@ void InsetBibitem::read(Lexer & lex)
|
||||
|
||||
docstring InsetBibitem::bibLabel() const
|
||||
{
|
||||
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||
if (bp.citeEngineType() == ENGINE_TYPE_NUMERICAL)
|
||||
return autolabel_;
|
||||
docstring const & label = getParam("label");
|
||||
return label.empty() ? autolabel_ : label;
|
||||
}
|
||||
@ -307,6 +310,17 @@ void InsetBibitem::collectBibKeys(InsetIterator const & it) const
|
||||
BibTeXInfo keyvalmap(false);
|
||||
keyvalmap.key(key);
|
||||
keyvalmap.label(label);
|
||||
|
||||
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||
Counters & counters = bp.documentClass().counters();
|
||||
docstring const bibitem = from_ascii("bibitem");
|
||||
if (bp.citeEngineType() == ENGINE_TYPE_NUMERICAL || getParam("label").empty()) {
|
||||
if (counters.hasCounter(bibitem))
|
||||
counters.step(bibitem, InternalUpdate);
|
||||
string const & lang = it.paragraph().getParLanguage(bp)->code();
|
||||
keyvalmap.setCiteNumber(counters.theCounter(bibitem, lang));
|
||||
}
|
||||
|
||||
DocIterator doc_it(it);
|
||||
doc_it.forwardPos();
|
||||
keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(
|
||||
@ -321,7 +335,7 @@ void InsetBibitem::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||
Counters & counters = bp.documentClass().counters();
|
||||
docstring const bibitem = from_ascii("bibitem");
|
||||
if (getParam("label").empty()) {
|
||||
if (bp.citeEngineType() == ENGINE_TYPE_NUMERICAL || getParam("label").empty()) {
|
||||
if (counters.hasCounter(bibitem))
|
||||
counters.step(bibitem, utype);
|
||||
string const & lang = it.paragraph().getParLanguage(bp)->code();
|
||||
|
Loading…
Reference in New Issue
Block a user