diff options
author | Alberto Bertogli <albertito@blitiri.com.ar> | 2013-11-02 22:12:50 +0100 |
---|---|---|
committer | Alberto Bertogli <albertito@blitiri.com.ar> | 2013-11-02 22:12:50 +0100 |
commit | 54026b7585badf3736ad97f6f6e1d656d9f469e2 (patch) | |
tree | 044e2ce2a547c1a21148c4f3d8e439696c1e2679 /utils.py | |
parent | a42d7da6a4c33d12c0af1847ba4512b1a3f70287 (diff) | |
download | git-arr-fork-54026b7585badf3736ad97f6f6e1d656d9f469e2.zip |
Make embedding markdown and images configurable per-repo
This patch introduces the embed_markdown and embed_images configuration
options, so users can enable and disable those features on a per-repository
basis.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -48,20 +48,23 @@ def can_colorize(s): return True -def can_markdown(fname): +def can_markdown(repo, fname): """True if we can process file through markdown, False otherwise.""" if markdown is None: return False + if not repo.info.embed_markdown: + return False + return fname.endswith(".md") -def can_embed_image(fname): +def can_embed_image(repo, fname): """True if we can embed image file in HTML, False otherwise.""" - exts = [ 'jpg', 'jpeg', 'png', 'gif' ] - if '.' in fname and fname.split('.')[-1].lower() in exts: - return True + if not repo.info.embed_images: + return False - return False + return (('.' in fname) and + (fname.split('.')[-1].lower() in [ 'jpg', 'jpeg', 'png', 'gif' ])) def colorize_diff(s): lexer = lexers.DiffLexer(encoding = 'utf-8') |