summaryrefslogtreecommitdiff
path: root/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* git.py: introduce Blob abstractionEric Sunshine2015-01-131-1/+1
| | | | | | | | | | | | | | | | | | Some blob representations (such as embedded images) require raw blob content, however, the 'blob' view is unconditionally handed cooked (utf8-encoded) content, thus representations which need raw content are forced to reload the blob in raw form, which is ugly and expensive (due to shelling out to git-cat-file a second time). The ultimate goal is to eliminate the wasteful blob reloading when raw content is needed. As a first step, introduce a Blob abstraction to be returned by Repo.blob() rather than the cooked content. A subsequent change will flesh out Blob, allowing it to return raw or cooked content on demand without the client having to specify one or the other when invoking Repo.blob(). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Enable line number anchors when using pygments HtmlFormatterVanya Sergeev2014-07-031-1/+3
| | | | Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
* Make embedding markdown and images configurable per-repoAlberto Bertogli2013-11-021-6/+9
| | | | | | | | 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>
* utils: Make the embedded image code use mimetypesAlberto Bertogli2013-11-021-10/+4
| | | | | | | | This patch makes minor changes to the code that handles embedded images, mostly to make it use mimetypes, and to remove SVG support (at least for now) due to security concerns. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Add embed data URI image blob supportVanya Sergeev2013-11-021-0/+28
|
* Add markdown blob supportVanya Sergeev2013-11-021-0/+14
|
* Only guess the lexer if the file starts with "#!"Alberto Bertogli2012-11-271-4/+9
| | | | | | | | The lexer guesser based on content is often wrong; to minimize the chances of that happening, we only use it on files that start with "#!", for which it usually has smarter rules. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Fall back to guess the lexer by contentAlberto Bertogli2012-11-181-2/+6
| | | | | | | | | If we can't guess the lexer by the file name, try to guess based on the content. This allows pygments to colorize extension-less files, usually scripts. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Use heuristics to decide what to colorizeAlberto Bertogli2012-11-181-2/+22
| | | | | | | In practise pygments seems to have a very hard time processing large files and files with long lines, so try to avoid using it in those cases. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Initial commit0.01Alberto Bertogli2012-11-101-0/+41
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>