Skip to content
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

Add a basic support for automatic table of content generation #19

Merged
merged 4 commits into from May 12, 2014
Merged

Add a basic support for automatic table of content generation #19

merged 4 commits into from May 12, 2014

Conversation

@Jenselme
Copy link

@Jenselme Jenselme commented May 12, 2014

It uses a macro-like syntax: <> to allow code reuse.

I added a toc_test methods to TestCreole2htmlMarkup to perform unittest. I pached the
existing tests so that they are correct despite the modification I made.

It supports:

  • max depth: depth=NUMBER
  • links to the correct section
…to a macro-like syntax: <<toc>>

I added a toc_test methods to TestCreole2htmlMarkup to perform unittest. I pached the
existing tests so that they are correct despite the modification I made.

It supports:
- max depth: depth=NUMBER
- links to the correct section
@jedie
Copy link
Owner

@jedie jedie commented May 12, 2014

Thanks for contributing.

Looks good to me, if the points above are fixed, i will merge.

- Avoid use of float('inf')
- Rename python_list2html_list to toc_list2html (more coherent)
- Rename variables in toc_list2html to be clearer
- Use document.replace('<p><<toc>></p>', html_toc, 1) in toc emit to limit replacement

Unit tests still fail in python2 (but pass with python3).
@Jenselme
Copy link
Author

@Jenselme Jenselme commented May 12, 2014

I address (normally) all your comment (except unit tests) with bcdd5e9.

@Jenselme
Copy link
Author

@Jenselme Jenselme commented May 12, 2014

Still fails according to Travis with the following error:

Traceback (most recent call last):
  File "./setup.py", line 18, in <module>
    from creole import VERSION_STRING
  File "/home/travis/build/jedie/python-creole/creole/__init__.py", line 31, in <module>
    from creole.creole2html.emitter import HtmlEmitter
  File "/home/travis/build/jedie/python-creole/creole/creole2html/emitter.py", line 68
    return u'<<toc>>'
                    ^
SyntaxError: invalid syntax

I am not able to reproduce on my computer, all tests pass (python 3.3 on Fedora 20). And the syntax seems correct. Any idea ?

@jedie
Copy link
Owner

@jedie jedie commented May 12, 2014

remove u before '' ?!?

@Jenselme
Copy link
Author

@Jenselme Jenselme commented May 12, 2014

I can try. But normally this syntax is correct in both python3 and 2.

jedie added a commit that referenced this pull request May 12, 2014
Add a basic support for automatic table of content generation
@jedie jedie merged commit f24b5ed into jedie:master May 12, 2014
1 check passed
1 check passed
@jedie
continuous-integration/travis-ci The Travis CI build passed
Details
@Jenselme
Copy link
Author

@Jenselme Jenselme commented May 12, 2014

Thanks for merging!

@Jenselme Jenselme deleted the Jenselme:toc branch May 12, 2014
@jedie
Copy link
Owner

@jedie jedie commented May 12, 2014

I will look at it tomorrow and create a new release.

Thanks for contributing ;)

@jedie
Copy link
Owner

@jedie jedie commented May 15, 2014

I have made some changes arount the <<toc>> stuff here: 5ffcccd

@jedie
Copy link
Owner

@jedie jedie commented May 15, 2014

btw. travis will fail, because i used stuff from python 2.7... Does anyone need 2.6 support?!?

EDIT: Have commit some changes for 2.6

@jedie
Copy link
Owner

@jedie jedie commented May 15, 2014

With 3f55b32 is also "chaotic" headlines possible and the limit works, see also: #20

EDIT: btw i have moves the toc code into a separat class. Maybe we should move some code, see: #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants