跳转到内容

模組討論:Infobox gene

页面内容不支持其他语言。
维基百科,自由的百科全书

这是本页的一个历史版本,由Jimmy-bot留言 | 贡献2017年2月8日 (三) 08:42 (机器人: 1个讨论已存档)编辑。这可能和当前版本存在着巨大的差异。


Jimmy-bot在话题“Infobox gene尺寸样式”中的最新留言:8年前

Module:Infobox gene

有個功能是自動幫條目加上[[分類:位於XX號人類染色體的基因]],但把模組移來zhwiki以後就抓不到號碼了。

例子請參考d:Q14865372en:Dopamine_transporter多巴胺轉運體

用來抓染色體號的code:

p.trimChromosome = function(entity)
	local string_to_trim = p.getValue(entity, "P1057")
	local out = ''
	if string.find(string_to_trim, 'chromosome') then
		out = string.match(string_to_trim, "%d+")--extract number from string
		if out == nil then
			out = string.match(string_to_trim, "X") or string.match(string_to_trim, "Y")
		end
	end
	if string.find(string_to_trim, 'mitochondrial') then
		out = "M"
	end
	return out	
end

—以上未簽名的留言由Panintelize對話貢獻)於2017-01-26T04:29‎Z加入。

用RELN(Q414043)的例子的话,其染色体(P1057)值为Q657319(#7),getValue 好像是会给个链接。在本来的英语代码中是:
如果存在“chromosome”,则寻找数字或X、Y;否则尝试寻找“mitochondrial”。
我们在中文维基百科测试一下吧:
{{#invoke:Wikidata|getValueFromID|Q414043|P1057|FETCH_WIKIDATA}}
[[7號染色體|7號染色體]]
也许改成找“染色體”或“染色体”就好了?——Artoria2e5 保持讨论完整直接ping我回复 2017年1月26日 (四) 06:04 (UTC)回复
完成 Special:Diff/42962820 ——Artoria2e5 保持讨论完整直接ping我回复 2017年1月26日 (四) 06:09 (UTC)回复

Infobox gene尺寸样式


目前模块:infobox gene直接用了infobox这个class实现,和之前更接近enwp样式的{{GNF Protein box}}在尺寸上差别稍显著,空间占用似乎太大。如果各位觉得可以的话,我可以加一个:css('border-spacing:3px;width:22em;text-align:left;font-size:small;line-height:1.5em')补偿回去(参照T:Infobox3cols)。——Artoria2e5 保持讨论完整直接ping我回复 2017年1月27日 (五) 23:26 (UTC)回复

完成Special:Diff/42990710——Artoria2e5 保持讨论完整直接ping我回复 2017年1月29日 (日) 03:30 (UTC)回复