Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bugzilla 的自動連結規則

22 views
Skip to first unread message

Kang-Hao (Kenny) Lu

unread,
Jun 19, 2012, 9:00:40 AM6/19/12
to "Mozilla 開發(mozilla.dev.general.zh)"
上次在 bugzilla 跟人討論 CSS 'background' 屬性序列化的一些問題的時候,發
現到不太確定要怎麼「提到」第一個留言才能自動產生連結。第一個留言是
"Discussion" 而不是 "Comment X",點一下 "Discussion" 會連到 #c0,但是還
是不知道究竟是寫 "Comment 0" 還是 "Discussion" 會連到 c0。

在不方便下手的情況,只好拿 Bugzilla 原始碼來看了(開源萬歲!耶!),在
[1] 的地方,有一個正則是:

$text =~ s~\b($bug_re(?:\s*,?\s*$comment_re)?|$comment_re)
~ # We have several choices. $1 here is the link, and $2-4
are set
# depending on which part matched
(defined($2) ? get_bug_link($2, $1, { comment_num => $3 })
: "<a href=\"$current_bugurl#c$4\">$1</a>")
~egox;

然後 "discussion" 搜不到東西,所以 "Comment 0" 是對的。

有興趣的人可以在 bugzilla 上發一個 bugzilla 的 bug。沒錯,都是同樣那個。

[1]
http://bzr.mozilla.org/bugzilla/4.0/annotate/head:/Bugzilla/Template.pm#L238


以上

Kenny
0 new messages