mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Clean up the include_bib script a bit.
This commit is contained in:
parent
f98bb89227
commit
e5c8f33be7
@ -41,8 +41,6 @@ def InsertBib(fil, out):
|
|||||||
elif "\\begin{btSect}" in line:
|
elif "\\begin{btSect}" in line:
|
||||||
raise BibError("Cannot export sectioned bibliographies")
|
raise BibError("Cannot export sectioned bibliographies")
|
||||||
|
|
||||||
filenew = fil[:-4] + "-bibinc.tex" #The new .tex file
|
|
||||||
|
|
||||||
if len(biblist) > 1:
|
if len(biblist) > 1:
|
||||||
raise BibError("Cannot export multiple bibliographies.")
|
raise BibError("Cannot export multiple bibliographies.")
|
||||||
if not biblist:
|
if not biblist:
|
||||||
@ -58,9 +56,35 @@ def InsertBib(fil, out):
|
|||||||
outfile = open(out, 'w')
|
outfile = open(out, 'w')
|
||||||
outfile.write("".join(newlist))
|
outfile.write("".join(newlist))
|
||||||
outfile.close()
|
outfile.close()
|
||||||
return filenew
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def usage():
|
||||||
|
print r'''
|
||||||
|
Usage: python include_bib.py file.tex [outfile.tex]
|
||||||
|
Includes the contents of file.bbl, which must exist in the
|
||||||
|
same directory as file.tex, in place of the \bibliography
|
||||||
|
command, and creates the new file outfile.tex. If no name
|
||||||
|
for that file is given, we create: file-bbl.tex.
|
||||||
|
'''
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
newfile = InsertBib(sys.argv[1], sys.argv[2])
|
args = len(sys.argv)
|
||||||
print "Wrote " + newfile
|
if args <= 1 or args > 3:
|
||||||
|
usage()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# we might should make sure this is a tex file....
|
||||||
|
infile = sys.argv[1]
|
||||||
|
if infile[-4:] != ".tex":
|
||||||
|
print "Error: " + infile + " is not a TeX file"
|
||||||
|
usage()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if args == 3:
|
||||||
|
outfile = sys.argv[2]
|
||||||
|
else:
|
||||||
|
outfile = infile[:-4] + "-bbl.tex"
|
||||||
|
|
||||||
|
newfile = InsertBib(infile, outfile)
|
||||||
|
print "Wrote " + outfile
|
||||||
|
@ -26,6 +26,8 @@ What's new
|
|||||||
|
|
||||||
- Add support for \subsubsection and \subsubsection* in beamer layout.
|
- Add support for \subsubsection and \subsubsection* in beamer layout.
|
||||||
|
|
||||||
|
- Made some minor improvements to the include_bib.py script.
|
||||||
|
|
||||||
|
|
||||||
* TEX2LYX IMPROVEMENTS
|
* TEX2LYX IMPROVEMENTS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user