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.

94 lines
4.8 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_rtf.inc.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/includes/transtab_refbase_rtf.inc.php $
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 28-May-06, 18:21
  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 RTF markup & entities. Converts refbase fontshape markup (italic, bold, underline)
  19. // and super- and subscript into RTF commands, greek letters get converted into the respective Unicode character 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_rtf = array(
  23. "/([{}])/" => '\\\\\\1', // escaping of curly brackets has to be done as the first action so that conversion doesn't mess with the RTF code generated by other actions
  24. "/__(?!_)(.+?)__/" => "{\\ul \\1}", // underline; the pattern for underline (__...__) must come before the one for italic (_..._)
  25. "/_(.+?)_/" => "{\\i \\1}", // italic
  26. "/\\*\\*(.+?)\\*\\*/" => "{\\b \\1}", // bold
  27. "/\\[super:(.+?)\\]/i" => "{\\super \\1}", // superscript (or use '\up6')
  28. "/\\[sub:(.+?)\\]/i" => "{\\sub \\1}", // subscript (or use '\dn6')
  29. "/\\[permil\\]/" => "\\uc0\\u8240 ",
  30. "/\\[infinity\\]/" => "\\uc0\\u8734 ",
  31. "/\\[alpha\\]/" => "\\uc0\\u945 ",
  32. "/\\[beta\\]/" => "\\uc0\\u946 ",
  33. "/\\[gamma\\]/" => "\\uc0\\u947 ",
  34. "/\\[delta\\]/" => "\\uc0\\u948 ",
  35. "/\\[epsilon\\]/" => "\\uc0\\u949 ",
  36. "/\\[zeta\\]/" => "\\uc0\\u950 ",
  37. "/\\[eta\\]/" => "\\uc0\\u951 ",
  38. "/\\[theta\\]/" => "\\uc0\\u952 ",
  39. "/\\[iota\\]/" => "\\uc0\\u953 ",
  40. "/\\[kappa\\]/" => "\\uc0\\u954 ",
  41. "/\\[lambda\\]/" => "\\uc0\\u955 ",
  42. "/\\[mu\\]/" => "\\uc0\\u956 ",
  43. "/\\[nu\\]/" => "\\uc0\\u957 ",
  44. "/\\[xi\\]/" => "\\uc0\\u958 ",
  45. "/\\[omicron\\]/" => "\\uc0\\u959 ",
  46. "/\\[pi\\]/" => "\\uc0\\u960 ",
  47. "/\\[rho\\]/" => "\\uc0\\u961 ",
  48. "/\\[sigmaf\\]/" => "\\uc0\\u962 ",
  49. "/\\[sigma\\]/" => "\\uc0\\u963 ",
  50. "/\\[tau\\]/" => "\\uc0\\u964 ",
  51. "/\\[upsilon\\]/" => "\\uc0\\u965 ",
  52. "/\\[phi\\]/" => "\\uc0\\u966 ",
  53. "/\\[chi\\]/" => "\\uc0\\u967 ",
  54. "/\\[psi\\]/" => "\\uc0\\u968 ",
  55. "/\\[omega\\]/" => "\\uc0\\u969 ",
  56. "/\\[Alpha\\]/" => "\\uc0\\u913 ",
  57. "/\\[Beta\\]/" => "\\uc0\\u914 ",
  58. "/\\[Gamma\\]/" => "\\uc0\\u915 ",
  59. "/\\[Delta\\]/" => "\\uc0\\u916 ",
  60. "/\\[Epsilon\\]/" => "\\uc0\\u917 ",
  61. "/\\[Zeta\\]/" => "\\uc0\\u918 ",
  62. "/\\[Eta\\]/" => "\\uc0\\u919 ",
  63. "/\\[Theta\\]/" => "\\uc0\\u920 ",
  64. "/\\[Iota\\]/" => "\\uc0\\u921 ",
  65. "/\\[Kappa\\]/" => "\\uc0\\u922 ",
  66. "/\\[Lambda\\]/" => "\\uc0\\u923 ",
  67. "/\\[Mu\\]/" => "\\uc0\\u924 ",
  68. "/\\[Nu\\]/" => "\\uc0\\u925 ",
  69. "/\\[Xi\\]/" => "\\uc0\\u926 ",
  70. "/\\[Omicron\\]/" => "\\uc0\\u927 ",
  71. "/\\[Pi\\]/" => "\\uc0\\u928 ",
  72. "/\\[Rho\\]/" => "\\uc0\\u929 ",
  73. "/\\[Sigma\\]/" => "\\uc0\\u931 ",
  74. "/\\[Tau\\]/" => "\\uc0\\u932 ",
  75. "/\\[Upsilon\\]/" => "\\uc0\\u933 ",
  76. "/\\[Phi\\]/" => "\\uc0\\u934 ",
  77. "/\\[Chi\\]/" => "\\uc0\\u935 ",
  78. "/\\[Psi\\]/" => "\\uc0\\u936 ",
  79. "/\\[Omega\\]/" => "\\uc0\\u937 ",
  80. "/\"(.+?)\"/" => "\\ldblquote \\1\\rdblquote ", // see also notes in 'cite_rtf.php' at '$markupPatternsArray'
  81. "/ +- +/" => " \\endash ",
  82. // "/�/$patternModifiers" => "\\endash "
  83. // Note that for UTF-8 based systems, '$patternModifiers' contains the "u" (PCRE_UTF8) pattern modifier which should cause PHP/PCRE
  84. // to treat pattern strings as UTF-8 (otherwise this conversion pattern would garble UTF-8 characters such as "�"). However, the
  85. // "�" character still seems to cause PREG compilation errors on some UTF8-based systems, which is why the line has been commented
  86. // out (it should work fine for a latin1-based system, though).
  87. );
  88. ?>