Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to Pelican #258

Closed
wants to merge 113 commits into from
Closed

Conversation

MinchinWeb
Copy link
Contributor

This allows you to export your JRNL to Pelican formatted Markdown. The exported files have the necessary metadata at the top, and then contain the body of the entry. Files are saved with .md extension.

These can then be used as source content to generate the files of a Pelican blog.

Example file:

Title: RAM?
Date: 2013-07-30 12:02:00
Tags: computer, RAM

8GB of RAM for my desktop??...

MinchinWeb and others added 30 commits July 28, 2014 18:43
(don't keep a second copy in `requirements.txt`)
jrnl needs the OSX fixes in version 1.1
…one()`

one side effect is that a `pytz` object is returned rather than a
string, and so conversion to a string must be done explicitly at run
time where needed.
want to maintain the ability to format with the use of just text.
If a line was exactly the length of `linewrap`, the extra space was
causing the next line to be blank. But if the line is empty, we need the
space to maintain the `| ` sidebar.
Previously, if a user forgot the exact name of a journal, they could check the configuration file to retrieve this information. This patch adds support for performing this task using the jrnl interface.

The newly added '-ls' option retrieves the available journals from the jrnl configuration files and displays each journal name on a separate line.

This patch also updates the jrnl help display and the usage documentation to reflect these changes.
@MinchinWeb MinchinWeb changed the title Export to pelican Export to Pelican Jul 30, 2014
@MinchinWeb
Copy link
Contributor Author

All the changes are in the last two commits (09e0e44 and 115a5c7), so it might be cleaner to just cherry pick those two. The rest showed up as I tried to rebase/fast-forward.

@maebert
Copy link
Contributor

maebert commented Aug 5, 2014

Awesome! Question: can we name that just YAML instead of Pelican? Also, see the line comments.

and convert to .format()
Without the first line being `---`, I don't know if it is completely
valid YAML
@MinchinWeb
Copy link
Contributor Author

We don't have to call it 'Pelican', I don't know if it's quite YAML. YAML starts and end its front matter with a line containing three dashes ---. I've added the ending line, but if I put in the starting line, Pelican chokes on the files. The practical solution would be to see if Jekyll will process these files. I unfortunately, can't test this as Windows is not a supported platform for Jekyll. :(

For now, I've renamed it 'yaml', and addressed your line comments.

Current export example:

Title: RAM?
Date: 2013-07-30 12:02:00
Tags: computer, RAM
---

8GB of RAM for my desktop??...

return u"[Journal exported to {0}]".format(output)
except IOError as e:
return u"[ERROR: {0} {1}]".format(e.filename, e.strerror)
if format is ("yaml" or "yaml-md"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't do what you want it to do. ("yaml" or "yaml-md") will be computed first and evaluate to "yaml" (since strings are Truth-y). The correct way is to do if format in ('yaml', 'yaml-md'). That said, I think we should get rid of yaml-md. It's technically more correct, however nobody that knows of yaml support will type in yaml-md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pelican-md was originally introduced in case someone later added a ReStructured Text export for Pelican (the front matter is a different format). In any case, I don't think that will be an issue/confusion with the option named yaml, so I've removed yaml-md as you're suggested (see c756770).

@MinchinWeb
Copy link
Contributor Author

Recreated against the 2.0-rc1 branch as #347. (This is against the master branch, so based on 1.9.6). Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet