Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

# Ignore output

examples/tango_output
examples/tango_output/*
docs/tango_output/*

161 changes: 161 additions & 0 deletions docs/basics.tango.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
\section{Basic preamble}
Add some informations to your document.
\code{{{
\title{Tango user's guide}
\author{Nadarajah Mag-Stellon}
\date{01 Avril 2014}
}}}

\section{Document}
As in Latex, you can use any class system for you document's command.
The basics document like article, report, book ... are available.
\code{{{
\document{article}
}}}

\section{Environment}
There are two kind of environment : anonymous and named environment
Anonymous environment is use with the keyword *abstract* and let you write a nameless environment.

\code{{{
\begin{EnvironementA}
\end{EnvironmentA}

\begin{abstract}
\end{abstract}
}}}

\section{Sections}
Tango provides commands which let you structure your document.
\code{{{
\section{section A} or = section A =
\subsection{subsection A} or == subSection A ==
\part{part A}
\chapter{chapter A}
\subsubsection{subsection A}
\paragraph{paragraph A}
}}}

\section{Styles}
You can use differents styles for your text.
\code{{{
**double star bold text**
__double underline bold text__

*single star emph text*
\emph{emph command text}
}}}

\section{List}
Two types of lists are available : itemize and enumerate.
In Markdown style :
\code{{{
We see three *classical* functions :
- the factorial function
- the fibonacci function
- the ackermann function

1. the factorial highlights:
a. a simple recursive scheme
b. a tail-call variant with a single accumulator
c. an imperative variant
i) using a while loop
ii) using a range iterator
2. the fibonacci highlights:
- a more complex recursive scheme
- the use of two accumulators for the tail-call version
}}}

In Latex style :
\code{{{
\begin{itemize}
\item the factorial function
\item the fibonacci function
\item the ackermann function
\end{itemize}

\begin{enumerate}
\item the factorial hightlights
\begin{enumerate}
\item a simple recursive scheme
... etc.
\end{enumerate}
\end{enumerate}
}}}

\section{Comments}
Tango has single and multi line comments.
\code{{{
% A single-line comment

%{
A multiline comment
%{ nested comment }%
}%
}}}

\section{Block code}
Show a code block and many languages are supported
\code{{{
def fact(n):
if n = 0:
return 1
else:
return n * fact(n-1)
}}}

A langage can be set by default
\code{{{
\set[defaultcodelanguage=python]
}}}

You can create a reference to a block code.This reference
let you use it as a copy/paste.
Create a reference as below :
\code{{{
\begin{code}[coderef=factit]
def fact(n):
def factit(n,acc):
if n = 0:
return acc
else:
return factit(n-1,n*acc)
# body of the function
return factit(n,1)
\end{code}
}}}
Use your reference as below :
\code{{{
\begin{evalcode}
\coderef[factit]
print("fact(4)={0}".format(fact(4))')
\end{evalcode}
}}}

\section{Maths}
Math expressions are rendered by MathJax.
Put your math expression into \$
\code{{{
$n! = 1 \times \ldots \times n$
}}}

For bigger expression, follow the example below.
\code{{{
\[
\left \{ \begin[t]{array}{l}
0!=1 \\
n! = n \times (n-1)! \text{ for } n>0
\end{array} \right.
\]
}}}

\section{Commands}
Syntax for hyperlinks
\code{{{
\url[Python]{http://www.python.org}
[Python|http://www.python.org]
}}}
Syntax for footnote
\code{{{
\footnote{footnote}
}}}
6 changes: 6 additions & 0 deletions docs/basicsDebug.tango.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
\subsection{Environment}
There are two kind of environment : anonymous and named environment
Anonymous environment is use with the keyword *abstract* and let you write a nameless environment.
\begin{verbatim}
% print "ok"
\end{verbatim}
5 changes: 5 additions & 0 deletions docs/define.tango.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
\defCommand
\defCmd
\defEnvironment
\defEnv
\macroCommandArgument
10 changes: 10 additions & 0 deletions docs/options.tango.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
== --html ==
Produce a HTML output

== --tex ==

Produce a Latex output

== --xml ==
Produce a xml output which is useful for debugging or pretty-print.

52 changes: 52 additions & 0 deletions docs/pythonInstructions.tango.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Tango has his own interpreter based on Python interpreter.
Thus, you can easily run some programs into Tango.

The command defPython let you define a Python function into Tango environment.

\defPython[construire]{{{
def construire(n):
"""Nat -> LISTE[Nat]
Hypothèse: n > 0
retourne la liste des entiers naturels 1 à n (inclus)
"""
l = []
for i in range(1,n+1):
l.append(i)
return l
}}}


The command checkPython takes two parameters : your python function call and the expected results. This command let you check that you call get the results that expected.

\checkPython{{{
>>> construire(5)
[1, 2, 3, 4, 5]
>>> construire(1)
[1]
}}}



The command showEvelPython evaluates a Python expression.
You can also evaluates function define by the command defPython.

\answer[lines=9, points=2]{
\showDefPython[construire]
}


Another solution whithout \snip{range} :

\showEvalPython{{{
def construire(n):
l = []
i = 1
while i <= n:
l.append(i)
i += 1
return l

construire(5)
construire(1)
}}}

32 changes: 32 additions & 0 deletions docs/tangoUserGuide.tango.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
\title{Tango user's guide}

\part{Synopsis}

python3 [tango.py path] [documentName] [--html | --tex | --xml]

\part{Description}

Tango is a programmable document processor which provides Latex/HTML output.
Tango use documents written in a mix of latex and markdown-inspired short cuts.

\part{Using Pandoc}

Before using Tango, you have to be into your document direction.
After, open a terminal and launch the **Synopsis** command-line.

\part{Options}

\include{options.tango.tex}

\part{Tango syntax}

If you get to know Markdown and Latex, it's quite easy since tango is inspired by them.

\include{basics.tango.tex}

%\part{Define structures}
%\include{define.tango.tex}

\part{Latex python instructions}

\include{pythonInstructions.tango.tex}
8 changes: 8 additions & 0 deletions docs/todo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TODO
----

#### Missing

- How can tango shows code ?
- With \begin{code} or \begin{verbatim}
- Not implemented
107 changes: 0 additions & 107 deletions examples/model.tango.tex

This file was deleted.

Loading