-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial tests with testwordpress.py (translations)
- Loading branch information
1 parent
94be7e1
commit eaa24c2
Showing
2 changed files
with
426 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import re | ||
|
||
lang = 'Ja' | ||
text = 'My text here' | ||
|
||
src="<!--:en-->weekly 256 - 09.06.–15.06.2015<!--:--><!--:es-->semanario 256 - 09.06.–15.06.2015<!--:--><!--:Ja-->週刊OSM 256 - 09.06.–15.06.2015<!--:--><!--:fr-->hebdo 256 - 09.06.–15.06.2015<!--:--><!--:cz-->týdeník 256 - 09.06.–15.06.2015<!--:--><!--:id-->edisi minggu 256 - 09.06.–15.06.2015<!--:--><!--:tr--> 256 - 09.06.–15.06.2015<!--:--><!--:pt-->semanário 256 - 09.06.–15.06.2015<!--:--><!--:de-->Wochennotiz 256 - 09.06.–15.06.2015<!--:--><!--:ro-->Săptămânal nr. 256 - 09.06.–15.06.2015<!--:-->" | ||
|
||
from testwordpresscontent import src | ||
|
||
# to negate a word 'bar': '^(?!.*?bar).*' or '^(.(?<!bar))*?$' | ||
|
||
out = re.sub( | ||
r'^(.*)(<!--:%s-->)(.(?<!<\!--:-->))*?(<!--:-->)(.*)$' % lang, # TODO fix for break lines | ||
r'\1\2%s\4\5' % text, | ||
src | ||
) | ||
|
||
print() | ||
print(src) | ||
print() | ||
print(out) | ||
print() |
Oops, something went wrong.