You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
3.3 KiB

  1. <?php
  2. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  3. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  4. // original author(s).
  5. //
  6. // This code is distributed in the hope that it will be useful,
  7. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  8. // License for more details.
  9. //
  10. // File: ./includes/export.inc.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/includes/export.inc.php $
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 09-May-06, 15:34
  15. // Modified: $Date: 2007-02-17 01:10:14 +0000 (Sat, 17 Feb 2007) $
  16. // $Author: msteffens $
  17. // $Revision: 894 $
  18. // This file contains functions
  19. // that are used when exporting
  20. // records from the database.
  21. include 'includes/transtab_refbase_bibtex.inc.php'; // include refbase markup -> BibTeX search & replace patterns
  22. if (($convertExportDataToUTF8 == "no") AND ($contentTypeCharset != "UTF-8")) // variables '$convertExportDataToUTF8' & '$contentTypeCharset' are defined in 'ini.inc.php'
  23. include_once 'includes/transtab_latin1_bibtex.inc.php'; // include Latin1 -> LaTeX/BibTeX translation table
  24. else
  25. include_once 'includes/transtab_unicode_bibtex.inc.php'; // include Unicode -> LaTeX/BibTeX translation table
  26. // --------------------------------------------------------------------
  27. // This function takes a BibTeX file (as generated by bibutils) and
  28. // converts any contained refbase markup into proper LaTeX/BibTeX markup:
  29. function standardizeBibtexOutput($bibtexSourceText)
  30. {
  31. global $contentTypeCharset; // these variables are defined in 'ini.inc.php'
  32. global $convertExportDataToUTF8;
  33. // The array '$transtab_refbase_bibtex' contains search & replace patterns for conversion from refbase markup to LaTeX/BibTeX markup & entities.
  34. // Converts refbase fontshape markup (italic, bold) into LaTeX commands of the 'textcomp' package, super- and subscript as well as greek
  35. // letters get converted into the respective commands in math mode. You may need to adopt the LaTeX markup to suit your individual needs.
  36. global $transtab_refbase_bibtex; // defined in 'transtab_refbase_bibtex.inc.php'
  37. // The arrays '$transtab_latin1_bibtex' and '$transtab_unicode_bibtex' provide translation tables for best-effort conversion of higher ASCII
  38. // characters from ISO-8859-1 (or Unicode, respectively) to LaTeX/BibTeX entities.
  39. global $transtab_latin1_bibtex; // defined in 'transtab_latin1_bibtex.inc.php'
  40. global $transtab_unicode_bibtex; // defined in 'transtab_unicode_bibtex.inc.php'
  41. // Perform search & replace actions on the given BibTeX text:
  42. $bibtexSourceText = searchReplaceText($transtab_refbase_bibtex, $bibtexSourceText, true); // function 'searchReplaceText()' is defined in 'include.inc.php'
  43. // Attempt to convert higher ASCII chars that were NOT converted by bibutils to their corresponding LaTeX/BibTeX entities:
  44. if (($convertExportDataToUTF8 == "no") AND ($contentTypeCharset != "UTF-8"))
  45. $bibtexSourceText = searchReplaceText($transtab_latin1_bibtex, $bibtexSourceText, false);
  46. else
  47. $bibtexSourceText = searchReplaceText($transtab_unicode_bibtex, $bibtexSourceText, false);
  48. return $bibtexSourceText;
  49. }
  50. // --------------------------------------------------------------------
  51. ?>