File: rd2html-img-lib.rb

package info (click to toggle)
ruby-pgplot 0.1.9-3
  • links: PTS, VCS
  • area: contrib
  • in suites: buster, stretch
  • size: 604 kB
  • ctags: 144
  • sloc: ruby: 1,607; makefile: 76; ansic: 57; sh: 17
file content (20 lines) | stat: -rw-r--r-- 334 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "rd/rd2html-lib"

module RD
  class RD2HTMLVisitor

    # RDVisitor#apply_to_Include 
    def apply_to_Include(content)
      if /^(.+\.(?:png|gif|jpg))(?::(.+))?$/ === content.filename
	m =  %Q[<p><img src="#{$1}" ]
	alt = $2 || $1
	m << %Q[alt="#{alt}"] 
	m << %Q[/></p>\n]
	m
      else
	super
      end
    end

  end
end