Skip to content

Commit

Permalink
Markdown articles accessible via http
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Jan 9, 2018
1 parent cf7ca91 commit 3677dfc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change log

For detailed information check [Blogophon's releases on Github](https://github.com/fboes/blogophon/releases).

* :gift: Markdown articles accessible via http
* :gift: Adding `<div class="table-wrapper"></div>` around `<table>…</table>`
* :gift: Improved editing of tags and dates
* :gift: Added update instructions
Expand Down
5 changes: 5 additions & 0 deletions docs/special-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ For every index page (start page, tag pages, author pages) there will be a corre

This JSON is understood by [Slack's slash command](https://slack.com/apps/A0F82E8CA-slash-commands), so you can have a Slack bot telling you about current articles.

Markdown
--------

For every article there will be a corresponding `article.md`.

Facebook Instant Articles
-------------------------

Expand Down
6 changes: 3 additions & 3 deletions htdocs/themes/default/templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
{{#config.specialFeatures.jsonrss}}
<link rel="alternate" type="application/rss+json" title="{{config.name}} JSON" href="{{config.absoluteBasePath}}rss.json" />
{{/config.specialFeatures.jsonrss}}
{{#config.specialFeatures.jsonforslack}}
<link rel="alternate" type="application/json" title="{{config.name}} Slack-JSON" href="{{config.absoluteBasePath}}slack.json" />
{{/config.specialFeatures.jsonforslack}}
{{#config.specialFeatures.markdown}}
<link rel="alternate" type="text/markdown" title="{{post.meta.Title}}" href="{{config.absoluteBasePath}}article.md" />
{{/config.specialFeatures.markdown}}
{{#config.specialFeatures.acceleratedmobilepages}}
<link rel="amphtml" href="{{post.meta.AbsoluteUrlAmp}}" />
{{/config.specialFeatures.acceleratedmobilepages}}
Expand Down
1 change: 1 addition & 0 deletions lib/blogophon-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ const BlogophonConsole = function() {
'JSON Feed',
"JSON for Slack",
"JSON-RSS",
"Markdown",
"Apple News",
"Facebook Instant Articles",
"Accelerated Mobile Pages",
Expand Down
10 changes: 8 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,14 @@ const Generator = function(config) {
if (config.specialFeatures.ajax) {
promises.push(fs.writeFileAsync(
post.meta.urlObj.filename('index', 'json'),
JSON.stringify(post, undefined, 2))
);
JSON.stringify(post, undefined, 2)
));
}
if (config.specialFeatures.markdown) {
promises.push(fs.copy(
post.filename,
post.meta.urlObj.filename('article', 'md')
));
}
if (!noimages) {
promises.push(external.buildArticleImages(post));
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/marky-mark.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ const markyMark = function(string, rules) {
return '<div class="table-wrapper">'
+ before
+ content
.replace(/(<tr[^>]*>[\s]*)<td([^>]*>)<strong>(.+?)<\/strong><\/td>/g, '$1<th scope="row"$2$3</th>')
.replace(/(<(?:th|td) style="text-align:\s?([a-z]+)[^"]*")/g, '$1 class="table-cell--$2"')
.replace(/(<tr[^>]*>[\s]*)<td([^>]*>)<strong>(.+?)<\/strong><\/td>/g, '$1<th scope="row"$2$3</th>')
.replace(/(<(?:th|td) style="text-align:\s?([a-z]+)[^"]*")/g, '$1 class="table-cell--$2"')
+ after
+ '</div>'
;
Expand Down

0 comments on commit 3677dfc

Please sign in to comment.