以HTML格式显示C. [英] Display C in HTML

查看:161
本文介绍了以HTML格式显示C.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有没有人知道一个在线的C-to-HTML转换器来显示代码

在浏览器中很好地格式化了?


非常感谢,

Adam

Hi,

Does anyone know of an online C-to-HTML converter to display code
nicely formatted in a browser?

Thanks a lot,
Adam

推荐答案



" Adam" < ne ** @ snowstone.org.ukha scritto nel messaggio新闻:11 ********************* @ c77g2000hse.googlegro ups.com ...

"Adam" <ne**@snowstone.org.ukha scritto nel messaggio news:11*********************@c77g2000hse.googlegro ups.com...




有没有人知道在线C-to-HTML转换器显示代码

在浏览器中很好地格式化了吗?


非常感谢,

Adam
Hi,

Does anyone know of an online C-to-HTML converter to display code
nicely formatted in a browser?

Thanks a lot,
Adam



'这不是关于C.的问题。

< ot>

您是否尝试过< pretag?你仍然需要转义诸如<,&等等字符......

< / ot>

That''s not a question about C.
<ot>
Have you tried the <pretag? You''ll still need to escape characters such as <, &, etc...
</ot>


Adam写道,在30/06/07 12:08:
Adam wrote, On 30/06/07 12:08:




有没有人知道在线C- to-HTML转换器显示代码

在浏览器中格式化了吗?
Hi,

Does anyone know of an online C-to-HTML converter to display code
nicely formatted in a browser?



几乎可以肯定。看看 http://clc-wiki.net/wiki/intro_to_clc

了解为什么有多少人不会考虑你的帖子,并在网站上进一步挖掘

,以便对你的问题进行启示

取决于你的实际要求。

-

Flash Gordon

Almost certainly. Have a look at http://clc-wiki.net/wiki/intro_to_clc
for information on why many will not consider your post topical, and dig
around further on the site for possible enlightenment with your problem
depending on what your real requirements are.
--
Flash Gordon


Adam说:
Adam said:




有没有人知道在线C-to-HTML转换器显示代码

很好在浏览器中格式化?
Hi,

Does anyone know of an online C-to-HTML converter to display code
nicely formatted in a browser?



以下代码在线,您可以在这篇

''ere Usenet文章中找到它。它没有显示完整的页面(因为我发现这通常不是我想要的
);相反,它包含了代码周围的代码和代码标签,并进行了通常的HTML转换,

可以这么说。 (至少,如果您在命令行中指定了

args。)


我在vim中使用它,如下所示:


:。,+ 5!text2html -c


(代码为多行代替5,少于1)。


这里是代码:


#include< stdio.h>

#include< string。 h>


int main(int argc,char ** argv)

{

int code = 0;

int ch;

if(argc 1&& strcmp(argv [1]," -c")== 0)

{

code = 1;

}


if(!code)

{

printf("< p> \ n");

}

其他

{

printf("< pre>< code> \ n");

}

while((ch = getchar())!= EOF)

{

开关(ch)

{

case''&'':printf( "&放大器;放大器;");打破;

case''<'':printf("& lt;");打破;

case''>'':printf("& gt;");打破;

case''"'':printf("& quot;");打破;

case''\ n'':if(!code){printf("< / p> \ n< p> \ n"); }

else {putchar(ch); } break;

默认值:putchar(ch);如果(!代码)

{

printf("< / p> \ n");

}

else

{

printf("< / code>< / pre> \ n");

}

返回0;

} < br $>
-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

The following code is online, in the sense that you can find it in this
''ere Usenet article. It doesn''t display a complete page (because I
found that that was usually not what I wanted); rather, it wraps pre
and code tags around the code, and does the "usual HTML conversions",
so to speak. (At least, it does if you spec -c in the command line
args.)

I use it from within vim like this:

:.,+5!text2html -c

(where you replace 5 with however many lines the code is, less 1).

Here''s the code:

#include <stdio.h>
#include <string.h>

int main(int argc, char **argv)
{
int code = 0;
int ch;
if(argc 1 && strcmp(argv[1], "-c") == 0)
{
code = 1;
}

if(!code)
{
printf("<p>\n");
}
else
{
printf("<pre><code>\n");
}
while((ch = getchar()) != EOF)
{
switch(ch)
{
case ''&'': printf("&amp;"); break;
case ''<'': printf("&lt;"); break;
case ''>'': printf("&gt;"); break;
case ''"'': printf("&quot;"); break;
case ''\n'': if(!code) { printf("</p>\n<p>\n"); }
else { putchar(ch); } break;
default: putchar(ch); break;
}
}
if(!code)
{
printf("</p>\n");
}
else
{
printf("</code></pre>\n");
}
return 0;
}
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


这篇关于以HTML格式显示C.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆