3
T'íc´ ã @ st d Z ddlmZ ddlmZ ddlZddlZddlmZ ddl Z ddl
Z
dddZd d
Zdd Z
ed
krpe
dS )z
Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
specifications from styles.xml in STYLE_FILE.odt.
é )Úprint_function)ÚetreeN)Úmkstempz/urn:oasis:names:tc:opendocument:xmlns:style:1.0z;urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0)ÚstyleÚfoc C sê t j| }|jd}tj|}x@|jdtdD ].}x(|jD ]}|jdtd r:|j|= q:W q.W t }t jt
j|d ddt j}xB|j
D ]6}|jdkr®|j|tj| q|j||j|j qW |j |j tj|d | d S ) Nz
styles.xmlz//style:page-layout-properties)Ú
namespacesz{%s}r r Úwé )ÚzipfileÚZipFileÚreadr Ú
fromstringZxpathÚ
NAMESPACESÚattribÚ
startswithr ÚosÚfdopenÚZIP_DEFLATEDÚinfolistÚfilenameÚwritestrÚtostringÚcloseÚshutilÚmove) r ZzinZstylesÚrootÚelÚattrÚtempnameZzoutÚitem© r úS/tmp/pip-build-gk9425m9/docutils/docutils-0.17.1.data/scripts/rst2odt_prepstyles.pyÚ prepstyle s$
r"