File: preparetips

package info (click to toggle)
tellico 2.3.5%2Bdfsg.1-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 18,024 kB
  • sloc: cpp: 61,829; ansic: 8,304; python: 1,977; xml: 328; ruby: 189; perl: 52; ada: 32; sh: 11; makefile: 10
file content (40 lines) | stat: -rwxr-xr-x 545 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/perl
# little script to extract the text from the tips file
# and output it, so xgettext can add the tips to the po file
#
# 2000 by Matthias Kiefer <matthias.kiefer@gmx.de>

$inTip=0;

while(<>)
{
	chomp;

	# tip starts with <html>
	if(/^\s*<html>/i)
	{
		$inTip=1;
		print "\ni18n(\n";
		next;
	}	

	if($inTip!=0)
	{
		# tip ends with </html>
		if(/^\s*<\/html>/i)
		{
			print ");\n";
			$inTip=0;
		}
		else
		{
			# replace \ with \\
			s/\\/\\\\/g;

			# replace " with \"
			s/"/\\"/g;
			
			print "\"$_\\n\"\n";
		}
	}   
}