Class: SiSU_Metadata::TeX_Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/shared_metadata.rb

Instance Method Summary collapse

Constructor Details

#initialize(md) ⇒ TeX_Metadata

Returns a new instance of TeX_Metadata.



994
995
996
997
998
999
# File 'lib/sisu/shared_metadata.rb', line 994

def initialize(md)
  @md=md
  @br="\\\\\n"
  @make=SiSU_Env::ProcessingSettings.new(md)
  @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
end

Instance Method Details

#meta_para(tag, inf, sc = true) ⇒ Object



1000
1001
1002
1003
1004
# File 'lib/sisu/shared_metadata.rb', line 1000

def meta_para(tag,inf,sc=true)
  inf=((inf.is_a?(String) && sc) ? spec_char(inf) : inf)
  %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
}
end

#metadata_texObject



1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
# File 'lib/sisu/shared_metadata.rb', line 1014

def 
  meta=[]
  l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
  language=l[:n]
  tr=SiSU_Translate::Source.new(@md,language)
  if @make.build.links_to_manifest? \
  and not @o_str.dump_or_redirect?
    tag="Document Manifest @"
    inf="#{@br}#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
    meta << meta_para(tag,inf)
  end
  if defined? @md.title.full \
  and @md.title.full=~/\S+/
    tag,inf=tr.full_title,@md.title.full
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.author \
  and @md.creator.author=~/\S+/
    tag,inf=tr.author,@md.creator.author
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.translator \
  and @md.creator.translator=~/\S+/
    tag,inf=tr.translator,@md.creator.translator
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.illustrator \
  and @md.creator.illustrator=~/\S+/
    tag,inf=tr.illustrator,@md.creator.illustrator
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.prepared_by \
  and @md.creator.prepared_by=~/\S+/
    tag,inf=tr.prepared_by,@md.creator.prepared_by
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.digitized_by \
  and @md.creator.digitized_by=~/\S+/
    tag,inf=tr.digitized_by,@md.creator.digitized_by
    meta << meta_para(tag,inf)
  end
  if defined? @md.rights.all \
  and @md.rights.all=~/\S+/
    tag,inf=tr.rights,@md.rights.all
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.description \
  and @md.notes.description=~/\S+/
    tag,inf=tr.description,@md.notes.description
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.subject \
  and @md.classify.subject=~/\S+/
    tag,inf=tr.subject,@md.classify.subject
    meta << meta_para(tag,inf)
  end
  if defined? @md.publisher \
  and @md.publisher=~/\S+/
    tag,inf=tr.publisher,@md.publisher
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.contributor \
  and @md.creator.contributor=~/\S+/
    tag,inf=tr.contributor,@md.creator.contributor
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.abstract \
  and @md.notes.abstract=~/\S+/
    tag,inf=tr.abstract,@md.notes.abstract
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.created \
  and @md.date.created=~/\S+/
    tag,inf=tr.date_created,@md.date.created
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.issued \
  and @md.date.issued=~/\S+/
    tag,inf=tr.date_issued,@md.date.issued
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.available \
  and @md.date.available=~/\S+/
    tag,inf=tr.date_available,@md.date.available
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.modified \
  and @md.date.modified=~/\S+/
    tag,inf=tr.date_modified,@md.date.modified
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.valid \
  and @md.date.valid=~/\S+/
    tag,inf=tr.date_valid,@md.date.valid
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.published \
  and @md.date.published=~/\S+/
    tag,inf=tr.date,@md.date.published
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.topic_register \
  and @md.classify.topic_register=~/\S+/
    tag,inf=tr.topic_register,@md.classify.topic_register
    inf=word_break_points(inf)
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.loc \
  and @md.classify.loc=~/\S+/
    tag,inf=tr.cls_loc,@md.classify.loc
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.dewey \
  and @md.classify.dewey=~/\S+/
    tag,inf=tr.cls_dewey,@md.classify.dewey
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.oclc \
  and @md.classify.oclc=~/\S+/
    tag,inf=tr.cls_oclc,@md.classify.oclc
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.pg \
  and @md.classify.pg=~/\S+/
    tag,inf=tr.cls_gutenberg,@md.classify.pg
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.isbn \
  and @md.classify.isbn=~/\S+/
    tag,inf=tr.cls_isbn,@md.classify.isbn
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.comment \
  and @md.notes.comment=~/\S+/
    tag,inf=tr.comments,@md.notes.comment
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.prefix_a \
  and @md.notes.prefix_a=~/\S+/
    tag,inf=tr.prefix_a,@md.notes.prefix_a
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.prefix_b \
  and @md.notes.prefix_b=~/\S+/
    tag,inf=tr.prefix_b,@md.notes.prefix_b
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.identifier \
  and @md.classify.identifier=~/\S+/
    tag,inf=tr.identifier,@md.classify.identifier
    meta << meta_para(tag,inf)
  end
  if defined? @md.original.source \
  and @md.original.source=~/\S+/
    tag,inf=tr.source,@md.original.source
    meta << meta_para(tag,inf)
  end
  if defined? @md.title.language \
  and @md.title.language=~/\S+/
    tag,inf=tr.language,@md.title.language
    meta << meta_para(tag,inf)
  end
  if defined? @md.original.language \
  and @md.original.language=~/\S+/
    tag,inf=tr.language_original,@md.original.language
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.format \
  and @md.classify.format=~/\S+/
    tag,inf=tr.format,@md.classify.format
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.relation \
  and @md.classify.relation=~/\S+/
    tag,inf=tr.relation,@md.classify.relation
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.coverage \
  and @md.classify.coverage=~/\S+/
    tag,inf=tr.coverage,@md.classify.coverage
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.keywords \
  and @md.classify.keywords=~/\S+/
    tag,inf=tr.keywords,@md.classify.keywords
    meta << meta_para(tag,inf)
  end
  meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
  if defined? @md.fns \
  and @md.fns=~/\S+/
    fn=spec_char(@md.fns)
    fn=word_break_points(fn)
    fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
    tag,inf=tr.sourcefile,fn
    meta << meta_para(tag,inf,false)
  end
  if defined? @md.file_encoding \
  and @md.file_encoding=~/\S+/
    tag,inf='Filetype',@md.file_encoding
    meta << meta_para(tag,inf)
  end
  if defined? @md.dgst \
  and @md.dgst.is_a?(Array)
    hash_of=spec_char(@md.dgst[0])
    hash_of=word_break_points(hash_of)
    dgst=number_break_points(@md.dgst[1])
    tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
    meta << meta_para(tag,inf,false)
  end
  meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
  if defined? @md.generated \
  and @md.generated.is_a?(Time)
    tag,inf=tr.last_generated,@md.generated
    meta << meta_para(tag,inf)
  end
  if defined? @md.project_details \
  and @md.project_details.version=~/\S+/
    tag=tr.sisu_version
    inf="#{@md.project_details.project} " +
      "#{@md.project_details.version} " +
      "of #{@md.project_details.date_stamp} " +
      "(#{@md.project_details.date})"
    meta << meta_para(tag,inf)
  end
  if defined? @md.ruby_version \
  and @md.ruby_version=~/\S+/
    tag,inf=tr.ruby_version,@md.ruby_version
    meta << meta_para(tag,inf)
  end
  meta
end

#number_break_points(inf) ⇒ Object



1011
1012
1013
# File 'lib/sisu/shared_metadata.rb', line 1011

def number_break_points(inf)
  SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_number_break_points
end

#spec_char(inf) ⇒ Object



1005
1006
1007
# File 'lib/sisu/shared_metadata.rb', line 1005

def spec_char(inf)
  SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_characters
end

#word_break_points(inf) ⇒ Object



1008
1009
1010
# File 'lib/sisu/shared_metadata.rb', line 1008

def word_break_points(inf)
  SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_word_break_points
end