jasedit / scriptorium Goto Github PK
View Code? Open in Web Editor NEWRepository creating a framework for providing a MultiMarkdown and LaTeX based system for easily writing academic papers.
License: MIT License
Repository creating a framework for providing a MultiMarkdown and LaTeX based system for easily writing academic papers.
License: MIT License
When executing scriptorium doctor
, the LaTeX package test should read and use the LATEX_CMD
configuration value for consistency
Called scriptorium make from directory with paper.mmd (folder name test).
Ryans-MacBook-Pro-2:test ryan$ scriptorium make -o test
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 9, in
load_entry_point('scriptorium==2.0.0', 'console_scripts', 'scriptorium')()
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 78, in main
args.func(args)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 12, in make
pdf = scriptorium.to_pdf(args.paper, use_shell_escape=args.shell_escape)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/papers.py", line 76, in to_pdf
print('LaTeX conversion failed with the following output:\n', output)
UnboundLocalError: local variable 'output' referenced before assignment
I get this error whatever I try to build:
C:\Users\Roland\Desktop\Thesis\Compile>scriptorium build mypaper.mmd
Traceback (most recent call last):
File "c:\users\roland\appdata\local\programs\python\python39\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\roland\appdata\local\programs\python\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Roland\AppData\Local\Programs\Python\Python39\Scripts\scriptorium.exe_main.py", line 7, in
File "c:\users\roland\appdata\local\programs\python\python39\lib\site-packages\scriptorium_main.py", line 181, in main
args.func(args)
File "c:\users\roland\appdata\local\programs\python\python39\lib\site-packages\scriptorium_main.py", line 16, in build_cmd
pdf = scriptorium.to_pdf(args.paper, use_shell_escape=args.shell_escape, flatten=args.flatten,
File "c:\users\roland\appdata\local\programs\python\python39\lib\site-packages\scriptorium\papers.py", line 137, in to_pdf
tex_fp.write(pymmd.convert(mmd_fp.read(), fmt=pymmd.LATEX, dname=mmd, ext=pymmd.SMART))
File "c:\users\roland\appdata\local\programs\python\python39\lib\site-packages\pymmd-0.4.0-py3.9.egg\pymmd\mmd.py", line 123, in convert
source, _ = _expand_source(source, dname, fmt)
File "c:\users\roland\appdata\local\programs\python\python39\lib\site-packages\pymmd-0.4.0-py3.9.egg\pymmd\mmd.py", line 83, in _expand_source
_MMD_LIB.g_string_new.restype = ctypes.POINTER(GString)
AttributeError: 'NoneType' object has no attribute 'g_string_new'
Right now, templates are added by simply specifying the repository containing them. It may ease usability to have some method by which a list of templates can be found and searched.
Windows does not have a good method of generally supporting the bash dependency. Switching to a python script for performing operations could be useful in helping this.
Make as a dependency could also be removed if this were the case.
When trying out the new Python system, running the following on a properly configured paper directory bombs out:
scriptorium make papers/thesis/main
The error produced indicates a failure to import a module.
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 11, in <module>
load_entry_point('scriptorium==2.0.0', 'console_scripts', 'scriptorium')()
File "/home/hakujin/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 565,
in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/hakujin/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2598,
in load_entry_point
return ep.load()
File "/home/hakujin/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2258,
in load
return self.resolve()
File "/home/hakujin/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2264,
in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named main
As far as I know, all python dependencies are satisfied at this point.
The error appears to be related to attempting to decode process output in cp1252, which doesn't support all text output. This should be fixed to at least not freak out.
Attempted to build a new document after completing the configuration in paper.mmd, but python errors occurred. Paper files are attached below.
$ scriptorium build
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.4/dist-packages/scriptorium/main.py", line 181, in main
args.func(args)
File "/usr/local/lib/python3.4/dist-packages/scriptorium/main.py", line 17, in build_cmd
keep_comments=args.keep_comments)
File "/usr/local/lib/python3.4/dist-packages/scriptorium/papers.py", line 116, in to_pdf
fname = paper_root(paper_dir)
File "/usr/local/lib/python3.4/dist-packages/scriptorium/papers.py", line 33, in paper_root
if get_template(fname):
File "/usr/local/lib/python3.4/dist-packages/scriptorium/papers.py", line 54, in get_template
idx = mmf.find(_BLANK_LINK)
TypeError: must be read-only pinned buffer, not bytearray
Current template implementations such as vtthesis have sections such as the abstract and acknowledgements embedded in the metadata.tex file. It'd be snazzy to have the ability to define those as external multimarkdown files to ease creation and maintenance.
Scriptorium fails when creating a new paper. I tried with both the ieeetran template and the report template. Traceback is below.
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 9, in
load_entry_point('scriptorium==2.0.0', 'console_scripts', 'scriptorium')()
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 78, in main
args.func(args)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 43, in create
if not scriptorium.create(args.output, args.template, force=args.force, config=args.config):
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/papers.py", line 117, in create
shutil.copyfile(giname, os.path.join(paper_dir))
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 21] Is a directory: 'test'
When trying to setup scriptorium on a new Ubuntu 16.04 computer, when the command sudo python -c "import pymmd; pymmd.build_mmd()"
is run, the following is reported
Entering 'submodules/greg'
Already up-to-date.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/robert/.local/lib/python2.7/site-packages/pymmd/download.py", line 65, in build_mmd
subprocess.call(cmake_cmd)
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
This prevent the rest of the install from working.
In the same vein as git's subcommands such as git add
, etc. having the ability to tab-complete things like scriptorium bu
to scriptorium build
would be a quality of life improvement for command-line users.
For example, the report template does not contain a metadata.tex file, but scriptorium attempts to create one regardless.
When running the scriptorium doctor
command, it returns Missing package latex
on a new install of Ubuntu 16.04.
A fatal LaTeX error can break error output statements inside Scriptorium. The stack trace and causative error are included below.
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 11, in <module>
load_entry_point('scriptorium==2.0.0', 'console_scripts', 'scriptorium')()
File "/usr/local/lib/python2.7/dist-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/__main__.py", line 78, in main
args.func(args)
File "/usr/local/lib/python2.7/dist-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/__main__.py", line 12, in make
pdf = scriptorium.to_pdf(args.paper, use_shell_escape=args.shell_escape)
File "/usr/local/lib/python2.7/dist-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/papers.py", line 76, in to_pdf
print('LaTeX conversion failed with the following output:\n', output)
UnboundLocalError: local variable 'output' referenced before assignment
LaTeX Warning: Citation 'mrx05' on page 1 undefined on input line 16.
pdfTeX warning (ext4): destination with the same identifier (name{page.1}) has
been already used, duplicate ignored
<to be read again>
\relax
l.18 \chapter
{Bibliography} [1
]
Chapter 2.
(/home/hakujin/scriptorium/bin/../templates/./simple_templates/report/footer.te
x
! Package biblatex Error: '\bibliographystyle' invalid.
See the biblatex package documentation for explanation.
Type H <return> for immediate help.
...
l.4 \bibliographystyle{ieeetr}
Here is how much of TeX's memory you used:
10908 strings out of 495000
178786 string characters out of 6181170
614717 words of memory out of 5000000
14062 multiletter control sequences out of 15000+600000
8501 words of font info for 30 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
37i,6n,32p,992b,729s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
Not sure if this intended behaviour, but running scriptorium make
in a paper directory fails, as opposed to being equivalent to scriptorium make .
.
Unit tests are recently added to the repository - adding more to improve coverage would be greatly appreciated. These are relatively simple to write, and I'm happy to review any PRs that introduce additional unit tests.
This results in breaking template usage
When running scriptorium build
under Python 2, the following TypeError exception is thrown:
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/scriptorium/__main__.py", line 161, in main
args.func(args)
File "/usr/local/lib/python2.7/dist-packages/scriptorium/__main__.py", line 16, in build_cmd
pdf = scriptorium.to_pdf(args.paper, use_shell_escape=args.shell_escape, flatten=args.flatten)
File "/usr/local/lib/python2.7/dist-packages/scriptorium/papers.py", line 61, in to_pdf
fname = paper_root(paper_dir)
File "/usr/local/lib/python2.7/dist-packages/scriptorium/papers.py", line 28, in paper_root
if get_template(fname):
File "/usr/local/lib/python2.7/dist-packages/scriptorium/papers.py", line 48, in get_template
idx = mm.find(bytearray(blank_line, 'utf-8'))
TypeError: find() argument 1 must be string or read-only buffer, not bytearray
This does not occur when running under Python 3.
Called template update on both ieeetran and report. Same result.
Ryans-MacBook-Pro-2:scriptorium ryan$ scriptorium template -u report
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 9, in
load_entry_point('scriptorium==2.0.0', 'console_scripts', 'scriptorium')()
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 102, in main
args.func(args)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 41, in template_cmd
scriptorium.update_template(args.update)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/templates.py", line 78, in update_template
treeish_re = re.compile(r'[A-Za-z0-9_-.]+')
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 190, in compile
return _compile(pattern, flags)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 244, in _compile
raise error, v # invalid expression
sre_constants.error: bad character range
MultiMarkdown 6 offers faster parser with some amount of changes to parsing. Considering migrating to the new engine would potentially be useful.
I know this was an issue that you previously took care of, but it unfortunately did not get documented. When I include an image, it appears absolutely enormous in the document.
Right now, all papers derive from a generic paper example, which suffers from not providing the appropriate metadata each template requires for correct formatting. Templates should be able to provide an example frontmatter with default values inserted.
This would also allow a paper to not require the use of metadata.tex
for templates which are simple enough to not require it.
This may not be an explicit dependency for Scriptorium for custom theme types, but needs further investigation to verify. If not, it may be worthwhile to consider removing the installation/setup.
mmf = mmap.mmap(mmd_fp.fileno(), 0, prot=mmap.PROT_READ
AttributeError: module 'mmap' has no attribute 'PROT_READ'
For completeness, the inclusion of OSX setup instructions in the README would be good.
Attempted to check the template list that is installed. I verified that the TEMPLATE_DIR is correct in the scriptorium config file.
Ryans-MacBook-Pro-2:scriptorium ryan$ scriptorium template -l
Traceback (most recent call last):
File "/usr/local/bin/scriptorium", line 9, in
load_entry_point('scriptorium==2.0.0', 'console_scripts', 'scriptorium')()
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 102, in main
args.func(args)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/main.py", line 44, in template_cmd
templates = scriptorium.all_templates(args.template_dir)
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scriptorium-2.0.0-py2.7.egg/scriptorium/templates.py", line 15, in all_templates
for dirpath, _, filenames in os.walk(dname):
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 278, in walk
names = listdir(top)
TypeError: coercing to Unicode: need string or buffer, NoneType found
This becomes a problem when first creating a document, and many pre-created files may be blank.
Currently, certain configuration values are defined on a per-user basis, such as the LATEX_CMD
configuration option. This isn't necessarily a per-user setting, however - particular papers may be limited in which LaTeX engine may be used for layout.
Is the LATEX_CMD
the only option which would be worth considering for generalization in this fashion? Would the --flatten
or --keep-comments
be worth including?
LaTeX can get confused sometimes by cruft in temporary files, and having a command to automatically remove these files would be useful. These should not removed every time, since those files are normally required for building the document.
People discuss this issue in related areas and tools (see here), which can serve as a decent starting point.
At a simple cut, this should be a clean function which:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.