Skip to content

Instantly share code, notes, and snippets.

@jasonm
Created September 2, 2011 18:33
Show Gist options
  • Save jasonm/1189421 to your computer and use it in GitHub Desktop.
Save jasonm/1189421 to your computer and use it in GitHub Desktop.
#
# AsciiDoc source code highlight filter configuration file.
#
# Documented in source-hightlight-filter.txt in AsciiDoc distribution
# ./examples/website/ directory.
#
# HTML outputs require GNU source-highlight (xhtml11, html4 outputs)
# http://www.gnu.org/software/src-highlite/source-highlight.html
#
# or Pygments (xhtml11 outputs):
# http://pygments.org/
#
# GNU source-hightlight is default, define the 'pygments' attribute to use
# Pygments.
#
########################
# Source block templates
########################
[source-highlight-block]
template::[listingblock]
ifdef::basebackend-html[]
[source-highlight-block]
<a name="{id}"></a>
<p><b>{title}</b></p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
|
</td></tr></table>
endif::basebackend-html[]
ifdef::basebackend-xhtml11,basebackend-html5[]
[source-highlight-block]
<div class="listingblock">
<a id="{id}"></a>
<div class="title">{caption=}{title}</div>
<div class="content">
|
</div></div>
endif::basebackend-xhtml11,basebackend-html5[]
# Use DocBook programlisting element.
ifdef::basebackend-docbook[]
[source-highlight-block]
<formalpara{id? id="{id}"}{role? role="{role}"}{reftext? xreflabel="{reftext}"}><title>{title}</title><para>
<programlisting language="{language}" linenumbering="{src_numbered=unnumbered}">
|
</programlisting>
{title#}</para></formalpara>
endif::basebackend-docbook[]
[source-filter-style]
# Source styles template.
ifdef::basebackend-html[]
ifndef::pygments[source-style=template="source-highlight-block",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_tab"),filter="source-highlight -f xhtml -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}"]
ifdef::pygments[source-style=template="source-highlight-block",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered"),filter="pygmentize -f html -l {language} {src_numbered?-O linenos=table} {encoding?-O encoding={encoding}}"]
endif::basebackend-html[]
ifdef::basebackend-html4[]
# html4 does not use pygments.
source-style=template="source-highlight-block",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_tab"),filter="source-highlight -f html -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}"
endif::basebackend-html4[]
ifdef::basebackend-docbook[]
source-style=template="source-highlight-block",presubs=(),postsubs=("specialcharacters","callouts"),posattrs=("style","language","src_numbered","src_tab")
endif::basebackend-docbook[]
#########################
# Source paragraph styles
#########################
[paradef-default]
template::[source-filter-style]
[paradef-literal]
template::[source-filter-style]
#########################
# Source block styles
#########################
[blockdef-listing]
template::[source-filter-style]
#
# DEPRECATED: Pre 8.2.7 filter definition.
#
#########################
# Source block definition
#########################
[blockdef-source-highlight]
# The old ^ delimiter is for backward compatibility, may be removed from
# in future versions.
delimiter=(^source~{4,}$)|(^\^{4,}$)
template=source-highlight-block
presubs=none
posattrs=language,src_numbered,src_tab,src_start,src_end
ifndef::basebackend-docbook[]
postsubs=callouts
# GNU Source Highlight filter.
filter=source-highlight -f {basebackend-xhtml11?xhtml}{basebackend-html4?html} -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}} {src_start?--line-range={src_start}-{src_end}}
endif::basebackend-docbook[]
ifdef::basebackend-docbook[]
postsubs=specialcharacters,callouts
# In the case of DocBook just pass the listing through and let the DocBook
# toolchain handle it.
filter=sed {src_start?-n {src_start},{src_end}p}
endif::basebackend-docbook[]
#
# DEPRECATED: End
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment