簡體   English   中英

groovy 和 gsp 中的 Markdown 超鏈接

[英]Markdown hyperlinks in groovy and gsp

在 mygsp.gsp 文件中,我有:

 <div><markdown:renderHtml text="${infoText}"/>/div>

在 myfile.groovy 中,我有:

 def infoText = "For further details. <http:\\\\www.myurl.com>"

輸出提供了一個指向同一頁面內myurl.com的超鏈接,在字符串“For more details”之后。

我怎樣才能:

  1. 超鏈接“myurl.com”以在新頁面中呈現?

  2. 覆蓋“了解更多詳情”。 代表myurl.com?

我的目標是通過 groovy 實現,HTML 會說:

  <a href="www.myurl.com". target="_/blank">For Further details</a> 

我找到了答案#2。

按照此處的markdown語法:daringfireball.net/projects/markdown/syntax#links,

我的代碼應該說:

def infotext =“” [有關更多詳細信息](http:\\ www.myurl.com)“”

而且有效!

我發現我的 Groovy DSL 腳本中的這一行將在示例中將“鏈接文本”顯示為https://myurl.com的鏈接:

def sDescription = '''<a href="https://myurl.com">Link Text</a>'''

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM