#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
""" Convert files to the file format generated by lyx 1.5"""
def revert_unicode_line(document, i, insets, spec_chars, replacement_character = '???'):
# Define strings to start and end ERT and math insets
- ert_intro='\n\n\\begin_inset ERT\nstatus collapsed\n\\begin_layout %s\n\\backslash\n' % document.default_layout
+ ert_intro='\n\n\\begin_inset ERT\nstatus collapsed\n\\begin_layout %s' % document.default_layout
ert_outro='\n\\end_layout\n\n\\end_inset\n'
math_intro='\n\\begin_inset Formula $'
math_outro='$\n\\end_inset'
command = command + '}'
elif not insets or insets[-1] != "ERT":
# add an ERT inset with the replacement character
- command = command.replace('\\\\', ert_intro)
- command = command + ert_outro
+ command = command.replace('\\\\', '\n\\backslash\n')
+ command = ert_intro + command + ert_outro
else:
command = command.replace('\\\\', '\n\\backslash\n')
last_char = '' # indicate that the character should not be removed
if i == -1:
break
name = document.body[i].split()[2]
- j = find_end_of_inset(document.body, i + 1)
+ j = find_end_of_inset(document.body, i)
preview_line = ""
option1 = ""
option2 = ""
def convert_tableborder(document):
- # The problematic is: LyX double the table cell border as it ignores the "|" character in
+ # The problem is: LyX doubles the table cell border as it ignores the "|" character in
# the cell arguments. A fix takes care of this and therefore the "|" has to be removed
i = 0
while i < len(document.body):
# the two tokens have to be in one line
if (h != -1 and k != -1):
# delete the "|"
- document.body[i] = document.body[i][:k] + document.body[i][k+1:len(document.body[i])-1]
+ document.body[i] = document.body[i][:k] + document.body[i][k+1:len(document.body[i])]
i = i + 1