Add a test condition context="citation" / context="bibliography" #80

Open
fbennett opened this Issue Sep 29, 2011 · 7 comments

Comments

Projects
None yet
4 participants
Member

fbennett commented Sep 29, 2011

In note styles, the formatting of entries in cs:citation and cs:bibliography is often roughly the same, with some small adjustments to, say, the formatting of names.

If the style is composed as a set of nested groups (the simplest way to strictly avoid extraneous spaces and hanging punctuation), the elements that require tweaking can end up deep inside the nesting hierarchy. Currently the only way to create separate "citation" and "bibliography" versions of the hierarchy is to create separate versions of any macros that (eventually) call elements that need tweaking. In a complex style, that leads to a lot of cutting and pasting, and unmaintainable code.

If a test for context were available, the macros from which the hierarchy is composed could be made smarter, and the same hierarchy (encapsulated in a single macro) could be used in both contexts.

Member

fbennett commented Sep 29, 2011

Here is a patch for the schema change, from the MLZ branch. It won't apply cleanly to official CSL 1.0, but shows what what would be added:

--- a/csl.rnc
+++ b/csl.rnc
@@ -1033,6 +1033,10 @@ div {
         attribute jurisdiction {
             list { jurisdictions+ }
         }
+      |
+        ## Tests whether the statement containing the condition is being
+        ## executed inside cs:citation or cs:bibliography
+        attribute context { "citation" | "bibliography" }
     )
 }
Owner

bdarcus commented Sep 29, 2011

Can you point to a style that demonstrates this problem?
On Sep 29, 2011 5:11 PM, "Frank Bennett" <
reply@reply.github.com>
wrote:

In note styles, the formatting of entries in cs:citation and
cs:bibliography is often roughly the same, with some small adjustments to,
say, the formatting of names.

If the style is composed as a set of nested groups, which is the simplest
way to strictly avoid extraneous spaces and hanging punctuation, the
elements that require tweaking can end up deep inside the nesting hierarchy.
Currently the only way to create separate "citation" and "bibliography"
versions of the hierarchy and of any macros that (eventually) call elements
that need tweaking. In a complex style, that leads to a lot of cutting an
pasting, and unmaintainable code.

If a test for context were available, the macros from which the hierarchy
is composed could be made smarter, and the same hierarchy (encapsulated in a
single macro) could be used in both contexts.

Reply to this email directly or view it on GitHub:
#80

Member

fbennett commented Sep 30, 2011

I've run into it with OSCOLA, which is validated against a schema that prohibits leading and tailing space on affixes:

https://github.com/fbennett/mlz-styles/blob/master/mlz-oscola.csl

It's currently done with the cut-paste-and-edit approach. I've added the "context" test attribute to the extended schema, and will be refactoring it in a more compact form in a few days.

Owner

rmzelle commented Oct 1, 2011

Fine with me.

The only question I have is whether this would complicate automated style editing.

Owner

rmzelle commented Oct 26, 2011

@adam3smith, do you see (a lot of) value in this, seeing as you're our most seasoned style editor?

Owner

adam3smith commented Oct 26, 2011

I'd yield to Frank on this. I don't edit legal styles, and those are by far the most complicated note-based style. For the styles I edit (where all note-based styles are, essentially, CMoS derivatives) there is no need for and very little value in this.

Owner

bdarcus commented Oct 26, 2011

I generally have the same reaction as @rmzelle - seems reasonable enough, but I do wonder if it might have negative unintended consequences, and whether the potential benefits outweigh the potential costs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment