Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to remove block indent in blocks with verbatim content #365

Closed
mojavelinux opened this issue May 29, 2013 · 0 comments
Closed
Assignees
Milestone

Comments

@mojavelinux
Copy link
Member

When including snippets of source code from external files, the code will often be padded with a leading block indent. This leading block indent is relevant in its original context. However, once inside the documentation, this leading block indent is no longer needed.

Instead of seeing:

    def names
      @name.split ' '
    end

We want to see:

def names
  @name.split ' '
end

Introduce an attribute named indent to blocks with verbatim content (listing, literal, source, verse, etc) that allows the leading block indent to be stripped and, optionally, a new block indent to be specified. When indent is 0, the leading block indent is stripped. When indent is > 0, the leading block indent is stripped, then a block indentation equal to the value of indent is inserted.

For example, this AsciiDoc source

[indent=0]
----
    def names
      @name.split ' '
    end
----

should produce:

def names
  @name.split ' '
end

This AsciiDoc source:

[indent=2]
----
    def names
      @name.split ' '
    end
----

should produce:

  def names
    @name.split ' '
  end

Note that the relative indentation between the lines of source code should not be affected.

@ghost ghost assigned mojavelinux May 29, 2013
mojavelinux added a commit that referenced this issue May 29, 2013
resolves #365 add indent attribute to verbatim blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant