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.

93 lines
4.2 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/transtab_refbase_html.inc.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/includes/transtab_refbase_html.inc.php $
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 28-May-06, 18:24
  15. // Modified: $Date: 2008-10-30 17:19:48 +0000 (Thu, 30 Oct 2008) $
  16. // $Author: msteffens $
  17. // $Revision: 1288 $
  18. // Search & replace patterns for conversion from refbase markup to HTML markup & entities. Converts refbase fontshape markup (italic, bold, underline)
  19. // and super- and subscript into HTML commands, greek letters get converted into the respective HTML entity codes.
  20. // Search & replace patterns must be specified as perl-style regular expression and search patterns must include the leading & trailing slashes.
  21. global $patternModifiers; // defined in 'transtab_unicode_charset.inc.php' and 'transtab_latin1_charset.inc.php'
  22. $transtab_refbase_html = array(
  23. "/__(?!_)(.+?)__/" => "<u>\\1</u>", // the pattern for underline (__...__) must come before the one for italic (_..._)
  24. "/_(.+?)_/" => "<i>\\1</i>",
  25. "/\\*\\*(.+?)\\*\\*/" => "<b>\\1</b>",
  26. "/\\[super:(.+?)\\]/i" => "<sup>\\1</sup>",
  27. "/\\[sub:(.+?)\\]/i" => "<sub>\\1</sub>",
  28. "/\\[permil\\]/" => "&permil;",
  29. "/\\[infinity\\]/" => "&infin;",
  30. "/\\[alpha\\]/" => "&alpha;",
  31. "/\\[beta\\]/" => "&beta;",
  32. "/\\[gamma\\]/" => "&gamma;",
  33. "/\\[delta\\]/" => "&delta;",
  34. "/\\[epsilon\\]/" => "&epsilon;",
  35. "/\\[zeta\\]/" => "&zeta;",
  36. "/\\[eta\\]/" => "&eta;",
  37. "/\\[theta\\]/" => "&theta;",
  38. "/\\[iota\\]/" => "&iota;",
  39. "/\\[kappa\\]/" => "&kappa;",
  40. "/\\[lambda\\]/" => "&lambda;",
  41. "/\\[mu\\]/" => "&mu;",
  42. "/\\[nu\\]/" => "&nu;",
  43. "/\\[xi\\]/" => "&xi;",
  44. "/\\[omicron\\]/" => "&omicron;",
  45. "/\\[pi\\]/" => "&pi;",
  46. "/\\[rho\\]/" => "&rho;",
  47. "/\\[sigmaf\\]/" => "&sigmaf;",
  48. "/\\[sigma\\]/" => "&sigma;",
  49. "/\\[tau\\]/" => "&tau;",
  50. "/\\[upsilon\\]/" => "&upsilon;",
  51. "/\\[phi\\]/" => "&phi;",
  52. "/\\[chi\\]/" => "&chi;",
  53. "/\\[psi\\]/" => "&psi;",
  54. "/\\[omega\\]/" => "&omega;",
  55. "/\\[Alpha\\]/" => "&Alpha;",
  56. "/\\[Beta\\]/" => "&Beta;",
  57. "/\\[Gamma\\]/" => "&Gamma;",
  58. "/\\[Delta\\]/" => "&Delta;",
  59. "/\\[Epsilon\\]/" => "&Epsilon;",
  60. "/\\[Zeta\\]/" => "&Zeta;",
  61. "/\\[Eta\\]/" => "&Eta;",
  62. "/\\[Theta\\]/" => "&Theta;",
  63. "/\\[Iota\\]/" => "&Iota;",
  64. "/\\[Kappa\\]/" => "&Kappa;",
  65. "/\\[Lambda\\]/" => "&Lambda;",
  66. "/\\[Mu\\]/" => "&Mu;",
  67. "/\\[Nu\\]/" => "&Nu;",
  68. "/\\[Xi\\]/" => "&Xi;",
  69. "/\\[Omicron\\]/" => "&Omicron;",
  70. "/\\[Pi\\]/" => "&Pi;",
  71. "/\\[Rho\\]/" => "&Rho;",
  72. "/\\[Sigma\\]/" => "&Sigma;",
  73. "/\\[Tau\\]/" => "&Tau;",
  74. "/\\[Upsilon\\]/" => "&Upsilon;",
  75. "/\\[Phi\\]/" => "&Phi;",
  76. "/\\[Chi\\]/" => "&Chi;",
  77. "/\\[Psi\\]/" => "&Psi;",
  78. "/\\[Omega\\]/" => "&Omega;",
  79. "/(?:\"|&quot;)(.+?)(?:\"|&quot;)/" => "&ldquo;\\1&rdquo;",
  80. "/ +- +/" => " &#8211; ",
  81. // "/�/$patternModifiers" => "&#8211;"
  82. // Note that for UTF-8 based systems, '$patternModifiers' contains the "u" (PCRE_UTF8) pattern modifier which should cause PHP/PCRE
  83. // to treat pattern strings as UTF-8 (otherwise this conversion pattern would garble UTF-8 characters such as "�"). However, the
  84. // "�" character still seems to cause PREG compilation errors on some UTF8-based systems, which is why the line has been commented
  85. // out (it should work fine for a latin1-based system, though).
  86. );
  87. ?>