Commit bbdafb90 authored by Momme's avatar Momme

Merge branch 'master' of gitlab.ecosystem-modelling.pml.ac.uk:momm/pyprotex

parents 6395e330 6004762a
#!/bin/bash
#
#BOP
# !DESCRIPTION:
# Convert to python 3. The script converts the file in the file
# argument to python. It creates the converted file in th py3 sub-folder.
# Additionaly the shell invokation will be changed to
# explicitly invoke python3.
#EOP
file=PyProTex.py
mkdir -p py3
2to3 -p -n -w -o py3 $file
# make the shell invokation python3 instead of python
sed -i "s/\#\!\/usr\/bin\/python\b/\#\!\/usr\/bin\/python3/" py3/$file
......@@ -33,13 +33,13 @@
#
# !DESCRIPTION:
# This as a python version of the protex perl tool.
# Th perl tool was developed at the Goddard Space Flight Center
# The perl tool was developed at the Goddard Space Flight Center
# by Arlindo Da Silva, Will Sawyer, and others under no specific
# license.
# The python version was created by Momme Butenschoen at the
# Plymouth Marine Laboratory
# The adaptation is based on the version 2.0 as downloaded from
# http://acmg.seas.harvard.edu/geos/wiki_docs/protex/protex.tar.gz
# http://acmg.seas.harvard.edu/geos/wiki\_docs/protex/protex.tar.gz
#
# Python class to produce a \LaTeX compatible document
# from a DAO Fortran source code with standard Pro\TeX
......@@ -55,7 +55,7 @@
# & implies -l and -s \\ \hline
# -b & Bare mode, meaning no preamble, etc. \\ \hline
# -i & internal mode: omit prologues marked !BOPI \\ \hline
# -g & Use GEOS style. Implies -n unless overidden.
# -g & Use GEOS style. Implies -n unless overidden. \\ hline
# +/-n & New Page for each subsection (wastes paper) \\ \hline
# +/-l & Listing mode, default is prologues only \\ \hline
# +/-s & Shut-up mode, i.e., ignore any code from BOC to EOC \\ \hline
......@@ -133,7 +133,7 @@
#
#EOP
#----------------------------------------------------------------------------
#BOC
from __future__ import print_function
from sys import argv,stderr,stdout
from time import localtime,strftime
......@@ -496,9 +496,9 @@ class PyProTex:
name=self.name_is.replace("_","\_")# Replace "_" with "\_"
if self.opt["n"] and not self.first: self.Str+="\n\\newpage\n"
if self.opt["f"]:
self.Str+="\n\\section{{{} }\n\n".format(name)
self.Str+="\n\\section{{{} }}\n\n".format(name)
else:
self.Str+="\n\section{{{} (Source: {})}\n\n".format(name, self.FileBaseName)
self.Str+="\n\section{{{} (Source: {})}}\n\n".format(name, self.FileBaseName)
self.have_name = 1
self.first = 0
return
......@@ -1117,3 +1117,4 @@ if __name__=="__main__":
PPTex=PyProTex(opts) #set-up with all options
PPTex(files) #translate all files
print(PPTex)
#EOC
......@@ -33,13 +33,13 @@
#
# !DESCRIPTION:
# This as a python version of the protex perl tool.
# Th perl tool was developed at the Goddard Space Flight Center
# The perl tool was developed at the Goddard Space Flight Center
# by Arlindo Da Silva, Will Sawyer, and others under no specific
# license.
# The python version was created by Momme Butenschoen at the
# Plymouth Marine Laboratory
# The adaptation is based on the version 2.0 as downloaded from
# http://acmg.seas.harvard.edu/geos/wiki_docs/protex/protex.tar.gz
# http://acmg.seas.harvard.edu/geos/wiki\_docs/protex/protex.tar.gz
#
# Python class to produce a \LaTeX compatible document
# from a DAO Fortran source code with standard Pro\TeX
......@@ -55,7 +55,7 @@
# & implies -l and -s \\ \hline
# -b & Bare mode, meaning no preamble, etc. \\ \hline
# -i & internal mode: omit prologues marked !BOPI \\ \hline
# -g & Use GEOS style. Implies -n unless overidden.
# -g & Use GEOS style. Implies -n unless overidden. \\ hline
# +/-n & New Page for each subsection (wastes paper) \\ \hline
# +/-l & Listing mode, default is prologues only \\ \hline
# +/-s & Shut-up mode, i.e., ignore any code from BOC to EOC \\ \hline
......@@ -133,7 +133,7 @@
#
#EOP
#----------------------------------------------------------------------------
#BOC
from sys import argv,stderr,stdout
from time import localtime,strftime
......@@ -496,9 +496,9 @@ class PyProTex:
name=self.name_is.replace("_","\_")# Replace "_" with "\_"
if self.opt["n"] and not self.first: self.Str+="\n\\newpage\n"
if self.opt["f"]:
self.Str+="\n\\section{{{} }\n\n".format(name)
self.Str+="\n\\section{{{} }}\n\n".format(name)
else:
self.Str+="\n\section{{{} (Source: {})}\n\n".format(name, self.FileBaseName)
self.Str+="\n\section{{{} (Source: {})}}\n\n".format(name, self.FileBaseName)
self.have_name = 1
self.first = 0
return
......@@ -1117,3 +1117,4 @@ if __name__=="__main__":
PPTex=PyProTex(opts) #set-up with all options
PPTex(files) #translate all files
print(PPTex)
#EOC
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment