Skip to content

Commit

Permalink
Initial tests with testwordpress.py (translations)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-mbm committed Jul 14, 2015
1 parent 94be7e1 commit eaa24c2
Show file tree
Hide file tree
Showing 2 changed files with 426 additions and 0 deletions.
22 changes: 22 additions & 0 deletions paicemana/testwordpress.py
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()
Loading

0 comments on commit eaa24c2

Please sign in to comment.