-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0dc912a
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Rot13 Custom Exporter for Jrnl | ||
|
||
This is a custom exporter to demostrate how to write customer exporters for | ||
[jrnl](https://github.com/jrnl-org/jrnl). It is also used by *jrnl* in its | ||
tests to ensure the feature works as expected. | ||
|
||
This plugin applies a [Caeser | ||
cipher](https://en.wikipedia.org/wiki/Caesar_cipher) (specifically the | ||
[ROT13](https://en.wikipedia.org/wiki/ROT13)) to output text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import codecs | ||
|
||
from jrnl.plugins.base import BaseExporter | ||
|
||
__version__ = "1.0.0" | ||
|
||
class Exporter(BaseExporter): | ||
names = ["rot13"] | ||
extension = "txt" | ||
version = __version__ | ||
|
||
@classmethod | ||
def export_entry(cls, entry): | ||
return codecs.encode(str(entry), "rot_13") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import re | ||
|
||
try: | ||
from setuptools import find_packages, setup | ||
except ImportError: | ||
from distutils.core import find_packages, setup | ||
|
||
base_dir = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
def get_version(filename="jrnl/contrib/exporter/rot13.py"): | ||
with open(os.path.join(base_dir, filename), encoding="utf-8") as initfile: | ||
for line in initfile.readlines(): | ||
m = re.match("__version__ *= *['\"](.*)['\"]", line) | ||
if m: | ||
return m.group(1) | ||
|
||
|
||
setup( | ||
name="jrnl-rot13", | ||
version=get_version(), | ||
description="Demonstration custom exporter for jrnl", | ||
long_description="\n\n".join([open(os.path.join(base_dir, "README.md")).read()]), | ||
long_description_content_type="text/markdown", | ||
author="W. Minchin", | ||
author_email="[email protected]", | ||
url="https://github.com/MinchinWeb/jrnl-rot13-exporter", | ||
packages=["jrnl", "jrnl.contrib", "jrnl.contrib.exporter"], | ||
include_package_data=True, | ||
install_requires=[ | ||
"jrnl", | ||
], | ||
zip_safe=False, # use wheels instead | ||
) |