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

Feature Request: Multiple post directives in a single file #83

Open
benjaminweb opened this issue Mar 6, 2017 · 2 comments
Open

Feature Request: Multiple post directives in a single file #83

benjaminweb opened this issue Mar 6, 2017 · 2 comments

Comments

@benjaminweb
Copy link

As of now ablog seems to come very near to what I desire as a blog tool for my requirements.

We think the more we can configure each blog entry, the better we can blog.
However, we end up configuring and not blogging!

For me there are two subtle obstacles of getting content into the blog:

  • saving each post in a new file
  • devising a title for each

Translating this into requirements for a content first principle:

  • multiple post directives in single file: no longer thinking of a name of a file, saving it, adding it to git/hg
  • .. post:: Month DD, year without title requirement: no second (!) redundant typing of the title

You can instantly start writing on a piece of paper.
That is not true for a new blog entry per se: You would have to define a new file name (if not, still a temporary one which you don't want to move later on, so your attention gets completely distracted
from the content). Then the content will only be visible.

Vision:
Type new-post. Type your content. Finis.
That will append the content to the single file with default date and meta-data.

The single file would look like:

.. post:: Apr 16, 2014

This is the second article without a title.
It is in the same file as the first.
It assumes standard values for language and author, if not specified otherwise.

.. post:: Apr 15, 2014
   :tags: earth, love, peace
   :category: python
   :author: me
   :location: SF
   :language: en

Some Fancy Title
=============

This is the first article with a title.

That would be similar to the .. code-block:: python directive that can be used multiple times in a document. However, the code that follows is indented. For .. post:: it isn't, I feel because there's only one allowed per file. Considering multiple .. post:: directives for a single file, the indents would be another, new obstacle. Could one get rid of that, so allowing the above example to just work?

Any change, in particular those with the best intent, may damage the overall package at the bottom line.

=> Would the ability for multiple post directives conflict ablog's current mechanics?

@abakan-zz
Copy link
Owner

Multiple post directives in a single document are handled as Posting Sections, but I think it's a little different from how you laid it out. This is the source to Posting and Listing page where Posting Sections was posted later.

Each post directive will look for a title in it's parent. I think that's the main difference from how you described. I am not sure now what happens when title is not found, but I will try it soon.

@benjaminweb
Copy link
Author

benjaminweb commented Mar 7, 2017

Firstly, I would like to emphasise I did not consider multiple post directives possible.
I wrote my issue with that in mind. The behaviour shown below confirmed that pre-conception, which seems to be wrong as per the documentation you referenced.

Remarkably, it seems already to be closer to what I desire than I initially thought.

The following content will lead to a hang-up at ``loading sources... [ 66%] first-post`.
Do I use the correct syntax? If not, what's the right way to do it?

.. post:: Mar 07, 2017
   :tags: atag
   :author: Benjamin Franklin

first
=====

World, hello again! This is the very first paragraph.

.. post:: Mar 07, 2017
   :tags: atag
   :author: Benjamin Franklin

second
======

This is the second paragraph.

If a title is not provided, the following exception is raised:

  File "/usr/local/lib/python3.6/site-packages/ablog/post.py", line 174, in _get_section_title
    return title.astext()
UnboundLocalError: local variable 'title' referenced before assignment

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

No branches or pull requests

2 participants