Template:WikiCard: Difference between revisions
Template page
More actions
No edit summary Tags: Manual revert Reverted |
No edit summary Tag: Manual revert |
||
| Line 1: | Line 1: | ||
<html> | |||
<div class="grid-item wiki-card"> | |||
<a href="/w/</html>{{{1}}}<html>"> | |||
</html>{{#if:{{{2|}}}|<html><img src="</html>{{#tag:nowiki|{{{2}}}}}<html>" alt="</html>{{{1}}}<html>"></html>|}}<html> | |||
</ | <div class="wiki-card-content"></html>{{{3|{{{1}}}}}}<html></div> | ||
</ | </a> | ||
</div> | |||
<style> | |||
.no-wrap { | |||
white-space: nowrap; | |||
} | |||
</style> | |||
<script> | |||
(function() { | |||
const script = document.currentScript; | |||
const card = script.closest('.wiki-card'); | |||
if (!card) return; | |||
const el = card.querySelector('.wiki-card-content'); | |||
if (!el) return; | |||
// Only process plain text | |||
if (el.children.length === 0) { | |||
const text = el.textContent.trim(); | |||
const parts = text.split(': '); | |||
if (parts.length > 1) { | |||
const first = parts.shift(); | |||
const rest = parts.join(': '); | |||
el.innerHTML = first + ': <span class="no-wrap">' + rest + '</span>'; | |||
} | |||
} | |||
})(); | |||
</script> | |||
</html> | |||