diff --git a/.gitignore b/.gitignore index 1a8fd1b8..3b171aba 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,11 @@ obj # virtaulenv env/ env*/ + +docs/_themes/jrnl/static/less/3L.less + +# PyCharm Project files +.idea/ + +# export testing director +exp/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f39fbf4..b3629c27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Changelog ### 1.8 (May 22, 2014) +* __1.8.7__ Fixed: -from and -to filters are inclusive (thanks to @grplyler) +* __1.8.6__ Improved: Tags like @C++ and @OS/2 work, too (thanks to @chaitan94) +* __1.8.5__ Fixed: file names when exporting to individual files contain full year (thanks to @jdevera) * __1.8.4__ Improved: using external editors (thanks to @chrissexton) * __1.8.3__ Fixed: export to text files and improves help (thanks to @igniteflow and @mpe) * __1.8.2__ Better integration with environment variables (thanks to @ajaam and @matze) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e4bddef..d4bbb29f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ If you use jrnl, you can totally make my day by just saying "thanks for the code Docs & Typos ------------ -If you find a typo or a mistake in the docs, just fix it right away and send a pull request. The Right Way™ to fix the docs is to edit the `docs/*.rst` files on the **master** branch. You can see the result if you run `make html` inside docs, and then open `docs/_build/html/index.html` in your browser. Changes to the CSS or Javascript should be made on `docs/_themes/jrnl/`. The `gh-pages` branch is automatically maintained and updates from `master`. +If you find a typo or a mistake in the docs, just fix it right away and send a pull request. The Right Way™ to fix the docs is to edit the `docs/*.rst` files on the **master** branch. You can see the result if you run `make html` inside the project's root directory, and then open `docs/_build/html/index.html` in your browser. Note that this requires [lessc](http://lesscss.org/#using-less-installation) and [Sphinx](https://pypi.python.org/pypi/Sphinx) to be installed. Changes to the CSS or Javascript should be made on `docs/_themes/jrnl/`. The `gh-pages` branch is automatically maintained and updates from `master`; you should never have to edit that. Bugs ---- @@ -18,7 +18,7 @@ They unfortunately happen. Specifically, I don't have a Windows machine to test Feature requests and ideas -------------------------- -So, you have an idea for a great feature? Awesome. I love you. As with bugs, first you should [open a new issue](https://www.github.com/maebert/jrnl/issues/new) on GitHub, describe the use case and what the feature should accomplish. If we agree that this feature is useful, it will sooner or later get implement it. Even sooner if you roll up your sleeves and code it yourself ;-) +So, you have an idea for a great feature? Awesome. I love you. As with bugs, first you should [open a new issue](https://www.github.com/maebert/jrnl/issues/new) on GitHub, describe the use case and what the feature should accomplish. If we agree that this feature is useful, it will sooner or later get implemented. Even sooner if you roll up your sleeves and code it yourself ;-) Keep in mind that the design goal of jrnl is to be _slim_. That means diff --git a/Makefile b/Makefile index 51939f90..56eb4598 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,13 @@ clean: rm -rf _static rm -f *.html +html: + curl https://raw.githubusercontent.com/mateuszkocz/3l/master/3L/3L.less > docs/_themes/jrnl/static/less/3L.less ;\ + lessc --clean-css docs/_themes/jrnl/static/less/jrnl.less docs/_themes/jrnl/static/css/jrnl.css ;\ + cd docs ;\ + make html ;\ + cd .. ;\ + open docs/_build/html/index.html ;\ # Build GitHub Page from docs docs: diff --git a/docs/_themes/jrnl/static/less/docs.less b/docs/_themes/jrnl/static/less/docs.less index 3eaa34b3..eb12bb48 100644 --- a/docs/_themes/jrnl/static/less/docs.less +++ b/docs/_themes/jrnl/static/less/docs.less @@ -108,15 +108,11 @@ a:hover, a:active { background:transparent !important; } -.highlight-output - { - .pre-block; - background: desaturate(lighten(@terminal,10), 10); - } -.highlight-javascript +.highlight-output, .highlight-javascript, .highlight-sh { .pre-block; background: desaturate(lighten(@terminal,10), 10); + pre {color: white;} } .highlight-python { diff --git a/docs/encryption.rst b/docs/encryption.rst index 9d420df6..37d341a8 100644 --- a/docs/encryption.rst +++ b/docs/encryption.rst @@ -25,6 +25,12 @@ Whenever you encrypt your journal, you are asked whether you want to store the e If you don't initially store the password in the keychain but decide to do so at a later point -- or maybe want to store it on one computer but not on another -- you can simply run ``jrnl --encrypt`` on an encrypted journal and use the same password again. +A note on security +------------------ + +While jrnl follows best practises, true security is an illusion. Specifically, jrnl will leave traces in your memory and your shell history -- it's meant to keep journals secure in transit, for example when storing it on an `untrusted `_ services such as Dropbox. If you're concerned about security, disable history logging for journal in your ``.bashrc`` :: + + HISTINGNORE="jrnl *" Manual decryption ----------------- diff --git a/docs/recipes.rst b/docs/recipes.rst index ffcc0643..e1aef9a9 100644 --- a/docs/recipes.rst +++ b/docs/recipes.rst @@ -37,6 +37,44 @@ Will give you the number of words you wrote in 2013. How long is my average entr This will first get the total number of words in the journal and divide it by the number of entries (this works because ``jrnl --short`` will print exactly one line per entry). +Importing older files +~~~~~~~~~~~~~~~~~~~~~ + +If you want to import a file as an entry to jrnl, you can just do ``jrnl < entry.ext``. But what if you want the modification date of the file to be the date of the entry in jrnl? Try this :: + + echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl + +The first part will format the modification date of ``entry.txt``, and then combine it with the contents of the file before piping it to jrnl. If you do that often, consider creating a function in your ``.bashrc`` or ``.bash_profile`` + +.. code-block:: sh + + jrnlimport () { + echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' $1` `cat $1` | jrnl + } + + +Using templates +~~~~~~~~~~~~~~~ + +Say you always want to use the same template for creating new entries. If you have an :doc:`external editor ` set up, you can use this :: + + jrnl < my_template.txt + $ jrnl -1 --edit + +Another nice solution that allows you to define individual prompts comes from `Jacobo de Vera `_: + +.. code-block:: sh + + function log_question() + { + echo $1 + read + jrnl today: ${1}. $REPLY + } + log_question 'What did I achieve today?' + log_question 'What did I make progress with?' + + External editors ---------------- diff --git a/features/data/configs/tags-216.json b/features/data/configs/tags-216.json new file mode 100644 index 00000000..4164d6f5 --- /dev/null +++ b/features/data/configs/tags-216.json @@ -0,0 +1,14 @@ +{ + "default_hour": 9, + "timeformat": "%Y-%m-%d %H:%M", + "linewrap": 80, + "encrypt": false, + "editor": "", + "default_minute": 0, + "highlight": true, + "password": "", + "journals": { + "default": "features/journals/tags-216.journal" + }, + "tagsymbols": "@" +} diff --git a/features/data/journals/tags-216.journal b/features/data/journals/tags-216.journal new file mode 100644 index 00000000..4bd942b9 --- /dev/null +++ b/features/data/journals/tags-216.journal @@ -0,0 +1,2 @@ +2013-06-10 15:40 I programmed for @OS/2. +Almost makes me want to go back to @C++, though. (Still better than @C#). diff --git a/features/data/journals/tags.journal b/features/data/journals/tags.journal index bfd49cf4..b4186a53 100644 --- a/features/data/journals/tags.journal +++ b/features/data/journals/tags.journal @@ -5,3 +5,4 @@ 2013-06-10 15:40 I met with @dan. As alway's he shared his latest @idea on how to rule the world with me. +inst diff --git a/features/tagging.feature b/features/tagging.feature index a30c1052..2d317938 100644 --- a/features/tagging.feature +++ b/features/tagging.feature @@ -20,3 +20,14 @@ Feature: Tagging @idea : 1 @dan : 1 """ + + Scenario: Tags should allow certain special characters + Given we use the config "tags-216.json" + When we run "jrnl --tags" + Then we should get no error + and the output should be + """ + @os/2 : 1 + @c++ : 1 + @c# : 1 + """ diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 546c34e2..8f741a30 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -18,7 +18,7 @@ class Entry: def parse_tags(self): fulltext = " ".join([self.title, self.body]).lower() - tags = re.findall(r'(?u)([{tags}]\w+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) + tags = re.findall(r'(?u)([{tags}][-+*#/\w]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) self.tags = tags return set(tags) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index c4cbd336..40f67968 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -221,8 +221,8 @@ class Journal(object): if (not tags or tagged(entry.tags)) and (not starred or entry.starred) and (not shortmatch or entry.short() == shortmatch) - and (not start_date or entry.date > start_date) - and (not end_date or entry.date < end_date) + and (not start_date or entry.date >= start_date) + and (not end_date or entry.date <= end_date) ] if short: if tags: diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 260d7f10..516b60f5 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line. from __future__ import absolute_import __title__ = 'jrnl' -__version__ = '1.8.4' +__version__ = '1.8.7' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert' diff --git a/jrnl/cli.py b/jrnl/cli.py index 6e234ab7..e7bc2260 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -43,8 +43,8 @@ def parse_args(args=None): exporting.add_argument('--short', dest='short', action="store_true", help='Show only titles or line containing the search tags') exporting.add_argument('--plain', dest='plain', action="store_true", help='Print without highlighting or text wrapping') exporting.add_argument('--tags', dest='tags', action="store_true", help='Returns a list of all tags and number of occurences') - exporting.add_argument('--export', metavar='TYPE', dest='export', help='Export your journal. Options: json, text, markdown', default=False, const=None) - exporting.add_argument('-o', metavar='OUTPUT', dest='output', help='The output of the file can be provided when using with --export', default=False, const=None) + exporting.add_argument('--export', metavar='TYPE', dest='export', choices=['text','txt','markdown','md','json'], help='Export your journal. TYPE can be json, markdown, or text.', default=False, const=None) + exporting.add_argument('-o', metavar='OUTPUT', dest='output', help='Optionally specifies output file when using --export. If OUTPUT is a directory, exports each entry into an individual file instead.', default=False, const=None) exporting.add_argument('--encrypt', metavar='FILENAME', dest='encrypt', help='Encrypts your existing journal with a new password', nargs='?', default=False, const=None) exporting.add_argument('--decrypt', metavar='FILENAME', dest='decrypt', help='Decrypts your journal and stores it in plain text', nargs='?', default=False, const=None) exporting.add_argument('--edit', dest='edit', help='Opens your editor to edit the selected entries.', action="store_true") diff --git a/jrnl/exporters.py b/jrnl/exporters.py index bdab3987..71919f34 100644 --- a/jrnl/exporters.py +++ b/jrnl/exporters.py @@ -100,7 +100,7 @@ def export(journal, format, output=None): def write_files(journal, path, format): """Turns your journal into separate files for each entry. Format should be either json, md or txt.""" - make_filename = lambda entry: e.date.strftime("%C-%m-%d_{0}.{1}".format(slugify(u(e.title)), format)) + make_filename = lambda entry: e.date.strftime("%Y-%m-%d_{0}.{1}".format(slugify(u(e.title)), format)) for e in journal.entries: full_path = os.path.join(path, make_filename(e)) if format == 'json':