Re: [PATCH] lyx2lyx helper
On Wed, Jan 22, 2003 at 03:05:28PM +, John Levon wrote: On Wed, Jan 22, 2003 at 10:38:40AM +0100, Jean-Marc Lasgouttes wrote: Why not use the same option for specifying either a lyx version or a file format? It is not like we are going to release LyX 215 one of these days... Well, given that lyx changes its release numbering scheme every release Hey, can the next one be 1.IV? -- Richard E. Hawkins, Asst. Prof. of Economics/\ ASCII ribbon campaign [EMAIL PROTECTED] Smeal 178 (814) 375-4700 \ / against HTML mail These opinions will not be those of Xand postings. Penn State until it pays my retainer. / \
Re: [PATCH] lyx2lyx helper
On Friday 24 January 2003 16:40, Dr. Richard E. Hawkins wrote: Well, given that lyx changes its release numbering scheme every release Hey, can the next one be 1.IV? And then the fix releases would be 1.IV.a, 1.IV.b... We have the linux style, the fetchmail style and now also the lyx style. Soon every software project will adopt it, so better to do it earlier than later. -- José Abílio
Re: [PATCH] lyx2lyx helper
On Wed, Jan 22, 2003 at 03:05:28PM +, John Levon wrote: > On Wed, Jan 22, 2003 at 10:38:40AM +0100, Jean-Marc Lasgouttes wrote: > > Why not use the same option for specifying either a lyx version or a > > file format? It is not like we are going to release LyX 215 one of > > these days... > Well, given that lyx changes its release numbering scheme every release > Hey, can the next one be 1.IV? -- Richard E. Hawkins, Asst. Prof. of Economics/"\ ASCII ribbon campaign [EMAIL PROTECTED] Smeal 178 (814) 375-4700 \ / against HTML mail These opinions will not be those of Xand postings. Penn State until it pays my retainer. / \
Re: [PATCH] lyx2lyx helper
On Friday 24 January 2003 16:40, Dr. Richard E. Hawkins wrote: > > > > Well, given that lyx changes its release numbering scheme every release > > > > Hey, can the next one be 1.IV? And then the fix releases would be 1.IV.a, 1.IV.b... We have the linux style, the fetchmail style and now also the lyx style. Soon every software project will adopt it, so better to do it earlier than later. -- José Abílio
Re: [PATCH] lyx2lyx helper
José == José Matos [EMAIL PROTECTED] writes: José This patch: * updates the version of lyx2lyx to match the José corresponing lyx version; * updates the reference to the José copyright date. * adds two new options to list the supported lyx José versions, and allow to specify it instead of the final file José format. * if both the file format and lyx version are given for José the resulting file it aborts as they are mutually exclusive. Why not use the same option for specifying either a lyx version or a file format? It is not like we are going to release LyX 215 one of these days... I think this would make the user interface simpler. JMarc
Re: [PATCH] lyx2lyx helper
On Wednesday 22 January 2003 09:38, Jean-Marc Lasgouttes wrote: Why not use the same option for specifying either a lyx version or a file format? It is not like we are going to release LyX 215 one of these days... But 2.15 or 2.10 is reasonable. ;-) And yes those are valid values regarding the fileformat and also accepted. Then we will let a latent bug that will manifest itself when we get those version. Then I will tell you I have warned you before. ;-) I think this would make the user interface simpler. Ok, I will modify the patch for it. JMarc -- José Abílio
Re: [PATCH] lyx2lyx helper
On Wed, Jan 22, 2003 at 10:01:02AM +, José Matos wrote: Ok, I will modify the patch for it. I have no troubles using different options to differnt things. And as you notices, 2.15 is well within reach. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: [PATCH] lyx2lyx helper
On Wednesday 22 January 2003 10:06, Andre Poenitz wrote: On Wed, Jan 22, 2003 at 10:01:02AM +, José Matos wrote: Ok, I will modify the patch for it. I have no troubles using different options to differnt things. And as you notices, 2.15 is well within reach. From beginning I wanted lyx2lyx to be the more general possible but now I am starting to question myself if we really need that initial format option. Any well formed LyX file has it and the only case that would justify it would be converting parts of LyX files. We don't do it now, and I don't see any reason to do it. Shall I remove this option? Andre' -- José Abílio
Re: [PATCH] lyx2lyx helper
Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre On Wed, Jan 22, 2003 at 10:01:02AM +, José Matos wrote: Ok, I will modify the patch for it. Andre I have no troubles using different options to differnt things. Andre And as you notices, 2.15 is well within reach. It should be 2.15.x anyway. And I seriously doubt that this will ever exist. JMarc
Re: [PATCH] lyx2lyx helper
José == José Matos [EMAIL PROTECTED] writes: José But 2.15 or 2.10 is reasonable. ;-) And yes those are valid José values regarding the fileformat and also accepted. José Then we will let a latent bug that will manifest itself when José we get those version. Then I will tell you I have warned you José before. ;-) No. If LyX 2.15 ever comes to existence, you will have to update lyx2lyx for it anyway (if only to support the new formats). So you will update lyx2lyx to avoid this problem, and there will be no bug. It is not what I'd call a big problem. JMarc
Re: [PATCH] lyx2lyx helper
On Wed, Jan 22, 2003 at 10:38:40AM +0100, Jean-Marc Lasgouttes wrote: Why not use the same option for specifying either a lyx version or a file format? It is not like we are going to release LyX 215 one of these days... Well, given that lyx changes its release numbering scheme every release john -- It is quite humbling to realize that the storage occupied by the longest line from a typical Usenet posting is sufficient to provide a state space so vast that all the computation power in the world can not conquer it. - Dave Wallace
Re: [PATCH] lyx2lyx helper
> "José" == José Matos <[EMAIL PROTECTED]> writes: José> This patch: * updates the version of lyx2lyx to match the José> corresponing lyx version; * updates the reference to the José> copyright date. * adds two new options to list the supported lyx José> versions, and allow to specify it instead of the final file José> format. * if both the file format and lyx version are given for José> the resulting file it aborts as they are mutually exclusive. Why not use the same option for specifying either a lyx version or a file format? It is not like we are going to release LyX 215 one of these days... I think this would make the user interface simpler. JMarc
Re: [PATCH] lyx2lyx helper
On Wednesday 22 January 2003 09:38, Jean-Marc Lasgouttes wrote: > > Why not use the same option for specifying either a lyx version or a > file format? It is not like we are going to release LyX 215 one of > these days... But 2.15 or 2.10 is reasonable. ;-) And yes those are valid values regarding the fileformat and also accepted. Then we will let a latent bug that will manifest itself when we get those version. Then I will tell you "I have warned you before". ;-) > I think this would make the user interface simpler. Ok, I will modify the patch for it. > JMarc -- José Abílio
Re: [PATCH] lyx2lyx helper
On Wed, Jan 22, 2003 at 10:01:02AM +, José Matos wrote: > Ok, I will modify the patch for it. I have no troubles using different options to differnt things. And as you notices, 2.15 is well within reach. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: [PATCH] lyx2lyx helper
On Wednesday 22 January 2003 10:06, Andre Poenitz wrote: > On Wed, Jan 22, 2003 at 10:01:02AM +, José Matos wrote: > > Ok, I will modify the patch for it. > > I have no troubles using different options to differnt things. And as you > notices, 2.15 is well within reach. From beginning I wanted lyx2lyx to be the more general possible but now I am starting to question myself if we really need that initial format option. Any well formed LyX file has it and the only case that would justify it would be converting parts of LyX files. We don't do it now, and I don't see any reason to do it. Shall I remove this option? > Andre' -- José Abílio
Re: [PATCH] lyx2lyx helper
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: Andre> On Wed, Jan 22, 2003 at 10:01:02AM +, José Matos wrote: >> Ok, I will modify the patch for it. Andre> I have no troubles using different options to differnt things. Andre> And as you notices, 2.15 is well within reach. It should be 2.15.x anyway. And I seriously doubt that this will ever exist. JMarc
Re: [PATCH] lyx2lyx helper
> "José" == José Matos <[EMAIL PROTECTED]> writes: José> But 2.15 or 2.10 is reasonable. ;-) And yes those are valid José> values regarding the fileformat and also accepted. José> Then we will let a latent bug that will manifest itself when José> we get those version. Then I will tell you "I have warned you José> before". ;-) No. If LyX 2.15 ever comes to existence, you will have to update lyx2lyx for it anyway (if only to support the new formats). So you will update lyx2lyx to avoid this problem, and there will be no bug. It is not what I'd call a big problem. JMarc
Re: [PATCH] lyx2lyx helper
On Wed, Jan 22, 2003 at 10:38:40AM +0100, Jean-Marc Lasgouttes wrote: > Why not use the same option for specifying either a lyx version or a > file format? It is not like we are going to release LyX 215 one of > these days... Well, given that lyx changes its release numbering scheme every release john -- " It is quite humbling to realize that the storage occupied by the longest line from a typical Usenet posting is sufficient to provide a state space so vast that all the computation power in the world can not conquer it." - Dave Wallace
[PATCH] lyx2lyx helper
This patch: * updates the version of lyx2lyx to match the corresponing lyx version; * updates the reference to the copyright date. * adds two new options to list the supported lyx versions, and allow to specify it instead of the final file format. * if both the file format and lyx version are given for the resulting file it aborts as they are mutually exclusive. The purpose of this patch is to make lyx2lyx more user friendly and to simplify its usage for normal users who wnat to use it for older version of lyx. Comments? -- José Abílio ? patch-lyx2lyx Index: lyx2lyx === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v retrieving revision 1.5 diff -u -p -r1.5 lyx2lyx --- lyx2lyx 7 Jan 2003 17:03:59 - 1.5 +++ lyx2lyx 21 Jan 2003 18:17:46 - @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Copyright (C) 2002 José Matos [EMAIL PROTECTED] +# Copyright (C) 2002-2003 José Matos [EMAIL PROTECTED] # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,7 +19,7 @@ import getopt, sys, string, re from error import error, warning from parser_tools import set_comment, set_format, check_token -version = 0.0.2 +version = 1.3.0 # Allow the dummy object to be able to carry related data # like a C struct @@ -37,7 +37,13 @@ opt.quiet = 0 format = re.compile(r(\d)[\.,]?(\d\d)) fileformat = re.compile(r\\lyxformat\s*(\S*)) -lst_ft = [210, 215, 216, 217, 218, 220, 221] + +lyx_version = {0.12:215, 1.0.0:215, 1.0.1: 215, 1.0.2:215, + 1.0.3:215, 1.0.4:215, 1.1.2:215, 1.1.4:215, + 1.1.5:216, 1.1.5fix1:216, 1.1.5fix2:216, + 1.1.6:217, 1.1.6fix1:217, 1.1.6fix2:217, + 1.1.6fix3:218, 1.1.6fix4:218,1.2.0:220, + 1.2.1:220, 1.2.2:220, 1.2.3:220,1.3.0:221} def usage(): print Usage: lyx2lyx [options] file1 @@ -45,44 +51,70 @@ Convert old lyx file file1 to newer fo Options: -h, --help this information -v, --version output version information and exit --l, --list list all available formats +-l, --list list all available file formats +-m, --list-versions list all lyx versions supported -d, --debug level level=0..2 (O_ no debug information,2_verbose) default: level=1 --f, --from version initial version (optional) --t, --to version final version (optional) +-f, --from version initial version +-t, --to version final lyx file format version +-n, --final-version version final lyx version -o, --output name name of the output file or else goes to stdout -q, --quiet same as --debug=0 def parse_options(argv): -_options = [help, version, list, from=, to=, output=, quiet] +_options = [help, version, list, list-versions, from=, to=, output=, final-version=, quiet] try: - opts, args = getopt.getopt(argv[1:], f:hlo:qt:v, _options) + opts, args = getopt.getopt(argv[1:], f:hlmn:o:qt:v, _options) except getopt.error: usage() sys.exit(2) +output_option = 0 + for o, a in opts: if o in (-h, --help): usage() sys.exit() if o in (-v, --version): print lyxconvert, version %s %(version) -print Copyright (C) 2002 LyX Team +print Copyright (C) 2002-2003 LyX Team sys.exit() if o in (-d, --debug): opt.debug = int(a) if o in (-q, --quiet): opt.debug = 0 if o in (-l, --list): -print lst_ft +lst = lyx_version.values() +lst.sort() +#determine unique representation +value = None +for item in lst: +if item != value: +value = item +print value, +print +sys.exit() +if o in (-m, --list-versions): +lyx_versions = lyx_version.keys() +lyx_versions.sort() +print lyx_versions sys.exit() if o in (-o, --output): opt.output = open(a, w) if o in (-f, --from): opt.start = lyxformat(a) if o in (-t, --to): +output_option = output_option + 1 opt.end = lyxformat(a) +if o in (-n,--final-version): +output_option = output_option + 1 +opt.end = lyxversion[a] + +if output_option == 2: +sys.stderr.write(Final output format and final LyX version are mutually exclusive, provide only one of them.\n) +usage() +sys.exit(2) if not opt.end: opt.end = lst_ft[len(lst_ft)-1]
Re: [PATCH] lyx2lyx helper
On Tuesday 21 January 2003 18:35, José Matos wrote: This patch: * updates the version of lyx2lyx to match the corresponing lyx version; * updates the reference to the copyright date. * adds two new options to list the supported lyx versions, and allow to specify it instead of the final file format. * if both the file format and lyx version are given for the resulting file it aborts as they are mutually exclusive. The purpose of this patch is to make lyx2lyx more user friendly and to simplify its usage for normal users who wnat to use it for older version of lyx. Errr ignore the last patch, this one is the real. :-) Comments? -- José Abílio ? patch-lyx2lyx Index: lyx2lyx === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v retrieving revision 1.5 diff -u -p -r1.5 lyx2lyx --- lyx2lyx 7 Jan 2003 17:03:59 - 1.5 +++ lyx2lyx 21 Jan 2003 18:56:19 - @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Copyright (C) 2002 José Matos [EMAIL PROTECTED] +# Copyright (C) 2002-2003 José Matos [EMAIL PROTECTED] # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,7 +19,7 @@ import getopt, sys, string, re from error import error, warning from parser_tools import set_comment, set_format, check_token -version = 0.0.2 +version = 1.3.0 # Allow the dummy object to be able to carry related data # like a C struct @@ -37,7 +37,22 @@ opt.quiet = 0 format = re.compile(r(\d)[\.,]?(\d\d)) fileformat = re.compile(r\\lyxformat\s*(\S*)) -lst_ft = [210, 215, 216, 217, 218, 220, 221] + +lyx_version = {0.12:215, 1.0.0:215, 1.0.1: 215, 1.0.2:215, + 1.0.3:215, 1.0.4:215, 1.1.2:215, 1.1.4:215, + 1.1.5:216, 1.1.5fix1:216, 1.1.5fix2:216, + 1.1.6:217, 1.1.6fix1:217, 1.1.6fix2:217, + 1.1.6fix3:218, 1.1.6fix4:218,1.2.0:220, + 1.2.1:220, 1.2.2:220, 1.2.3:220,1.3.0:221} +lst_ft = [] +lst = lyx_version.values() +lst.sort() +#determine unique representation +value = None +for item in lst: +if item != value: +value = item +lst_ft.append(value) def usage(): print Usage: lyx2lyx [options] file1 @@ -45,30 +60,34 @@ Convert old lyx file file1 to newer fo Options: -h, --help this information -v, --version output version information and exit --l, --list list all available formats +-l, --list list all available file formats +-m, --list-versions list all lyx versions supported -d, --debug level level=0..2 (O_ no debug information,2_verbose) default: level=1 --f, --from version initial version (optional) --t, --to version final version (optional) +-f, --from version initial version +-t, --to version final lyx file format version +-n, --final-version version final lyx version -o, --output name name of the output file or else goes to stdout -q, --quiet same as --debug=0 def parse_options(argv): -_options = [help, version, list, from=, to=, output=, quiet] +_options = [help, version, list, list-versions, from=, to=, output=, final-version=, quiet] try: - opts, args = getopt.getopt(argv[1:], f:hlo:qt:v, _options) + opts, args = getopt.getopt(argv[1:], f:hlmn:o:qt:v, _options) except getopt.error: usage() sys.exit(2) +output_option = 0 + for o, a in opts: if o in (-h, --help): usage() sys.exit() if o in (-v, --version): print lyxconvert, version %s %(version) -print Copyright (C) 2002 LyX Team +print Copyright (C) 2002-2003 LyX Team sys.exit() if o in (-d, --debug): opt.debug = int(a) @@ -77,12 +96,26 @@ def parse_options(argv): if o in (-l, --list): print lst_ft sys.exit() +if o in (-m, --list-versions): +lyx_versions = lyx_version.keys() +lyx_versions.sort() +print lyx_versions +sys.exit() if o in (-o, --output): opt.output = open(a, w) if o in (-f, --from): opt.start = lyxformat(a) if o in (-t, --to): +output_option = output_option + 1 opt.end = lyxformat(a) +if o in (-n,--final-version): +output_option = output_option + 1 +opt.end = lyxversion[a] + +if output_option == 2: +sys.stderr.write(Final output format and final LyX version are mutually exclusive, provide only one of them.\n) +usage() +sys.exit(2) if not opt.end: opt.end = lst_ft[len(lst_ft)-1]
[PATCH] lyx2lyx helper
This patch: * updates the version of lyx2lyx to match the corresponing lyx version; * updates the reference to the copyright date. * adds two new options to list the supported lyx versions, and allow to specify it instead of the final file format. * if both the file format and lyx version are given for the resulting file it aborts as they are mutually exclusive. The purpose of this patch is to make lyx2lyx more user friendly and to simplify its usage for normal users who wnat to use it for older version of lyx. Comments? -- José Abílio ? patch-lyx2lyx Index: lyx2lyx === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v retrieving revision 1.5 diff -u -p -r1.5 lyx2lyx --- lyx2lyx 7 Jan 2003 17:03:59 - 1.5 +++ lyx2lyx 21 Jan 2003 18:17:46 - @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Copyright (C) 2002 José Matos <[EMAIL PROTECTED]> +# Copyright (C) 2002-2003 José Matos <[EMAIL PROTECTED]> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,7 +19,7 @@ import getopt, sys, string, re from error import error, warning from parser_tools import set_comment, set_format, check_token -version = "0.0.2" +version = "1.3.0" # Allow the dummy object to be able to carry related data # like a C struct @@ -37,7 +37,13 @@ opt.quiet = 0 format = re.compile(r"(\d)[\.,]?(\d\d)") fileformat = re.compile(r"\\lyxformat\s*(\S*)") -lst_ft = ["210", "215", "216", "217", "218", "220", "221"] + +lyx_version = {"0.12":"215", "1.0.0":"215", "1.0.1": "215", "1.0.2":"215", + "1.0.3":"215", "1.0.4":"215", "1.1.2":"215", "1.1.4":"215", + "1.1.5":"216", "1.1.5fix1":"216", "1.1.5fix2":"216", + "1.1.6":"217", "1.1.6fix1":"217", "1.1.6fix2":"217", + "1.1.6fix3":"218", "1.1.6fix4":"218","1.2.0":"220", + "1.2.1":"220", "1.2.2":"220", "1.2.3":"220","1.3.0":"221"} def usage(): print """Usage: lyx2lyx [options] file1 @@ -45,44 +51,70 @@ Convert old lyx file to newer fo Options: -h, --help this information -v, --version output version information and exit --l, --list list all available formats +-l, --list list all available file formats +-m, --list-versions list all lyx versions supported -d, --debug level level=0..2 (O_ no debug information,2_verbose) default: level=1 --f, --from version initial version (optional) --t, --to version final version (optional) +-f, --from version initial version +-t, --to version final lyx file format version +-n, --final-version version final lyx version -o, --output name name of the output file or else goes to stdout -q, --quiet same as --debug=0""" def parse_options(argv): -_options = ["help", "version", "list", "from=", "to=", "output=", "quiet"] +_options = ["help", "version", "list", "list-versions", "from=", "to=", "output=", "final-version=", "quiet"] try: - opts, args = getopt.getopt(argv[1:], "f:hlo:qt:v", _options) + opts, args = getopt.getopt(argv[1:], "f:hlmn:o:qt:v", _options) except getopt.error: usage() sys.exit(2) +output_option = 0 + for o, a in opts: if o in ("-h", "--help"): usage() sys.exit() if o in ("-v", "--version"): print "lyxconvert, version %s" %(version) -print "Copyright (C) 2002 LyX Team" +print "Copyright (C) 2002-2003 LyX Team" sys.exit() if o in ("-d", "--debug"): opt.debug = int(a) if o in ("-q", "--quiet"): opt.debug = 0 if o in ("-l", "--list"): -print lst_ft +lst = lyx_version.values() +lst.sort() +#determine unique representation +value = None +for item in lst: +if item != value: +value = item +print value, +print +sys.exit() +if o in ("-m", "--list-versions"): +lyx_versions = lyx_version.keys() +lyx_versions.sort() +print lyx_versions sys.exit() if o in ("-o", "--output"): opt.output = open(a, "w") if o in ("-f", "--from"): opt.start = lyxformat(a) if o in ("-t", "--to"): +output_option = output_option + 1 opt.end = lyxformat(a) +if o in ("-n","--final-version"): +output_option = output_option + 1 +opt.end = lyxversion[a] + +if output_option == 2: +sys.stderr.write("Final output format and final LyX version are mutually exclusive, provide only one of them.\n") +usage() +sys.exit(2) if not opt.end: opt.end = lst_ft[len(lst_ft)-1]
Re: [PATCH] lyx2lyx helper
On Tuesday 21 January 2003 18:35, José Matos wrote: > This patch: > * updates the version of lyx2lyx to match the corresponing lyx version; > * updates the reference to the copyright date. > * adds two new options to list the supported lyx versions, and allow to > specify it instead of the final file format. > * if both the file format and lyx version are given for the resulting file > it aborts as they are mutually exclusive. > > The purpose of this patch is to make lyx2lyx more user friendly and to > simplify its usage for normal users who wnat to use it for older version of > lyx. Errr ignore the last patch, this one is the real. :-) > Comments? -- José Abílio ? patch-lyx2lyx Index: lyx2lyx === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v retrieving revision 1.5 diff -u -p -r1.5 lyx2lyx --- lyx2lyx 7 Jan 2003 17:03:59 - 1.5 +++ lyx2lyx 21 Jan 2003 18:56:19 - @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Copyright (C) 2002 José Matos <[EMAIL PROTECTED]> +# Copyright (C) 2002-2003 José Matos <[EMAIL PROTECTED]> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,7 +19,7 @@ import getopt, sys, string, re from error import error, warning from parser_tools import set_comment, set_format, check_token -version = "0.0.2" +version = "1.3.0" # Allow the dummy object to be able to carry related data # like a C struct @@ -37,7 +37,22 @@ opt.quiet = 0 format = re.compile(r"(\d)[\.,]?(\d\d)") fileformat = re.compile(r"\\lyxformat\s*(\S*)") -lst_ft = ["210", "215", "216", "217", "218", "220", "221"] + +lyx_version = {"0.12":"215", "1.0.0":"215", "1.0.1": "215", "1.0.2":"215", + "1.0.3":"215", "1.0.4":"215", "1.1.2":"215", "1.1.4":"215", + "1.1.5":"216", "1.1.5fix1":"216", "1.1.5fix2":"216", + "1.1.6":"217", "1.1.6fix1":"217", "1.1.6fix2":"217", + "1.1.6fix3":"218", "1.1.6fix4":"218","1.2.0":"220", + "1.2.1":"220", "1.2.2":"220", "1.2.3":"220","1.3.0":"221"} +lst_ft = [] +lst = lyx_version.values() +lst.sort() +#determine unique representation +value = None +for item in lst: +if item != value: +value = item +lst_ft.append(value) def usage(): print """Usage: lyx2lyx [options] file1 @@ -45,30 +60,34 @@ Convert old lyx file to newer fo Options: -h, --help this information -v, --version output version information and exit --l, --list list all available formats +-l, --list list all available file formats +-m, --list-versions list all lyx versions supported -d, --debug level level=0..2 (O_ no debug information,2_verbose) default: level=1 --f, --from version initial version (optional) --t, --to version final version (optional) +-f, --from version initial version +-t, --to version final lyx file format version +-n, --final-version version final lyx version -o, --output name name of the output file or else goes to stdout -q, --quiet same as --debug=0""" def parse_options(argv): -_options = ["help", "version", "list", "from=", "to=", "output=", "quiet"] +_options = ["help", "version", "list", "list-versions", "from=", "to=", "output=", "final-version=", "quiet"] try: - opts, args = getopt.getopt(argv[1:], "f:hlo:qt:v", _options) + opts, args = getopt.getopt(argv[1:], "f:hlmn:o:qt:v", _options) except getopt.error: usage() sys.exit(2) +output_option = 0 + for o, a in opts: if o in ("-h", "--help"): usage() sys.exit() if o in ("-v", "--version"): print "lyxconvert, version %s" %(version) -print "Copyright (C) 2002 LyX Team" +print "Copyright (C) 2002-2003 LyX Team" sys.exit() if o in ("-d", "--debug"): opt.debug = int(a) @@ -77,12 +96,26 @@ def parse_options(argv): if o in ("-l", "--list"): print lst_ft sys.exit() +if o in ("-m", "--list-versions"): +lyx_versions = lyx_version.keys() +lyx_versions.sort() +print lyx_versions +sys.exit() if o in ("-o", "--output"): opt.output = open(a, "w") if o in ("-f", "--from"): opt.start = lyxformat(a) if o in ("-t", "--to"): +output_option = output_option + 1 opt.end = lyxformat(a) +if o in ("-n","--final-version"): +output_option = output_option + 1 +opt.end = lyxversion[a] + +if output_option == 2: +sys.stderr.write("Final output format and final LyX version are mutually exclusive, provide only one of them.\n") +usage() +sys.exit(2) if not opt.end: opt.end =