Difference between revisions of "Template:Hc"

From ArchWiki
Jump to: navigation, search
(pre now gets overflow:auto from the css)
(merge example proposed in Template talk:Hc#Add named-parameters usage)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
+
<noinclude>{{DISPLAYTITLE:Template:hc}}
{{DISPLAYTITLE:Template:hc}}
 
 
{{Template}}
 
{{Template}}
  
Line 10: Line 9:
 
==Usage==
 
==Usage==
  
{{bc|<nowiki>{{hc|head|code}}</nowiki>}}
+
* {{ic|1}} or {{ic|head}}: the code in the top pane
 +
* {{ic|2}} or {{ic|output}}: the code in the bottom pane
 +
 
 +
<nowiki>{{hc|main.h|#include <stdio.h>}}</nowiki>
 +
 
 +
<nowiki>{{hc|head=main.h|output=#include <stdio.h>}}</nowiki>
  
 
==Example==
 
==Example==
  
{{hc|head|code}}</noinclude><includeonly><pre&lt;noinclude&gt;&lt;/noinclude&gt; style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">{{{head|{{{1|{{Error}}}}}}}}</pre&lt;noinclude&gt;&lt;/noinclude&gt;><!-- The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block -->
+
{{hc|head=main.h|output=#include <stdio.h>}}</noinclude><includeonly><pre<noinclude></noinclude> style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">{{{head|{{{1|{{META Error}}}}}}}}</pre<noinclude></noinclude>><!-- The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block -->
<pre&lt;noinclude&gt;&lt;/noinclude&gt; style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">{{{output|{{{2|{{Error}}}}}}}}</pre&lt;noinclude&gt;&lt;/noinclude&gt;></includeonly>
+
<pre<noinclude></noinclude> style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">{{{output|{{{2|{{META Error}}}}}}}}</pre<noinclude></noinclude>></includeonly><noinclude><!-- The &lt;noinclude>&lt;/noinclude> hack is needed to allow wiki markup inside the pre tags; reference: http://www.gossamer-threads.com/lists/wiki/mediawiki/118688#118688 --></noinclude>

Latest revision as of 10:39, 21 April 2017

This page is a template. It contains no Arch Linux-related information, but should be used as part of other articles. For more information, read Help:Template.

Please do not experiment with this template; you could ruin all pages using this template. If you want to edit this template, copy the text to Template:Sandbox, edit and test it there, and copy it back when it works.

Feel free to voice your opinion regarding this template.

Block code with header.

Usage

  • 1 or head: the code in the top pane
  • 2 or output: the code in the bottom pane
{{hc|main.h|#include <stdio.h>}}
{{hc|head=main.h|output=#include <stdio.h>}}

Example

main.h
#include <stdio.h>