2 questions

Hi,

just a couple of questions:

  1. in the apsa style there is this macro:

Zotero doesn’t display anything if the variable URL is not set. I have
the feeling this is wrong, and that the real problem is an error in
the style which should be:

  1. the apa style uses the title as the author substitution. In Zotero
    the “Some Title” record, which is without the author, is rendered with
    the title in the place of the author, and no title. I find no
    reference of that in the schema. Is that correct? Does that mean that
    once I used a variable I should empy it? For instance, if I have a
    reference without author and I substitute it with the editor, the
    editor field is not to be used later?

TIA,
Andrea

Hi Andrea,

just a couple of questions:

  1. in the apsa style there is this macro:

Zotero doesn’t display anything if the variable URL is not set. I have
the feeling this is wrong

I don’t believe it is. If a variable within a group is not present,
nothing gets printed. Since the URL variable is the only one, it
cancels everything else if absent.

  1. the apa style uses the title as the author substitution. In Zotero
    the “Some Title” record, which is without the author, is rendered with
    the title in the place of the author, and no title. I find no
    reference of that in the schema. Is that correct? Does that mean that
    once I used a variable I should empy it? For instance, if I have a
    reference without author and I substitute it with the editor, the
    editor field is not to be used later?

Correct. We should put that in the schema.

Bruce

ú

Hi Andrea,

just a couple of questions:

  1. in the apsa style there is this macro:

Zotero doesn’t display anything if the variable URL is not set. I have
the feeling this is wrong

I don’t believe it is. If a variable within a group is not present,
nothing gets printed. Since the URL variable is the only one, it
cancels everything else if absent.

sorry but I still do not understand: is
not dependant on the url varaible.

This is going to be printed, and so, within that group, there is
something that is going to b e printed.

Or perhaps you are meaning that “text value” depends on the variable?
which one? and how?

I still think that the style is wrong and a “” must
be present to make “” dependant on the
value of the variable URL.

BTW, the date group is indeed not going to print anything if the
variable “accessed” is not set.

Andrea

I don’t believe it is. If a variable within a group is not present,
nothing gets printed. Since the URL variable is the only one, it
cancels everything else if absent.

sorry but I still do not understand: is
not dependant on the url varaible.

It is when it’s in a group.

This is going to be printed, and so, within that group, there is
something that is going to b e printed.

Or perhaps you are meaning that “text value” depends on the variable?
which one? and how?

I’m saying the group element adds certain processing expectations
beyond the others. If I have …

… and there’s no “medium” variable, then “foo” does not print.

I still think that the style is wrong and a “” must
be present to make “” dependant on the
value of the variable URL.

No. Let me know if the above fails to explain why.

Bruce

Sorry Bruce but I still don’t get the rule.

Suppose the following:

in this case we have a within a macro, without those
"certain processing expectations". Is “Some text” supposed to be
printed, when URL is not set?

If yes, “Available at:” is going to be printed?

In other words, can you explain the general rule, please?

Sorry if I keep bothering, but I cannot implement something I don’t
understand.

Thanks,
Andrea

Suppose the following:

in this case we have a within a macro, without those
“certain processing expectations”. Is “Some text” supposed to be
printed, when URL is not set?

Yes, b/c we’ve settled that the result of any macro call is a string,
and the “try” macro has no group or choose element. As such, it will
always return the “Some text” even if the URL is not present.

If yes, “Available at:” is going to be printed?

I would say yes, b/c the macro returns a non-empty result.

Do people agree with me here?

In other words, can you explain the general rule, please?

If people agree with me above, then we’d have to say something like:

Descendants or other formatting related content (for example, prefix
or suffiix attributes) of a cs:group element are printed only where at
least one macro or variable call returns non-null results.

Let me know if people agree with the basic idea or not, and whether if
you do you can suggest better language.

Sorry if I keep bothering, but I cannot implement something I don’t
understand.

Sure; no problem.

Bruce

I would say that this rule is just too complicated. The only affected
element, here, is “text value”. Since “if variable” is there to check
the existence of a variable, if you want to link a “text value” to the
presence of a variable, this can be done by using “if variable”.

“text value” should just do what is supposed to do, print out a
string, and not behave accordingly to the context it is in. And the
same “group”: if some content is produced, no matter how, within a
"group" element, the group prefix, suffix and formatting should be
used for that content.

I really do not see the point of this rule. It makes the
implementation uselessly complicated.

My 2 cents,
Andrea

does this apply to every variable. names and dates included?

Thanks,
Andrea

I believe cs:group was introduced prior to cs:choose and cs:macro, and
so in part accounts for its presence. Getting rid of it would cause
problems, so I wouldn’t be willlng to consider that unless all of us
agreed a) it was a good idea, and b) that we’d fix the existing styles
that use it.

WRT to implementation, as I see it, the group element is (mostly*)
syntactic sugar for:

… where the group in question is:

So WRT to your code, you don’t need to do anything to supoprt the
conditional logic; you just need to write (what I assume is a little)
code to create the correct conditional statement.

Right?

If yes, is that REALLY particularly difficult? If it is, then how?

Bruce

  • “Mostly” b/c there’s also the delimiter attribute.

Yes, though I can’t imagine a case where you’d substitute dates. The
common substitutions are title and secondary contributor roles (like
editor).

Bruce

WRT to implementation, as I see it, the group element is (mostly*)
syntactic sugar for:

...

I came to notice that now that I had a closer look to a greater number
of styles.

So WRT to your code, you don’t need to do anything to supoprt the
conditional logic; you just need to write (what I assume is a little)
code to create the correct conditional statement.

Right?

If I understand the logic of the rule, if a group does evaluate to
nothing after removing and then nothing will
be printed.

If yes, is that REALLY particularly difficult? If it is, then how?

This is not REALLY difficult, just a few more lines of code. A bit
uglier if you let me say that: it duplicates the conditional
and I didn’t understand the reason. Now I think I’ve got it. Sorry for
taking so long…:wink:

Andrea

The more I think about it and the more I believe this rule is just bad
design. Take a look at the APSA style:

If the variable “accessed” is set, then

<group prefix="[“suffix=”]">

will evaluate to something, and so

will be printed even though the URL variable is not set. I’m sure you
agree with that.

You may say that “accessed” cannot be set if “URL” is not set. But you
are developing a citation style language, which should produce a
predictable output even with strange reference data. Instead, with
this kind of approach, you need to relay on the well-formedness (or
correctness, or coherence, call it as you want) of the reference data
you are displaying.

I’m really puzzled, and while I already have the code for implementing
your rule (I just check what happens to the group when
and are removed from the group’s children), I’m not sure
I’m going to keep it. I think that in pandoc a style like that should
just be considered a buggy style.

I’d really like to hear the opinion of the authors of the other
implementations.

Please let me know.

Andrea

What I meant is not that the rule is bad design, but that the
rule can lead to badly designed styles. Sorry.

andrea

I’m ambivalent at this stage - still working through the details of the
implementation. The “syntactical sugar” is sufficiently beneficial in my
mind, through I appreciate your point here.

Regards,

Liam.2008/7/7 Andrea Rossato <@Andrea_Rossato1>:

The more I think about it and the more I believe this rule is just bad
design. Take a look at the APSA style:

If the variable “accessed” is set, then

<group prefix=“[“suffix=”]”>

will evaluate to something, and so

will be printed even though the URL variable is not set. I’m sure you
agree with that.

I do, but an item that has an access date without a URL doesn’t make
much sense; it’s effectively a data error.

I think you’re highlighting here a hypothetical, rather than
practical, problem. I expect this macro will work pretty well in
practice.

You may say that “accessed” cannot be set if “URL” is not set.

Well, I wouldn’t say that formally, but yes.

But you are developing a citation style language, which should produce a
predictable output even with strange reference data. Instead, with
this kind of approach, you need to relay on the well-formedness (or
correctness, or coherence, call it as you want) of the reference data
you are displaying.

Sure, but I don’t see how cs:group is any particular problem. If we
removed it, you’d still see this sort of thing (using cs:choose); the
CSL code would just be more complex.

I’m really puzzled, and while I already have the code for implementing
your rule (I just check what happens to the group when
and are removed from the group’s children), I’m not sure
I’m going to keep it. I think that in pandoc a style like that should
just be considered a buggy style.

If you can’t correctly process a valid style, I’d say you have a buggy
implementation :wink:

Seriously, though, I’m not understanding your response here. I’ve
explained to you the rule, and you’ve implemented without much effort.
This sort of stuff works (in, for example, Zotero) fine. Why on earth
would you want to remove code??

I’d really like to hear the opinion of the authors of the other
implementations.

Yeah: Liam? Johan?

Bruce

[…]

I’m really puzzled, and while I already have the code for implementing
your rule (I just check what happens to the group when
and are removed from the group’s children), I’m not sure
I’m going to keep it. I think that in pandoc a style like that should
just be considered a buggy style.

Just to try to explain myself a bit clearer, I think that if you agree
with me that here “Available at:” gets printed when “accessed” is set,
and so that the rule applies to and only,
which must be removed before evaluating a group to check if it is
going to produce something, this would be fine for me.

Sorry if I keep bothering with this problem, which seems to be the
last step to an almost working implementation…
:wink:

Andrea

Sorry my fault, but the problem is that I’m developing the
implementation on quite hypothetical data and when I tried out apsa
with an “accessed” set, but without the URL, I thought my
implementation was bugged and that I did not correctly understood the
rule …

I’ve spent far too many hours in getting the last stuff together in
the last few days and I’m getting tired.

I’ll start cleaning up the code for a commit.

Thanks for your kind attention.

Andrea

I’ve added a test case variant on Bruce’s example to the citeproc-rb tree,
and attached it as well as the small JSON file he posted a while back.
For the second entry there is a title but no URL - so the test I’ve written
effectively looks like:

assert(first_group_results.empty?)
assert_equal(“The words ‘Splitting the Difference’ appear in the citation.”,
second_group_results)

Hope this helps - is there a better place to begin placing CSL test files?

Regards,

Liam.

test_groups.csl (895 Bytes)

csl_test_data.json (1.55 KB)