使用golang的present包来运行Ruby或Python代码

huangapple go评论76阅读模式
英文:

Using golang present package to run ruby or python code

问题

我使用Golang的present包来构建演示文稿。我可以使用.play <file>.go在给定的.slide文件中运行Golang代码。

我想知道是否可以使用.play <file>.rb.play <file>.py来运行Ruby或Python代码?

我尝试了上述方法,但当我在浏览器中点击Run按钮时,它给我报错。是否可以运行其他语言的代码?如果可以,如何操作?如果不行,为什么?

check.rb:

puts 'hello, world'

<空行>

这是我的example.slide文件的代码:

检查Ruby代码的工作情况
这里没有太多内容!
15:04 2 Jan 2006
标签:Ruby,Golang

Piyush Chauhan
********************
********************
********************
@piyushpsycho

* 幻灯片或章节的标题(必须有星号)

一些文本

.play check.rb

** 子章节

- 项目符号
- 更多项目符号
- 一个带有
英文:

I used Golang present package to build a presentation. I'm able to run Golang code using .play &lt;file&gt;.go in my given .slide file.

I wonder if it's possible to run ruby or python code too using .play &lt;file&gt;.rb or .play &lt;file&gt;.py ?

> I tried above method but it's giving me error when I click on Run
> button in browser. Is it possible to run code for other languages ? If
> Yes, how ? If No, Why not ?

check.rb:

puts &#39;hello, world&#39;

<blank line>

Here is the code for my example.slide file:

Checking the working of Ruby Code
Nothing much here!
15:04 2 Jan 2006
Tags: Ruby, Golang

Piyush Chauhan
********************
********************
********************
@piyushpsycho

* Title of slide or section (must have asterisk)

Some Text

.play check.rb

** Subsection

- bullets
- more bullets
- a bullet with

答案1

得分: 3

你的脚本使用了shebang注释来确定要运行的程序。将你的脚本改为:

#! /usr/bin/ruby
puts 'hello, world'
英文:

Present uses a shebang comment to determine the program to run. Change your script to:

#! /usr/bin/ruby
puts &#39;hello, world&#39;

huangapple
  • 本文由 发表于 2015年1月14日 02:20:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/27928857.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定