Skip to content

Commit

Permalink
Tear-Insert-Fold grammars
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed Feb 16, 2013
1 parent ee2f846 commit 0e60672
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
24 changes: 21 additions & 3 deletions WikiPage.py
Expand Up @@ -4,7 +4,7 @@

languages = ('Abbreviated as', 'English', 'German', 'French', 'Dutch', 'Russian')
flags = ('' , 'EN' , 'DE' , 'FR' , 'NL' , 'RU')
code = ('**','[[')
code = ('**','[[','`')

class WikiPage:
def __init__(self, fname):
Expand Down Expand Up @@ -180,6 +180,10 @@ def __init__(self, s):
j = s.find(']]')
self.chunks.append(MDLink(s[2:j]))
s = s[j+2:]
elif s.startswith('`'):
j = s[1:].find('`')+1
self.chunks.append(MDCode(s[1:j]))
s = s[j+1:]
else:
seq = list(filter(lambda x:x!=-1,map(lambda x:s.find(x),code)))
if len(seq) < 1:
Expand All @@ -206,12 +210,26 @@ def __str__(self):

# bar not yet implemented
class MDLink:
def __init__(self, s):
if s.find('|') < 0:
self.goal = self.text = s
else:
self.text,self.goal = s.split('|')
def getHtml(self):
return '<a href="%s.html">%s</a>' % (self.goal, self.text) # .capitalize()?
def __str__(self):
if self.goal == self.text:
return '[[%s]]' % self.text
else:
return '[[%s|%s]]' % (self.text,self.goal)

class MDCode:
def __init__(self, s):
self.text = s
def getHtml(self):
return '<a href="%s.html">%s</a>' % (self.text, self.text) # .capitalize()?
return '<code>%s</code>' % self.text
def __str__(self):
return '[[%s]]' % self.text
return '`%s`' % self.text

class MDBare:
def __init__(self, s):
Expand Down
19 changes: 19 additions & 0 deletions push.sh
@@ -0,0 +1,19 @@
#!/bin/sh

echo $@ > commit.msg
./genHome.py
cd wiki
git add -A
git commit -F ../commit.msg
git push
cd ..
./md2html.py
cd up
git add -A
git commit -F ../commit.msg
git push
cd ..
git add *.py *.sh up wiki
git commit -F commit.msg
git push
rm commit.msg
2 changes: 1 addition & 1 deletion up
Submodule up updated from 3197a3 to 6b0b4a
2 changes: 1 addition & 1 deletion wiki
Submodule wiki updated from 392fda to 35fa5e

0 comments on commit 0e60672

Please sign in to comment.