ardumont / org2jekyll

Blogging with org-mode and jekyll without alien yaml headers.
GNU General Public License v2.0
71 stars 19 forks source link

Allows for the usage of new front matter variables #40

Closed halcyon closed 8 years ago

halcyon commented 8 years ago

Antoine, I apologize for not submitting this pull request for you to look over sooner. I have been ill, and have only recently recovered.

I had a use case similar to that of the other person who needed to be able to use customized front-matter. As I dug into the issue, I did some refactoring that you might find beneficial.

Notable changes

  1. Special lines at the top of buffer that only have a meaning in Org mode are not passed through to Jekyll front-matter. All other special lines at the top of the buffer that do not have an Org-only meaning, and do not translate directly to a special Jekyll front-matter meaning are simply passed through as customized front-matter. I think this approach has several advantages - one of which is that if Jekyll ever adds new front-matter keywords, org2jekyll doesn't have to be updated to accomodate this.
  2. Org special lines are parsed directly from the buffer in a generalized way, and only from the top of the buffer where they relate to front-matter.
  3. Data-driven approach gives us the ability to test directly without mocks, resulting in tests that can be more concise, readable and maintainable.

Looking forward to your thoughts.

ardumont commented 8 years ago

Hello,

Thanks for the PR, i need some time to ingest it though.

In your description, I don't get the expression front-matter you keep using, can you please clarify it? Thanks. Ah do you mean front-related?

Antoine, I apologize for not submitting this pull request for you to look over sooner. I have been ill, and have only recently recovered.

No problem.

I had a use case similar to that of the other person who needed to be able to use customized front-matter. As I dug into the issue, I did some refactoring that you might find beneficial.

35 #36 related then.

  1. ... org2jekyll doesn't have to be updated to accomodate this.

That's good, indeed.

  1. Org special lines are parsed directly from the buffer in a generalized way, and only from the top of the buffer where they relate to front-matter.

I don't understand this sentence. Can you please also clarify?

  1. Data-driven approach gives us the ability to test directly without mocks, resulting in tests that can be more concise, readable and maintainable.

Good point.

Cheers,

halcyon commented 8 years ago

Thanks for the PR, i need some time to ingest it though.

Thanks for your quick response, I appreciate you taking the time to look it over and discuss.

I don't get the expression front-matter you keep using, can you please clarify it

Yes, front matter is the YAML at the top of Jekyll pages.

Org special lines are parsed directly from the buffer in a generalized way, and only from the top of the buffer where they relate to front-matter.

Org special lines are described in the Org manual as, "...lines in the buffer to define settings on a per-file basis. These lines start with a ‘#+’ followed by a keyword, a colon, and then individual words defining a setting." While they serve a similar purpose as Jekyll's front matter, they differ in that they can also be used anywhere in an Org document for things that wouldn't make sense to set globally for the entire document - such as syntax highlighting some source code in the middle of the document with #+BEGIN_SRC: and #+END_SRC:.

As a result of this, it would make sense to only retrieve the Org special lines that are at the top of the document - where they are analogous to front matter. This is important, because you wouldn't want properties relating only to formatting a section of an Org document to be copied into the Jekyll front matter. Searching only the top of the document should also yield a nominal performance improvement.

Currently, only predefined Org special lines are found. In the PR I've added a regular expression that will find any Org special line - this is what I meant by it being more generalized.

ardumont commented 8 years ago

Thanks for your quick response, I appreciate you taking the time to look it over and discuss.

Well, how can we achieve improvments without discussion?

^^

Yes, frontmatter is the YAML at the top of Jekyll pages.

Thanks for the explanation and the link. I did not read all of jekyll's manual indeed. It did not even occur to me it was a jekyll term.

Org special lines are described in the Org manual as, ...

Thanks. I thought i took care of that. I need to take a closer look at your PR. If i recall correctly though, my approach may have been naive ^^

Searching only the top of the document should also yield a nominal performance improvement.

Indeed.

Currently, only predefined Org special lines are found. In the PR I've added a regular expression that will find any Org special line - this is what I meant by it being more generalized.

Ok... Ah yes, i see now. Indeed.

Thus your initial remark org2jekyll doesn't have to be updated to accomodate this..

Do you think you can take a stab at rebasing to the latest code or is it too much of a hassle?

Thanks anyway.

halcyon commented 8 years ago

Sure, I can do that. Would you be ok with me removing the recently added extra-yaml feature when I rebase? I'll also break the changes up into smaller commits so it's easier to examine.

ardumont commented 8 years ago

Would you be ok with me removing the recently added extra-yaml feature when I rebase?

Sure, we'll need to update the readme accordingly (either you or me).

halcyon commented 8 years ago

Cool, sounds good - team work! 😃

ardumont commented 8 years ago

Cool, sounds good - team work! :smiley:

Indeed ^^

ardumont commented 8 years ago

cf. #41 for the follow-up.