Skip to content

Commit 6ed44a1

Browse files
committed
Issue #5: Move or copy lyx2xml into this repo
1 parent b91fe1d commit 6ed44a1

File tree

4 files changed

+776
-0
lines changed

4 files changed

+776
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*~
33
*-
44
.*.swp
5+
*.pyc
56
docbook.dtd
67
META-INF
78
net

Diff for: src/lyx2xml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#! /usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
" Program used to convert between different versions of the lyx file format."
5+
import optparse
6+
import sys
7+
import LyX
8+
from lyx2xml import LyX2XML
9+
10+
def outcb(text):
11+
if text:
12+
sys.stdout.write(text)
13+
14+
def main():
15+
args = {}
16+
args["usage"] = "usage: %prog [options] [file]"
17+
args["version"] = """lyx2xml, version 0.1 Copyright (C) 2012 Nicolas Williams"""
18+
args["description"] = """Convert lyx file <file> to XML."""
19+
20+
parser = optparse.OptionParser(**args)
21+
22+
parser.add_option("-d", "--debug", type="int",
23+
help="level=0..2 (O_ quiet, 10_verbose) default: 2")
24+
25+
(options, args) = parser.parse_args()
26+
27+
def _debugcb(s):
28+
if options.debug:
29+
sys.stderr.write('\n\n[debug] %s\n' % (s))
30+
if args:
31+
LyX2XML(args[0], outcb, _debugcb, options.debug or 0)
32+
else:
33+
LyX2XML('/dev/fd/0', outcb, _debugcb, options.debug or 0)
34+
35+
sys.exit(0)
36+
37+
if __name__ == "__main__":
38+
main()
39+

0 commit comments

Comments
 (0)