Skip to content

Commit

Permalink
Version 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
klen committed Mar 7, 2011
1 parent 81836f0 commit c1facda
Show file tree
Hide file tree
Showing 13 changed files with 602 additions and 22 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGES
=======

## 2011-03-07 0.0.6
-------------------
* MARKDOWN_EDITOR_SETTINGS holds the extra parameters (Sergii Iavorskyi)
* Add docs to pypi

## 2011-03-06 0.0.5
-------------------
* Add MARKDOWN_SKIN option (Sergii Iavorskyi)
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Django markdown support and wysiwig.
Django markdown support and wysiwyg.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ register: _register clean
remove:
sudo pip uninstall $(MODULE)

upload: _upload clean _commit
upload: _upload clean _commit doc

test:
cd example_project && ./manage.py test main
Expand All @@ -31,3 +31,7 @@ _commit:

_register:
python setup.py register

doc:
python setup.py build_sphinx --source-dir=docs/ --build-dir=docs/_build --all-files
python setup.py upload_sphinx --upload-dir=docs/_build/html
62 changes: 54 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
.. -*- mode: rst -*-
django-markdown
###############

**Django markdown** is django application that allows use markdown wisywig in flatpages, admin forms and other forms.
**Django markdown** is django application that allows use markdown wysiwyg in flatpages, admin forms and other forms.
Documentaton available at pypi_ or github_.

.. contents::

Requirements
-------------
============

- python >= 2.5
- django >= 1.2
- markdown


Installation
------------
============

**Django markdown** should be installed using pip: ::

pip install django-markdown


Setup
------
=====

- Add 'django_markdown' to INSTALLED_APPS ::

Expand All @@ -37,7 +36,7 @@ Setup


Use django_markdown
-------------------
===================

1) Custom forms: ::

Expand All @@ -62,10 +61,57 @@ Use django_markdown


Settings
--------
========

**MARKDOWN_SKIN** - skin option, default value is ``markitup``

Example: `settings.py` ::

MARKDOWN_SKIN = 'simple'

**MARKDOWN_EDITOR_SETTINGS** - holds the extra parameters set to be passed to textarea.markItUp()


Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/django_markdown/issues


Contributing
============

Development of django-markdown happens at github: https://github.com/klen/django_markdown


Contributors
=============

* klen_ (Kirill Klenov)

* yavorskiy_ (Sergii Iavorskyi)


License
=======

Licensed under a `GNU lesser general public license`_.


Copyright
=========

Copyright (c) 2011 Kirill Klenov (horneds@gmail.com)

Markitup_:
(c) 2008 Jay Salvat
http://markitup.jaysalvat.com/


.. _GNU lesser general public license: http://www.gnu.org/copyleft/lesser.html
.. _pypi: http://packages.python.org/scss/
.. _github: https://github.com/klen/python-scss
.. _klen: https://github.com/klen
.. _yavorskiy: https://github.com/yavorskiy
2 changes: 1 addition & 1 deletion django_markdown/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = VERSION = '0.0.5'
__version__ = VERSION = '0.0.6'
__project__ = PROJECT = 'django-markdown'
6 changes: 4 additions & 2 deletions django_markdown/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging
from django.views.generic.simple import direct_to_template


def preview(request):
return direct_to_template(request, 'django_markdown/preview.html', content=request.REQUEST.get('data', 'No content posted'))
return direct_to_template(
request, 'django_markdown/preview.html',
content=request.REQUEST.get('data', 'No content posted'))
18 changes: 9 additions & 9 deletions django_markdown/widgets.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
from django import forms
from django.core.urlresolvers import reverse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.simplejson import simplejson


class MarkdownWidget(forms.Textarea):

class Media:
js = (
settings.STATIC_URL + 'django_markdown/jquery.markitup.js',
settings.STATIC_URL + 'django_markdown/markdown.js',
( settings.STATIC_URL or settings.MEDIA_URL ) + 'django_markdown/jquery.markitup.js',
( settings.STATIC_URL or settings.MEDIA_URL ) + 'django_markdown/markdown.js',
)
css = {
'screen': (
settings.STATIC_URL + 'django_markdown/skins/%s/style.css' % getattr(settings, 'MARKDOWN_EDITOR_SKIN', 'markitup'),
settings.STATIC_URL + 'django_markdown/markdown.css',
( settings.STATIC_URL or settings.MEDIA_URL ) + 'django_markdown/skins/%s/style.css' % getattr(settings, 'MARKDOWN_EDITOR_SKIN', 'markitup'),
( settings.STATIC_URL or settings.MEDIA_URL ) + 'django_markdown/markdown.css',
)
}

def render(self, name, value, attrs=None):
html = super(MarkdownWidget, self).render(name, value, attrs)

editor_settings = getattr(settings, 'MARKDOWN_EDITOR_SETTINGS', {})
editor_settings['previewParserPath'] = reverse('django_markdown_preview')

html += '<script type="text/javascript">miu.init(\'%s\', %s)</script>' % (attrs['id'], simplejson.dumps(editor_settings))

return mark_safe(html)

return mark_safe(html)
130 changes: 130 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/python-scss.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python-scss.qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/python-scss"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/python-scss"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
1 change: 1 addition & 0 deletions docs/changes.rst
Loading

0 comments on commit c1facda

Please sign in to comment.