Sha256: fd694162e047f06336d9e35748306ca422a6b7265842914ad64d9990c33901ec

Contents?: true

Size: 979 Bytes

Versions: 10

Compression:

Stored size: 979 Bytes

Contents

# encoding: utf-8
module HTML
  class Pipeline

    class LinuxFr
      CONTEXT = {
        toc_minimal_length: 5000,
        toc_header: "<h2 class=\"sommaire\">Sommaire</h2>\n",
        svgtex_url: "http://localhost:16000",
        host: "linuxfr.org"
      }

      def self.render(text)
        pipeline = HTML::Pipeline.new [
          HTML::Pipeline::SVGTeX::PreFilter,
          HTML::Pipeline::MarkdownFilter,
          HTML::Pipeline::TableOfContentsFilter,
          HTML::Pipeline::SVGTeX::PostFilter,
          HTML::Pipeline::SyntaxHighlightFilter,
          HTML::Pipeline::RelativeLinksFilter,
          HTML::Pipeline::CustomLinksFilter,
        ], CONTEXT
        result = pipeline.call text
        result[:output].to_s
      end

      def self.sanitize(html)
        return "" if html.nil?
        pipeline = HTML::Pipeline.new [HTML::Pipeline::SanitizationFilter]
        result = pipeline.call html
        result[:output].to_s
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
html-pipeline-linuxfr-0.14.24 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.23 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.22 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.21 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.20 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.19 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.18 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.17 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.16 lib/html/pipeline/linuxfr.rb
html-pipeline-linuxfr-0.14.15 lib/html/pipeline/linuxfr.rb