tagging: Allow using titles in for related stories.
[matthijs/upstream/blosxom-plugins.git] / xtaran / acronyms
1 # Bloxsom Plugin: Acronyms
2 # Author: Axel Beckert, based on autolinks by Fletcher T. Penney
3 # Version: 0.1
4 # Download: http://noone.org/blosxom/acronyms
5
6 package acronyms;
7
8 # --- Configurable variables ----
9
10 # Where is the definition page
11 $link_file = "$blosxom::datadir/acronyms";
12
13
14 # -------------------------------
15
16 $ignore = 0;
17
18 sub start {
19         open (LINKS, $link_file);
20         @abbrlist = <LINKS>;
21         close LINKS;
22         1;
23 }
24
25 sub story {
26         my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
27
28         if ($$story_ref =~ m/<!-- noacronyms -->/gi || $$body_ref =~ m/<!-- noacronyms -->/gi) {
29                 $ignore = 1;
30         }
31
32         if ($ignore == 0) {
33                 my %tags = ();
34                 my $j = 0;
35
36                 # remove other tags
37                 $$body_ref =~ s{<\D.*?>}{
38                     do {
39                         $tags{++$j} = $&;
40                         "<$j>";
41                     };
42                 }gse;
43
44                 foreach $i (@abbrlist) {
45                         chomp($i);
46                         next unless $i;
47
48                         my ($word, $class, $link);
49
50                         if ($i =~ /(.*?)=(.*?)\|(.*)/) {
51                                 $word  = $1;
52                                 $class = lc($2);
53                                 $link  = $3;
54                         } elsif ($i =~ /(.*?)=(.*)/) {
55                                 $word  = $1;
56                                 $link  = $2;
57                                 $class = $word =~ /\./ ? 'abbr' : 'acronym';
58                         }
59
60                         #print STDERR "$word => $class + $link\n";
61
62 # By default, autolinks now changes only the first occurence of a given term
63 # If you want to change all occurences, 
64 # change the end of the following line to '\/a>/ig'
65
66                         if ($word) {
67                                 $word =~ s/\\./<.>/g;
68                                 $word =~ s/\./\\./g;
69                                 $word =~ s/<\.>/./g;
70                                 #print STDERR sprintf "Replaced $word %i times\n",
71                                 $$body_ref =~ s/\b($word)\b/<$class title="$link">$1<\/$class>/g;
72                                 $$title_ref =~ s/\b($word)\b/<$class title="$link">$1<\/$class>/g
73                                     if $blosxom::flavour eq 'html';
74                         }
75                 }
76
77                 # reinsert tags
78                 $$body_ref =~ s{<(\d+)>}{$tags{$1}}gs;
79
80         }
81         1;
82 }
83
84 1;
85
86
87 __END__
88
89 =head1 NAME
90
91 Blosxom Plug-in: acronyms
92
93 =head1 DESCRIPTION
94
95 Allows you to create a list of keywords that are automatically
96 marked as abbreviation or acronym.
97
98 You can set your own location for the acronyms data file, but by
99 default it lives in your data directory.
100
101 =head1 EXAMPLE DATA FILE
102
103 Put this in you acronyms data file and you already have a reasonable
104 base to extend.
105
106 ASCII=American Standard Code for Information Interchange
107 BGP=Border Gateway Protocol; Beer-to-Glass-Protocol (Roger Schwentker)
108 BSD=Berkeley System Distribution
109 CD=Compact-Disc
110 CGI=Common Gateway Interface; Computer Generated Imagery
111 CLI=Command Line Interface
112 CLUE=Command Line User Environment
113 CS=Computer Science; Counter Strike
114 CSS=Cascading Stylesheets
115 CVS=Concurrent Versioning System
116 DSL=Digital Subscriber Line
117 DVD=Digital Video Disc
118 ELF=Executable and Linking Format
119 FAQ=Frequently asked question(s)
120 FIFO=First In, First Out
121 FOSS=Free and Open Source Software
122 FLOSS=Free, Libre and Open Source Software
123 FSF=Free Software Foundation
124 FSFE=Free Software Foundation Europe
125 FUD=Fear, Uncertainty and Doubt
126 FYEO=Four Your Eyes Only
127 FYI=For Your Information
128 GNOME=GNU Network Object Model Environment
129 GPL=GNU General Public License
130 GPRS=General Packet Radio Service
131 GSM=Global System for Mobile Communications
132 GTK=GIMP-Toolkit
133 GUI=Graphical User Interface
134 HTML=Hypertext Markup Language
135 HTTP=Hypertext Transport Protocol
136 IIS=Internet Intrusion Server
137 IMO=in my opinion
138 IMHO=in my humble opinion
139 IMNSHO=in my not so humble opinion
140 IRC=Internet Relay Chat
141 ISBN=International Standard Book Number
142 ISDN=Integrated Services Digital Network (German: I schnall des nedd ;-)
143 ISSN=International Standard Serial Number
144 ITP=intend to package
145 JFYI=Just For Your Information
146 JFTR=Just For The Record
147 KDE=Kolorful Diskfilling Environment
148 KISS=Keep it simple, stupid
149 MCSE=Minesweeper Consultant and Solitaire Expert (User Friendly)
150 MHz=abbr|Megahertz
151 MMS=Multimedia Messaging Service
152 MMX=Multimedia Extension
153 MPEG=Moving Picture Experts Group
154 MP3=MPEG (Moving Picture Experts Group) 1 Audio Layer 3
155 MSIE=Microsoft Internet Explorer
156 MTV=Music TeleVision
157 NIH=Not Invented Here
158 OOP=Object-Oriented Programming
159 OS=Operating System; Open Source
160 OSI=Open Source Initiative; Open Systems Interconnection
161 OSS=Open Source Software
162 PC=Personal Computer
163 PERL=Pathologically Eclectic Rubbish Lister
164 PHP[2345]?=Programmers Hate PHP ;-)
165 PISG=Perl IRC Statistics Generator
166 QA=Quality Assurance
167 RAM=Random Access Memory
168 RIP=Rest in Peace
169 SMD=Surface Mounted Devices
170 SMS=Short Message Service
171 SSI=Server-Side Includes
172 TLA=Three Letter Acronym
173 UI=User Interface
174 UK=United Kingdom
175 UMTS=Universal Mobile Telecommunications System
176 URL=Uniform Resource Locator
177 URI=Uniform Resource Indicator
178 US=United States (of America)
179 USA=United States of America
180 USB=Universal Serial Bus
181 VCF=Vintage Computer Festival
182 VCFE=Vintage Computer Festival Europe
183 VCFe=Vintage Computer Festival Europe
184 VM=Virtual Machine
185 VoIP=Voice over IP
186 WFM=Works For Me
187 WAP=Wireless Application Protocol
188 WTF=what/who the fuck
189 WTH=what the heck/hell
190 WML=Website Meta Language; Wireless Markup Language; Wesnoth Markup Language
191 WORN=Write Once, Read Never
192 WWW=World Wide Waiting ;-)
193 XHTML=Extensible Hypertext Markup Language
194 XML=Extensible Markup Language
195 aka=acronym|also known as
196 btw.=abbr|by the way
197 btw=abbr|by the way
198 BTW=abbr|by the way
199 e.g.=for example; as an example
200 gpl=GNU General Public License
201 i.e.=id est (that is to say; in other words) 
202 irc=Internet Relay Chat
203 pisg=Perl IRC Statistics Generator
204 GHz=Gigahertz
205 MB=Megabyte
206 GB=Gigabyte; Great Britain
207 TB=Terabyte
208 kB=Kilobyte
209 IIRC=if I remember correctly
210 AFAIK=as far as I know
211 AFAICS=as far as I can see
212 AFAIR=as far as I remember
213 YMMV=your milage may vary
214 LMAA=Leck&apos; mich am Arsch
215 ASAP=as soon as possible
216 EFF=Electronic Frontier Foundation
217 FFII=Foundation for a Free Information Infrastructure / F&ouml;rderverein f&uuml;r eine Freie Informationelle Infrastruktur
218 WYSIWYG=What you see is what you get
219 TOFU=Text oben, Fullquote unten
220 PEBKAC=Problem exists between keyboard and chair
221 FIFO=First In, First Out
222 LIFO=Last In, First Out
223 GIGO=Garbage In, Garbage Out
224 EU=European Union
225 yast2?=Yet another Setup Tool
226 SuS[EI]=System- und Software-Entwicklung
227 KoL=Kingdom of Loathing
228 MUD=Multi User Dungeon
229 XMMS=X Multimedia System
230 SUV=Sport Utility Vehicle
231 SUVs=Sport Utility Vehicles
232 IMD[Bb]=Internet Movie Database
233 FTWCA=For those who care about
234 LUG=Linux User Group
235 GUUG=German Unix User Group
236 SPF=Sender Policy Framework, formerly Sender Permitted From
237 RBL=Realtime Black-List
238 SMTP=Simple Mail Transfer Protocol
239 NSFW=Not Safe For Work
240 ROM=Read Only Memory
241 CD-ROM=Compact Disc Read-Only Memory
242 ISO=International Organization for Standardization; also short for a image of an ISO9660 (CD-ROM) file system
243
244 =head1 AUTHOR
245
246 Axel Beckert <blosxom@deuxchevaux.org>
247
248 =head1 LICENSE
249
250 This source was and therefore is still submitted to the public domain.
251 Feel free to use and modify it.  Credits to Fletcher Penney and
252 Gregory Bair for their original work would be appreciated.
253
254 THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND.
255 USE AT YOUR OWN RISK!