diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a2a611e..03e0a9d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,13 @@ Changelog For detailed information check [Blogophon's releases on Github](https://github.com/fboes/blogophon/releases). -rc 1.1.0 --------- +1.1.0 +----- * [x] New (and very basic) default theme -* [x] Fixed major bug for installations in subfolders * [x] Image gallery added +* [x] Adding support for video / audio tags in Markdown +* [x] Fixed major bug for installations in subfolders 1.0.4 ----- diff --git a/README.md b/README.md index 03b3e4c6..02b3dea1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A live example of this blog generator can be found at [3960! Journal](http://jou * Generates a bunch of way to find your articles: Regular index pages, tag pages, author pages. * The Blogophon comes with a built-in image-scaler, which leads to responsive images. * The default theme puts all relevant meta stuff into `` for SEO and social sharing (via schema.org and OpenGraph). -* A ton of [special features](docs/special-features.md) like ATOM, RSS, AMP, etc. +* A ton of [special features](docs/special-features.md) like RSS/ATOM newsfeeds, Accelerated Mobile Pages (AMP), Facebook Instant Articles, etc. Requirements ------------ diff --git a/docs/markdown.md b/docs/markdown.md index 3f8f69d4..7697a8d8 100644 --- a/docs/markdown.md +++ b/docs/markdown.md @@ -72,7 +72,7 @@ And this part will only be shown on article pages. ``` -If you do not use both methods, the Blogophon will build a **teaser text from article text** by using the first 160 characters. +If you do not use one of the methods mentioned above, the Blogophon will build a **teaser text from article text** by using the first 160 characters. Images ------ @@ -110,9 +110,22 @@ An image gallery is built by supplying a paragraph consisting only of images: ``` -Youtube & Vimeo +Videos & Audios --------------- +To show video and audio files you just have to use the regular Markdown used for images: + +```markdown +![Audio description](/media/audio.mp3) _produces an audio player_ +![Video description](/media/video.mp4) _produces an video player_ +![Video description](/media/video.webm) _produces an video player_ + +``` + +Remember to use valid URLs for your video / audio files. You may want to upload this kind of files directly to `htdocs/media`. + +### Youtube & Vimeo + For displaying a embedded video player for Youtube or Vimeo, just put a link to the given video into a single line. This will be converted to a full blown video player. Giphy diff --git a/src/blogophon-console.js b/src/blogophon-console.js index 362aa981..56c87dd5 100644 --- a/src/blogophon-console.js +++ b/src/blogophon-console.js @@ -99,7 +99,7 @@ var BlogophonConsole = function() { internal.shortfilenameFromTitle = function(title) { return SuperString(title.trim().toLowerCase()) .asciify() - .replace(/(^|\-)(de(r|n|m|s)|die(s|se|ser|ses|sen|sem)?|d(a|o|e)s|(m|s|d)?ein(e|es|er|em|en)?|a|the|(e|a)l|l(a|o)s?|(i|o|a)(n|m))\-/g, '$1') + .replace(/(^|\-)([a-z]|de[rnms]|die(s|se|ser|ses|sen|sem)?|d[aoe]s|[msd]?ein(e|es|er|em|en)?|th(e|is|at|ese|ose)|my|[ea]l|l[ao]s?|[ia][nm]|o[nf]|ist?|[ua]nd)\-/g, '$1') .replace(/(^[\-]+|[\-]+$)/g, '') .replace(/([\-])[\-]+/g, '$1') .replace(/\-(md~?)$/, '.$1') diff --git a/src/helpers/marky-mark.js b/src/helpers/marky-mark.js index b7fe07ab..aeeb7a94 100644 --- a/src/helpers/marky-mark.js +++ b/src/helpers/marky-mark.js @@ -352,11 +352,15 @@ var markyMark = function markyMark(string, rules) { ; }) .replace(/(]+src="[^"]+\-(\d+)x(\d+)\.[^"]+")/g, '$1 width="$2" height="$3"') + .replace(/(<)img([^>]src="[^"]+\.(mp[234g]|webm|og[gamv])(?:#[^"]*)?"+[^>]*?)\s*\/?>/, function(all, first, last, suffix) { + var tag = suffix.match(/^(?:mp[24g]|webm|og[gmv])$/) ? 'video' : 'audio'; + all = first + tag + last + ' controls="controls">'; + return all.replace(/\salt="([^"]*)"([^>]*>)/, '$2$1'); + }) + .replace(/(<(?:img|hr|br)[^>]*[^/])(>)/g, '$1 /$2') .replace(/(>)\[ \](\s)/g, '$1$2') .replace(/(>)\[[xX]\](\s)/g, '$1$2') .replace(/(]*[^/])(>)/g, '$1 /$2') - .replace(/(<(?:hr|br)[^/])(>)/g, '$1 /$2') .replace(/(]*>)([\s\S]+?)(\/table)/g, function(all, before, content, after) { return before + content.replace(/(]*>[\s]*)]*>)(.+?)<\/strong><\/td>/g, '$1') + after; }) diff --git a/src/templates/.htaccess b/src/templates/.htaccess index 6137e38c..6dcc2fdc 100644 --- a/src/templates/.htaccess +++ b/src/templates/.htaccess @@ -8,11 +8,14 @@ DirectoryIndex index.html ErrorDocument 404 /404.html ErrorDocument 410 /404.html -AddType text/xml xml rss atom -AddType text/plain .md -AddType text/calendar .ics AddType application/json .json AddType application/vnd.google-earth.kml+xml .kml +AddType text/calendar .ics +AddType text/plain .md +AddType text/xml xml rss atom +AddType video/mp4 .mp4 +AddType video/ogg .ogv +AddType video/webm .webm Header set Access-Control-Allow-Origin "*" diff --git a/test/marky-mark.js b/test/marky-mark.js index 1191a026..4146925e 100644 --- a/test/marky-mark.js +++ b/test/marky-mark.js @@ -209,3 +209,28 @@ exports.testTable = function(test) { test.done(); }; + +exports.testMultimediaTags = function(test) { + test.expect(8); + + var m; + + m = markyMark('Description'); + test.ok(m.match(/Description'); + test.ok(!m.match(/<(img|audio)/), 'Image tag is gone'); + test.ok(m.match(/Description<\/video>/), 'Video tag with description is present'); + + m = markyMark(''); + test.ok(!m.match(/<(img|audio)/), 'Image tag is gone'); + test.ok(m.match(/