Skip to content

Commit 9f49d82

Browse files
committed
first implementation
1 parent 505f2da commit 9f49d82

File tree

8 files changed

+89
-18
lines changed

8 files changed

+89
-18
lines changed

Diff for: .moban.d/README.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
{%endblock%}
55

66
{%block features %}
7-
**{{name}}** does xyz.
7+
**{{name}}** is inspired by `csvtotable <https://github.com/vividvilla/csvtotable>`_ and
8+
provides the functionality to pyexcel family.
9+
10+
Quick evaluation::
11+
12+
$ pyexcel transcode --sheet-index 0 googl.ods google.sortable.html
13+
814
{%endblock%}

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ that the following conditions are met:
1212
this list of conditions and the following disclaimer in the documentation
1313
and/or other materials provided with the distribution.
1414

15-
* Neither the name of '' nor the names of the contributors
15+
* Neither the name of 'pyexcel-sortable' nor the names of the contributors
1616
may not be used to endorse or promote products derived from this software
1717
without specific prior written permission.
1818

Diff for: README.rst

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
================================================================================
2-
- Let you focus on data, instead of file formats
2+
pyexcel-sortable - Let you focus on data, instead of file formats
33
================================================================================
44

55
.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png
66
:target: https://www.patreon.com/pyexcel
77

8-
.. image:: https://api.travis-ci.org/pyexcel/.svg?branch=master
9-
:target: http://travis-ci.org/pyexcel/
8+
.. image:: https://api.travis-ci.org/pyexcel/pyexcel-sortable.svg?branch=master
9+
:target: http://travis-ci.org/pyexcel/pyexcel-sortable
1010

11-
.. image:: https://codecov.io/github/pyexcel//coverage.png
12-
:target: https://codecov.io/github/pyexcel/
11+
.. image:: https://codecov.io/github/pyexcel/pyexcel-sortable/coverage.png
12+
:target: https://codecov.io/github/pyexcel/pyexcel-sortable
1313

1414
.. image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg
1515
:target: https://gitter.im/pyexcel/Lobby
1616

17-
.. image:: https://readthedocs.org/projects//badge/?version=latest
18-
:target: http://.readthedocs.org/en/latest/
17+
.. image:: https://readthedocs.org/projects/pyexcel-sortable/badge/?version=latest
18+
:target: http://pyexcel-sortable.readthedocs.org/en/latest/
1919

2020

21-
**** does xyz.
21+
**pyexcel-sortable** is inspired by `csvtotable <https://github.com/vividvilla/csvtotable>`_ and
22+
provides the functionality to pyexcel family.
23+
24+
Quick evaluation::
25+
26+
$ pyexcel transcode --sheet-index 0 googl.ods google.sortable.html
27+
2228

2329

2430

@@ -28,15 +34,15 @@ You can install it via pip:
2834

2935
.. code-block:: bash
3036
31-
$ pip install
37+
$ pip install pyexcel-sortable
3238
3339
3440
or clone it and install it:
3541

3642
.. code-block:: bash
3743
38-
$ git clone https://github.com/pyexcel/.git
39-
$ cd
44+
$ git clone https://github.com/pyexcel/pyexcel-sortable.git
45+
$ cd pyexcel-sortable
4046
$ python setup.py install
4147
4248
@@ -61,8 +67,8 @@ Development guide
6167

6268
Development steps for code changes
6369

64-
#. git clone https://github.com/pyexcel/.git
65-
#. cd
70+
#. git clone https://github.com/pyexcel/pyexcel-sortable.git
71+
#. cd pyexcel-sortable
6672

6773
Upgrade your setup tools and pip. They are needed for development and testing only:
6874

Diff for: goog.ods

11.4 KB
Binary file not shown.

Diff for: pyexcel-sortable.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
overrides: "pyexcel.yaml"
2-
name: ""
2+
name: "pyexcel-sortable"
33
nick_name: "sortable"
44
version: "0.0.1"
5+
current_version: "0.0.1"
56
release: "0.0.1"
67
dependencies:
78
- csvtotable >= 1.1.1

Diff for: pyexcel_sortable/__init__.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
pyexcel_sortable
3+
~~~~~~~~~~~~~~~~~~~~~~~
4+
5+
Transform pyexcel sheet into a sortable html
6+
7+
:copyright: (c) 2016-2017 by Onni Software Ltd.
8+
:license: New BSD License, see LICENSE for further details
9+
"""
10+
from lml.plugin import PluginInfoChain, PluginInfo
11+
12+
13+
class MyPluginInfo(PluginInfo):
14+
15+
def tags(self):
16+
file_types = self.file_types
17+
for file_type in file_types:
18+
yield file_type
19+
20+
21+
PluginInfoChain(__name__).add_a_plugin_instance(
22+
MyPluginInfo(
23+
'renderer',
24+
'%s.sortable.Sortable' % __name__,
25+
file_types=['sortable.html'],
26+
stream_type='string'
27+
)
28+
)

Diff for: pyexcel_sortable/sortable.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
pyexcel_sortable
3+
~~~~~~~~~~~~~~~~~~~~~~~
4+
5+
Transform pyexcel sheet into a sortable html
6+
7+
:copyright: (c) 2016-2017 by Onni Software Ltd.
8+
:license: New BSD License, see LICENSE for further details
9+
"""
10+
from pyexcel.renderer import Renderer
11+
12+
13+
from csvtotable.convert import render_template, freeze_js
14+
15+
16+
class Sortable(Renderer):
17+
def render_sheet(self, sheet, caption="", display_length=300,
18+
**keywords):
19+
if len(sheet.colnames) == 0:
20+
sheet.name_columns_by_row(0)
21+
22+
html = render_template(
23+
sheet.colnames, sheet.array[1:],
24+
caption=caption, display_length=display_length)
25+
26+
js_freezed_html = freeze_js(html)
27+
self._stream.write(js_freezed_html.encode('utf-8'))
28+
29+
def render_book(self, book, **keywords):
30+
raise Exception("Please select a sheet for transformation")

Diff for: setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
PY2 = sys.version_info[0] == 2
99
PY26 = PY2 and sys.version_info[1] < 7
1010

11-
NAME = ''
11+
NAME = 'pyexcel-sortable'
1212
AUTHOR = 'C.W.'
13-
VERSION = ''
13+
VERSION = '0.0.1'
1414
1515
LICENSE = 'New BSD'
1616
DESCRIPTION = (

0 commit comments

Comments
 (0)