GithubHelp home page GithubHelp logo

hplgit / doconce Goto Github PK

View Code? Open in Web Editor NEW
308.0 36.0 60.0 461.14 MB

Lightweight markup language - document once, include anywhere

Home Page: http://hplgit.github.io/doconce/doc/web/index.html

License: Other

Shell 0.41% TeX 3.35% HTML 8.54% Python 17.91% CSS 8.85% JavaScript 1.57% Emacs Lisp 0.08% R 59.17% Jupyter Notebook 0.11% Makefile 0.01% Dockerfile 0.01%

doconce's Introduction

doconce's People

Contributors

ahmadia avatar aless80 avatar dirkcgrunwald avatar dragly avatar fmatheus avatar henriasv avatar hplgit avatar ischurov avatar johanhake avatar johannesring avatar jrwrigh avatar ketch avatar kghustad avatar mikaem avatar mimeiners avatar mirko-lelansky avatar npmcdn-to-unpkg-bot avatar pierrethibault avatar robinkastberg avatar simetenn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doconce's Issues

New feature: the ptex2tex step can be omitted when compiling DocOnce to LaTeX

The doconce format pdflatex (or latex) command results in a file with extension .p.tex, which must be transformed to an ordinary LaTeX file using either the stand-alone ptex2tex program or the simpler doconce ptex2tex utility. The flexible typesetting of computer code offered by ptex2tex has now been reimplemented in a simpler way within DocOnce such that the ptex2tex step is unnecessary.

Running

Terminal> doconce format pdflatex mydoc --latex_code_style=X

generates a mydoc.tex file directly. Moreover, the LaTeX code for typesetting computer is simpler, more readable, and more flexible than offered by ptex2tex. The argument X can be simple or very complex, depending on how much detailed control of the typesetting of various code environments that is wanted. The verbatim typesetting now relies on three LaTeX environments: Verbatim, minted, and listlisting. These can be combined with colored backgrounds, if desired, and various parameters (line numbers, indent, etc.) can be specified for each code environment.

More detailed information on how to use the new --latex_code_style option is given in the demo.

Unable to run *.do.txt containing Exercise Section

Here is my source file: http://pastebin.com/QBTKKp59
Would you please help me in getting rid of the following error?

$ doconce format html main.do.txt --list_of_exercises=toc
 translating doconce text in main.do.txt to html
 Traceback (most recent call last):
  File "/home/sohail/anaconda/envs/doc27/bin/doconce", line 1177, in <module>
  main()
  File "/home/sohail/anaconda/envs/doc27/bin/doconce", line 1167, in main
eval(command + '()')
  File "<string>", line 1, in <module>
  File "/home/sohail/anaconda/envs/doc27/bin/doconce", line 92, in format
doconce.doconce.format_driver()
  File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 4278, in format_driver
out_filename = file2file(filename_preprocessed, format, basename)
  File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 3247, in file2file
  filestr = doconce2format(filestr, format)
  File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 3575, in doconce2format
filestr = exercises(filestr, format, code_blocks, tex_blocks)
 File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/doconce.py", line 1434, in exercises
formatted_exercise, formatted_solution = EXERCISE[format](exer)
 File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/html.py", line 1737, in html_exercise
hint_header='__Hint.__')
 File "/home/sohail/anaconda/envs/doc27/lib/python2.7/site-packages/doconce/common.py", line 792, in doconce_exercise_output
ssol += answer_header + '\n' + exer['answer'] + '\n'
UnboundLocalError: local variable 'ssol' referenced before assignment

quizes do not work with utf8

Trying to include utf8 characters somewhere between !bquiz and !equiz lead to an error 'ascii' codec can't encode....

underline and double underline

I want to generate "underline" and "doubleunderline" in final generated PDF, i am not able to see any way in which doconce allows me to do so. Underline is also possible in HTML
Can you kindly enhance it

The repository is huge

I am a newcomer to doconce and I am really eager to start using it. However, having to download 300+ MB in order to try the program is too much. du -h -d 1 reveals that more than half of that are git objects, which I believe to be unnecessary for most users. A large amount of space is taken up by files related to slide generation, which are not essential either. Also, I noticed an overlap in the content of the bundled and lib directories. The latter includes zip files of some of the directories in the former.

This comment is not intended to be a rant and I apologize if it sounds like it. I am very interested in using this tool and more importantly, I want my colleagues to use it.

Unicode chars in title does not compile properly to html

Hi,

I try to make a presentation with the line:
TITLE: Sustentação
and got the following error:

Traceback (most recent call last):
  File "/usr/local/bin/doconce", line 1177, in <module>
    main()
  File "/usr/local/bin/doconce", line 1167, in main
    eval(command + '()')
  File "<string>", line 1, in <module>
  File "/usr/local/bin/doconce", line 92, in format
    doconce.doconce.format_driver()
  File "/usr/local/lib/python2.7/dist-packages/doconce/doconce.py", line 4499, in format_driver
    out_filename = file2file(filename_preprocessed, format, basename)
  File "/usr/local/lib/python2.7/dist-packages/doconce/doconce.py", line 3478, in file2file
    filestr = doconce2format(filestr, format)
  File "/usr/local/lib/python2.7/dist-packages/doconce/doconce.py", line 3905, in doconce2format
    filestr = INTRO[format] + filestr
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)

To overcome the situation I just added these two lines in make.sh:

doconce replace '<h1>Sustentacao</h1>' '<h1>Sustentação</h1>' $name.html
doconce replace '<title>Sustentacao</title>' '<title>Sustentação</title>' $name.html

Interestingly was that it accepts:

AUTHOR: Sustentação

but not:

TITLE: Sustentação

I used the beige theme, where just TITLE is made a little glossy.

Thanks in advance,

Typo in DocOnce Description

Me again, sorry :-)
Found another one:
reStructuredText chapter
-> The sentence before the third codeblock says "unovonv" instead of "unoconv"

Issue at the doconce manual

I have not found other mean to report a minor typo en the doconce manual I've just read.
the section available at
http://hplgit.github.io/doconce/doc/pub/manual/html/manual.html#exercise-1-compute-integrals
Look at the excercise b), it describes the integral as

$e^{-at}\sin(wx)$

but I'm guessing that you meant

$e^{-ax}\sin(wx)$

My guess is based on the solution proposed and the python source code provided which reads

F = sp.integrate(sp.exp(-a_x)_sp.sin(w*x), x)

Sorry if this is not the best way of reporting a typo, but I did not found other way.

D.M.

--latex_exercise_numbering= is replaced by --exercise_numbering=`

Use of the --latex_exercise_numbering=chapter or absolute will have no effect now - change to --exercise_numbering=. The --exercise_numbering= makes it possible to have chapter-wise numbering of exercises for any format. In particular, you can get the same numbering in an html version of a book as in the latex version.

This change was part of a efforts with extracting exercises as separate files for distribution to students (e.g., as .tex files or IPython notebook files - the students can fill in the answers and learn to use latex or notebooks). See quick description.

New version of preprocess can include parts of other files

Many DocOnce documents make heavy use of # #include "file". With a new version of preprocess, https://github.com/hplgit/preprocess, it is possible to include just parts of another file. For example, one can easily include an example from the middle of a report in another document.

Here is another example: if the solution of an exercise is available as a separate report add_project.do.txt, parts of that report can be included in the solution environments of the exercise. The exercise goes like

!bsubex
Compute $1+1$.

!bsol
# #include "add_project.do.txt" fromto: Computing \$1+1\$ is a huge task\.@===== Computing 2 times 2 =====
!esol
!esubex

!bsubex
Compute $2\cdot 2$.

!bsol
# #include "add_project.do.txt" fromto: ===== Computing 2 times 2 =====@===== Concluding
!esol
!esubex

The syntax is identical to what is used by the DocOnce @@@CODE inclusion command (fromto: start-regex@end-regex).

New functionality for IPython/Jupyter notebooks

The handling of interactive sessions in DocOnce when compiling to the ipynb format has been changed. Previously, the entire session became a computational cell, but this is not what you (normally) want. You want to break up the session such that each output like >>> a ends a cell and enables printing a when executing the cell. In this way, you can recreate the entire interactive session in the notebook. This also works for sessions with IPython syntax.

Special features to be aware of when translating DocOnce to IPython/Jupyter notebooks is document
here:

http://hplgit.github.io/doconce/doc/pub/ipynb/info.html

How to write IPython/Jupyter notebooks from programs or simple ascii input

Notebooks are meant to be written interactively in the browser, but many would prefer to use an editor like Emacs and write the notebook in plain Markdown and computer code. Others may have lots of LaTeX files that they want to translate to notebooks, and then translating to an ascii format first is attractive. If the ascii format is extended with programming constructs like variables and functions, it also becomes more functional than writing notebooks in the web browser. Here is a description of such an ascii format and how the little compiler can be written:

http://hplgit.github.io/doconce/doc/pub/ipynb/ipynb_generator.html

Note that DocOnce offers the same possibility to write notebooks in ascii format, and with much more functionality, such as copying selected parts of files, capturing output from programs in the text, proper equation referencing in Markdown math, much more testing for potential Mako problems, handling of literature references, references to other sections, etc. The note above is for those who want to create their own independent format and/or learn how to use IPython.nbformat functionality for writing notebooks from programs.

DocOnce supports Matlab notebooks

DocOnce has a new output format matlabnb for Matlab notebooks in the publish format, http://se.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html. The implementation is very experimental!

Note that the publish format is very primitive so only a small subset of the DocOnce markup can successfully translate to Matlab notebooks. However, if one writes within this subset, it is easy to write notebooks that translate to both Python and Matlab.

Doconce > DocOnce?

The eye visually doesn't create the second word without a little help. Lowercasing to doconce would be a reasonable solution, but if you're going to mash together two words DocOnce will read much more naturally (at least to Americans).

TODO is probably not up to date

I've tried to get a whole picture about this project by reading different docs etc. and stumbled upon TODO. I wonder if it's still up to date as the mentions of pandoc etc. doesn't make me feel like so.

Particularly I'm looking for a better support for CommonMark with some extensions (as described on https://github.com/jgm/CommonMark/wiki/Proposed-Extensions-to-CommonMark) allowing the same set of features as the markup used e.g. for the book A Primer on Scientific Programming with Python (I believe the markup is the one on http://hplgit.github.io/teamods/writing_reports/_static/report.do.txt.html).

conda install did not install ipython notebook

Using Ubuntu 14.10, it appears that, after installing miniconda, and then running the conda package install conda install --channel johannr doconce, it is missing the ipython notebook for some operations. Once I ran conda install ipython-notebook, all the ipynb operations worked with doconce. Perhaps this could be included in the conda package?

Figure Caption cannot have _

Just wanted to make a general comment that confused me and caused a lot of tex errors, The Figure captions apparently cannot have _

This might be handy to include in the documentation. Thanks again

--html_toc_depth doesn't work

Trying to specify --html_toc_depth=1 during doconce format html, I have the following warning:

*** warning: unrecognized command-line option
    --html_toc_depth=1

It seems that there's no handlers for html_toc_depth at all:

[user@maccie doconce #2152]$ grep "html_toc_depth" **/*.py
build/lib/doconce/misc.py:    bootstrap_options = ' --html_style=bootswatch_readable --html_code_style=inherit --html_pre_style=inherit --html_toc_depth=2 --pygments_html_style=default'
lib/doconce/misc.py:    bootstrap_options = ' --html_style=bootswatch_readable --html_code_style=inherit --html_pre_style=inherit --html_toc_depth=2 --pygments_html_style=default'

And that's all, no other mentions of this options in the sources.

bib2rst.py can't import bib4txt

see error:

ben@Bens-MacBook-Pro ~/dev/doconce !510 # python bin/bib2rst.py
Traceback (most recent call last):
File "bin/bib2rst.py", line 26, in
from bibstuff import bib4txt
ImportError: cannot import name bib4txt

This is after running python setup.py install on head.

How to convert from .ipynb notebook to .do.txt format?

Is there a tool that automatically takes an IPython notebook and converts it to Doconce format? I can see two reasons why this would be very useful:

  1. I have lots of IPython notebooks; getting them into .do format would allow me to easily publish them in other ways.
  2. In my workflow it would be nice to write the document in .do format, convert to .ipynb, run the code and debug it in the notebook, and then convert back to .do.

Issues with generating markdown for slate

Slate is very similar to Nikola, but specialized on API docs: https://github.com/tripit/slate
Somehow I think that using doconce to generate markdown for Slate might be a good idea, especially if one want to generate LaTeX/PDF as well.

Slate has it's own flavor of markdown: https://github.com/tripit/slate/wiki/Markdown-Syntax
which use PHP style tables :-(

Finally I managed to use doconce format pandoc myfile --github_md which gives

  1. Verbose HTML tables in generated markdown which is fine for Slate
  2. 
    

Two problems still remain:

  1. DocOnce support only dozen programming languages compared to quite many supported by Slate http://rouge.jayferd.us/demo

Seems I can hack pandoc.py to add what I need (Java), but what will happen when I will generate say LaTex format ?

  1. Strangely enough Slate use verbose HTML for Notes and Warnings! It seems that some special syntax in DocOnce would be helpfull to generate those tags for Slate and something different for LaTeX.

Is it feasible to have special option --slate_md to generate correct markdown for Slate and still valid LaTeX from the DocOnce format ?

Installing doconce as a part of anaconda

While trying to follow the answer at: http://stackoverflow.com/questions/29545338/how-to-build-a-non-distribution-non-recipe-existent-packages-for-anaconda/29569096#29569096

I got:

$ conda skeleton pypi doconce
doconce not found, trying Doconce
Using url http://code.google.com/p/doconce/downloads/list (0 B) for Doconce.
Downloading Doconce (use --no-download to skip this step)
Unpacking Doconce...
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda-build/issues

Include the output of the command 'conda info' in your report.

Traceback (most recent call last):
File "/home/sohail/anaconda/bin/conda-skeleton", line 5, in <module>
sys.exit(main())
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 188, in main
args_func(args, p)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 321, in args_func
args.func(args, p)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 202, in execute
pypi.main(args, parser)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 376, in main
get_package_metadata(args, package, d, data)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 428, in    get_package_metadata
unpack(join(SRC_CACHE, d['filename']), tempdir)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 640, in unpack
raise Exception("not a valid source")
Exception: not a valid source

Would some body help??

There is no way to specify the output filename?

I am trying to add support for doconce in http://getnikola.com and ran into something:

I can't find a way to call doconce with a specific filename as input and a filename as output.

So, if you can describe the command line I should use to turn posts/foo.do into cache/posts/foo.html it would be much appreciated :-)

anaconda doconce install error

I am not sure if this is a conda error or not, just just wanted to let you know

Linux Mint 17.1
installed Anaconda

bash Anaconda-2.2.0-Linux-x86_64.sh

I closed the terminal and opened a new one.

neal@cinnamon ~ $ conda info
Current conda install:

             platform : linux-64
        conda version : 3.12.0
  conda-build version : 1.11.0
       python version : 2.7.9.final.0
     requests version : 2.7.0
     root environment : /home/neal/anaconda  (writable)
  default environment : /home/neal/anaconda
     envs directories : /home/neal/anaconda/envs
        package cache : /home/neal/anaconda/pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/linux-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : None

when I try to install

conda install --channel johannr doconce

I get the error

doconce-1.0.3- 100% |################################| Time: 0:00:03   1.77 MB/s
Extracting packages ...
[      COMPLETE      ] |##################################################| 100%
Unlinking packages ...
[      COMPLETE      ] |##################################################| 100%
Linking packages ...
An unexpected error has occurred, please consider sending the########     |  90%
following traceback to the conda GitHub issue tracker at:

    https://github.com/conda/conda/issues

Include the output of the command 'conda info' in your report.


Traceback (most recent call last):
  File "/home/neal/anaconda/bin/conda", line 5, in <module>
    sys.exit(main())
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 202, in main

  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 207, in args_func
    try:
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 46, in execute
    install.install(args, parser, 'install')
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
    log.debug("Can't write the history file")
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/plan.py", line 502, in execute_actions
    if to_link:
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 140, in execute_instructions

  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 84, in LINK_CMD
    return dist, pkgs_dir, int(linktype)
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 80, in link
    if pkgs_dir is None:
  File "/home/neal/anaconda/lib/python2.7/site-packages/conda/install.py", line 523, in link

  File "/home/neal/anaconda/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/home/neal/anaconda/lib/python2.7/site-packages/snowballstemmer-1.2.0-py2.7.egg-info'

I also tried doing the complete install as root and I get the same error. I however, used the install script
with success.

I am really excited to see this project grow. Awesome work!

Adding option to --latex_style

Using LaTeX or DocOnce to prepare manuscripts is great because the files can be version controlled and the writer does not have to fuss over the formatting.

However, one of the biggest challenges of using LaTeX to prepare manuscripts in the life and health sciences is that few journals support LaTeX. No LaTeX styles or templates are provided, and the writer has to spend considerable time tweaking LaTeX parameters to meet the formatting requirements of a given journal. And if your manuscript is accepted, you will have to generate a .doc version of your manuscript.

Nevertheless, there are a few journals that support LaTeX. A series of journals that have become increasingly popular are PLOS journals. When preparing a manuscript for one of these journals, there is a LaTeX template that can be used. It is not a .cls, but rather a .tex file with lots of commands, as well as a .bst file.

Would it be possible to add some functionality to DocOnce so that users could specify --latex_style=PLOS? I am not certain whether this would be more complicated than adding another pdf_style based on a .cls file. As a non-expert, would this be something I could tackle with some guidance, or would this be too hard?

Adding a PLOS latex_style would add to the pool of people who might be interested in using DocOnce. For me, it would be easier to get colleagues to collaborate a .do.txt file; most would be intimated and confused with a .tex file.

Regards.

\Verb generated by format pdflatex

Is there an option to make doconce generate \verb instead of \Verb when using "format pdflatex"?

When I run

doconce format pdflatex test1.do.txt

where

$ cat test1.do.txt 
The word `test` is in verbatim.

the generated .tex file contains \Verb, causing the "undefined control sequence" error:

$ pdflatex test1.p.tex
... <snipped>
! Undefined control sequence.
l.93 The word \Verb
                   !test! is in verbatim.

If I replace the \Verb with \verb, then pdflatex test1.p.tex runs ok:

$ doconce subst '\\Verb' '\\verb' test1.p.tex
\\Verb replaced by \\verb in test1.p.tex
$ pdflatex test1.p.tex
# this is ok

display of url from bibliography -- doc format html

Consider a bibliography item for a web site:

@Misc{test,
author = {First Last},
title =  {{T}his title is a test},
url =    {http://test_url.org},
howpublished = {\url{http://test_howpublished}},
year = {2015}
}

When building doconce format pdflatex, it will displays correctly like this:

screen shot 2015-03-10 at 9 43 51 pm

But when building for doconce format html, it generates this:

screen shot 2015-03-10 at 9 42 58 pm

It seems to me that when building format html, the HTML code should just display the howpublished field (like in format pdflatex) or the url field, but not both. Or am I doing something wrong?

(Normally url and howpublished would use the same web address. I use different ones here just to see which one is displayed in html and pdflatex, respectively)

The paper.pub file (publish import mybib.bib) looks like:

$ cat papers.pub 
* misc
** {T}his Title Is a Test
   key:          test
   author:       First Last
   year:         2015
   url:          http://test_url.org
   status:       published
   howpublished: \url{http://test_howpublished}
   entrytype:    misc

.do.txt source file:

$ cat my.do.txt 
Referece test cite{test}

===== References =====

BIBFILE: papers.pub

utf8x issues

I keep getting this error when I try pdflatex

The package inputenc has already been loaded with options:
  [utf8x]
There has now been an attempt to load it with options
  [utf8]
Adding the global options:
  utf8x,utf8
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.

I'm not sure how to fix this with doconce.

Any help appreciated.

elsevier.cls in the generated latex file from doconce

for writing a research paper , I have to write in latex STRICTLY USING "elsevier.cls"
( please refer http://www.elsevier.com/author-schemas/the-journal-document-class-elsart
http://www.elsevier.com/author-schemas/latex-instructions
http://mirrors.ctan.org/macros/latex/contrib/elsarticle/doc/elsdoc.pdf
)

Now, Can i write my research paper in "doconce", so as to "generate the latex" while which only uses "Journal documentclass elsarticle " from the "elsevier.cls" . So that the research paper can be submitted to an elsevier journal.

simple example syntax bug

__This is a paragraph heading.___ has an extra _

from http://hplgit.github.io/doconce/doc/pub/tutorial/tutorial.html#link_footnote_1

======= First a Section Heading with 7 = Characters =======

===== Then a Subsection Heading with 5 = Characters =====

=== Finally a Subsubection Heading with 3 = Characters ===

You can also have paragraphs with a paragraph heading surrounded
by double underscores are the beginning of a line.

__This is a paragraph heading.___
And here comes the text.

===== A Subsection with Sample Text =====
label{my:first:sec}

Ordinary text looks like ordinary text, but must always start at the
beginning of lines. Tags used for _boldface_ words, *emphasized*
words, and `computer` words look natural in plain text.  Quotations
appear inside double backticks and double single quotes, as in ``this
example''.

Below the section title we have a *label*, which can be used to
refer to Section ref{my:first:sec}.
References to equations, such as (ref{myeq1}), work in the same
LaTeX-inspired way.

Lists are typeset as you would do in email,

  * item 1
  * item 2,
    perhaps with a 2nd line
  * item 3

Note the consistent use of indentation (as in Python programming!).
Lists can also have automatically numbered items instead of bullets,

  o item 1
  o item 2
  o item 3,
    but be careful with the indentation of the next lines!

__Hyperlinks.__
URLs with a link word are possible, as in "hpl": "http://folk.uio.no/hpl".
If the word is just URL, the URL itself becomes the link name,
as in URL: "tutorial.do.txt". DocOnce distinguishes between paper
and screen output. In traditional paper output, in PDF generated from LaTeX
generated from DocOnce, the URLs of links appear as footnotes.
With screen output, all links are clickable hyperlinks, except in
the plain text format which does not support hyperlinks.

__Inline comments.__
DocOnce also allows inline comments of the form [name: comment] (with
a space after `name:`), e.g., such as [hpl: here I will make some
remarks to the text]. Inline comments can be removed from the output
by a command-line argument (see Section ref{doconce2formats} for an
example). Inline comments can also be used for detailed editing of
text, much like track changes in word, to illustrate how a text
is revised. (However, for seeing how others have revised the text, I
strongly recommend using Git for version control and running `git diff`
on the appropriate versions, or you can click on differences at
GitHub if the files are hosted there.)

__Footnotes.__ Adding a footnote[^footnote] is also possible.

[^footnote]: The syntax for footnotes is borrowed from Extended Markdown.

__Tables.__
Tables are also written in the plain text way, e.g.,

  |--c--------c-----------c--------|
  |time  | velocity | acceleration |
  |---r-------r-----------r--------|
  | 0.0  | 1.4186   | -5.01        |
  | 2.0  | 1.376512 | 11.919       |
  | 4.0  | 1.1E+1   | 14.717624    |
  |--------------------------------|

The characters `c`, `r`, and `l` can be inserted, as illustrated above,
for aligning the headings and the columns (center, right, left).

# Lines beginning with # are comment lines.

Generated makefile make.py shows SyntaxErrors

Details

Doconce makefile make.py created with the command

$ doconce makefile example.do.txt html pdflatex

Fails when executed as

$ python make.py

The error message is

File "make.py", line 19
print 'Command failed.' %% cmd
^
SyntaxError: invalid syntax

How to reproduce the issue

Create file example.do.txt with the contents:

TITLE: Example
AUTHOR: Example
DATE: Feb 2015
TOC: on

========= Example =========
Lorem ipsum dolor...

Execute commands

$ doconce makefile example.do.txt html pdflatex
$ python make.py

System info

Os: Debian Jessie 8 ( Testing )
Doconce version: DocOnce version 1.0.2 Installed from official git repository downloaded and compiled the 10 Feb of 2015

format pdflatex --sections_up to prompt sections to chapters

When I use 7 = for section titles in .do.txt source and run doconce format pdflatex --sections_up, \section{} in the .tex file is promoted to \chapter{} as expected, but \documentclass still uses article (not book), causing pdflatex command to fail (e.g. article does not support \chapter)

I could get around this problem by some preprocessing, but it would be great if article can also be promoted to book when 7 = is prompted to 9 by --sections_up, to avoid pdflatex errors.

Test:

$ cat intro.do.txt 
======= Introduction =======

This is the intro.

$ doconce format pdflatex intro --sections_up
translating doconce text in intro.do.txt to pdflatex
transforming sections: section to chapter...
transforming sections: subsection to section...
transforming sections: subsubsection to subsection...
output in intro.p.tex
$ doconce ptex2tex intro
output in intro.tex
$ cat intro.tex
...<snipped>
\documentclass[%
twoside,                 % oneside: electronic viewing, twoside: printing
final,                   % or draft (marks overfull hboxes, figures with paths)
10pt]{article}
...<snipped>
\chapter{Introduction}

*_html not working

I can't get any of the commands slides_html, split_html or slides_beamer to work. This means I can't produce any slides. I think I have a working installation of DocOnce, it works perfectly well for papers and web pages. The error I get is
command slides_html not legal, must be among, and then a list of permitted commands.

Failure to compile document

Issue
I am able to compile my book on my work computer, but I get an error when I try to compile it on my laptop. I have tried to install Doconce on another laptop and I get the same error message. It appears to be a problem with preprocess, but I am relatively new to Python so the error message does not give me sufficient information about how to solve it. Hopefully someone will have some ideas.

Systems and Programs

  • Both computers are running Linux Mint.
  • DocOnce: After installing a python 2.7 environment for Anaconda, Doconce was installed following the conda method recommend in the read-me file. I have done this for both systems.
    • Work computer: Doconce installed a few months ago; not updated.
    • Laptop: Doconce installed in late November 2015.

Error Message
(python2)13:45 ~/.../book$ doconce format pdflatex book.do.txt --latex_code_style=vrb --latex_style=Springer_T2
running preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Could not run preprocessor:
preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Traceback (most recent call last):
File "/home/martin/anaconda3/envs/python2/bin/preprocess", line 9, in
load_entry_point('preprocess==1.2.2', 'console_scripts', 'preprocess')()
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 568, in load_entry_point
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 2719, in load_entry_point
ImportError: Entry point ('console_scripts', 'preprocess') not found

return code from preprocess: 1
Abort! (add --no_abort on the command line to avoid this abortion)

Error Message (--no-abort added)

(python2)13:45 ~/.../book$ doconce format pdflatex book.do.txt --latex_code_style=vrb --latex_style=Springer_T2 --no_abort
running preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Could not run preprocessor:
preprocess -DFORMAT=pdflatex -DDEVICE=screen book.do.txt > tmp_preprocess__book.do.txt
Traceback (most recent call last):
File "/home/martin/anaconda3/envs/python2/bin/preprocess", line 9, in
load_entry_point('preprocess==1.2.2', 'console_scripts', 'preprocess')()
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 568, in load_entry_point
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/init.py", line 2719, in load_entry_point
ImportError: Entry point ('console_scripts', 'preprocess') not found

return code from preprocess: 1
avoided abortion because of --no-abort
Traceback (most recent call last):
File "/home/martin/anaconda3/envs/python2/bin/doconce", line 1518, in
main()
File "/home/martin/anaconda3/envs/python2/bin/doconce", line 1508, in main
eval(command + '()')
File "", line 1, in
File "/home/martin/anaconda3/envs/python2/bin/doconce", line 95, in format
doconce.doconce.format_driver()
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/doconce/doconce.py", line 4774, in format_driver
preprocessor_options)
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/doconce/doconce.py", line 4431, in preprocess
remove_code_and_tex(filestr, format)
File "/home/martin/anaconda3/envs/python2/lib/python2.7/site-packages/doconce/common.py", line 478, in remove_code_and_tex
if filestr[-1] != '\n':
IndexError: string index out of range

Doconce does not show installed version

Details

Doconce does not show the installed version with the --help option

$ doconce --help
Usage: doconce command [optional arguments]
commands: format insertdocstr old2new_format gwiki_figsubst remove_inline_comments latin2html sphinx_dir subst replace replace_from_file clean help latex_header latex_footer guess_encoding change_encoding bbl2rst split_rst list_labels teamod sphinxfix_localURLs make_figure_code_links grab spellcheck ptex2tex ...

Neither there is an option --version.

Knowing the doconce version would be useful when reading the online documentation in order to know how much accordance to expect.

My system info

Os: Debian Jessie 8 ( Testing )
Doconce version: 0.7.3-1 installed from official Debian repository for US. (the testing repository)

Typo in DocOnce Description

While a friend and me are currently working on a lightweight german description on DocOnce for school I tripped over a minor typo in the "Markdown to HTML conversion" section:

In the codeblock you wrote "m2html" instead of "md2html" like in the sentence before for the conversion from pandoc to html.

Hope this helps and keep up the amazing work on DocOnce.

Add possibility to place caption below the figure in html

Currently, there are two ways to place caption for figures in html: either caption is above the figure (default behaviour) or it is on the right side of the figure (with sidecap=True). It seems to be useful to add an option to place caption below the figure as it is standard way to do it in many typographic traditions (e.g. Russian).

How can we done this properly? I see at least two possible approaches:

  1. Add another option like bottomcap. Then if two options sidecap and bottomcap are True, one of them is ignored. (Which one?)
  2. Replace sidecap with another option caption_placement that can take one of the following values: top, bottom, side (or even left, right instead of just side)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.