You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
1.6 KiB

4 years ago
////
Included in:
- user-manual: Source blocks
////
// tag::src-base[]
.app.rb
[source,ruby]
----
require 'sinatra'
get '/hi' do
"Hello World!"
end
----
// end::src-base[]
// tag::src-base-co[]
.app.rb // <1>
[#src-listing] <2>
[source,ruby] // <3> <4>
---- // <5>
require 'sinatra'
get '/hi' do
"Hello World!"
end
----
// end::src-base-co[]
// src-base-co-res is the result of src-base-co
// tag::src-base-co-res[]
[#src-listing]
[source,ruby]
.app.rb
----
require 'sinatra'
get '/hi' do
"Hello World!"
end
----
// end::src-base-co-res[]
// tag::src-para-co[]
[source,xml] <!--1-->
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
This is normal content. // <2>
// end::src-para-co[]
// tag::src-para[]
[source,xml]
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
This is normal content.
// end::src-para[]
// tag::src-lang[]
:source-highlighter: pygments
:source-language: java
[source]
----
public void setAttributes(Attributes attributes) {
this.options.put(ATTRIBUTES, attributes.map());
}
----
You can override the global source language by specifying a source language on the block.
[source,ruby]
require 'sinatra'
// end::src-lang[]
// tag::src-inc[]
[source,ruby]
----
\include::app.rb[]
----
// end::src-inc[]
// tag::rel[]
:sourcedir: src/main/java
[source,java]
----
\include::{sourcedir}/org/asciidoctor/Asciidoctor.java[]
----
// end::rel[]
// tag::ind[]
[source,ruby,indent=0]
----
\include::lib/document.rb[lines=5..10]
----
// end::ind[]
// tag::fence[]
```ruby
require 'sinatra'
get '/hi' do
"Hello World!"
end
```
// end::fence[]