[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    l10n/scripts
From:       Gaute Hvoslef Kvalnes <gaute () verdsveven ! com>
Date:       2005-06-11 11:49:37
Message-ID: 1118490577.579916.23827.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 424287 by kvalnes:

Wrap before tags.
CCMAIL=kde-i18n-doc@kde.org


 M  +14 -0     msgsplit  


--- trunk/l10n/scripts/msgsplit #424286:424287
@@ -4,6 +4,10 @@
 
 max_length = 78
 
+wrap_before = ['<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<p>', '<br>', '<br/>', 
+	       '<ol>', '<ul>', '<li>', '<table>', '<th>', '<tr>', '<td>', '<center>', 
+	       '<blockquote>', '<pre>', '<hr>', '<hr/>']
+
 def splitit( start, message, outfile ):
 	if len(start):
 		if len(message) + len(start) < max_length and \
@@ -30,6 +34,16 @@
 				last_brace = index
 			if message[index] == u' ':
 				last_space = index
+			if message[index] == u'<':
+				for s in wrap_before:
+					if index > 0 and message[index:].startswith(s):
+						outfile.write('"%s"\n' % message[:index].encode('utf-8'))
+						message = message[index:]
+						mlen -= index
+						index = 0
+						last_brace = 0
+						last_space = 0
+						continue
 			if index > max_length:
 				if last_brace > 50:
 					index = last_brace
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic