<commit_before>
!split

<%doc>
This is Mako comment block
to test the use of Mako as preprocessor.
</%doc>


The format of this document is
% if FORMAT == 'html':
plain, homemade HTML (from Doconce).
  % elif FORMAT == 'latex':
plain, homemade LaTeX (from Doconce).
  % elif FORMAT == 'pdflatex':
plain, homemade pdfLaTeX (from Doconce).
  %else:
${FORMAT}
% endif

% if SOMEVAR is not UNDEFINED:
# Just a comment
% endif

__Abstract.__
This is a document with many test constructions for doconce syntax.
It was used heavily for the development and kept for testing
numerous constructions, also special and less common cases.

And exactly for test purposes we have an extra line here, which
is part of the abstract.

# Cannot demonstrate chapter headings since abstract and chapter
# is mutually exclusive in LaTeX

======= Section 1 =======
label{sec1}

Here is a nested list:

  * item1
  * item2
  * item3 which continues
    on the next line to test that feature
  * and a sublist
    * with indented subitem1
    * and a subitem2
  * and perhaps an ordered sublist
    o first item
    o second item,
      continuing on a new line

__Here is a list with paragraph heading.__

  * item1
  * item2

=== Here is a list with subsubsection heading ===

  * item1
  * item2

!bquote
Here are two lines that make up
a block quote.
!equote

Here is a reference to Equation (ref{my:eq1}).
# #if FORMAT in ("sphinx", "html")
This equation appears in another part if this document is split.
# #endif


===== Subsection 1 =====
label{subsec1}

idx{`somefunc` function}

# Refer to section/appendix etc. at the beginning of the line
# and other special fix situations for HTML.

More text, with a reference back to
Section ref{sec1} and ref{subsec1}, and further to the
sections    ref{subsec1} and ref{subsubsec:ex}, which
encourages you to do the tasks in the
Exercises ref{demo:ex:1} and ref{exer:some:formula}.
Appendices     ref{app1} and ref{app2} are also nice elements.


# sphinx code-blocks: pycod=python cod=fortran cppcod=c++ sys=console

=== Computer code ===

Let's do some copying from files too. First from subroutine up to the very end,

@@@CODE ../doc/src/manual/__testcode.f fromto: subroutine@
and then just the subroutine,
@@@CODE ../doc/src/manual/__testcode.f from-to:a comment@^C\s+END1
and finally the complete file:
@@@CODE ../doc/src/manual/__testcode.f

Testing other code environments. First Python:

!bc
|bc pycod
def f(x):
    return x+1
|ec
!ec
which gets rendered as

!bc pycod
def f(x):
    return x+1
!ec

# #if FORMAT not in ("rst", "plain", "epytext", "st")
Test paragraph and subsubsection headings before code.

__Paragraph heading before code.__

!bc pycod
def g(y):
    return y+1
!ec

=== Subsubsection heading before code ===

!bc pycod
def h(z):
    return z+1
!ec
# #endif

# #if FORMAT in ("sphinx", "html", "latex", "pdflatex")
Now a complete program to be shown via Python Online Tutorial:
# #else
Here is a program that is supposed to be interactive via
Python Online Tutorial, but that service is not accessible
for the present format.
# #endif

!bc pyoptpro
class Line:
    def __init__(self, a, b):
        self.a, self.b = a, b

    def __call__(self, x):
        a, b = self.a, self.b
        return a*x + b

line = Line(2, 1)
y = line(x=3)
print y
!ec

# #if FORMAT == "sphinx"
Another complete program to be typeset as a sage cell:
# #else
Some more Python code (actually specified as a sage cell, but
such cells are not supported by this format).
# #endif

!bc pyscpro
a = 2
b = 3
print 'a+b:', a + b

# In a sage cell we can also plot
from matplotlib.pyplot import *
from numpy import *
x = linspace(0, 4*pi, 101)
y = exp(-0.1*x)*cos(x)
plot(x, y)
xlabel('x'); ylabel('y')
show()
!ec

## Should also test that one can read .pyopt and .pysc programs

Then Cython:
!bc cycod
cpdef f(double x):
    return x + 1
!ec

Standard Python shell sessions:

!bc ipy
>>> from numpy import sin
>>> # Some comment
>>> x = sin(1.2); print 'Value:', x
Value: 0.932039085967
!ec

IPython sessions:

!bc ipy
In [1]: from numpy import sin

In [2]: # Some comment

In [3]: x = sin(1.2); print 'Value:', x
Value: 0.932039085967
!ec

# This one tests a + sign before a code environment
C++:
!bc cpppro
#include <iostream>

int main()
{
   std::cout << "Sample output" << std::endl;
   return 0
}
!ec
# The next should get correctly typset in sphinx (cod is fcod)
And a little bit of Fortran:

!bc
|bc cod
      subroutine midpt(x, length, a, b)
      real*8 a, b, x
      x = (a + b)/2
      length = b - a
      return
      end
|ec
!ec
which then is typeset as

!bc cod
      subroutine midpt(x, length, a, b)
      real*8 a, b, x
      x = (a + b)/2
      length = b - a
      return
      end
!ec

HTML:

!bc htmlcod
<table>
<tr><td>Column 1</td><td>Column 2</td></tr>
<tr><td>0.67526 </td><td>0.92871 </td></tr>
<!-- comment -->
</table>
!ec

System call:
!bc sys
Terminal> mkdir test
Terminal> cd test
Terminal> myprog -f
output1
output2
!ec

It is time to test `verbatim inline font` especially with `a newline
inside the text` and an exclamation mark at the end: `BEGIN`! The
exclamation mark inside the verbatim text is potentially not smart
since latex use ! in the `Verb` typesetting, but this should now
be fixed: test `!bc` and `!ec` as well as `!bsummary`.
Also test backslashes and braces like `\begin`, `\begin{enumerate}`,
`\end{this}\end{that}`, and `{something \inside braces}` in inline
verbatim text. Since the exclamation mark is used as delimiter
in LaTeX inline verbatim, we need to test it, as in `a != b`,
and a Doconce directive a la `!bc`.

Here is some color{red}{red} color and an attempt to write color{green}{with
green color containing a linebreak. <linebreak>
And one more.} Some formats will only display <linebreak>
this correctly when HTML is the output format. <linebreak>
But here some more running text is added which is not part of
the previous blocks with line breaks.

=== Running OS commands ===

@@@OSCMD python -c 'print "Testing\noutput\nfrom\nPython."'

=== Footnotes ===

Here is a test of footnotes[^footnote], which are handy in text.
They are used in different flavors, now in

 * list items
 * even with math $\nabla^2u$ [^math1]
 * and code `h[i] += 1` [^code],

which gives flexibility in writing.
This is the third[^example-of-the-third-footnote] example.

  [^footnote]: Typesetting of the footnote depends on the format.
Plain text does nothing, LaTeX removes the
definition and inserts the footnote as part of the LaTeX text.
reStructuredText and Sphinx employ a similar type of typesetting
as Extended Markdown and Doconce, and in HTML we keep the same
syntax, just displayed properly in HTML.
[^math1]: Math footnotes can be dangerous since it
interferes with an exponent.
[^code]: One-line footnote.

Here is some more text before a new definition of a footnote that was used
used above.
<commit_msg>updates<commit_after>
!split

<%doc>
This is Mako comment block
to test the use of Mako as preprocessor.
</%doc>


The format of this document is
% if FORMAT == 'html':
plain, homemade HTML (from Doconce).
  % elif FORMAT == 'latex':
plain, homemade LaTeX (from Doconce).
  % elif FORMAT == 'pdflatex':
plain, homemade pdfLaTeX (from Doconce).
  %else:
${FORMAT}
% endif

% if SOMEVAR is not UNDEFINED:
# Just a comment
% endif

__Abstract.__
This is a document with many test constructions for doconce syntax.
It was used heavily for the development and kept for testing
numerous constructions, also special and less common cases.

And exactly for test purposes we have an extra line here, which
is part of the abstract.

# Cannot demonstrate chapter headings since abstract and chapter
# is mutually exclusive in LaTeX

======= Section 1 =======
label{sec1}

Here is a nested list:

  * item1
  * item2
  * item3 which continues
    on the next line to test that feature
  * and a sublist
    * with indented subitem1
    * and a subitem2
  * and perhaps an ordered sublist
    o first item
    o second item,
      continuing on a new line

__Here is a list with paragraph heading.__

  * item1
  * item2

=== Here is a list with subsubsection heading ===

  * item1
  * item2

!bquote
Here are two lines that make up
a block quote.
!equote

Here is a reference to Equation (ref{my:eq1}).
# #if FORMAT in ("sphinx", "html")
This equation appears in another part if this document is split.
# #endif


===== Subsection 1 =====
label{subsec1}

idx{`somefunc` function}

# Refer to section/appendix etc. at the beginning of the line
# and other special fix situations for HTML.

More text, with a reference back to
Section ref{sec1} and ref{subsec1}, and further to the
sections    ref{subsec1} and ref{subsubsec:ex}, which
encourages you to do the tasks in the
Exercises ref{demo:ex:1} and ref{exer:some:formula}.
Appendices     ref{app1} and ref{app2} are also nice elements.


# sphinx code-blocks: pycod=python cod=fortran cppcod=c++ sys=console

=== Computer code ===

Let's do some copying from files too. First from subroutine up to the very end,

@@@CODE ../doc/src/manual/__testcode.f fromto: subroutine@
and then just the subroutine,
@@@CODE ../doc/src/manual/__testcode.f from-to:a comment@^C\s+END1
and finally the complete file:
@@@CODE ../doc/src/manual/__testcode.f

Testing other code environments. First Python:

!bc
|bc pycod
def f(x):
    return x+1
|ec
!ec
which gets rendered as

!bc pycod
def f(x):
    return x+1
!ec

# #if FORMAT not in ("rst", "plain", "epytext", "st")
Test paragraph and subsubsection headings before code.

__Paragraph heading before code.__

!bc pycod
def g(y):
    return y+1
!ec

=== Subsubsection heading before code ===

!bc pycod
def h(z):
    return z+1
!ec
# #endif

# #if FORMAT in ("sphinx", "html", "latex", "pdflatex")
Now a complete program to be shown via Python Online Tutorial:
# #else
Here is a program that is supposed to be interactive via
Python Online Tutorial, but that service is not accessible
for the present format.
# #endif

!bc pyoptpro
class Line:
    def __init__(self, a, b):
        self.a, self.b = a, b

    def __call__(self, x):
        a, b = self.a, self.b
        return a*x + b

line = Line(2, 1)
y = line(x=3)
print y
!ec

# #if FORMAT == "sphinx"
Another complete program to be typeset as a sage cell:
# #else
Some more Python code (actually specified as a sage cell, but
such cells are not supported by this format).
# #endif

!bc pyscpro
a = 2
b = 3
print 'a+b:', a + b

# In a sage cell we can also plot
from matplotlib.pyplot import *
from numpy import *
x = linspace(0, 4*pi, 101)
y = exp(-0.1*x)*cos(x)
plot(x, y)
xlabel('x'); ylabel('y')
show()
!ec

## Should also test that one can read .pyopt and .pysc programs

Then Cython:
!bc cycod
cpdef f(double x):
    return x + 1
!ec

Standard Python shell sessions:

!bc ipy
>>> from numpy import sin
>>> # Some comment
>>> x = sin(1.2); print 'Value:', x
Value: 0.932039085967
!ec

IPython sessions:

!bc ipy
In [1]: from numpy import sin

In [2]: # Some comment

In [3]: x = sin(1.2); print 'Value:', x
Value: 0.932039085967
!ec

# This one tests a + sign before a code environment
C++:
!bc cpppro
#include <iostream>

int main()
{
   std::cout << "Sample output" << std::endl;
   return 0
}
!ec
# The next should get correctly typset in sphinx (cod is fcod)
And a little bit of Fortran:

!bc
|bc cod
      subroutine midpt(x, length, a, b)
      real*8 a, b, x
      x = (a + b)/2
      length = b - a
      return
      end
|ec
!ec
which then is typeset as

!bc cod
      subroutine midpt(x, length, a, b)
      real*8 a, b, x
      x = (a + b)/2
      length = b - a
      return
      end
!ec

HTML:

!bc htmlcod
<table>
<tr><td>Column 1</td><td>Column 2</td></tr>
<tr><td>0.67526 </td><td>0.92871 </td></tr>
<!-- comment -->
</table>
!ec

System call:
!bc sys
Terminal> mkdir test
Terminal> cd test
Terminal> myprog -f
output1
output2
!ec

It is time to test `verbatim inline font` especially with `a newline
inside the text` and an exclamation mark at the end: `BEGIN`! The
exclamation mark inside the verbatim text is potentially not smart
since latex use ! in the `Verb` typesetting, but this should now
be fixed: test `!bc` and `!ec` as well as `!bsummary`.
Also test backslashes and braces like `\begin`, `\begin{enumerate}`,
`\end{this}\end{that}`, and `{something \inside braces}` in inline
verbatim text. Since the exclamation mark is used as delimiter
in LaTeX inline verbatim, we need to test it, as in `a != b`,
and a Doconce directive a la `!bc`.

Here is some color{red}{red} color and an attempt to write color{green}{with
green color containing a linebreak. <linebreak>
And one more.} Some formats will only display <linebreak>
this correctly when HTML is the output format. <linebreak>
But here some more running text is added which is not part of
the previous blocks with line breaks.

=== Running OS commands ===

@@@OSCMD python -c 'print "Testing\noutput\nfrom\nPython."'

=== Footnotes ===

Here is a test of footnotes[^footnote], which are handy in text.
They are used in different flavors, now in

 * list items
 * even with math $\nabla^2u$ [^math1]
 * and code `h[i] += 1` [^code],
 * and "links": "http://google.com" [^google-search]

which gives flexibility in writing.
This is the third[^example-of-the-third-footnote] example.

  [^footnote]: Typesetting of the footnote depends on the format.
Plain text does nothing, LaTeX removes the
definition and inserts the footnote as part of the LaTeX text.
reStructuredText and Sphinx employ a similar type of typesetting
as Extended Markdown and Doconce, and in HTML we keep the same
syntax, just displayed properly in HTML.
[^math1]: Math footnotes can be dangerous since it
interferes with an exponent.
[^code]: One-line footnote.

[^google-search]: URL: "google.com" is perhaps the most famous
web site today.

Here is some more text before a new definition of a footnote that was used
used above.

{'fraction_non_alphanumeric': 0.10568696527428284, 'fraction_numerical': 0.013804011790926739, 'mean_word_length': 3.6898179366149697, 'pattern_counts': {'":': 1, '<': 53, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3353638', 'n_tokens_mistral': 4760, 'n_tokens_neox': 4559, 'n_words': 2027}