gerbil 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/fmt/html.yaml CHANGED
@@ -7,26 +7,6 @@ code: |
7
7
  # load the String#to_html method
8
8
  require 'gerbil/html'
9
9
 
10
- # load admonition icons
11
- Icon = Struct.new(:path, :name, :format, :data)
12
- class Icon
13
- # Returns a HTML image tag containing embedded image data. The given
14
- # attributes (name => value) are applied to the HTML tag declaration.
15
- def to_html aAttributes = {}
16
- atts = aAttributes.inject('') {|s,(k,v)| s << %( #{k}="#{v}") }
17
- %{<img src="data:image/#{format};base64,#{data}" alt="#{name}"#{atts}/>}
18
- end
19
- end
20
-
21
- ICONS = {}
22
- Dir[File.join(Gerbil[:format_home], 'html.icons', '*.*')].each do |path|
23
- ext = File.extname(path)
24
- name = File.basename(path, ext)
25
- data = [File.read(path)].pack('m')
26
-
27
- ICONS[name] = Icon.new(path, name, ext.sub('.', ''), data)
28
- end
29
-
30
10
  class String
31
11
  # Transforms this UTF-8 string into HTML entities.
32
12
  def to_html_entities
@@ -48,7 +28,7 @@ code: |
48
28
  if code > 0xFF or code.chr =~ /[[:alnum:]\-_:\.]/
49
29
  code
50
30
  else
51
- ?\s
31
+ 32 # ASCII character code for a single space
52
32
  end
53
33
  end.pack('U*').strip.gsub(/[[:space:]-]+/, '-')
54
34
  end
@@ -93,6 +73,54 @@ code: |
93
73
  %{<a href="#{h aUrl}"#{%{ title="#{aTitle}"} if aTitle}>#{aName}</a>}
94
74
  end
95
75
 
76
+ # Encodes the given input in base64 format.
77
+ def encode_base_64 aInput
78
+ [aInput].pack('m')
79
+ end
80
+
81
+ # Returns a HTML <img> tag that embeds the given image data.
82
+ #
83
+ # aData:: raw image image data in base64 encoding
84
+ # aFormat:: format of the image data (e.g. PNG, JPG, GIF, etc.)
85
+ # aAttrs:: additional attributes for the <img> tag
86
+ #
87
+ def embed_image_data aData, aFormat, aAttrs
88
+ atts = aAttrs.inject('') {|s,(k,v)| s << %( #{k}="#{v}") }
89
+ %{<img src="data:image/#{aFormat};base64,#{aData}"#{atts}/>}
90
+ end
91
+
92
+ # Returns a HTML <img> tag that embeds the given image file.
93
+ #
94
+ # aPath:: path to the image file
95
+ # aFormat:: format of the image data (e.g. PNG, JPG, GIF, etc.)
96
+ # aAttrs:: additional attributes for the <img> tag
97
+ #
98
+ def embed_image_file aPath, aFormat = aPath[/\w+$/], aAttrs = {}
99
+ data = encode_base_64 File.read(aPath)
100
+ embed_image_data data, aFormat, aAttrs
101
+ end
102
+
103
+ # load admonition icons
104
+ Icon = Struct.new(:path, :name, :format, :data)
105
+
106
+ class Icon
107
+ # Returns a HTML image tag containing embedded image data. The given
108
+ # attributes (name => value) are applied to the HTML tag declaration.
109
+ def to_html aAttributes = {}
110
+ embed_image_data data, format, aAttributes
111
+ end
112
+ end
113
+
114
+ ICONS = {}
115
+
116
+ Dir[File.join(Gerbil[:format_home], 'html.icons', '*.*')].each do |path|
117
+ ext = File.extname(path)
118
+ name = File.basename(path, ext)
119
+ data = encode_base_64 File.read(path)
120
+
121
+ ICONS[name] = Icon.new(path, name, ext.sub('.', ''), data)
122
+ end
123
+
96
124
 
97
125
  nodes:
98
126
  ##
@@ -461,6 +489,18 @@ styles:
461
489
  font-family : Cambria, Georgia, serif;
462
490
  }
463
491
 
492
+ /* lists */
493
+
494
+ #content li:first-child
495
+ {
496
+ margin-top : 1em;
497
+ }
498
+
499
+ #content li
500
+ {
501
+ margin-bottom : 1em;
502
+ }
503
+
464
504
  /* headings */
465
505
 
466
506
  h1,
@@ -541,7 +581,7 @@ styles:
541
581
  padding : 1em;
542
582
  border : 1px solid #C0C0C0;
543
583
  vertical-align : top;
544
- background-color : #FFFFFF;
584
+ background-color : inherit;
545
585
  }
546
586
 
547
587
  th
@@ -716,55 +756,20 @@ styles:
716
756
  max-width : 36em;
717
757
  }
718
758
 
719
- /* hyperlinks */
720
-
721
- a
722
- {
723
- color : #0000FF;
724
- text-decoration : none;
725
- }
726
-
727
- a:visited
728
- {
729
- color : #800080;
730
- }
731
-
732
- a:hover
733
- {
734
- color : #FF0000;
735
- text-decoration : underline;
736
- }
737
-
738
- a:target
739
- {
740
- color : #FF0000;
741
- text-decoration : underline;
742
- }
743
-
744
- a.toc:link,
745
- a.toc:visited
746
- {
747
- text-decoration : none;
748
- z-index : 1;
749
- }
750
-
751
- a img
752
- {
753
- border : none;
754
- }
759
+ /* emphasis */
755
760
 
756
- /*
757
- mark external links with a symbol to help the user
758
- distinguish between internal and external links
759
- */
760
- a:after
761
+ blockquote
761
762
  {
762
- content: "∗";
763
+ margin : 1em;
764
+ border : 5px dotted #C0C0C0;
765
+ padding : 1em;
766
+ color : #444;
763
767
  }
764
768
 
765
- a[href^="#"]:after
769
+ hr
766
770
  {
767
- content: "";
771
+ color : #FF0000; /* for IE6 */
772
+ background-color : #FF0000; /* for Firefox */
768
773
  }
769
774
 
770
775
  /* source code */
@@ -783,7 +788,7 @@ styles:
783
788
  background-color : #FFFAF0;
784
789
  }
785
790
 
786
- /* output of syntax colorizer */
791
+ /* output of the syntax coloring library */
787
792
  .code
788
793
  {
789
794
  background-color : #FFFFF0;
@@ -791,12 +796,12 @@ styles:
791
796
 
792
797
  pre
793
798
  {
799
+ cursor : text;
794
800
  line-height : normal;
795
801
  border : 1px dashed #C0C0C0;
796
802
  background-color : #F5FFDF;
797
803
  padding : 1em;
798
804
  overflow : auto;
799
- cursor : text;
800
805
  }
801
806
 
802
807
  /*
@@ -815,23 +820,62 @@ styles:
815
820
  }
816
821
  */
817
822
 
818
- /* emphasis */
823
+ /* hyperlinks */
819
824
 
820
- blockquote
825
+ a > img
821
826
  {
822
- margin : 1em;
823
- border : 5px dotted #C0C0C0;
824
- padding : 1em;
825
- color : #444;
827
+ border : none;
826
828
  }
827
829
 
828
- hr
830
+ a:link
829
831
  {
830
- color : #FF0000; /* for IE6 */
831
- background-color : #FF0000; /* for Firefox */
832
+ color : #0000FF;
833
+ text-decoration : none;
834
+ }
835
+
836
+ a:visited
837
+ {
838
+ color : #9400D3;
839
+ text-decoration : none;
840
+ }
841
+
842
+ a:hover
843
+ {
844
+ color : #FF0000;
845
+ text-decoration : underline;
846
+ }
847
+
848
+ a:target
849
+ {
850
+ color : #FF0000;
851
+ font-weight : bold;
852
+ }
853
+
854
+ a.toc:link,
855
+ a.toc:visited
856
+ {
857
+ text-decoration : none;
858
+ z-index : 1;
832
859
  }
833
860
 
834
861
  print: |
862
+ /* source code */
863
+
864
+ tt
865
+ {
866
+ color : inherit;
867
+ background-color : inherit;
868
+ font-weight : normal;
869
+ }
870
+
871
+ pre,
872
+ .code
873
+ {
874
+ border : none;
875
+ overflow : visible;
876
+ background-color : inherit;
877
+ }
878
+
835
879
  /* headings */
836
880
 
837
881
  h1,
@@ -857,8 +901,8 @@ styles:
857
901
 
858
902
  a:after
859
903
  {
860
- content : " (" attr(href) ")";
861
- font-family : sans-serif;
904
+ content : " " attr(href);
905
+ font-family : Consolas, "Lucida Console", monospace;
862
906
  font-weight : normal;
863
907
  font-size : 90%;
864
908
  }
@@ -886,23 +930,6 @@ styles:
886
930
  font-style : normal;
887
931
  }
888
932
 
889
- /* source code */
890
-
891
- tt
892
- {
893
- color : inherit;
894
- background-color : inherit;
895
- font-weight : normal;
896
- }
897
-
898
- pre,
899
- .code
900
- {
901
- border : none;
902
- overflow : visible;
903
- background-color : inherit;
904
- }
905
-
906
933
  /* document structure */
907
934
 
908
935
  #lof
@@ -923,3 +950,5 @@ styles:
923
950
  {
924
951
  _padding-bottom : 0.5em; /* for IE6 */
925
952
  }
953
+
954
+
data/lib/gerbil.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gerbil = {
4
4
  :name => 'Gerbil',
5
- :version => '2.0.0',
6
- :release => '2008-02-03',
5
+ :version => '2.1.0',
6
+ :release => '2008-05-29',
7
7
  :website => 'http://gerbil.rubyforge.org',
8
8
  :home => File.expand_path(File.join(File.dirname(__FILE__), '..'))
9
9
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gerbil
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-03 00:00:00 -08:00
12
+ date: 2008-05-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency