# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__version__ = '$Id$'[4:12]
+__version__ = '4.0-' + '$Id$'[4:11]
from time import clock
start_time = clock()
cgi.print_arguments()
cgi.print_form(form)
cgi.print_environ()
+ #FIXME link_inline("sys/footer")
print('''
<div id="footer"><hr />
<p class="copyright">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img class="license" alt="Creative Commons License" src="%s" /></a>
<span class="benchmark">generated in %0.3fs</span> by <a href="http://www.codewiz.org/wiki/GeekiGeeki">GeekiGeeki</a> version %s
</p>
-''' % (relative_url('cc-by-sa.png'), clock() - start_time, __version__))
+''' % (relative_url('sys/cc-by-sa.png'), clock() - start_time, __version__))
if mod_string:
print('<p class="modified">last modified %s</p>' % mod_string)
print('</div></body></html>')
"**": ["b", False],
"##": ["tt", False],
"__": ["u", False],
+ "--": ["del", False],
"^^": ["sup", False],
",,": ["sub", False],
"''": ["em", False], # LEGACY
style[1] = not style[1]
return ['</', '<'][style[1]] + style[0] + '>'
+ def _glyph_repl(self, word):
+ return '—'
+
def _tit_repl(self, word):
if self.h_level:
result = '</h%d><p>\n' % self.h_level
print('<div class="wiki"><p>')
scan_re = re.compile(r"""(?:
- # Styles and formatting
- (?P<b> \*\*|'''|//|''|\#\#|``|__|\^\^|,,)
+ # Styles and formatting ("--" must cling to a word to disambiguate it from the dash)
+ (?P<b> \*\* | // | \#\# | __ | --\b | \b-- | \^\^ | ,, | ''' | '' | `` )
| (?P<tit> \={2,6})
| (?P<br> \\\\)
| (?P<rule> ^-{3,})
| (?P<hi> \b( FIXME | TODO | DONE )\b )
+ | (?P<glyph> --)
# Links
| (?P<macro> \<\<([^\s\|\>]+)(?:\s*\|\s*([^\>]+)|)\>\>)
| (?P<hurl> \[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])
# Inline HTML
- | (?P<html> <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b )
+ | (?P<html> <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b )
| (?P<htmle> ( /\s*> | </(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])> ) )
| (?P<ent> [<>&] )
| (?P<url> (http|https|ftp|mailto)\:[^\s'\"]+\S)
| (?P<email> [-\w._+]+\@[\w.-]+)
- # Lists, divs, spans
+ # Lists, divs, spans and inline objects
| (?P<li> ^\s+[\*\#]\s+)
| (?P<pre> \{\{\{|\s*\}\}\})
| (?P<inl> \{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})
def format_dir(self):
out = '== '
pathname = ''
- for dirname in self.page_name.split('/'):
+ for dirname in self.page_name.strip('/').split('/'):
pathname = (pathname + '/' + dirname) if pathname else dirname
out += '[[' + pathname + '|' + dirname + ']]/'
out += ' ==\n'
os.remove(name)
except OSError, err:
if err.errno != errno.ENOENT: raise err
+ path = os.path.split(name)[0]
+ if not os.path.exists(path):
+ os.makedirs(path)
os.rename(tmp_filename, name)
def save(self, newdata, changelog):