Template:Hbc: Difference between revisions

From KDE Community Wiki
m (Edit displaytitle after renaming template)
(Usage examples and parameters in separate section)
 
Line 7: Line 7:
* Use [[Template:ic]] for inline code.
* Use [[Template:ic]] for inline code.


== Usage ==
== Parameters ==


* {{ic|1}} or {{ic|head}}: the code in the top pane
* {{ic|1}} or {{ic|head}}: the code in the top pane
* {{ic|2}} or {{ic|output}}: the code in the bottom pane
* {{ic|2}} or {{ic|output}}: the code in the bottom pane


<nowiki>{{hbc|main.h|#include <stdio.h>}}</nowiki>
== Usage examples ==


With fully named parameters:
  <nowiki>{{hbc|head=main.h|output=#include <stdio.h>}}</nowiki>
  <nowiki>{{hbc|head=main.h|output=#include <stdio.h>}}</nowiki>


== Example ==
Without parameter names:
<nowiki>{{hbc|main.h|#include <stdio.h>}}</nowiki>
 
== Result ==


{{hbc|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 -->
{{hbc|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<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>
<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 11:21, 29 September 2023

This page is a template, editing it will affect all the pages that make use of it, so users should be especially careful when editing it. For more details on how to use templates see "A Quick Guide to Templates"

Block code with header.

Parameters

  • 1 or head: the code in the top pane
  • 2 or output: the code in the bottom pane

Usage examples

With fully named parameters:

{{hbc|head=main.h|output=#include <stdio.h>}}

Without parameter names:

{{hbc|main.h|#include <stdio.h>}}

Result

main.h
#include <stdio.h>