emailquote.pl 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License version 2 as
  5. # published by the Free Software Foundation.
  6. #
  7. # You can get a copy of GPL version 2 at
  8. # http://www.gnu.org/licenses/gpl-2.0.html
  9. #
  10. # For user doc, see:
  11. # http://www.oddmuse.org/cgi-bin/oddmuse/Email_Quote_Extension
  12. use strict;
  13. use v5.10;
  14. AddModuleDescription('emailquote.pl', 'Email Quote Extension');
  15. our ($q, $bol, @MyRules);
  16. push(@MyRules, \&EmailQuoteRule);
  17. sub EmailQuoteRule {
  18. # > on a line of its own should work
  19. if ($bol && m/\G(\s*\n)*((\&gt;))+\n/cg) {
  20. return $q->p();
  21. }
  22. # > hi, you mentioned that:
  23. # >> I don't like Oddmuse.
  24. # > in last letter.
  25. elsif ($bol && m/\G(\s*\n)*((\&gt;)+)[ \t]/cg
  26. or InElement('dd') && m/\G(\s*\n)+((\&gt;)+)[ \t]/cg) {
  27. my $leng = length($2) / 4;
  28. return CloseHtmlEnvironmentUntil('dd') . OpenHtmlEnvironment('dl',$leng, 'quote')
  29. . $q->dt() . AddHtmlEnvironment('dd');
  30. }
  31. return;
  32. }