[LyX/master] Improve on-screen representation with MLA style

Juergen Spitzmueller spitz at lyx.org
Thu Jul 11 11:39:34 UTC 2024


commit 29b36dd0b85326f8675bb9deb903ac2f9bd0da9f
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Jul 11 13:38:22 2024 +0200

    Improve on-screen representation with MLA style
    
    This style is quite unique, so we need to accommodate that
---
 lib/citeengines/biblatex-natbib.citeengine | 22 ++++++++++++++--------
 lib/citeengines/biblatex.citeengine        | 22 ++++++++++++++--------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/lib/citeengines/biblatex-natbib.citeengine b/lib/citeengines/biblatex-natbib.citeengine
index b0848f5108..8c034b9bed 100644
--- a/lib/citeengines/biblatex-natbib.citeengine
+++ b/lib/citeengines/biblatex-natbib.citeengine
@@ -187,18 +187,20 @@ CiteFormat default
 	!makeauthor {%ifstar%[[%!fullciteauthor%]][[%!abbrvciteauthor%]]}
 	# "prenote "
 	!textbefore {%textbefore%[[%textbefore% ]]}
+	# Separator before textafter
+	!tasep {%ifstyle:mla,mla-strict,mla-new,mla7%[[]][[,]]}
 	# ", postnote"
-	!textafter {%textafter%[[, %textafter%]]}
+	!textafter {%textafter%[[%!tasep% %textafter%]]}
 	# "prenote " (for qualified lists)
 	!ctextbefore {%curpretext%[[%curpretext% ]]}
 	# ", postnote" (for qualified lists)
-	!ctextafter {%curposttext%[[, %curposttext%]]}
+	!ctextafter {%curposttext%[[%!tasep% %curposttext%]]}
 	# Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
 	!makeyear {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
 	# Add a year if it exists (else "??") and indicate a possible modifier (as in 2017[a])
 	!myear {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}
 	# Add a shorthand if it exists else myear (see above)
-	!shmyear {%shorthand%[[%shorthand%]][[%!myear%]]}
+	!shmyear {%shorthand%[[%shorthand%]][[{%ifstyle:mla,mla-strict,mla-new,mla7%[[%!makeshorttitle%]][[%!myear%]]}]]}
 	# Add a year if it exists (else "??") without any modifier at all
 	!byear {%year%[[%year%]][[??]]}
 	# Add a shorttitle or title if it exists (else "??")
@@ -254,16 +256,20 @@ CiteFormat authoryear
 	# MACROS
 	#
 	!open (
+	!tcopen {%ifstyle:mla,mla-strict,mla-new,mla7%[[]][[(]]}
 	!sep ;
 	!close )
+	!tcclose {%ifstyle:mla,mla-strict,mla-new,mla7%[[]][[)]]}
 	!aysep {%ifstyle:apa%[[,]]}
 
+	# Title (with MLA), else year
+	!mkyear {%ifstyle:mla,mla-strict,mla-new,mla7%[[, %!makeshorttitle%]][[%!makeyear%]]}
 	# "cf. Author et. al Year..."
-	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor%%!aysep% %!makeyear%%!endlink%%!ctextafter%%!nextcite%
+	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor%%!aysep% %!mkyear%%!endlink%%!ctextafter%%!nextcite%
 	# "cf. Author et. al Year..."
-	!makepcite %!ctextbefore%%!startlink%%!abbrvpciteauthor%%!aysep% %!makeyear%%!endlink%%!ctextafter%%!nextpcite%
+	!makepcite %!ctextbefore%%!startlink%%!abbrvpciteauthor%%!aysep% %!mkyear%%!endlink%%!ctextafter%%!nextpcite%
 	# "Author et al. (cf. Year..."
-	!makecitet %!startlink%%!makeauthor%%!endlink% %!open%%!textbefore%%!makeyear%%!nextcitet%
+	!makecitet %!startlink%%!makeauthor%%!endlink% %!tcopen%%!textbefore%%!mkyear%%!nextcitet%
 	# "cf. Author et al. Year..."
 	!makecitealt %!textbefore%%!startlink%%!makeauthor% %!makeyear%%!endlink%%!nextcitealt%
 	# "Author et al., Year..."
@@ -274,7 +280,7 @@ CiteFormat authoryear
 	# "...; Nextauthor Year..."
 	!nextpcite {%next%[[%!sep% %!makepcite%]]}
 	# "...), [and] Nextauthor (Year..."
-	!nextcitet {%next%[[%!close%%!smartsep%%!startlink%%!makeauthor%%!endlink% %!open%%!makeyear%%!nextcitet%]]}
+	!nextcitet {%next%[[%!tcclose%%!smartsep%%!startlink%%!makeauthor%%!endlink% %!tcopen%%!mkyear%%!nextcitet%]]}
 	# "...; NextAuthor et al. Year..."
 	!nextcitealt {%next%[[%!sep% %!startlink%%!makeauthor% %!makeyear%%!endlink%%!nextcitealt%]]}
 	# "...; NextAuthor et al., Year..."
@@ -287,7 +293,7 @@ CiteFormat authoryear
 	#
 
 	# "Author (cf. Year),[ and] NextAuthor (Year, p. xx)"
-	citet %!makecitet%%!textafter%%!close%
+	citet %!makecitet%%!textafter%%!tcclose%
 	# "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
 	citep %!open%%!textbefore%%!makepcite%%!textafter%%!close%
 	# "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
diff --git a/lib/citeengines/biblatex.citeengine b/lib/citeengines/biblatex.citeengine
index c69806d153..0d77bc811c 100644
--- a/lib/citeengines/biblatex.citeengine
+++ b/lib/citeengines/biblatex.citeengine
@@ -192,18 +192,20 @@ CiteFormat default
 	!makeauthor {%ifstar%[[%!forceabbrvciteauthor%]][[%!abbrvciteauthor%]]}
 	# "prenote "
 	!textbefore {%textbefore%[[%textbefore% ]]}
+	# Separator before textafter
+	!tasep {%ifstyle:mla,mla-strict,mla-new,mla7%[[]][[,]]}
 	# ", postnote"
-	!textafter {%textafter%[[, %textafter%]]}
+	!textafter {%textafter%[[%!tasep% %textafter%]]}
 	# "prenote " (for qualified lists)
 	!ctextbefore {%curpretext%[[%curpretext% ]]}
 	# ", postnote" (for qualified lists)
-	!ctextafter {%curposttext%[[, %curposttext%]]}
+	!ctextafter {%curposttext%[[%!tasep% %curposttext%]]}
 	# Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
 	!year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
 	# Add a year if it exists (else "??") and indicate a possible modifier (as in 2017[a])
 	!myear {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}
 	# Add a shorthand if it exists else myear (see above)
-	!shmyear {%shorthand%[[%shorthand%]][[%!myear%]]}
+	!shmyear {%shorthand%[[%shorthand%]][[{%ifstyle:mla,mla-strict,mla-new,mla7%[[%!makeshorttitle%]][[%!myear%]]}]]}
 	# Add a year if it exists (else "??") without any modifier at all
 	!byear {%year%[[%year%]][[??]]}
 	# Add a shorttitle or title if it exists (else "??")
@@ -242,23 +244,27 @@ CiteFormat authoryear
 	# MACROS
 	#
 	!open (
+	!tcopen {%ifstyle:mla,mla-strict,mla-new,mla7%[[]][[(]]}
 	!sep ;
 	!close )
+	!tcclose {%ifstyle:mla,mla-strict,mla-new,mla7%[[]][[)]]}
 	!aysep {%ifstyle:apa%[[,]]}
 
+	# Title (with MLA), else year
+	!makeyear {%ifstyle:mla,mla-strict,mla-new,mla7%[[, %!makeshorttitle%]][[%!year%]]}
 	# "cf. Author et. al Year..."
-	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor%%!aysep% %!year%%!endlink%%!ctextafter%%!nextcite%
+	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor%%!aysep% %!makeyear%%!endlink%%!ctextafter%%!nextcite%
 	# "cf. Author et. al Year..."
-	!makepcite %!ctextbefore%%!startlink%%!abbrvpciteauthor%%!aysep% %!year%%!endlink%%!ctextafter%%!nextpcite%
+	!makepcite %!ctextbefore%%!startlink%%!abbrvpciteauthor%%!aysep% %!makeyear%%!endlink%%!ctextafter%%!nextpcite%
 	# Author et al. (cf. Year...
-	!maketextcite {%ifqualified%[[%!textbefore%]]}%!startlink%%!abbrvciteauthor%%!endlink% %!open%{%ifqualified%[[%!ctextbefore%]][[%!textbefore%]]}%!year%%!ctextafter%%!nexttextcite%
+	!maketextcite {%ifqualified%[[%!textbefore%]]}%!startlink%%!abbrvciteauthor%%!endlink% %!tcopen%{%ifqualified%[[%!ctextbefore%]][[%!textbefore%]]}%!makeyear%%!ctextafter%%!nexttextcite%
 
 	# "...; Nextauthor Year..."
 	!nextcite {%next%[[%!sep% %!makecite%]]}
 	# "...; Nextauthor Year..."
 	!nextpcite {%next%[[%!sep% %!makepcite%]]}
 	# "...); Nextauthor (Year..."
-	!nexttextcite {%next%[[%!close%%!smartsep%%!startlink%%!abbrvciteauthor%%!endlink% %!open%%!ctextbefore%%!year%%!ctextafter%%!nexttextcite%]]}
+	!nexttextcite {%next%[[%!tcclose%%!smartsep%%!startlink%%!abbrvciteauthor%%!endlink% %!tcopen%%!ctextbefore%%!makeyear%%!ctextafter%%!nexttextcite%]]}
 
 	# Add a year if it exists (else title, else "??") and possibly a modifier (as in 2017a)
 	!yeartitle {%year%[[%year%{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}]][[{%title%[[%title%]][[??]]}]]}
@@ -276,7 +282,7 @@ CiteFormat authoryear
 	# "cf. Author A Year; Author B Year, p. xx"
 	cite %!textbefore%%!makecite%%!textafter%
 	# "cf. Author A (Year),[ and] Author B (Year, p. xx)"
-	citet %!maketextcite%%!textafter%%!close%
+	citet %!maketextcite%%!textafter%%!tcclose%
 	# "(cf. Author A Year; Author B Year, p. xx)"
 	citep %!open%%!textbefore%%!makepcite%%!textafter%%!close%
 	# This prints year or title, if year is missing


More information about the lyx-cvs mailing list