【问题标题】:Jquery terminal text formatting syntax, what am I doing wrong?Jquery终端文本格式语法,我做错了什么?
【发布时间】:2015-06-25 16:00:49
【问题描述】:

我正在使用jquery terminal,它运行良好。然而,在我的一生中,我无法弄清楚将格式化我的字符串的正确语法。

例子说

echo([string|function], [options]) — display string on terminal — (additionally if you can call this function with a function as argument it will call that function and print the result, this function will be called every time you resize the terminal or browser). There are three options raw — it will allow to display raw html, finalize — which is callback function with one argument the div container and flush — default is true, if it's false it will not print echo text to terminal until you call flush method. 

You can also use basic text formating using syntax as folow: 

[[guib;<COLOR>;<BACKGROUND>]some text] will display some text:

[[ — open formating
u — underline
s — strike
o — overline
i — italic
b — bold
g — glow (using css text-shadow)
; — separator
color — color of text (hex, short hex or html name of the color)
; — separator
color — background color (hex, short hex or html name of the color)
; — separator [optional]
class — class adeed to format span element [optional]
] — end of format specification
text — text that will be formated (most of the time for internal use, when you format text that's wrap in more then one line you'll get full text in data-text attribute)
] — end of formating

好的...所以我尝试过这样的东西

terminal.echo(["s"], myText);

还有这个

terminal.echo("[[s]" + myText + "]");

还有这个

terminal.echo([["s"], myText]);

还有其他几个。

这可能是一个愚蠢/简单的问题,但我真的很难过。谁能告诉我我做错了什么?

【问题讨论】:

  • 乍一看,您的第二次尝试应该可以工作,但文档并没有说 &lt;COLOR&gt;&lt;BACKGROUND&gt; 是可选的。也许你应该指定它们。
  • 不幸的是,在第二次尝试中,我只看到“[[s”等...作为输出文本的一部分
  • 是的,这就是为什么我建议您指定&lt;COLOR&gt;&lt;BACKGROUND&gt;。文档只说这个类是可选的,所以看起来其他参数是强制性的。
  • 做到了。写这个作为答案,我会给你接受。

标签: jquery css syntax text-formatting jquery-terminal


【解决方案1】:

从 Frédéric Hamidi 那里得到答案,我需要包括颜色和背景,它们不是可选的。

【讨论】:

  • 您可以跳过它们,但需要分号。例如[[s;;]sometext]
  • 能否请您发布一个示例...我有同样的问题,但仍然不明白如何使用它...
猜你喜欢
  • 1970-01-01
  • 2016-03-08
  • 2023-03-07
  • 1970-01-01
  • 1970-01-01
  • 2014-01-03
  • 2022-11-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多