inukshuk / citeproc-ruby

A Citation Style Language (CSL) Cite Processor
101 stars 22 forks source link

URL citation #73

Closed mapreal19 closed 4 years ago

mapreal19 commented 4 years ago

Hi @inukshuk,

I'm having trouble citing a website, is this supported?

Given the following BibTeX:

@misc{noauthor_2017-xx,
  title = "Google",
  year = 2015,
  howpublished = "\url{http://www.google.com/}"
}

When I render the bibliography (using APA for instance) I receive the following item:

Google. (2015). \url{http://www.google.com/}

And I was hoping to get something in the form of:

Google. (2015). Retrieved from http://www.google.com

The howpublished attribute is not being processed?

inukshuk commented 4 years ago

There are a few steps involved here. First, it really depends on the style and what result you're expecting. I think CSL does not have a howpublished variable (unless I missed it) -- this probably needs to be accessed for your needs.

If that's the case then this is really a question for bibtex-ruby which converts your bibtex entry to citeproc/json: what is howpublished converted to? From your example, my guess is that it gets converted to url -- maybe it should be accessed by default? Another issue is the LaTeX \url{...} in there -- this is something that the latex-decode filter should ideally strip away. If you've enabled the filter, it's something we may want to fix. In any case, I think this is something that falls into the realm of bibtex-ruby.

mapreal19 commented 4 years ago

@inukshuk I'm using indeed the latex filter, I've received this value:

#<BibTeX::Value "\\urlhttp://www.google.com/">

Whereas if I don't use the filter I receive:

#<BibTeX::Value "\\url{http://www.google.com/}">

what is howpublished converted to?

It gets converted to publisher.

 "publisher"=>"\\url{http://www.google.com/}"

So maybe bibtex-ruby should pick the url within howplublished and convert it to URL?

I think this is something that falls into the realm of bibtex-ruby.

I'll create the issue there

inukshuk commented 4 years ago

latex-decode probably does not know about \url -- we could add it there (or use a custom filter).

I'm not sure about howpublished; we can't certainly map it to URL by default. We may want to inspect the value?

mapreal19 commented 4 years ago

latex-decode probably does not know about \url -- we could add it there (or use a custom filter).

Where can I make that change?

I'm not sure about howpublished; we can't certainly map it to URL by default. We may want to inspect the value?

Yeah, I was thinking something like if howpublished.include? "url{" returns true then we map it to URL, does it make sense?

mapreal19 commented 4 years ago

@inukshuk this is what I had in mind: https://github.com/inukshuk/bibtex-ruby/pull/139

I'm ignoring the latex fix for now

inukshuk commented 4 years ago

Looks good to me!

mapreal19 commented 4 years ago

awesome! when you bump a new version I'll give it a go, but I think this will just do what I expected in the first place :)

inukshuk commented 4 years ago

Done!