Detecting specific strings

Hi everyone,

I’ve run into a fairly specific problem; I’m creating a citation style for a specific university, and they have their own rules for citing their own content (lectures, etc), and I wish to differentiate these cites from other similar cites that originate from other websites.

I’m unsure how to do this, my first thought is to check for specific strings in the URL, as most, if not all of their content will come from one of their own URLs.

Any suggestions on how to do this? if I am missing something specific that detects strings within a cite, I would appreciate any assistance in learning further.

This obviously does not pertain to the setup of citeproc, etc in my own website, but how to ellicit this functionality from a CSL file, so other academics can cite efficiently.

Thank you in advance

Sorry, that won’t work. CSL doesn’t let you test against specific strings. Your only options are to either use specific item types or test for the presence of a specific variable reserverd (by you) for that purpose. (Also, of course, this is a terrible rule and they shouldn’t be doing this).

Ahh right, the custom variable seems interesting. I’m fairly new to this, so please forgive me, but how does that work?

Sorry, shouldn’t be doing what?

You’d pick a variable or combination of variables only used for items in that category, so something like

<if variable="annote" match="any">

if you need the style available through the official style repository, this must be a valid CSL variable. (otherwise you can also make up variables. At least Zotero/citeproc-js are fine with those.

As for what they shouldn’t do: come up with separate citation rules for documents from their institution. There’s no reason for this and it means that you’ll have inconsistent citations of the same type of items depending on where a document was authored as well as inconsistent citations of the same item depending on where an author happens to be. It’s a bad idea.

Ahh, ok. Might need to think of another way, to achieve this. Are there any plans to implement such functionality? Or at least something similar?

Yes, I can see your point. Would a more palatable alternative be that the institution lists themselves as a publisher instead, and use CSL accordingly?

String matching? Not in the near future. There have been some discussions about making CSL more extensible, including things like this, but that all has costs in terms of performance and portability and I’m not sure we’re particularly close.

Interesting - I’ve never heard of a university doing that kind of thing. I had always believed that each department or school would use standardised forms of citation, such as Chicago or APA, depending on their field.

That would be better all around, but sadly is not even close to the reality.