mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Support MLA's \autocite variants
This commit is contained in:
parent
08c0377f0c
commit
369c871609
@ -92,7 +92,8 @@ CiteEngine authoryear
|
||||
citeyear[][]=cite*
|
||||
citebyear[][]=citeyear
|
||||
Footcite$[][]=smartcite
|
||||
Autocite$[][]
|
||||
!mla,mla-strict,mla-new,mla7@Autocite$|mlaautocite[][]
|
||||
mla,mla-strict,mla-new,mla7@Mlaautocite|autocite*<!_mlaautocitestar!_mlaautocitetooltip>$[][]=autocite
|
||||
citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
|
||||
!mla,mla-strict,mla-new,mla7@fullcite[][]
|
||||
footfullcite[][]
|
||||
@ -154,6 +155,8 @@ CiteFormat default
|
||||
# GUI strings for the starred commands
|
||||
_citetitlestar F&orce full title[[Possible substitute to All aut&hors]]
|
||||
_citetitlestartooltip Use full title even if shorttitle exists
|
||||
_mlaautocitestar Omit aut&hors[[Possible substitute to All aut&hors]]
|
||||
_mlaautocitestartooltip Omit authors or editors in the citation
|
||||
# The following are handled by BiblioInfo
|
||||
B_etal et al.
|
||||
B_namesep , [[separate author names in citation, except for last name]]
|
||||
@ -314,6 +317,9 @@ CiteFormat authoryear
|
||||
# 1. APA
|
||||
# "cf. Author A Year; Author B Year, p. xx"
|
||||
nptextcite %!textbefore%%!makepcite%%!textafter%
|
||||
# 2. MLA
|
||||
# "Auto: (cf. Author A Year; Author B Year, p. xx)"
|
||||
mlaautocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makepcite%%!textafter%%!close%
|
||||
End
|
||||
|
||||
CiteFormat numerical
|
||||
|
@ -84,7 +84,8 @@ CiteEngine authoryear
|
||||
citeyear[][]=cite*
|
||||
citebyear[][]=citeyear
|
||||
Footcite$[][]=smartcite
|
||||
Autocite$[][]
|
||||
!mla,mla-strict,mla-new,mla7@Autocite$|mlaautocite[][]
|
||||
mla,mla-strict,mla-new,mla7@Mlaautocite|autocite*<!_mlaautocitestar!_mlaautocitetooltip>$[][]=autocite
|
||||
citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
|
||||
!mla,mla-strict,mla-new,mla7@fullcite[][]
|
||||
footfullcite[][]
|
||||
@ -146,6 +147,8 @@ CiteFormat default
|
||||
_citeauthorstartooltip Force a short author list (using et al.)
|
||||
_citetitlestar F&orce full title[[Possible substitute to All aut&hors]]
|
||||
_citetitlestartooltip Use full title even if shorttitle exists
|
||||
_mlaautocitestar Omit aut&hors[[Possible substitute to All aut&hors]]
|
||||
_mlaautocitestartooltip Omit authors or editors in the citation
|
||||
# The following are handled by BiblioInfo
|
||||
B_etal et al.
|
||||
B_namesep , [[separate author names in citation, except for last name]]
|
||||
@ -300,6 +303,9 @@ CiteFormat authoryear
|
||||
# 1. APA
|
||||
# "cf. Author A Year; Author B Year, p. xx"
|
||||
nptextcite %!textbefore%%!makepcite%%!textafter%
|
||||
# 2. MLA
|
||||
# "Auto: (cf. Author A Year; Author B Year, p. xx)"
|
||||
mlaautocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makepcite%%!textafter%%!close%
|
||||
End
|
||||
|
||||
CiteFormat numerical
|
||||
|
@ -379,7 +379,7 @@ def revert_biblatex_chicago(document):
|
||||
|
||||
|
||||
def revert_nptextcite(document):
|
||||
"""Revert \\nptextcite to ERT"""
|
||||
"""Revert \\nptextcite and MLA's autocite variants to ERT"""
|
||||
|
||||
# 1. Get cite engine
|
||||
engine = "basic"
|
||||
@ -400,6 +400,13 @@ def revert_nptextcite(document):
|
||||
return
|
||||
|
||||
# 4. Convert \nptextcite to ERT
|
||||
new_citations = {
|
||||
"nptextcite": "nptextcite",
|
||||
"mlaautocite": "autocite",
|
||||
"Mlaautocite": "Autocite",
|
||||
"mlaautocite*": "autocite*",
|
||||
"Mlaautocite*": "Autocite*",
|
||||
}
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, "\\begin_inset CommandInset citation", i)
|
||||
@ -416,7 +423,7 @@ def revert_nptextcite(document):
|
||||
i = j + 1
|
||||
continue
|
||||
cmd = get_value(document.body, "LatexCommand", k)
|
||||
if cmd == "nptextcite":
|
||||
if cmd in list(new_citations.keys()):
|
||||
pre = get_quoted_value(document.body, "before", i, j)
|
||||
post = get_quoted_value(document.body, "after", i, j)
|
||||
key = get_quoted_value(document.body, "key", i, j)
|
||||
@ -424,7 +431,7 @@ def revert_nptextcite(document):
|
||||
document.warning("Citation inset at line %d does not have a key!" % (i))
|
||||
key = "???"
|
||||
# Replace known new commands with ERT
|
||||
res = "\\nptextcite"
|
||||
res = "\\" + new_citations[cmd]
|
||||
if pre:
|
||||
res += "[" + pre + "]"
|
||||
if post:
|
||||
|
Loading…
Reference in New Issue
Block a user