Sha256: e0f42c2b1a6fb73ed976e95fd21611bea4c89677f5ce5d68f8baab6e20768e64

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

require_relative '../include_use_case'

class IncludeTextAsPre < IncludeUseCase

  def self.build

    use_case = self.new

    includee_file_name = 'triple_backtick.md'

    use_case.files_to_write.store(
        includee_file_name,
        <<EOT
This file uses triple-backtick to format a ```symbol```, which means that it cannot be included as a code block.
EOT
    )

    use_case.files_to_write.store(
        INCLUDER_FILE_NAME,
        <<EOT
This file includes the backticked content as pre(formatted).

@[:pre](#{includee_file_name})

EOT
    )

    use_case.files_to_write.store(
        TEMPLATE_FILE_NAME,
        <<EOT
### Include Text As Pre

Use file inclusion to include text as pre-formatted (rather than as a code block).

You might need to do this if you have text to include that has triple-backticks.

#### File to Be Included

Here's a file containing text to be included; the text has triple-backticks.:

@[markdown](#{includee_file_name})

#### Includer File

Here's a template file that includes it:

@[markdown](#{INCLUDER_FILE_NAME})

The treatment token ```:pre``` specifies that the included text is to be treated as pre-formatted.

@[:markdown](../interface.md)

#### File with Inclusion

Here's the finished file with the included preformatted text:

@[markdown](#{INCLUDED_FILE_NAME})

EOT
    )

    system(INCLUDE_COMMAND)

    use_case.build

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
markdown_helper-2.2.0 markdown/use_cases/include_files/include_text_as_pre/use_case_builder.rb
markdown_helper-2.1.0 markdown/use_cases/include_files/include_text_as_pre/use_case_builder.rb