biborb-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [biborb-general] bibtex export


From: Guillaume Gardey
Subject: Re: [biborb-general] bibtex export
Date: Wed, 08 Feb 2006 21:22:14 +0100

88Hi,

The bibtex export is defined in the php file bibtex.php (function
array_to_bibtex_string). The export is no longer made with xsl
transformations. So you can modify this function to tune your needs.

For instance, the following php code may be a quick basic solution to
protect upper case letters in title.

function array_to_bibtex_string($tab,$fields_to_export){
  $export = "";
  foreach($tab as $entry){
    $entry_exported = "";
    $export .= "@".$entry['___type']."{".$entry['id'];
    foreach($fields_to_export as $field){
      if(array_key_exists($field,$entry)){
        $data = $entry[$field];
        // protect upper case
        if($field == 'title'){
          $data = preg_replace("/(\p{Lu}+)/","{\\1}", data);
        }
        $export .= ",\n";
        if($entry[$field][0] != "#"){
          $export .= "\t".$field." = {".$data."}";
        }
        else{
          $export .= "\t".$field." = ".substr($data,1);
        }
      }
    }
    $export .= "\n}\n";
  }
  return $export;
}

... but it won't detect if upper case letters are already protected...

All the best
Guillaume


Le lundi 06 février 2006 à 09:33 +0100, Daniel Niederloehner a écrit :
> Dear BibORB users,
> 
> I tested BibORB now for a while and found a point to enhance the Bibtex
> export:
> The contents of the title field could be enclosed in additionally curly
> parenthesis (to keep upper case words correctly).
> 
> Maybe there is one out there, who had a similar idea and a solution?
> Or does someone has an idea how to achieve this behavior? I'm no
> specialist in xsl/xml and therefore was lost, when looking into the
> sources...
> 
> 
> Thanks, Daniel
> 
> 
> 
> _______________________________________________
> Biborb-general mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/biborb-general
> 

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]