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

2.0 KiB

Test of mege code

#&summary Code in mege #&

Test of mege code

While the <@eval macros.titlelink('basics')@> does include code, this test contains more. And all of it's different.

Shown, but not highlighted

Without formatting

Inline: while [ 1 ] ; do echo y ; done, simple.

echo Hello
if hello:
    print('Hello')
wget *url*
cond = source and not highlighted

With formatting

#++pre

wget *url*

#&pre Preformatted but still monospace <strong>{Escaped}&strong!</strong> #&

#++pre

*Preformatted* but still [[http://en.wikipedia.org/wiki/Monospace][monospace]]
<em>{Escaped}&emph!</em>

Inline: =while [ 1 ] ; do echo y ; done=&tt, messy.

Shown and highlighted

#++sh

x=32
echo $x
cond = source and highligted
print(cond)

Inline: =<p>abc</p>=&html.

HTML

<div style='margin-left: 20px' id='tempobj'>au</div>

The above code equals: #++show

<div style='margin-left: 20px' id='tempobj'>au</div>

Inline HTML: <@html <strong>strong text</strong>@>.

JavaScript, CSS

  window.addEventListener('load', function(event){
      tempobj = document.getElementById('tempobj');
      tempobj.addEventListener(
          'click', function(event){tempobj.innerHTML += 'A';}, false);
  }, false);

#++show

  window.addEventListener('load', function(event){
      tempobj = document.getElementById('tempobj');
      tempobj.addEventListener(
          'click', function(event){tempobj.innerHTML += 'A';}, false);
  }, false);

Eval'd Code

Inline code: <@eval 2 + 3@> = <@eval 2 + 3@>.

Inline code: #&-eval 2 + 3 #&

Block code:

#&paragraph #++eval

2 + 3

#&paragraph #++dexec

print('<em>Date</em>:', datetime.datetime.utcnow())