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

Refactor RSS feeds generation, and do it through templates #515

Merged
merged 12 commits into from
Mar 25, 2016

Conversation

ArthurHoaro
Copy link
Member

This PR is a bit huge, please look at the commit log to review it. I've tried to split everything in different commits to make it understandable.

To sum it up:

  • RSS and Atom feeds are now sharing the same code, in FeedBuilder.
  • They're generated through RainTPL templates.
  • It's now covered by unit tests.
  • There is a new plugin hook called before rendering feeds.
  • The ENABLE_RSS_PERMALINKS setting in administration has been reworded.

Fixes #273

Note that this doesn't concern Daily RSS feed.

PS: tig is awesome.

@ArthurHoaro ArthurHoaro self-assigned this Mar 12, 2016
@ArthurHoaro ArthurHoaro added this to the 0.7.0 milestone Mar 12, 2016
@virtualtam virtualtam mentioned this pull request Mar 12, 2016
43 tasks
@alexisju
Copy link

Nice! Markdown plugin will be able to generate formatted feeds soon 😄 (cfr #485)

class FeedBuilder
{
/**
* @var string Constant: RSS feed type.
Copy link
Member

Choose a reason for hiding this comment

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

why the trailing dots at the end of each comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Habits from my pro Sonar rules.

@virtualtam
Copy link
Member

Very cool work @ArthurHoaro ! It's nice to see chunks of code drifting away from index.php ;-)

@ArthurHoaro
Copy link
Member Author

Thanks for the review! I'll work on it soon.

ATOM feed improvement:

  * Adds a subtitle to match RSS feed behavior.
  * Better syntax for categories (see http://edward.oconnor.cx/2007/02/representing-tags-in-atom ).
  * Use locale to set the language
Improvements:

  * Add searchtags in categories domain URL.
  * Language is now based on the locale.
  * Add a generator tag.
  * self link is always displayed.
Minor changes:

  * Fix the date which was in a invalid format.
  * Avoid empty categories (tags).
  * Use the locale to set the language
@ArthurHoaro
Copy link
Member Author

I've update the commit log to take your review into account. I've also added a new commit: 26c7b67

Refactor filter in LinkDB

  • search type now carried by LinkDB in order to factorize code between different search sources.
  • LinkDB->filter split in 3 method: filterSearch, filterHash, filterDay (we know what type of filter is needed).
  • filterHash now throw a LinkNotFoundException if it doesn't exist: internal implementation choice, still displays a 404.
  • Smallhash regex has been rewritten.
  • Unit tests update

It's not really related to this PR, but it has to be done, and lighten the buildData method.

*
* @return array Link array with feed attributes.
*/
public function buildItem($link, $pageaddr)
Copy link
Member

Choose a reason for hiding this comment

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

unless directly tested, can be either private or protected

@virtualtam
Copy link
Member

Thanks 👍
I should be able to test it tomorrow ;-)

@virtualtam
Copy link
Member

Tested, works fine ;-)

  * search type now carried by LinkDB in order to factorize code between different search sources.
  * LinkDB->filter split in 3 method: filterSearch, filterHash, filterDay (we know what type of filter is needed).
  * filterHash now throw a LinkNotFoundException if it doesn't exist: internal implementation choice, still displays a 404.
  * Smallhash regex has been rewritten.
  * Unit tests update
@ArthurHoaro
Copy link
Member Author

Thanks again!

@ArthurHoaro ArthurHoaro merged commit f66a199 into shaarli:master Mar 25, 2016
@ArthurHoaro ArthurHoaro deleted the template-feeds branch March 25, 2016 18:21
alexisju added a commit to alexisju/albinomouse-template that referenced this pull request Mar 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants