Разметка User RPL

Опубликовать текст программы на UserRPL (и не только) с раскраской синтаксиса не просто, а очень просто.

Заключаем текст в тег <blockcode>. В качестве значения атрибута type пишем type="userrpl". Подробнее о форматировании - в справке по ссылке, где перечислены и другие доступные для раскраски языки.

Ниже пример форматирования программы из "Прогулки по лунолётам".

%%HP: T(0)A(D)F(.);

«
  PUSH
  CLLCD
  "Lunar ship"
  {
    {"g   " "Acceleration of gravity, m/sec2" 0}
    {"nflow" "Nozzle flow, m/sec" 0}
    {"life" "Life support, sec" 0}
    {"alim" "Acceleration limit, m/sec2" 0}
    {"mship" "Ship mass w/o fuel, kg" 0}
    {"mfuel" "Fuel mass, kg" 0}
    {"h0  " "Initial altitude, m" 0}
  }
  2
  {1.62 3660 3600 29.4 2250 400 0}
  {1.62 3660 3600 29.4 2250 400 0}
  INFORM
  IF 1 ==
  THEN
    OBJ\->
    DROP
    'hi'  STO
    'mf'  STO
    'ms'  STO
    'alim'  STO
    'ls'  STO
    'nf'  STO
    'g'   STO

    0 'tostop' STO
    1 'newgame' STO

    CLLCD
    {
      {"Quit" « »}
      {"New" « »}
    }
    TMENU
    "Any key to start..." 1 DISP
    -1 WAIT DROP

    DO
      IF newgame 1 ==
      THEN
        0.0 'xi'  STO
        0.0 'a'   STO
        0.5 'da'  STO
        0.0 'ui'  STO @ vertical velocity
        0.0 'vi'  STO @ horisontal velosity
        0.0 'dmf' STO @ fuel consumption
        0.0 'q'   STO
        0.0 'ac'  STO @ angle of climb in degrees; 0 for vertical flight mode
        1.0 'dt'  STO @ Maneuver discrete time in sec

        0.0 't' STO
        0 'launched' STO
        0 'landed' STO
        0 'newgame' STO
      END

      ls 1 - 'ls' STO
      @ output data
      "Life support: " ls \->STR + " sec" +
      1 DISP
      "Fuel: " mf \->STR + " kg" +
      2 DISP
      "Acceler.: " a \->STR + " m/sec2" +
      3 DISP
      "Altitude: " hi \->STR + " m" +
      4 DISP
      "V(vert): " ui \->STR + " m/sec" +
      5 DISP
      1 WAIT
      WHILE KEY
      REPEAT
      \-> k
      «
        IF landed 0 ==
        THEN
          CASE
            k 25 == THEN a da + 'a' STO END
            k 34 == THEN da 0.1 - 'da' STO END
            k 35 == THEN a da - 'a' STO END
            k 36 == THEN da 0.1 + 'da' STO END
          END
        END
        CASE
          k 11 == THEN 1 'tostop' STO END
          k 12 == THEN 1 'newgame' STO END
        END
      »
      END

      @ input checks
      IF a alim >
      THEN
        alim 'a' STO
      END
      IF mf 0 \<=
      THEN
        0. 'a' STO
      END
      dt 't' STO
      IF
        hi 0 >
        a 0 >
        AND
      THEN
        1 'launched' STO
      END
      IF
        hi 0 ==
        launched 1 ==
        AND
      THEN
        IF landed 0 ==
        THEN
          "Landing!" MSGBOX
          1 'landed' STO
        END
      END

      @ calculate maneuver
      DO
        a ms mf + * nf /
          DUP 'q' STO
        t * 'dmf' STO
        vi DUP a t * ac SIN * +
          DUP 'vi' STO
        + 2 / t * xi + 'xi' STO
        ui DUP a ac COS * g - t * +
          DUP 'ui' STO
        + 2 / t * hi + 'hi' STO
        mf q t * - DUP 'mf' STO
        IF 0 <
        THEN
          mf q / 't' STO
        END
        IF hi 0 <
        THEN
          hi 2 * DUP g a ac COS * - *
            ui SQ + \v/ ui - /
          't' STO
        END
      UNTIL
        mf 0 \>=
        hi 0 \>=
        AND
      END

    UNTIL
      tostop 1 ==
    END

    {
      'tostop'
      'launched'
      'landed'
      'newgame'
      'a'
      'ac'
      'da'
      'ui'
      'vi'
      'dmf'
      'dt'
      't'
      'q'
      'xi'
      'hi'
      'mf'
      'ms'
      'alim'
      'ls'
      'nf'
      'g'
    } PURGE

    CLEAR
    0 MENU
  END
  POP
»

@ Commands to install
HOME
'Lunar' PURGE
'Lunar' STO
CLEAR
2. MENU