Skip to content

Commit

Permalink
fixes testwordpress.py for line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-mbm committed Jul 14, 2015
1 parent eaa24c2 commit 26208fc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions paicemana/testwordpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
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<!--:-->"
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.–\r
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'^(.*)(<!--:%s-->)(.(?<!<\!--:-->))*?(<!--:-->)(.*)$' % lang,
r'\1\2%s\4\5' % text,
src
src,
flags = re.MULTILINE + re.DOTALL
)

print()
Expand Down

0 comments on commit 26208fc

Please sign in to comment.