I am using biblio on a site to be able to reference papers from many different nodes easily (a bit like in a paper, but linking to the paper's page instead). For this, I make nice URLs manually, so that I can do the links without looking them up every time. Is there any chance to get biblio integrated with pathauto so I could access certain fields, like the last name of the first author, the year, etc. Also, if there was a citation key (like in BibTeX), that would work for me as the main part of the URL, too. My reference URLs would then look like this: references/[citekey].html, and the citekey would look like Lastname_Conference_2004 (i.e., I could use the right abbreviations that a program would never be able to figure out).

Comments

cirotix’s picture

I second you on this feature. I am building the same king of website where manual pretty url is not possible because of the size of the DB. Your solution would be very neat.

rjerome’s picture

I just finished the bibtex integration, and am adding a citekey field to the db, so I just have to figure a way to bring it all together.

eagereyes’s picture

Here is something URL-related that I thought I wouldn't start another issue for: would it be difficult to have the bibliography show up under a different URL than /biblio? Sure, I can make a URL alias for it, but all filters still use /biblio. It would be great if that could be customized.

rjerome’s picture

That should be relatively easy, I'll look into it.

Ron.

rjerome’s picture

You can now define the "base" url for biblio on the admin/settings/biblio page. So if you prefer /pubs to list all your publications, just enter pubs in the textfield and all the links will reference that base URL.

It will default to the same /biblio if no value is entered.

eagereyes’s picture

Sorry for not replying to this earlier, I tried it out some time ago. This is a wonderful feature, thank you!

cirotix’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

Hi Ron,

Is there any progress done on the citekey field? I am looking at the code (27/01 version) and can't find anything in the db.
I see that in the bibtex_export function there is a biblio_cite field but can't find any reference to it otherwise.

BTW your module is really fantastic, and even more fantastic are the possibilities offered by it.

What I would like to see and am willing to contribute to is (most of those features are already required by others but I summarize them here by order of importance for me):

a- the possibility the add a citekey field, possibly imported from a bibtex file (I don't know the other formats)

b- the possibility to access a single publication with an url like biblio/citekey/$value_of_the_citekey

c- a filter that would take all the publications cited in a node and display them at the end of the node (needs a)
For example something such as:

  Check this article biblio-cite(article1) and this one biblio-cite(article2)
  

Would be rendered in

  Check the article [1] and this one [2]

  Bibliography
  [1] Ron Jerome, How I have written a fantastic module, Drupal Handbook (2007)
  [2] Ron Jerome, The biblio module handbook, www.drupal.org (2007)
  

Idealy the reference style (number, alpha, etc...) should be configurable. But it is not very important and I guess number is easier to implement. The style of the biblio is of course the same as the one in the global configuration

d- the possibility to group several publications together and displayed them nicely.

e- the possibility to access a group of publications with an url such as biblio/group/$name_of_the_group

I can think to thousands of other things but I think that it is quite a lot for now.
What I really need is c).
I am willing to contribute (and even to write all the code for this) but as I have read that you have some plans for a) I would like to know more about them.
b) is trivial once you have a)

I am ready to discuss more in details all the points, should you want to.

Let me know and thanks again for this fantastic module

rjerome’s picture

Hi Damien,

I made a start on your list. Items a) and b) are done, with the caveat that citekeys are currently not checked for duplicates when they are inserted, so it's possible to have duplicate keys. I will have to add a routine to make sure that the keys are unique. I am thinking that for entries which don't provide a citekey, one would be created.

I don't think the citation filter will be a big deal, but I haven't started coding it yet.

I'm not quite sure what you mean by grouping of citations or how you would want to categorize them? Do you think this could be achieved with taxonomy?

Any way, give the citekey stuff a try and let me know what you think.

Ron.

cirotix’s picture

StatusFileSize
new768 bytes

Hi Ron,

I am very impressed by the speed of the reaction! I do appreciate.

I have give a try to the citekey feature. A few comments:

- The import works very well. As you have mentioned it doesn't check for duplicate. I think that it should happened an alpha increment if the key already exists. Something such as jerome2006, jerome2006a, jerome2006b,... It is common practice in bibtex (at least for me :) ) It a duplicate is found and a new key is generated it should be made clear to the user, by printing a message giving the new key for the specific publication. I guess that all this discussion could be part of a larger problem of bibliography DB: the management of duplicates. This is fare from easy as it happen very often that the same publication is cited in 2 different ways. I guess some regexp magic can do it. I will think a little bit to that and let you know

- I can't find a way to manually add/change the citekey of the publication. It seems to be possible to choose the key only from a bibtex import. Is that true? Also the citekey is not displayed on the publication view.

- the biblio/citekey/ works very well.

About the grouping, I guess that yes taxonomy should work for it. My idea is to have the possibility to link to a group of publication.
Let say that I have a large bibliography on Sound and Music Computing (my field actually :) ) and I want to have the following groupings:

  • Sound Synthesis
    • Physical Models
    • Spectral Models
  • Sound Effects
    • Time domain effects
    • Frequencey domain effects

I want to categorize my publications within this taxonomy so yes indeed the taxonomy is the good solution. I will give it a try and see if that fits my needs.

On a side note I have a patch for bibtex.php.
First of all I have toggled the ability to removes the curly braces of the strings. In bibtex if you want to protect the case in the titles you have to write either:
a) {My {T}itle is {G}ood}
b) {{My Title is Good}}

the b) case was managed correctly but a) not (the curly braces was not removed)

Then the _removeCurlyBraces was buggy (wrong variable and wrong regular expression) and was not managing the case {{M}y {T}itle is {G}ood}. It was giving {M}y Title is Good

The patch is attached.

I have a final small point to discuss. It seems that you are coding drupal functions in bibtex.php like bib2node. IMO it would be better to have all the drupal specific bits in biblio.module. AFAIK bibtex.php is coming from the work of several peoples working on php publication databases. Forking it will make the upgrade to possible future versions more difficult. And also it could be nice to propagate your (or mine) modifications to the original authors of bibtex.php
so that every one can benefits for them. Of course this is only my opinion. It is perfectly fine if it is better for you (and probably it is) the way you are doing it know.

damien

cirotix’s picture

Me again.

Taxonomy works well to cluster the publications but the problem is the visual rendering. You see the list of the publications as a list of nodes and not as a bibliography page (such as the one you have at the url /biblio).
I think that there are 2 possibilities to solve that:

  • be able to filter on taxonomy and have an url like biblio/taxonomy/$taxonomy_value
  • use the view.module, once your data will be exposed to the module

damien

cirotix’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new734 bytes

Another patch.
There was a small bug in the bibtex export (calling biblio_cite instead of biblio_citekey)

I am working on the options and comments setting on the import . In _biblio_import you have:

$node['type'] = "biblio";
      $node['created'] = time();
      $node['changed'] = time();
      $node['comment'] = ;
      $node['promote'] = 0;
      $node['moderate'] = 0;
      $node['sticky'] = 0;
      $node['format'] = 0;
      $node['status'] = 1;

It would be nicer to be have the same options as the one defined in the nodes type setting (admin/content/types/biblio).

As far as I understand, I should do something like this:

variable_get('comment_biblio, COMMENT_NODE_READ_WRITE)

but it always return me the default value (COMMENT_NODE_READ_WRITE).

Do you have any ideas? Sorry for the dumb question but I am very new to Drupal programing.

damien

rjerome’s picture

Status: Reviewed & tested by the community » Active

Hey Damien,

By default, the "citekey" entry box is not on, you can enable it for individual types or all types by going to the admin/settings/biblio/types/edit page and scrolling down to the bottom of the page and checking it as common to all types.

Thanks for the patch, I haven't looked at it yet, but I will. I'm actually beginning to think that this particular bibtex parser may not have been the best choice. I was considering changing to one found here http://bibliophile.sourceforge.net. I think it might be a little more robust. I'll give it a try and let you know what I think.

With respect the the grouping, I think with a little work the taxonomy module could be our friend here. Otherwise I would be just recreating much of it's functionality. I need to look into what interfaces are available to connect the two modules.

rjerome’s picture

Hi Damien,

That comment setting should work, but there seems to be a missing closing single quote (maybe a typo in your post) you had
variable_get('comment_biblio, COMMENT_NODE_READ_WRITE)

should be

variable_get('comment_biblio', COMMENT_NODE_READ_WRITE)

cirotix’s picture

Yes I knew bibliophile. I use to develop on phpBibMan [0] (which is dead now) and have a site running it that I plan to convert to drupal with your module. It could be a good option. But except for the curly braces I didn't have any problem with bibtex.php in your module.

About variable_get('comment_biblio', COMMENT_NODE_READ_WRITE); it was my mistake not to write it correctly in my comment but it is correctly written in the code. Still it doesn't grab me the variable. I will investigate a little bit more.

damien
[0] http://phpbibman.sourceforge.net/

eagereyes’s picture

Hey, great to see lots of new stuff happening! Is there anything special I need to do when upgrading? I just tried out 4.7.x-2.3, but I get errors when accessing /biblio and trying to add biblio items:

Unknown column 'visible' in 'where clause' query: SELECT t.* FROM drupal_biblio_types as t WHERE tid > -2 AND visible = 1 in /[...]/includes/database.mysql.inc on line 121.

Invalid argument supplied for foreach() in /[...]/includes/form.inc on line 664.

Unknown column 'b.vid' in 'on clause' query: SELECT COUNT(*) FROM drupal_node n left join drupal_biblio b on n.vid=b.vid WHERE n.type='biblio' AND n.status=1 in /[...]/includes/database.mysql.inc on line 121.

Reverted back to 4.7.x-1.x-dev for the moment, but I would love to have the "pathauto" functionality described above. Is there a chance to change the prefix (i.e., /biblio/citekey/)? I already have a bunch of references under a different URL scheme. I am also adding a .html at the end ...

rjerome’s picture

Sounds like you didn't run the update.php script after you installed the new module.

The "citekey" URL will use whatever "base" you set for biblio, so basically you can set the base to blaa and then use /blaa/citekey. Assuming that's what you mean by "change the prefix"

Ron.

eagereyes’s picture

update.php was it, thank you. For some reason I thought that it would be run automagically when re-enabling the module.

As for the citekey/pathauto: What I meant was a separate URL for the citekey, so that I can have my list of papers under /biblio, but single papers are under /references/<citekey>.html. I wonder if making the relevant information available to pathauto would be a good way to go, since that is already quite flexible, and there would be less duplication of effort.

pathscollide’s picture

It looks like this thread got a little off track (but with some positive side effects ;-)

Like eagereyes, I am very interested in the original question -- is it possible to expose the citekey field to pathauto, so I can construct a path pattern for my biblio references like this: bibliography/entries/[citekey]?

This way we avoid having to manually create all our paths, we get nice paths that don't say things like node/473, and we aren't forced to use the node title in the path, which sometimes gets a bit long.

By the way, I'm using biblio-4.7.x-2.x-dev (think I downloaded it on March 25), and the bibliography/citekey/whoever2006 feature doesn't work (note that I have changed the base URL in my biblio settings). All I get is the following message, every time: "Sorry, citekey: citekey not found."

pathscollide’s picture

StatusFileSize
new478 bytes

OK, here is what I have implemented for my own purposes. If you drop this file into your pathauto/contrib folder, you will be able to define path aliases that include the citekey field. (File attached - don't forget to remove the .txt extension).

I should point out that on my site, I have made citekey a required field for all entry types and have put autocomplete on it, so I can do partially-automated duplicate checking (since, at least in my version of biblio, there is no duplicate checking on citekeys).

Note also that hook_pathauto_node, which I am using here, will soon be deprecated as pathauto joins forces with the token module (further info here: http://groups.drupal.org/node/3830).

rjerome’s picture

Thanks,

I was just looking at the pathauto API and it doesn't look like it would be to big a deal to implement. I'll take what you submitted and flesh it out a bit, then report back on this thread when it's available. Unfortunately, the time I have available to work on this project has been somewhat limited lately and it is likely to continue to be that way for another month or two.

Ron.

janusman’s picture

I've gone ahead and built a patch for 5.x-1.15 to include some biblio fields with the TOKEN module (which is now the way to have tokens for pathauto). Please review.

--- biblio.module_orig	2008-06-04 10:53:15.131560000 -0500
+++ biblio.module	2008-06-04 12:16:27.048103000 -0500
@@ -3748,3 +3748,41 @@
   return $pubs;
 
 }
+
+/**
+ * Implementation of hook_token_list() for og specific tokens
+ */
+function biblio_token_list($type = 'all') {
+  if ($type == 'node') {
+    $tokens['node']['biblio_year']          = t("Biblio: Publication year");
+    $tokens['node']['biblio_authors']      = t("Biblio: Authors");
+    $tokens['node']['biblio_type_id']      = t("Biblio: Type ID (e.g.: 100)");
+    $tokens['node']['biblio_type']      = t("Biblio: Type Name (e.g.: book)");
+    return $tokens;
+  }
+}
+
+/**
+ * Implementation of hook_token_values() for og specific tokens
+ */
+function biblio_token_values($type, $object = NULL) {
+  switch ($type) {
+    case 'node':
+      if ($object->type == "biblio") {
+        $type = db_result(db_query('SELECT name FROM {biblio_types} as t WHERE t.tid = %d',$object -> biblio_type));
+        #$title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $gid));
+        $values['biblio_year'] = check_plain($object -> biblio_year);
+        $values['biblio_authors'] = check_plain($object -> biblio_authors);
+        $values['biblio_type_id'] = check_plain($object -> biblio_type);
+        $values['biblio_type'] = check_plain($type);
+        return $values;
+      }
+      break;   
+  }
+
+  // No group info found. Return defaults.
+  $values['biblio_year'] = '';
+  $values['biblio_authors'] = '';
+  $values['biblio_type'] = '';
+  return $values;
+}

rjerome’s picture

Great thanks,

I just committed it to CVS.

Ron

Anonymous’s picture

Hopefully for 6.x too? :-) I didn't find it in the dev version from today. Definitely a great feature! Thanks, janusman!

rjerome’s picture

This is a tiny bit trickier in 6.x with regards to author names. Not having used this feature at all my question would be, do you need all the author names in the token or perhaps just the first author?

Ron.

Anonymous’s picture

Personally, I would just use title and year and the moment :-) But I guess having only the first author would be better than nothing for a first version of this feature!

ar-jan’s picture

I second the request for a 6.x implementation of Biblio fields explosed to PathAuto/Token. For me first author, year, title would also be fine (I would use the (first) author). And thanks again for great module!

ntripcevich’s picture

I'm wondering if there's some way to truncate [biblio_authors] field to the last name only?
Maybe cut it off at the first space in the [biblio_authors] field?
Currently I'm using
biblio/[biblio_authors]-[biblio_year]
and the result is long URLs that have lastname-firstname-year.

E.g., http://sitename.com/biblio/aramaki-shigeo-onuma-naoki-portillo-felix-1984
but I'd rather have
http://sitename.com/biblio/aramaki1984
and for multiple pubs in a year...
http://sitename.com/biblio/aramaki1984a
http://sitename.com/biblio/aramaki1984b
(as discussed above)

Ultimately I'd like to be able to have hyperlinked references from a Drupal Book imported from HTML via HTML2Book, but I need a predictable way to point hyperlinks at citations. Maybe citekey is the way to go... I'll check on that too, though I don't want to have to add one manually. Thanks

ar-jan’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

Bumping this since you're working on D6 version now...
And changing to 6.x since it's implemented for 5.x.

rjerome’s picture

Token hooks for Pathauto support have been added to 6.x.

The tokens are the same as in 5.x...

    $tokens['node']['biblio_year']          = t("Biblio: Publication year");
    $tokens['node']['biblio_authors']      = t("Biblio: Authors");
    $tokens['node']['biblio_type_id']      = t("Biblio: Type ID (e.g.: 100)");
    $tokens['node']['biblio_type']      = t("Biblio: Type Name (e.g.: book)");
ar-jan’s picture

Status: Active » Fixed

(I used the feature without problem so I guess that's fixed)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pathscollide’s picture

Status: Closed (fixed) » Active

Hi there,

Would it be possible to add a token for the citekey field, as mentioned a few times in this thread? That way we can use the citekey with Pathauto.

Thanks for all the changes and improvements to this great module.

rjerome’s picture

Will do, I usually update the issue with a link to the CVS commit when it's done, but poke me again if I forget.

Ron.

rjerome’s picture

Status: Active » Fixed

Added citekey token... http://drupal.org/cvs?commit=317424

Ron.

pathscollide’s picture

Thanks so much!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.