Merge branch 'master' into plain-and-match

Just getting in sync with upstream.
This commit is contained in:
vietjtnguyen 2014-07-04 02:40:36 -07:00
commit 8352855d8a
16 changed files with 101 additions and 15 deletions

8
.gitignore vendored
View file

@ -42,3 +42,11 @@ obj
# virtaulenv # virtaulenv
env/ env/
env*/ env*/
docs/_themes/jrnl/static/less/3L.less
# PyCharm Project files
.idea/
# export testing director
exp/

View file

@ -4,6 +4,9 @@ Changelog
### 1.8 (May 22, 2014) ### 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.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.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) * __1.8.2__ Better integration with environment variables (thanks to @ajaam and @matze)

View file

@ -7,7 +7,7 @@ If you use jrnl, you can totally make my day by just saying "thanks for the code
Docs & Typos 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 Bugs
---- ----
@ -18,7 +18,7 @@ They unfortunately happen. Specifically, I don't have a Windows machine to test
Feature requests and ideas 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 Keep in mind that the design goal of jrnl is to be _slim_. That means

View file

@ -10,6 +10,13 @@ clean:
rm -rf _static rm -rf _static
rm -f *.html 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 # Build GitHub Page from docs
docs: docs:

View file

@ -108,15 +108,11 @@ a:hover, a:active
{ {
background:transparent !important; background:transparent !important;
} }
.highlight-output .highlight-output, .highlight-javascript, .highlight-sh
{
.pre-block;
background: desaturate(lighten(@terminal,10), 10);
}
.highlight-javascript
{ {
.pre-block; .pre-block;
background: desaturate(lighten(@terminal,10), 10); background: desaturate(lighten(@terminal,10), 10);
pre {color: white;}
} }
.highlight-python .highlight-python
{ {

View file

@ -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. 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 <http://techcrunch.com/2014/04/09/condoleezza-rice-joins-dropboxs-board/>`_ services such as Dropbox. If you're concerned about security, disable history logging for journal in your ``.bashrc`` ::
HISTINGNORE="jrnl *"
Manual decryption Manual decryption
----------------- -----------------

View file

@ -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). 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 <advanced>` 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 <https://github.com/maebert/jrnl/issues/194#issuecomment-47402869>`_:
.. 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 External editors
---------------- ----------------

View file

@ -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": "@"
}

View file

@ -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#).

View file

@ -5,3 +5,4 @@
2013-06-10 15:40 I met with @dan. 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. As alway's he shared his latest @idea on how to rule the world with me.
inst

View file

@ -20,3 +20,14 @@ Feature: Tagging
@idea : 1 @idea : 1
@dan : 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
"""

View file

@ -18,7 +18,7 @@ class Entry:
def parse_tags(self): def parse_tags(self):
fulltext = " ".join([self.title, self.body]).lower() 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 self.tags = tags
return set(tags) return set(tags)

View file

@ -221,8 +221,8 @@ class Journal(object):
if (not tags or tagged(entry.tags)) if (not tags or tagged(entry.tags))
and (not starred or entry.starred) and (not starred or entry.starred)
and (not shortmatch or entry.short() == shortmatch) and (not shortmatch or entry.short() == shortmatch)
and (not start_date or entry.date > start_date) and (not start_date or entry.date >= start_date)
and (not end_date or entry.date < end_date) and (not end_date or entry.date <= end_date)
] ]
if short: if short:
if tags: if tags:

View file

@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line.
from __future__ import absolute_import from __future__ import absolute_import
__title__ = 'jrnl' __title__ = 'jrnl'
__version__ = '1.8.4' __version__ = '1.8.7'
__author__ = 'Manuel Ebert' __author__ = 'Manuel Ebert'
__license__ = 'MIT License' __license__ = 'MIT License'
__copyright__ = 'Copyright 2013 - 2014 Manuel Ebert' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert'

View file

@ -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('--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('--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('--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('--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='The output of the file can be provided when using with --export', 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('--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('--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") exporting.add_argument('--edit', dest='edit', help='Opens your editor to edit the selected entries.', action="store_true")

View file

@ -100,7 +100,7 @@ def export(journal, format, output=None):
def write_files(journal, path, format): def write_files(journal, path, format):
"""Turns your journal into separate files for each entry. """Turns your journal into separate files for each entry.
Format should be either json, md or txt.""" 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: for e in journal.entries:
full_path = os.path.join(path, make_filename(e)) full_path = os.path.join(path, make_filename(e))
if format == 'json': if format == 'json':