mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +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%'>!}
|
!startlink {!<a href='#LyXCite-%clean:key%'>!}
|
||||||
!endlink {!</a>!}
|
!endlink {!</a>!}
|
||||||
|
|
||||||
!cite %!startlink%{%label%[[%label%]][[#%key%]]}%!endlink%%!nextcite%
|
!cite %!startlink%{%label%[[%label%]][[{%numericallabel%[[%numericallabel%]][[#%key%]]}]]}%!endlink%%!nextcite%
|
||||||
|
|
||||||
!nextcite {%next%[[%!sep% %!cite%]]}
|
!nextcite {%next%[[%!sep% %!cite%]]}
|
||||||
!nexthashkey {%next%[[%!sep% #%key%%!nexthashkey%]]}
|
!nexthashkey {%next%[[%!sep% #%key%%!nexthashkey%]]}
|
||||||
|
@ -89,15 +89,15 @@ CiteFormat numerical
|
|||||||
!sep ,
|
!sep ,
|
||||||
!close ]
|
!close ]
|
||||||
|
|
||||||
!citet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%#%key%%!endlink%]]}%!nextcitet%
|
!citet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
|
||||||
!citealt %!abbrvauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%#%key%%!endlink%]]}%!nextcitealt%
|
!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%]]}
|
!nextcitet {%next%[[%!close%%!sep% %!citet%]]}
|
||||||
!nextcitealt {%next%[[%!sep% %!citealt%]]}
|
!nextcitealt {%next%[[%!sep% %!citealt%]]}
|
||||||
!nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
|
!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%
|
cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
|
||||||
citep %!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_;
|
ret = label_;
|
||||||
else if (key == "modifier" && modifier_ != 0)
|
else if (key == "modifier" && modifier_ != 0)
|
||||||
ret = modifier_;
|
ret = modifier_;
|
||||||
|
else if (key == "numericallabel")
|
||||||
|
ret = cite_number_;
|
||||||
else if (key == "abbrvauthor")
|
else if (key == "abbrvauthor")
|
||||||
// Special key to provide abbreviated author names.
|
// Special key to provide abbreviated author names.
|
||||||
ret = getAbbreviatedAuthor(buf, false);
|
ret = getAbbreviatedAuthor(buf, false);
|
||||||
|
@ -4313,8 +4313,10 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
|
|||||||
DocumentClass const & textclass = master->params().documentClass();
|
DocumentClass const & textclass = master->params().documentClass();
|
||||||
|
|
||||||
// do this only if we are the top-level Buffer
|
// do this only if we are the top-level Buffer
|
||||||
if (master == this)
|
if (master == this) {
|
||||||
|
textclass.counters().reset(from_ascii("bibitem"));
|
||||||
reloadBibInfoCache();
|
reloadBibInfoCache();
|
||||||
|
}
|
||||||
|
|
||||||
// keep the buffers to be children in this set. If the call from the
|
// 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.
|
// 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
|
docstring InsetBibitem::bibLabel() const
|
||||||
{
|
{
|
||||||
|
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||||
|
if (bp.citeEngineType() == ENGINE_TYPE_NUMERICAL)
|
||||||
|
return autolabel_;
|
||||||
docstring const & label = getParam("label");
|
docstring const & label = getParam("label");
|
||||||
return label.empty() ? autolabel_ : label;
|
return label.empty() ? autolabel_ : label;
|
||||||
}
|
}
|
||||||
@ -307,6 +310,17 @@ void InsetBibitem::collectBibKeys(InsetIterator const & it) const
|
|||||||
BibTeXInfo keyvalmap(false);
|
BibTeXInfo keyvalmap(false);
|
||||||
keyvalmap.key(key);
|
keyvalmap.key(key);
|
||||||
keyvalmap.label(label);
|
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);
|
DocIterator doc_it(it);
|
||||||
doc_it.forwardPos();
|
doc_it.forwardPos();
|
||||||
keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(
|
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();
|
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||||
Counters & counters = bp.documentClass().counters();
|
Counters & counters = bp.documentClass().counters();
|
||||||
docstring const bibitem = from_ascii("bibitem");
|
docstring const bibitem = from_ascii("bibitem");
|
||||||
if (getParam("label").empty()) {
|
if (bp.citeEngineType() == ENGINE_TYPE_NUMERICAL || getParam("label").empty()) {
|
||||||
if (counters.hasCounter(bibitem))
|
if (counters.hasCounter(bibitem))
|
||||||
counters.step(bibitem, utype);
|
counters.step(bibitem, utype);
|
||||||
string const & lang = it.paragraph().getParLanguage(bp)->code();
|
string const & lang = it.paragraph().getParLanguage(bp)->code();
|
||||||
|
Loading…
Reference in New Issue
Block a user