metanohi/site/projects/mege/tests/code.org

115 lines
2.0 KiB
Org Mode
Raw Normal View History

2011-07-26 03:04:17 +02:00
#+title: Test of mege code
#&summary
Code in mege
#&
#+license: bysa
* Test of mege code
While the <@eval macros.titlelink('basics')@> does include code,
this test contains more. And all of it's different.
2011-08-01 22:39:41 +02:00
** Shown, but not highlighted
*** Without formatting
Inline: =while [ 1 ] ; do echo y ; done=, simple.
: echo Hello
: if hello:
: print('Hello')
: wget *url*
#+BEGIN_SRC
cond = source and not highlighted
#+END_SRC
*** With formatting
#++pre
: wget *url*
#&pre
*Preformatted* but still [[http://en.wikipedia.org/wiki/Monospace][monospace]]
<strong>{Escaped}&strong!</strong>
#&
#++pre
#+BEGIN_SRC
*Preformatted* but still [[http://en.wikipedia.org/wiki/Monospace][monospace]]
<em>{Escaped}&emph!</em>
#+END_SRC
Inline: =while [ 1 ] ; /do/ echo y ; done=&tt, messy.
** Shown and highlighted
#++sh
: x=32
: echo $x
#+BEGIN_SRC python
cond = source and highligted
print(cond)
#+END_SRC
Inline: =<p>abc</p>=&html.
** HTML
#+BEGIN_SRC html
<div style='margin-left: 20px' id='tempobj'>au</div>
#+END_SRC
The above code equals:
#++show
#+BEGIN_SRC html
<div style='margin-left: 20px' id='tempobj'>au</div>
#+END_SRC
Inline HTML: <@html <strong>strong text</strong>@>.
** JavaScript, CSS
#+BEGIN_SRC javascript
window.addEventListener('load', function(event){
tempobj = document.getElementById('tempobj');
tempobj.addEventListener(
'click', function(event){tempobj.innerHTML += 'A';}, false);
}, false);
#+END_SRC
# Make mege load it
#++show
#+BEGIN_SRC javascript
window.addEventListener('load', function(event){
tempobj = document.getElementById('tempobj');
tempobj.addEventListener(
'click', function(event){tempobj.innerHTML += 'A';}, false);
}, false);
#+END_SRC
** Eval'd Code
Inline code: =<@eval 2 + 3@>= = <@eval 2 + 3@>.
Inline code:
#&-eval
2 + 3
#&
Block code:
#&paragraph
#++eval
#+BEGIN_SRC python
2 + 3
#+END_SRC
#&paragraph
#++dexec
#+BEGIN_SRC python
print('<em>Date</em>:', datetime.datetime.utcnow())
#+END_SRC