abakan-zz / ablog

ABlog for blogging with Sphinx
ablog.readthedocs.org
Other
122 stars 35 forks source link

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

Open benjaminweb opened 7 years ago

benjaminweb commented 7 years ago

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:

Translating this into requirements for a content first principle:

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 commented 7 years ago

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 commented 7 years ago

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