Skip to content

Drastic update of the tutorial #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv
.idea
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Online Version: http://sdiehl.github.com/gevent-tutorial/
Want to add an example. Its uber simple.

1. Fork the repo.
2. ``pip install -r requirements.txt``
3. Edit ``tutorial.md``.
2. Create a virtual environment using [virtualenv](https://pypi.org/project/virtualenv/) package by
running `virtualenv venv` and activate it. You can follow the documentation if you don't know how to use it.
3. ``pip install -r requirements.txt``
4. Edit ``tutorial.md``.

Add your text as Markdown.

Expand Down Expand Up @@ -43,9 +45,9 @@ Will output this as html:
</code>
</pre>

4. Run ``./build``
5. Issue pull request.
6. Get good gevent karma.
5. Run ``python build``
6. Issue pull request.
7. Get good gevent karma.

Released under MIT License.

Expand Down
4 changes: 3 additions & 1 deletion body.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
</h3>

<blockquote>
gevent is a concurrency library based around <a href="http://software.schmorp.de/pkg/libev.html">libev</a>. It provides a clean API for a variety of concurrency and network related tasks.
gevent is a concurrency library based around <strong><a href="http://software.schmorp.de/pkg/libev.html">libev</a></strong> or
his new powerful descendant <strong><a href="https://libuv.org/">libuv</a></strong>.
It provides a clean API for a variety of concurrency and network related tasks.
</blockquote>
</header>

Expand Down
15 changes: 7 additions & 8 deletions build
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env python

import re
import codecs
import os
import re
import sys
import codecs
from io import StringIO

import markdown
from cStringIO import StringIO
from cogapp import Cog
from jinja2 import Template

from jinja2 import Environment, FileSystemLoader

OUTPUT = 'index.html'
Expand All @@ -35,13 +34,13 @@ start_code = """<pre><code class="python">"""
end_code = """</pre></code>"""

r1 = re.sub('\[\[\[end\]\]\]', end_code, cogged)
r2 = re.sub(r'\[\[\[cog',start_code, r1)
r3 = re.sub(r'\]\]\]',end_code + '\n' + start_code, r2)
r2 = re.sub(r'\[\[\[cog', start_code, r1)
r3 = re.sub(r'\]\]\]', end_code + '\n' + start_code, r2)

rendered_code = r3

body = markdown.markdown(rendered_code, extensions=['toc'])

with open(OUTPUT, 'w+') as f:
f.write(template.render(body=body))
print 'Wrote', OUTPUT
print('Wrote', OUTPUT)
Loading