Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ea392495
Commit
ea392495
authored
Feb 08, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disabled wikipath markdown extension, as it requires markdown 2.1.0, and we are running 2.0.3
parent
b1377f6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
66 deletions
+2
-66
simplewiki/mdx_wikipath.py
+1
-65
simplewiki/models.py
+1
-1
No files found.
simplewiki/mdx_wikipath.py
View file @
ea392495
#!/usr/bin/env python
'''
WikiLink Extention for Python-Markdown
======================================
Converts CamelCase words to relative links. Requires Python-Markdown 1.6+
Basic usage:
>>> import markdown
>>> text = "Some text with a WikiLink."
>>> md = markdown.markdown(text, ['wikilink'])
>>> md
'
\\
n<p>Some text with a <a href="/WikiLink/" class="wikilink">WikiLink</a>.
\\
n</p>
\\
n
\\
n
\\
n'
To define custom settings the simple way:
>>> md = markdown.markdown(text,
... ['wikilink(base_url=/wiki/,end_url=.html,html_class=foo)']
... )
>>> md
'
\\
n<p>Some text with a <a href="/wiki/WikiLink.html" class="foo">WikiLink</a>.
\\
n</p>
\\
n
\\
n
\\
n'
Custom settings the complex way:
>>> md = markdown.Markdown(text,
... extensions = ['wikilink'],
... extension_configs = {'wikilink': [
... ('base_url', 'http://example.com/'),
... ('end_url', '.html'),
... ('html_class', '') ]},
... encoding='utf8',
... safe_mode = True)
>>> str(md)
'
\\
n<p>Some text with a <a href="http://example.com/WikiLink.html">WikiLink</a>.
\\
n</p>
\\
n
\\
n
\\
n'
Use MetaData with mdx_meta.py (Note the blank html_class in MetaData):
>>> text = """wiki_base_url: http://example.com/
... wiki_end_url: .html
... wiki_html_class:
...
... Some text with a WikiLink."""
>>> md = markdown.Markdown(text, ['meta', 'wikilink'])
>>> str(md)
'
\\
n<p>Some text with a <a href="http://example.com/WikiLink.html">WikiLink</a>.
\\
n</p>
\\
n
\\
n
\\
n'
From the command line:
python markdown.py -x wikilink(base_url=http://example.com/,end_url=.html,html_class=foo) src.txt
By [Waylan Limberg](http://achinghead.com/).
Project website: http://achinghead.com/markdown-wikilinks/
Contact: waylan [at] gmail [dot] com
License: [BSD](http://www.opensource.org/licenses/bsd-license.php)
Version: 0.4 (Oct 14, 2006)
Dependencies:
* [Python 2.3+](http://python.org)
* [Markdown 1.6+](http://www.freewisdom.org/projects/python-markdown/)
* For older dependencies use [WikiLink Version 0.3]
(http://code.limberg.name/svn/projects/py-markdown-ext/wikilinks/tags/release-0.3/)
'''
# THIS ONLY WORKS WITH MARKDOWN 2.1.0
import
markdown
try
:
...
...
simplewiki/models.py
View file @
ea392495
...
...
@@ -267,7 +267,7 @@ class Revision(models.Model):
# Create pre-parsed contents - no need to parse on-the-fly
ext
=
WIKI_MARKDOWN_EXTENSIONS
ext
+=
[
"wikipath(base_url=
%
s)"
%
reverse
(
'wiki_view'
,
args
=
(
'/'
,))]
#
ext += ["wikipath(base_url=%s)" % reverse('wiki_view', args=('/',))]
print
ext
self
.
contents_parsed
=
markdown
(
self
.
contents
,
extensions
=
ext
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment