HTTP Links within a Code Fragment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HTTP Links within a Code Fragment

jnorthr
was trying to add the apache license terms into the bottom of one of my documents, but i can't figure out how to make the http: like active/clickable - any ideas ? thx jim

== License

....
Copyright - www.fredbloggs.com, 2014

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
....
Reply | Threaded
Open this post in threaded view
|

Re: HTTP Links within a Code Fragment

mojavelinux
Administrator
In order to make links in literal and listing blocks, you need to explicitly enable the substitution group named "macros". (Links are a type of inline macro).

Here's an example using the shorthand syntax coming in Asciidoctor 1.5.0 (grab one of the preview releases to use it):

```asciidoc

[subs=+macros]
....
Copyright - http://www.fredbloggs.com, 2014 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
....

```

To do this in Asciidoctor 0.1.4, you have to list all the substitutions exclusively:

```asciidoc

[subs="verbatim,macros"]
....
Copyright...
....

```

Beware that this may require that you escape certain characters...though I don't think there are any issues in this example.

-Dan


On Sat, Mar 22, 2014 at 6:44 AM, jnorthr [via Asciidoctor :: Discussion] <[hidden email]> wrote:
was trying to add the apache license terms into the bottom of one of my documents, but i can't figure out how to make the http: like active/clickable - any ideas ? thx jim

== License

....
Copyright - www.fredbloggs.com, 2014

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
....


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/HTTP-Links-within-a-Code-Fragment-tp1636.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--