Class: Elisp::Code

Inherits:
Object
  • Object
show all
Defined in:
lib/elisp.rb

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Code

Returns a new instance of Code.



142
143
144
# File 'lib/elisp.rb', line 142

def initialize(content)
  @content = content
end

Instance Method Details

#<<(content) ⇒ Object



146
147
148
# File 'lib/elisp.rb', line 146

def <<(content)
  @content << "\n#{content}"
end

#htmlObject



150
151
152
153
# File 'lib/elisp.rb', line 150

def html
  content = CGI.escape_html(@content)
  %(<pre class="code"><code>#{content}</code></pre>)
end

#pandoc_json_objectObject



155
156
157
158
159
160
161
162
163
# File 'lib/elisp.rb', line 155

def pandoc_json_object
  {
    "t": "CodeBlock",
    "c": [
      ["", ["emacs-lisp"], []],
      @content,
    ],
  }
end