projects
/
geekigeeki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
746aad9
)
Add inline HTML.
author
Bernardo Innocenti
<bernie@codewiz.org>
Sun, 23 Sep 2007 00:50:18 +0000
(
02:50
+0200)
committer
Bernardo Innocenti
<bernie@codewiz.org>
Sun, 23 Sep 2007 00:50:18 +0000
(
02:50
+0200)
geekigeeki.py
patch
|
blob
|
history
diff --git
a/geekigeeki.py
b/geekigeeki.py
index 71ce72406f6b94893516fcb03862964f48e1bdeb..46c61c55ad5343f95bbf6541eb959a6cab0f0638 100755
(executable)
--- a/
geekigeeki.py
+++ b/
geekigeeki.py
@@
-337,6
+337,7
@@
class PageFormatter:
self.raw = raw
self.is_em = self.is_b = 0
self.h_level = 0
self.raw = raw
self.is_em = self.is_b = 0
self.h_level = 0
+ self.h_count = 0
self.list_indents = []
self.in_pre = False
self.in_table = False
self.list_indents = []
self.in_pre = False
self.in_table = False
@@
-354,20
+355,16
@@
class PageFormatter:
def _tit_repl(self, word):
if self.h_level:
def _tit_repl(self, word):
if self.h_level:
- result = "</h%d>" % self.h_level
+ result = "</h%d>
</a>
" % self.h_level
self.h_level = 0
else:
self.h_level = len(word) - 1
self.h_level = 0
else:
self.h_level = len(word) - 1
- result = "<h%d>" % self.h_level
+ self.h_count += 1
+ result = '<a href="#%d"><h%d id="%d">' % (self.h_count, self.h_level, self.h_count)
return result
def _rule_repl(self, word):
return result
def _rule_repl(self, word):
- s = self._undent()
- if len(word) <= 3:
- s = s + "\n<hr size='1' noshade=\"noshade\" />\n"
- else:
- s = s + "\n<hr size='%d' noshade=\"noshade\" />\n" % (len(word) - 2 )
- return s
+ return self._undent() + '\n<hr size="%d" noshade="noshade" />\n' % (len(word) - 2)
def _word_repl(self, word):
return Page(word).link_to()
def _word_repl(self, word):
return Page(word).link_to()
@@
-402,17
+399,17
@@
class PageFormatter:
def _email_repl(self, word):
return '<a href="mailto:%s">%s</a>' % (word, word)
def _email_repl(self, word):
return '<a href="mailto:%s">%s</a>' % (word, word)
+ def _html_repl(self, word):
+ return word; # Pass through
def _ent_repl(self, s):
return {'&': '&',
'<': '<',
'>': '>'}[s]
def _ent_repl(self, s):
return {'&': '&',
'<': '<',
'>': '>'}[s]
-
def _li_repl(self, match):
return '<li>'
def _li_repl(self, match):
return '<li>'
-
def _pre_repl(self, word):
if word == '{{{' and not self.in_pre:
self.in_pre = True
def _pre_repl(self, word):
if word == '{{{' and not self.in_pre:
self.in_pre = True
@@
-501,6
+498,7
@@
class PageFormatter:
+ r"(?P<emph>'{2,3})"
+ r"|(?P<tit>\={2,6})"
+ r"|(?P<rule>^-{3,})"
+ r"(?P<emph>'{2,3})"
+ r"|(?P<tit>\={2,6})"
+ r"|(?P<rule>^-{3,})"
+ + r"|(?P<html><(/|)(div|span|iframe)[^<>]*>)"
+ r"|(?P<ent>[<>&])"
+ r"|(?P<hi>\b(FIXME|TODO|DONE)\b)"
+ r"|(?P<ent>[<>&])"
+ r"|(?P<hi>\b(FIXME|TODO|DONE)\b)"