# conditional? effects on design?

**URL:** <https://discourse.citationstyles.org/t/conditional-effects-on-design/221>\
**Category:** CSL Development\
**Created:** [September 19, 2006, 7:22pm UTC](https://discourse.citationstyles.org/t/conditional-effects-on-design/221 "2006-09-19T19:22:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [September 19, 2006, 7:22pm UTC](https://discourse.citationstyles.org/t/conditional-effects-on-design/221/1 "2006-09-19T19:22:58Z")

</div>

Simon,

Did you get a chance to look into the conditional I added to the schema?

Also, you mentioned it simplifies things. Am wondering with where we’re  
at what a clean design for a CSL implementation (and maybe API)?

The API issue is important, BTW, in part because of intersections with  
word-processors. Like OOo has a bib API; figuring out an API for this  
processing is in part about figuring out how to fit it into OOo.

Was just looking again at how I had been doing the Ruby port, and  
wondering is something simpler would work; like starting with …

# reads a CSL file and creates an object

class CSL  
attr\_reader :meta, :general, :citation, :bibliography  
def initialize(meta=[], general=[], citation=[], bibliography=[])  
@meta = meta  
@general = general  
@citation = citation  
@bibliography = bibliography  
end  
end

class Template  
attr\_reader :name, :fields  
def initialize(name=nil, fields=[])  
@name = name  
@fields = fields  
end  
end

class Field  
attr\_reader :name, :style, :prefix, :suffix, :substitute  
def initialize(name=nil, style=nil, prefix=nil, suffix=nil,  
substitute=nil)  
@name = name  
@style = style  
@prefix = prefix  
@suffix = suffix  
@substitute = substitute  
end  
end

---

<div class="post-metadata">

**Author:** ![Simon\_Kornblith](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Simon\_Kornblith](https://discourse.citationstyles.org/u/Simon_Kornblith)\
**Post date:** [September 19, 2006, 10:43pm UTC](https://discourse.citationstyles.org/t/conditional-effects-on-design/221/2 "2006-09-19T22:43:54Z")

</div>

> Simon,
> 
> Did you get a chance to look into the conditional I added to the schema?

I haven’t gotten around to implement it yet (I’m quite busy at the moment),  
but it looks fine.

> Also, you mentioned it simplifies things. Am wondering with where we’re  
> at what a clean design for a CSL implementation (and maybe API)?
> 
> The API issue is important, BTW, in part because of intersections with  
> word-processors. Like OOo has a bib API; figuring out an API for this  
> processing is in part about figuring out how to fit it into OOo.
> 
> Was just looking again at how I had been doing the Ruby port, and  
> wondering is something simpler would work; like starting with …
> 
> # reads a CSL file and creates an object
> 
> class CSL  
> attr\_reader :meta, :general, :citation, :bibliography  
> def initialize(meta=, general=, citation=, bibliography=)  
> @meta = meta  
> @general = general  
> @citation = citation  
> @bibliography = bibliography  
> end  
> end
> 
> class Template  
> attr\_reader :name, :fields  
> def initialize(name=nil, fields=)  
> @name = name  
> @fields = fields  
> end  
> end
> 
> class Field  
> attr\_reader :name, :style, :prefix, :suffix, :substitute  
> def initialize(name=nil, style=nil, prefix=nil, suffix=nil,  
> substitute=nil)  
> @name = name  
> @style = style  
> @prefix = prefix  
> @suffix = suffix  
> @substitute = substitute  
> end  
> end

My API is more of a mess than I’d like it to be, but I’d be happy if we  
could develop a good object-oriented system to replace it that wouldn’t  
result in too much of a speed hit. I would suggest that a standard API  
separate the generation of the bibliography from the generation of  
individual citations. To do this, the API would probably need to separate  
the parsing of the CSL file from the creation of the citations and  
bibliography as well.

In addition, the API should provide an easy way to create a system that  
generates citations and updates the bibliography incrementally (if a user  
creates a new citation from a GUI, it won’t be necessary to completely  
regenerate all citations within the document). This functionality should not  
be mandatory, and doesn’t even have to be formalized, but the model should  
allow for such extension.

I’ll try to provide some more thoughts on this later.

Simon

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [September 19, 2006, 11:05pm UTC](https://discourse.citationstyles.org/t/conditional-effects-on-design/221/3 "2006-09-19T23:05:11Z")

</div>

> > Did you get a chance to look into the conditional I added to the  
> > schema?
> 
> I haven’t gotten around to implement it yet (I’m quite busy at the  
> moment),  
> but it looks fine.

OK, when you get a break, we can just hook it up, integrate whatever  
into the styles, and be done hopefully.

> I would suggest that a standard API separate the generation of the  
> bibliography from the generation of individual citations. To do this,  
> the API would probably need to separate  
> the parsing of the CSL file from the creation of the citations and  
> bibliography as well.

Yeah, that’s what I was thinking.

Also, WRT to OOo, we had a discussion yesterday with some managers and  
engineers at Sun, and we chatted just a short bit about the processing.  
Basically, what they are thinking is that the formatter sends some  
pre-rendered chunks (maybe even the final string) to Writer, which just  
inserts it into the citation and bibliography fields.

But we need to figure out exactly how that works, so we can get the  
proper citation rendering (in author-date styles, for example, ibid,  
etc.).

> In addition, the API should provide an easy way to create a system that  
> generates citations and updates the bibliography incrementally (if a  
> user  
> creates a new citation from a GUI, it won’t be necessary to completely  
> regenerate all citations within the document). This functionality  
> should not  
> be mandatory, and doesn’t even have to be formalized, but the model  
> should  
> allow for such extension.
> 
> I’ll try to provide some more thoughts on this later.

No rush; just want us to keep in view.

WRT to OOo, our process is basically a) finish the ODF metadata work,  
and b) evaluate the existing bib API to see where we need it enhanced.  
But b is not a huge rush given a.

Bruce
