If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

User:結衣/Templates/Code

From The Cutting Room Floor
Jump to navigation Jump to search

user input

About

This template is a wrapper for the semantic HTML tag <code> that marks short computer code fragments using semantic markup. Prefer using semantic markup to deprecated HTML tags like <tt>. This template styles text according to reset styles governed by common user agents.

Usage

{{code|1[|class=<text>][|id=<text>][|title=<text>][|style=<text>]}}

Type {{:User:結衣/Templates/Code|1}}, where 1 is computer code; this can be source code, file paths, web links, etc. This template exposes the HTML attributes class, style, id, and title. Use {{User:結衣/Templates/Pre}} to markup preformatted text and blocks of computer code until this wiki adopts Extension:SyntaxHighlight.

Examples

user input

collatz = lambda n, c = None: (c := (c or 0) + 1) and collatz((n//2, 3*n + 1)[n % 2], c) if n > 1 else c or 1