Skip to content

Commit 4cc6817

Browse files
authored
Merge pull request #77 from rasbt/doc-fixes
Update documentation files
2 parents 3716760 + 63a9bd7 commit 4cc6817

File tree

9 files changed

+193
-26
lines changed

9 files changed

+193
-26
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
[![Continuous Integration](https://travis-ci.org/rasbt/biopandas.svg?branch=master)](https://travis-ci.org/rasbt/biopandas)
77
[![Build status](https://ci.appveyor.com/api/projects/status/jcp91fvbgmqws30p/branch/master?svg=true)](https://ci.appveyor.com/project/rasbt/biopandas/branch/master)
88
[![Code Coverage](https://coveralls.io/repos/rasbt/biopandas/badge.svg?branch=master&service=github)](https://coveralls.io/github/rasbt/biopandas?branch=master)
9-
[![Code Health](https://landscape.io/github/rasbt/biopandas/master/landscape.svg?style=flat)](https://landscape.io/github/rasbt/biopandas/master)
109
[![PyPI Version](https://img.shields.io/pypi/v/biopandas.svg)](https://pypi.python.org/pypi/biopandas/)
1110
[![License](https://img.shields.io/badge/license-new%20BSD-blue.svg)](https://github.com/rasbt/biopandas/blob/master/LICENSE)
12-
![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)
13-
![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)
11+
![Python 3](https://img.shields.io/badge/python-3-blue.svg)
1412
[![JOSS](http://joss.theoj.org/papers/10.21105/joss.00279/status.svg)](http://joss.theoj.org/papers/10.21105/joss.00279)
15-
[![Discuss](https://img.shields.io/badge/discuss-google_group-blue.svg)](https://groups.google.com/forum/#!forum/biopandas-users)
13+
[![Discuss](https://github.com/rasbt/biopandas/discussions)
1614

1715
<hr>
1816

docs/CONTRIBUTING.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ and checking off items as you go.
4848
## Syncing an Existing Fork
4949

5050
If you already forked biopandas earlier, you can bring you "Fork" up to date
51-
with the master branch as follows:
51+
with the main branch as follows:
5252

5353
#### 1. Configuring a remote that points to the upstream repository on GitHub
5454

@@ -87,7 +87,7 @@ upstream https://github.com/rasbt/biopandas.git (push)
8787

8888
#### 2. Syncing your Fork
8989

90-
First, fetch the updates of the original project's master branch by executing:
90+
First, fetch the updates of the original project's `main` branch by executing:
9191

9292
```bash
9393
$ git fetch upstream
@@ -101,23 +101,23 @@ remote: Compressing objects: 100% (xx/xx), done.
101101
remote: Total xx (delta xx), reused xx (delta x)
102102
Unpacking objects: 100% (xx/xx), done.
103103
From https://github.com/rasbt/biopandas
104-
* [new branch] master -> upstream/master
104+
* [new branch] main -> upstream/main
105105
```
106106

107-
This means that the commits to the `rasbt/biopandas` master branch are now
108-
stored in the local branch `upstream/master`.
107+
This means that the commits to the `rasbt/biopandas` `main` branch are now
108+
stored in the local branch `upstream/main`.
109109

110-
If you are not already on your local project's master branch, execute
110+
If you are not already on your local project's main branch, execute
111111

112112
```bash
113-
$ git checkout master
113+
$ git checkout main
114114
```
115115

116-
Finally, merge the changes in upstream/master to your local master branch by
116+
Finally, merge the changes in upstream/main to your local main branch by
117117
executing
118118

119119
```bash
120-
$ git merge upstream/master
120+
$ git merge upstream/main
121121
```
122122

123123
which will give you an output that looks similar to
@@ -135,7 +135,7 @@ SOME FILE2 | 10 +++++++
135135

136136
#### 1. Creating a new feature branch
137137

138-
Please avoid working directly on the master branch but create a new feature branch:
138+
Please avoid working directly on the main branch but create a new feature branch:
139139

140140
```bash
141141
$ git branch <new_feature>
@@ -258,9 +258,19 @@ The documentation is built via [MkDocs](http://www.mkdocs.org); to ensure that t
258258
For example,
259259

260260
```bash
261-
~/github/biopandas/docs$ mkdocs serve
261+
~/github/biopandas$ mkdocs serve
262262
```
263263

264+
To install and set up mkdocs for the first time, please follow the following steps:
265+
266+
267+
1. `~$ conda install mkdocs --channel conda-forge`
268+
2. `~$ cd ~/github/biopandas/docs`
269+
3. `~/github/biopandas$ python mdx_math_setup.py install`
270+
4. `~/github/biopandas$ conda install mkdocs-bootstrap --channel conda-forge`
271+
272+
273+
264274
#### 1. Editing the Tutorials
265275

266276
Please note that documents containing code examples are generated from IPython Notebook files and converted to markdown via

docs/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
[![Continuous Integration](https://travis-ci.org/rasbt/biopandas.svg?branch=master)](https://travis-ci.org/rasbt/biopandas)
88
[![PyPI Version](https://img.shields.io/pypi/v/biopandas.svg)](https://pypi.python.org/pypi/biopandas/)
99
[![License](https://img.shields.io/badge/license-new%20BSD-blue.svg)](https://github.com/rasbt/biopandas/blob/master/LICENSE)
10-
![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)
11-
![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)
10+
![Python 3](https://img.shields.io/badge/python-3-blue.svg)
1211
[![JOSS](http://joss.theoj.org/papers/10.21105/joss.00279/status.svg)](http://joss.theoj.org/papers/10.21105/joss.00279)
13-
[![Discuss](https://img.shields.io/badge/discuss-google_group-blue.svg)](https://groups.google.com/forum/#!forum/biopandas-users)
12+
[![Discuss](https://github.com/rasbt/biopandas/discussions)
1413

1514
<br>
1615

docs/mdx_math.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# -*- coding: utf-8 -*-
2+
3+
'''
4+
Math extension for Python-Markdown
5+
==================================
6+
7+
Adds support for displaying math formulas using
8+
[MathJax](http://www.mathjax.org/).
9+
10+
Author: 2015-2017, Dmitry Shachnev <[email protected]>.
11+
'''
12+
13+
"""
14+
Copyright 2015-2017 Dmitry Shachnev <[email protected]>.
15+
All rights reserved.
16+
17+
Redistribution and use in source and binary forms, with or without
18+
modification, are permitted provided that the following conditions
19+
are met:
20+
21+
1. Redistributions of source code must retain the above copyright
22+
notice, this list of conditions and the following disclaimer.
23+
2. Redistributions in binary form must reproduce the above copyright
24+
notice, this list of conditions and the following disclaimer in the
25+
documentation and/or other materials provided with the distribution.
26+
3. Neither the name of the author nor the names of its contributors
27+
may be used to endorse or promote products derived from this software
28+
without specific prior written permission.
29+
30+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40+
SUCH DAMAGE.
41+
"""
42+
43+
from markdown.inlinepatterns import Pattern
44+
from markdown.extensions import Extension
45+
from markdown.util import AtomicString, etree
46+
47+
48+
class MathExtension(Extension):
49+
def __init__(self, *args, **kwargs):
50+
self.config = {
51+
'enable_dollar_delimiter':
52+
[False, 'Enable single-dollar delimiter'],
53+
'add_preview': [False, 'Add a preview node before each math node'],
54+
}
55+
super(MathExtension, self).__init__(*args, **kwargs)
56+
57+
def extendMarkdown(self, md, md_globals):
58+
def _wrap_node(node, preview_text, wrapper_tag):
59+
if not self.getConfig('add_preview'):
60+
return node
61+
preview = etree.Element('span', {'class': 'MathJax_Preview'})
62+
preview.text = AtomicString(preview_text)
63+
wrapper = etree.Element(wrapper_tag)
64+
wrapper.extend([preview, node])
65+
return wrapper
66+
67+
def handle_match_inline(m):
68+
node = etree.Element('script')
69+
node.set('type', 'math/tex')
70+
node.text = AtomicString(m.group(3))
71+
return _wrap_node(node, ''.join(m.group(2, 3, 4)), 'span')
72+
73+
def handle_match(m):
74+
node = etree.Element('script')
75+
node.set('type', 'math/tex; mode=display')
76+
if '\\begin' in m.group(2):
77+
node.text = AtomicString(''.join(m.group(2, 4, 5)))
78+
return _wrap_node(node, ''.join(m.group(1, 2, 4, 5, 6)), 'div')
79+
else:
80+
node.text = AtomicString(m.group(3))
81+
return _wrap_node(node, ''.join(m.group(2, 3, 4)), 'div')
82+
83+
inlinemathpatterns = (
84+
Pattern(r'(?<!\\|\$)(\$)([^\$]+)(\$)'), #  $...$
85+
Pattern(r'(?<!\\)(\\\()(.+?)(\\\))') # \(...\)
86+
)
87+
mathpatterns = (
88+
Pattern(r'(?<!\\)(\$\$)([^\$]+)(\$\$)'), # $$...$$
89+
Pattern(r'(?<!\\)(\\\[)(.+?)(\\\])'), # \[...\]
90+
Pattern(r'(?<!\\)(\\begin{([a-z]+?\*?)})(.+?)(\\end{\3})')
91+
)
92+
if not self.getConfig('enable_dollar_delimiter'):
93+
inlinemathpatterns = inlinemathpatterns[1:]
94+
for i, pattern in enumerate(inlinemathpatterns):
95+
pattern.handleMatch = handle_match_inline
96+
md.inlinePatterns.add('math-inline-%d' % i, pattern, '<escape')
97+
for i, pattern in enumerate(mathpatterns):
98+
pattern.handleMatch = handle_match
99+
md.inlinePatterns.add('math-%d' % i, pattern, '<escape')
100+
101+
102+
def makeExtension(*args, **kwargs):
103+
return MathExtension(*args, **kwargs)

docs/mdx_math_setup.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Copyright 2015-2017 Dmitry Shachnev <[email protected]>.
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions
9+
are met:
10+
11+
1. Redistributions of source code must retain the above copyright
12+
notice, this list of conditions and the following disclaimer.
13+
2. Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in the
15+
documentation and/or other materials provided with the distribution.
16+
3. Neither the name of the author nor the names of its contributors
17+
may be used to endorse or promote products derived from this software
18+
without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30+
SUCH DAMAGE.
31+
"""
32+
33+
from distutils.core import setup
34+
35+
long_description = \
36+
"""This extension adds math formulas support to Python-Markdown_
37+
(works with version 2.6 or newer).
38+
39+
.. _Python-Markdown: https://github.com/waylan/Python-Markdown
40+
41+
You can find the source on GitHub_.
42+
Please refer to the `README file`_ for details on how to use it.
43+
44+
.. _GitHub: https://github.com/mitya57/python-markdown-math
45+
.. _`README file`: https://github.com/mitya57/python-markdown-math/blob/master/README.md
46+
"""
47+
48+
setup(name='python-markdown-math',
49+
description='Math extension for Python-Markdown',
50+
long_description=long_description,
51+
author='Dmitry Shachnev',
52+
author_email='[email protected]',
53+
version='0.3',
54+
url='https://github.com/mitya57/python-markdown-math',
55+
py_modules=['mdx_math'],
56+
license='BSD')

docs/sources/api_subpackages/biopandas.mol2.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
biopandas version: 0.2.7
1+
biopandas version: 0.3.0
22
## PandasMol2
33

44
*PandasMol2()*
@@ -193,7 +193,8 @@ Acccesses the pandas DataFrame
193193

194194
*split_multimol2(mol2_path)*
195195

196-
Splits a multi-mol2 file into individual Mol2 file contents.
196+
Generator function that
197+
splits a multi-mol2 file into individual Mol2 file contents.
197198

198199
**Parameters**
199200

docs/sources/api_subpackages/biopandas.pdb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
biopandas version: 0.2.7
1+
biopandas version: 0.3.0
22
## PandasPdb
33

44
*PandasPdb()*

docs/sources/api_subpackages/biopandas.testutils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
biopandas version: 0.2.7
1+
biopandas version: 0.3.0
22
## assert_raises
33

44
*assert_raises(exception_type, message, func, *args, **kwargs)*

mkdocs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ copyright: Copyright &copy; 2015-2021 <a href="http://sebastianraschka.com">Seba
2828
google_analytics: ['UA-38457794-3', 'rasbt.github.io/biopandas']
2929

3030
nav:
31-
- Home: index.md
3231
- Tutorials:
3332
- Working with PDB Structures in DataFrames: tutorials/Working_with_PDB_Structures_in_DataFrames.md
3433
- Working with MOL2 Structures in DataFrames: tutorials/Working_with_MOL2_Structures_in_DataFrames.md
3534
- API:
3635
- biopandas.pdb: api_subpackages/biopandas.pdb.md
3736
- biopandas.mol2: api_subpackages/biopandas.mol2.md
3837
- Changelog: CHANGELOG.md
39-
- Installation: installation.md
40-
- Contributing: CONTRIBUTING.md
41-
- Citing: citing.md
38+
- Install: installation.md
39+
- Discuss: https://github.com/rasbt/biopandas/discussions
40+
- Contribute: CONTRIBUTING.md
41+
- Cite: citing.md

0 commit comments

Comments
 (0)