Class: Deplate::Formatter::XHTML10transitional

Inherits:
HTML
  • Object
show all
Defined in:
lib/deplate/fmt/xhtml10t.rb

Direct Known Subclasses

XHTML11m

Instance Method Summary collapse

Methods inherited from HTML

#format_highstep, #format_list_of_endnotes, #format_math, #format_math_re_jsmath, #format_math_re_mathml, #format_pagenumber, #format_url, #format_url_re_js_obfuscate_email, #formatter_initialize_headings_navbar, #formatter_initialize_html_asciimath, #initialize_page_comments, #inlatex, #inlatex_re_mathml, #prepare_babelfish, #prepare_html_asciimath, #prepare_html_deplate_button, #prepare_html_jsmath, #prepare_html_sidebar, #prepare_validate_html

Instance Method Details

#head_doctypeObject



17
18
19
20
# File 'lib/deplate/fmt/xhtml10t.rb', line 17

def head_doctype
    return %Q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">}
end


38
39
40
# File 'lib/deplate/fmt/xhtml10t.rb', line 38

def head_link_tag(text)
    return %Q{<link #{text} />}
end

#head_meta_tag(text) ⇒ Object



34
35
36
# File 'lib/deplate/fmt/xhtml10t.rb', line 34

def head_meta_tag(text)
    return %Q{<meta #{text} />}
end

#html_defObject



25
26
27
28
29
30
31
32
# File 'lib/deplate/fmt/xhtml10t.rb', line 25

def html_def
    acc = [%{xmlns="http://www.w3.org/1999/xhtml"}]
    lang = @deplate.options.messages.prop('lang', self)
    if lang
        acc << %{lang="#{lang}"} << %{xml:lang="#{lang}"}
    end
    "<html #{acc.join(" ")}>"
end

#html_lang(stripped = false) ⇒ Object



22
23
# File 'lib/deplate/fmt/xhtml10t.rb', line 22

def html_lang(stripped=false)
end

#include_image_svg(invoker, file, args, inline = false) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/deplate/fmt/xhtml10t.rb', line 42

def include_image_svg(invoker, file, args, inline=false)
    if args['include']

        svg = File.read(file)
        svg.sub!(/^.*?<\?xml .*?\?>[^<]*/, '')
        svg.sub!(/^<!DOCTYPE .*?>[^<]*/, '')
        return svg

    else

        acc  = ['type="image/svg+xml"']

        file = args['file'] if args['file']
        file = img_url(use_image_filename(file, args))
        acc << %{data="#{file}"}

        w = args['w'] || args['width']
        acc << %{width="#{w}"} if w
        h = args['h'] || args['heigth']
        acc << %{height="#{h}"} if h

        # b = args['border'] || '0'
        # acc << %{border="#{b}"}

        # # f = file[0..-(File.extname(file).size + 1)]
        # alt = args['alt']
        # if alt
        #     alt.gsub!(/[\\"&<>]/) do |s|
        #         case s
        #         when '\\'
        #             ''
        #         else
        #             plain_text(s).gsub(/\\([0-9&`'+])/, '\\1')
        #         end
        #     end
        # else
        #     alt = File.basename(file, '.*')
        # end
        # acc << %{alt="#{alt}"}

        style = args['style']
        if style
            style = Deplate::Core.split_list(style, ',', '; ', invoker.source)
        else
            style = []
        end
        style << (inline ? 'inline' : 'figure')
        acc << %{class="#{class_attr(style)}"}

        img_id = args['id']
        unless img_id
            fbase  = Deplate::Core.clean_name(File.basename(fbase || 'imgid'))
            img_id = @deplate.auto_numbered(fbase, :inc => 1, :fmt => %{#{fbase}_%s})
        end
        acc << %{id="#{img_id}" name="#{img_id}"}

        # hi = args['hi']
        # if hi
        #     case hi
        #     when String
        #         hi_img = img_url(use_image_filename(hi, args))
        #     else
        #         hi_img = [File.dirname(file), %{hi-#{File.basename(file)}}]
        #         hi_img = File.join(hi_img.compact)
        #     end
        #     
        #     setup_highlight_image
        #     acc << %{onMouseover="HighlightImage('%s', '%s')" onMouseout="HighlightImage('%s', '%s')"} % [
        #         img_id, img_url(hi_img, args), 
        #         img_id, file
        #     ]
        # end

        return %{<object #{acc.join(' ')} ></object>}

    end
end