From c492787647e136c6d41084045deb19f86875ce11 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 9 Feb 2008 03:20:18 +0000 Subject: Added code.txt to web/ for demos. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1214 788f1e2b-df1e-0410-8736-df70ead52e1b --- web/code.txt | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 web/code.txt (limited to 'web/code.txt') diff --git a/web/code.txt b/web/code.txt new file mode 100644 index 000000000..c15ccfc9b --- /dev/null +++ b/web/code.txt @@ -0,0 +1,45 @@ +% Code with syntax highlighting + +Here's what a delimited code block looks like: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell} + -- | Inefficient quicksort in haskell. + qsort :: (Enum a) => [a] -> [a] + qsort [] = [] + qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +And here's how it looks after syntax highlighting: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell} +-- | Inefficient quicksort in haskell. +qsort :: (Enum a) => [a] -> [a] +qsort [] = [] +qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Here's some python, with numbered lines (specify `{.python .numberLines}`): + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.python .numberLines} +class FSM(object): + +"""This is a Finite State Machine (FSM). +""" + +def __init__(self, initial_state, memory=None): + + """This creates the FSM. You set the initial state here. The "memory" + attribute is any object that you want to pass along to the action + functions. It is not used by the FSM. For parsing you would typically + pass a list to be used as a stack. """ + + # Map (input_symbol, current_state) --> (action, next_state). + self.state_transitions = {} + # Map (current_state) --> (action, next_state). + self.state_transitions_any = {} + self.default_transition = None + ... +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -- cgit v1.2.3