Files
oddmuse/modules/fieldlist.pl

33 lines
1022 B
Perl
Raw Normal View History

2008-02-23 17:11:27 +00:00
# Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
2008-02-23 17:11:27 +00:00
# published by the Free Software Foundation.
#
# You can get a copy of GPL version 2 at
# http://www.gnu.org/licenses/gpl-2.0.html
#
# For user doc, see:
2008-02-23 17:11:27 +00:00
# http://www.oddmuse.org/cgi-bin/oddmuse/Field_List_Extension
use strict;
use v5.10;
AddModuleDescription('fieldlist.pl', 'Field List Extension');
2008-02-23 17:11:27 +00:00
2015-04-10 13:31:28 +03:00
our ($bol, @MyRules);
2008-02-23 17:11:27 +00:00
push(@MyRules, \&FieldListRules);
sub FieldListRules {
# :fieldname: fieldbody
2008-02-23 17:11:27 +00:00
if ($bol && m/\G\s*\:(?=(((\S.*\S)|\S)\:))/cg
or InElement('dd') && m/\G\s*\n(\s)*\:(?=(((\S.*\S)|\S)\:))/cg) {
return CloseHtmlEnvironmentUntil('dd') . OpenHtmlEnvironment('dl', 1, 'fieldlist')
. AddHtmlEnvironment('dt'); # `:' needs special treatment, later
} elsif (InElement('dt') and m/\G\:[ \t]*(?=((\S)+))/cg) {
return CloseHtmlEnvironment() . AddHtmlEnvironment('dd');
}
return;
}