summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/conf/forum_data_rules.py16
-rw-r--r--askbot/const/__init__.py3
-rw-r--r--askbot/doc/source/footnotes.rst70
-rw-r--r--askbot/doc/source/index.rst3
-rw-r--r--askbot/doc/source/optional-modules.rst18
-rw-r--r--askbot/utils/html.py4
-rw-r--r--askbot/utils/markup.py10
7 files changed, 116 insertions, 8 deletions
diff --git a/askbot/conf/forum_data_rules.py b/askbot/conf/forum_data_rules.py
index bf38393e..afbbf027 100644
--- a/askbot/conf/forum_data_rules.py
+++ b/askbot/conf/forum_data_rules.py
@@ -14,9 +14,21 @@ FORUM_DATA_RULES = livesettings.ConfigurationGroup(
settings.register(
livesettings.BooleanValue(
FORUM_DATA_RULES,
+ 'ENABLE_VIDEO_EMBEDDING',
+ default = False,
+ description = _(
+ 'Enable embedding videos. '
+ '<em>Note: please read <a href="%(url)s>read this</a> first.</em>'
+ ) % {'url': const.DEPENDENCY_URLS['embedding-video']}
+ )
+)
+
+settings.register(
+ livesettings.BooleanValue(
+ FORUM_DATA_RULES,
'WIKI_ON',
- default=True,
- description=_('Check to enable community wiki feature')
+ default = True,
+ description = _('Check to enable community wiki feature')
)
)
diff --git a/askbot/const/__init__.py b/askbot/const/__init__.py
index ea9236b6..0006714d 100644
--- a/askbot/const/__init__.py
+++ b/askbot/const/__init__.py
@@ -239,7 +239,8 @@ USER_VIEW_DATA_SIZE = 50
DEPENDENCY_URLS = {
'mathjax': 'http://www.mathjax.org/resources/docs/?installation.html',
- 'favicon': 'http://en.wikipedia.org/wiki/Favicon'
+ 'favicon': 'http://en.wikipedia.org/wiki/Favicon',
+ 'embedding-video': 'http://askbot.org/doc/optional-modules.html#embedding-video'
}
PASSWORD_MIN_LENGTH = 8
diff --git a/askbot/doc/source/footnotes.rst b/askbot/doc/source/footnotes.rst
new file mode 100644
index 00000000..f8e96da0
--- /dev/null
+++ b/askbot/doc/source/footnotes.rst
@@ -0,0 +1,70 @@
+=========
+Footnotes
+=========
+
+This page summarizes additional information that might be useful
+for deployment of development of ``askbot``.
+
+.. _git:
+
+Git
+===
+
+At askbot we use ``git`` to keep track of the source code,
+and the main repository is hosted at
+`github <https://github.com/ASKBOT/askbot-devel>`_.
+
+With git you can always grab
+the latest code of askbot from the
+latest ``askbot`` code::
+
+ git clone git://github.com/ASKBOT/askbot-devel.git
+
+Do some customization by editing files and then::
+
+ git add <list-of-changed-files>
+ git commit -m 'explain why you have changed some files'
+
+Bring updates from the main repo::
+
+ git git fetch origin master:github #.. onto a local branch called github
+ git checkout master
+ git merge github
+
+If all goes well, you are done. Otherwise, you may need to
+`resolve the conflict <http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#resolving-a-merge>`_.
+
+Here is a
+`good basic tutorial <http://www.ralfebert.de/tutorials/git/>`_
+about git,
+more comprehensive ones
+`here <http://book.git-scm.com/>`_
+and
+`there <http://help.github.com/>`_.
+Finally, you also may want to visit the
+official git `reference <http://gitref.org>`_
+and `documentation <http://www.kernel.org/pub/software/scm/git/docs/>`_.
+There are `screencasts <http://gitcasts.com/>`_ too.
+
+.. _pip:
+
+Pip
+===
+
+``Pip`` is the best package management tool for python, allows to install and
+unistall python packages, supports installation from source code repositories
+and much more.
+
+For more information about ``pip``,
+including its installation,
+please visit the `pip package page <http://pypi.python.org/pypi/pip>`_
+and the links within.
+
+.. _pip-pypi: http://pypi.python.org/pypi/pip
+.. _git-csm-book: http://book.git-scm.com/
+.. _git-basic-tutorial: http://www.ralfebert.de/tutorials/git/
+.. _git-github-tutorial: http://help.github.com/
+.. _git-docs: http://www.kernel.org/pub/software/scm/git/docs/
+.. _git-reference: http://gitref.org
+.. _git-casts: http://gitcasts.com/
+.. _git-resolve-conflict: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#resolving-a-merge
diff --git a/askbot/doc/source/index.rst b/askbot/doc/source/index.rst
index 981af741..fedc3913 100644
--- a/askbot/doc/source/index.rst
+++ b/askbot/doc/source/index.rst
@@ -22,7 +22,8 @@ at the forum_ or by email at admin@askbot.org
Import data (StackExchange) <import-data>
Appendix A: Maintenance procedures <management-commands>
Appendix B: Sending email to askbot <sending-email-to-askbot>
- Apperdix C: Optional modules <optional-modules>
+ Appendix C: Optional modules <optional-modules>
+ Footnotes <footnotes>
Contributors <contributors>
Some background information: Askbot is written in Python on top of the Django platform.
diff --git a/askbot/doc/source/optional-modules.rst b/askbot/doc/source/optional-modules.rst
index 9b73a5a8..bf24a009 100644
--- a/askbot/doc/source/optional-modules.rst
+++ b/askbot/doc/source/optional-modules.rst
@@ -5,6 +5,24 @@ Optional modules
Askbot supports a number of optional modules, enabling certain features, not available
in askbot by default.
+.. _embedding-video:
+
+Embedding video
+===============
+
+Want to share videos in askbot posts? It is possible, but you will have to install a forked
+version of ``markdown2`` module, here is how:
+
+ pip uninstall markdown2
+ pip install -U -e git+git://github.com/andryuha/python-markdown2.git#egg=markdown2
+
+Also, for this to work you'll need to have :ref:`pip` and :ref:`git` installed on your system.
+
+Finally, please go to your forum :ref:`live settings <live-settings>` -->
+"Settings for askbot data entry and display" and check "Enable embedding video".
+
+Limitation: at the moment only YouTube is supported, but more will work soon.
+
.. _ldap:
LDAP authentication
diff --git a/askbot/utils/html.py b/askbot/utils/html.py
index 25a74a4a..aa8e24d8 100644
--- a/askbot/utils/html.py
+++ b/askbot/utils/html.py
@@ -9,11 +9,11 @@ class HTMLSanitizerMixin(sanitizer.HTMLSanitizerMixin):
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd',
'li', 'ol', 'p', 'pre', 'q', 's', 'samp', 'small', 'span', 'strike',
'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead',
- 'tr', 'tt', 'u', 'ul', 'var')
+ 'tr', 'tt', 'u', 'ul', 'var', 'object', 'param')
acceptable_attributes = ('abbr', 'align', 'alt', 'axis', 'border',
'cellpadding', 'cellspacing', 'char', 'charoff', 'charset', 'cite',
- 'cols', 'colspan', 'datetime', 'dir', 'frame', 'headers', 'height',
+ 'cols', 'colspan', 'data', 'datetime', 'dir', 'frame', 'headers', 'height',
'href', 'hreflang', 'hspace', 'lang', 'longdesc', 'name', 'nohref',
'noshade', 'nowrap', 'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope',
'span', 'src', 'start', 'summary', 'title', 'type', 'valign', 'vspace',
diff --git a/askbot/utils/markup.py b/askbot/utils/markup.py
index 0caf6848..16e45f87 100644
--- a/askbot/utils/markup.py
+++ b/askbot/utils/markup.py
@@ -4,18 +4,24 @@ from askbot.conf import settings as askbot_settings
from markdown2 import Markdown
#url taken from http://regexlib.com/REDetails.aspx?regexp_id=501 by Brian Bothwell
-URL_RE = re.compile("((?<!(href|.src)=['\"])((http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*))")
+URL_RE = re.compile("((?<!(href|.src|data)=['\"])((http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*))")
LINK_PATTERNS = [
(URL_RE, r'\1'),
]
def get_parser():
- extras = ['link-patterns',]
+ extras = ['link-patterns', 'video']
if askbot_settings.ENABLE_MATHJAX or \
askbot_settings.MARKUP_CODE_FRIENDLY:
extras.append('code-friendly')
+ if askbot_settings.ENABLE_VIDEO_EMBEDDING:
+ #note: this requires a forked version of markdown2 module
+ #pip uninstall markdown2
+ #pip install -e git+git://github.com/andryuha/python-markdown2.git
+ extras.append('video')
+
return Markdown(
html4tags=True,
extras=extras,