README: Update
[orgmuse.git] / org-addition.pl
blob0ac6a42c78b3970e9dafde2f499cc3837b807dce
1 #!/usr/bin/env perl
2 # ====================[ orgaddition.pl ]====================
4 =head1 NAME
6 orgaddition - An Oddmuse module for augmenting the Org Markup module with
7 so-called, unofficial "Org Additions" markup.
9 =head1 INSTALLATION
11 orgaddition is simply installable; simply:
13 =over
15 =item First install the Org Markup module; see
16 L<http://oddmuse.org/wiki/Org_Markup_Extension>.
18 =item Move this file into the B<wiki/modules/> directory for your Oddmuse Wiki.
20 =back
22 =cut
23 package OddMuse;
25 $ModulesDescription .= '<p>See <a href="http://oddmuse.org/wiki/Org_Markup_Extension">Org Markup Extension</a></p>';
27 # ....................{ CONFIGURATION }....................
29 =head1 CONFIGURATION
31 orgaddition is easily configurable; set these variables in the
32 B<wiki/config.pl> file for your Oddmuse Wiki.
34 =cut
35 # Since these rules are not official now, users can turn off some of
36 # them.
37 use vars qw($OrgAdditionSupSub
38 $OrgAdditionDefList
39 $OrgAdditionInlineQuote
42 =head2 $OrgAdditionSupSub
44 A boolean that, if true, enables this extension's handling of
45 ^^supscript^^ and ,,subscript,,-style markup. (By default, this boolean is
46 true.)
48 =cut
49 $OrgAdditionSupSub = 0;
51 =head2 $OrgAdditionDefList
53 A boolean that, if true, enables this extension's handling of
54 "; definition : lists"-style markup. (By default, this boolean is true.)
56 =cut
57 $OrgAdditionDefList = 0;
59 =head2 $OrgAdditionInlineQuote
61 A boolean that, if true, enables this extension's handling of ''inline
62 quote''-style markup. (By default, this boolean is false.)
64 =cut
65 $OrgAdditionInlineQuote = 0;
67 # ....................{ MARKUP }....................
68 push(@MyRules, \&OrgAdditionRule);
69 SetHtmlEnvironmentContainer('blockquote');
71 # Blockquote line-breaks conflict with Org-style line-breaks.
72 $RuleOrder{\&OrgAdditionRule} = -11;
74 sub OrgAdditionRule {
75 # definition list
76 # ; dt
77 # : dd
78 if ($OrgAdditionDefList && $bol && m/\G\s*\;[ \t]*(?=(.+(\n)(\s)*\:))/cg
79 or InElement('dd') && m/\G\s*\n(\s)*\;[ \t]*(?=(.+\n(\s)*\:))/cg) {
80 return CloseHtmlEnvironmentUntil('dd') . OpenHtmlEnvironment('dl', 1)
81 . AddHtmlEnvironment('dt');
82 } # `:' needs special treatment, later
83 elsif (InElement('dt') and m/\G\s*\n(\s)*\:[ \t]*(?=(.+(\n)(\s)*\:)*)/cg) {
84 return CloseHtmlEnvironment() . AddHtmlEnvironment('dd');
85 } elsif (InElement('dd') and m/\G\s*\n(\s)*\:[ \t]*(?=(.+(\n)(\s)*\:)*)/cg) {
86 return CloseHtmlEnvironment() . AddHtmlEnvironment('dd');
88 # ''inline quotes''
89 elsif ($OrgAdditionInlineQuote and m/\G\'\'/cgs) {
90 return AddOrCloseHtmlEnvironment('q');
93 return undef;
96 =head1 COPYRIGHT AND LICENSE
98 The information below applies to everything in this distribution,
99 except where noted.
101 Copyleft 2008 by B.w.Curry <http://www.raiazome.com>.
102 Copyright 2008 by Weakish Jiang <weakish@gmail.com>.
103 Copyright 2009 Alex Schroeder <alex@gnu.com>
104 Copyright 2013 Jambunathan K <kjambunathan@gmail.com>
106 This program is free software; you can redistribute it and/or modify
107 it under the terms of the GNU General Public License as published by
108 the Free Software Foundation; either version 3 of the License, or
109 (at your option) any later version.
111 This program is distributed in the hope that it will be useful,
112 but WITHOUT ANY WARRANTY; without even the implied warranty of
113 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114 GNU General Public License for more details.
116 You should have received a copy of the GNU General Public License
117 along with this program. If not, see L<http://www.gnu.org/licenses/>.
119 =cut