forked from klen/django_markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
465 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ db.sqlite3 | |
dist | ||
docs/_* | ||
sitegen.egg-info | ||
todo.txt | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" Application settings. """ | ||
|
||
import posixpath | ||
|
||
from django.conf import settings | ||
|
||
|
||
MARKDOWN_EDITOR_SETTINGS = getattr(settings, 'MARKDOWN_EDITOR_SETTINGS', {}) | ||
MARKDOWN_EDITOR_SKIN = getattr(settings, 'MARKDOWN_EDITOR_SKIN', 'simple') | ||
MARKDOWN_EXTENSIONS = getattr(settings, 'MARKDOWN_EXTENSIONS', []) | ||
MARKDOWN_SET_PATH = getattr(settings, 'MARKDOWN_SET_PATH', posixpath.join( | ||
'django_markdown', 'sets' | ||
)) | ||
MARKDOWN_SET_NAME = getattr( | ||
settings, 'MARKDOWN_SET_NAME', | ||
'markdownextra' if 'extra' in MARKDOWN_EXTENSIONS else 'markdown') | ||
|
||
MARKDOWN_STYLE = getattr(settings, 'MARKDOWN_STYLE', posixpath.join( | ||
'django_markdown', 'preview.css' | ||
)) | ||
STATIC_URL = settings.STATIC_URL or settings.MEDIA_URL |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
// Starting from Django 1.6+, jQuery is only available as 'django' object attribute. | ||
// Unfortunately, it's not compatible with markitup.js library because it needs global jQuery variable to be initialized. | ||
jQuery = jQuery || django.jQuery; | ||
|
||
(function($) { | ||
// from http://docs.djangoproject.com/en/1.4/ref/contrib/csrf/#ajax | ||
function getCookie(name) { | ||
var cookieValue = null; | ||
if (document.cookie && document.cookie != '') { | ||
var cookies = document.cookie.split(';'); | ||
for (var i = 0; i < cookies.length; i++) { | ||
var cookie = $.trim(cookies[i]); | ||
// Does this cookie string begin with the name we want? | ||
if (cookie.substring(0, name.length + 1) == (name + '=')) { | ||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); | ||
break; | ||
} | ||
} | ||
} | ||
return cookieValue; | ||
} | ||
var csrftoken = getCookie('csrftoken'); | ||
|
||
function csrfSafeMethod(method) { | ||
// these HTTP methods do not require CSRF protection | ||
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); | ||
} | ||
|
||
$.ajaxSetup({ | ||
crossDomain: false, // obviates need for sameOrigin test | ||
beforeSend: function(xhr, settings) { | ||
if (!csrfSafeMethod(settings.type)) { | ||
xhr.setRequestHeader("X-CSRFToken", csrftoken); | ||
} | ||
} | ||
}); | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.