001 | #!/usr/bin/env osascript |
---|
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
---|
003 | #com.cocolog-nifty.quicktimer.icefloe |
---|
004 | (* |
---|
005 | AFDFO を先にインストール済みの必要があります |
---|
006 | https://quicktimer.cocolog-nifty.com/icefloe/2024/11/post-56e0e1.html |
---|
007 | *) |
---|
008 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
---|
009 | use AppleScript version "2.8" |
---|
010 | use framework "Foundation" |
---|
011 | use framework "AppKit" |
---|
012 | use framework "UniformTypeIdentifiers" |
---|
013 | use scripting additions |
---|
014 | property refMe : a reference to current application |
---|
015 | |
---|
016 | ################# |
---|
017 | ##設定項目 |
---|
018 | set strSaveExtension to ("html") as text |
---|
019 | |
---|
020 | |
---|
021 | ################# |
---|
022 | ## |
---|
023 | set strCommandText to ("/usr/bin/which python3") as text |
---|
024 | try |
---|
025 | do shell script strCommandText |
---|
026 | on error |
---|
027 | return "python3未インストール" |
---|
028 | end try |
---|
029 | ################# |
---|
030 | ## |
---|
031 | set appFileManager to refMe's NSFileManager's defaultManager() |
---|
032 | set ocidHomeDirURL to appFileManager's homeDirectoryForCurrentUser() |
---|
033 | set ocidSaveDirPathURL to ocidHomeDirURL's URLByAppendingPathComponent:("Sites/FontList") isDirectory:(true) |
---|
034 | set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0 |
---|
035 | ocidAttrDict's setValue:(493) forKey:(refMe's NSFilePosixPermissions) |
---|
036 | set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference) |
---|
037 | |
---|
038 | ################# |
---|
039 | ##バイナリーへのパス |
---|
040 | set appFileManager to refMe's NSFileManager's defaultManager() |
---|
041 | set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask)) |
---|
042 | set ocidLibraryDirPathURL to ocidURLsArray's firstObject() |
---|
043 | set ocidBinFilePathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Python/3.9/bin/tx") isDirectory:(false) |
---|
044 | set strBinFilePath to ocidBinFilePathURL's |path| as text |
---|
045 | |
---|
046 | ################# |
---|
047 | ## ダイアログ関連 |
---|
048 | set strName to (name of current application) as text |
---|
049 | if strName is "osascript" then |
---|
050 | tell application "Finder" to activate |
---|
051 | else |
---|
052 | tell current application to activate |
---|
053 | end if |
---|
054 | |
---|
055 | tell application "Finder" |
---|
056 | set aliasDefaultLocation to (path to fonts folder from user domain) as alias |
---|
057 | end tell |
---|
058 | set listUTI to {"public.font", "public.opentype-font"} as list |
---|
059 | set strPromptText to "フォントファイルを選んでください" as text |
---|
060 | set strMes to "選んでください" as text |
---|
061 | set aliasFilePath to (choose file strMes with prompt strPromptText default location (aliasDefaultLocation) of type listUTI without invisibles, multiple selections allowed and showing package contents) as alias |
---|
062 | |
---|
063 | ####ファイルパス |
---|
064 | set strFilePath to (POSIX path of aliasFilePath) as text |
---|
065 | set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath) |
---|
066 | set ocidFilePath to ocidFilePathStr's stringByStandardizingPath() |
---|
067 | set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:(false) |
---|
068 | set strFontsFilePath to ocidFilePathURL's absoluteString() as text |
---|
069 | # |
---|
070 | set strExtensionName to ocidFilePathURL's pathExtension() as text |
---|
071 | set ocidFileName to ocidFilePathURL's lastPathComponent() |
---|
072 | set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension() |
---|
073 | set strBaseFileName to ocidBaseFilePathURL's lastPathComponent() as text |
---|
074 | # |
---|
075 | set ocidSaveBasePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strBaseFileName) isDirectory:(false) |
---|
076 | set ocidSaveFilePathURL to ocidSaveBasePathURL's URLByAppendingPathExtension:("html") |
---|
077 | |
---|
078 | |
---|
079 | |
---|
080 | ################# |
---|
081 | #コマンド整形 |
---|
082 | #リストのみ |
---|
083 | set strCommandText to ("\"" & strBinFilePath & "\" -dump -0 -y \"" & strFilePath & "\"") as text |
---|
084 | ## |
---|
085 | log "\n" & strCommandText & "\n" |
---|
086 | #コマンド実行 |
---|
087 | set strExecCommand to ("/bin/zsh -c '" & strCommandText & "'") as text |
---|
088 | try |
---|
089 | set strResponse to (do shell script strExecCommand) as text |
---|
090 | |
---|
091 | on error |
---|
092 | log "osascript でエラーしました" |
---|
093 | return false |
---|
094 | end try |
---|
095 | |
---|
096 | ################# |
---|
097 | # |
---|
098 | set ocidTmpArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0) |
---|
099 | set ocidTmpStringM to (refMe's NSMutableString's alloc()'s initWithCapacity:(0)) |
---|
100 | # |
---|
101 | set ocidResponse to refMe's NSString's stringWithString:(strResponse) |
---|
102 | set ocidResponseArray to ocidResponse's componentsSeparatedByString:("\r") |
---|
103 | # |
---|
104 | repeat with itemArray in ocidResponseArray |
---|
105 | set boolPreFixStart to (itemArray's hasPrefix:("## Top Dict")) as boolean |
---|
106 | if boolPreFixStart is true then |
---|
107 | set boolStart to true as boolean |
---|
108 | set ocidTmpStringM to (refMe's NSMutableString's alloc()'s initWithCapacity:(0)) |
---|
109 | else if boolPreFixStart is false then |
---|
110 | set boolPreFixEnd to (itemArray's hasPrefix:("## Private")) as boolean |
---|
111 | if boolPreFixEnd is true then |
---|
112 | set boolStart to false as boolean |
---|
113 | (ocidTmpArrayM's addObject:(ocidTmpStringM)) |
---|
114 | else |
---|
115 | set boolPreFixFileName to (itemArray's hasPrefix:("## Filename")) as boolean |
---|
116 | if boolPreFixFileName is false then |
---|
117 | set boolPreFixDict to (itemArray's hasPrefix:("## FontDict[")) as boolean |
---|
118 | if boolPreFixDict is false then |
---|
119 | (ocidTmpStringM's appendString:(itemArray)) |
---|
120 | (ocidTmpStringM's appendString:("\n")) |
---|
121 | else if boolPreFixDict is true then |
---|
122 | set itemArray to (itemArray's stringByReplacingOccurrencesOfString:("## ") withString:("")) |
---|
123 | (ocidTmpStringM's appendString:(itemArray)) |
---|
124 | (ocidTmpStringM's appendString:("\n")) |
---|
125 | end if |
---|
126 | end if |
---|
127 | end if |
---|
128 | end if |
---|
129 | |
---|
130 | end repeat |
---|
131 | |
---|
132 | |
---|
133 | ################# |
---|
134 | # |
---|
135 | set ocidXMLDoc to refMe's NSXMLDocument's alloc()'s init() |
---|
136 | (ocidXMLDoc's setDocumentContentKind:(refMe's NSXMLDocumentHTMLKind)) |
---|
137 | # DTD付与 |
---|
138 | set ocidDTD to refMe's NSXMLDTD's alloc()'s init() |
---|
139 | (ocidDTD's setName:("html")) |
---|
140 | (ocidXMLDoc's setDTD:(ocidDTD)) |
---|
141 | # XML主要部分を生成 |
---|
142 | set ocidRootElement to doMakeRootElement() |
---|
143 | #ボディエレメント |
---|
144 | set ocidBodyElement to (refMe's NSXMLElement's elementWithName:("body")) |
---|
145 | #ヘッダー |
---|
146 | set ocidHeaderElement to (refMe's NSXMLElement's elementWithName:("header")) |
---|
147 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:("header")) |
---|
148 | (ocidHeaderElement's addAttribute:(ocidAddNode)) |
---|
149 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_header")) |
---|
150 | (ocidHeaderElement's addAttribute:(ocidAddNode)) |
---|
151 | (ocidBodyElement's addChild:(ocidHeaderElement)) |
---|
152 | #アーティクル |
---|
153 | set ocidArticleElement to (refMe's NSXMLElement's elementWithName:("article")) |
---|
154 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:("article")) |
---|
155 | (ocidArticleElement's addAttribute:(ocidAddNode)) |
---|
156 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_article")) |
---|
157 | (ocidArticleElement's addAttribute:(ocidAddNode)) |
---|
158 | (ocidBodyElement's addChild:(ocidArticleElement)) |
---|
159 | #フッター |
---|
160 | set ocidFooterElement to (refMe's NSXMLElement's elementWithName:("footer")) |
---|
161 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:("footer")) |
---|
162 | (ocidFooterElement's addAttribute:(ocidAddNode)) |
---|
163 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_footer")) |
---|
164 | (ocidFooterElement's addAttribute:(ocidAddNode)) |
---|
165 | #リンク付与(不要なら削除可) |
---|
166 | set ocidAElement to (refMe's NSXMLElement's elementWithName:("a")) |
---|
167 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("href") stringValue:("https://quicktimer.cocolog-nifty.com/")) |
---|
168 | (ocidAElement's addAttribute:(ocidAddNode)) |
---|
169 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("target") stringValue:("_blank")) |
---|
170 | (ocidAElement's addAttribute:(ocidAddNode)) |
---|
171 | set strContents to ("AppleScriptで生成しました") as text |
---|
172 | (ocidAElement's setStringValue:(strContents)) |
---|
173 | (ocidFooterElement's addChild:(ocidAElement)) |
---|
174 | (ocidBodyElement's addChild:(ocidFooterElement)) |
---|
175 | |
---|
176 | log "HTMLヘッダー部終了" |
---|
177 | ############################## |
---|
178 | # TABLE コンテンツ部分生成開始 |
---|
179 | ############################## |
---|
180 | #【table】 |
---|
181 | set ocidTableElement to (refMe's NSXMLElement's elementWithName:("table")) |
---|
182 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("summary") stringValue:("ADKFOリスト")) |
---|
183 | (ocidTableElement's addAttribute:(ocidAddNode)) |
---|
184 | |
---|
185 | ######################## |
---|
186 | #【caption】 |
---|
187 | set ocidCaptionElement to (refMe's NSXMLElement's elementWithName:("caption")) |
---|
188 | (ocidCaptionElement's setStringValue:(strFontsFilePath)) |
---|
189 | (ocidTableElement's addChild:(ocidCaptionElement)) |
---|
190 | ######################## |
---|
191 | #【colgroup】 |
---|
192 | set ocidColgroupElement to (refMe's NSXMLElement's elementWithName:("colgroup")) |
---|
193 | #テーブルのタイトル部 |
---|
194 | set listColName to {"行番号", "キー名", "値"} as list |
---|
195 | set listColID to {"liineNO", "KeyName", "Value"} as list |
---|
196 | #項目数を取得して |
---|
197 | set numCntCol to (count of listColName) as integer |
---|
198 | #タイトル部の数だけ繰り返し |
---|
199 | repeat with itemNo from 1 to numCntCol by 1 |
---|
200 | set strItemName to (item itemNo of listColName) as text |
---|
201 | #【col】col生成 |
---|
202 | set ocidAddElement to (refMe's NSXMLElement's elementWithName:("col")) |
---|
203 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(strItemName)) |
---|
204 | (ocidAddElement's addAttribute:(ocidAddNode)) |
---|
205 | (ocidColgroupElement's addChild:(ocidAddElement)) |
---|
206 | end repeat |
---|
207 | #テーブルエレメントに追加 |
---|
208 | (ocidTableElement's addChild:(ocidColgroupElement)) |
---|
209 | |
---|
210 | ######################## |
---|
211 | #【thead】 |
---|
212 | set ocidTheadElement to (refMe's NSXMLElement's elementWithName:("thead")) |
---|
213 | #TR |
---|
214 | set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr")) |
---|
215 | #項目数を取得して |
---|
216 | set numCntCol to (count of listColName) as integer |
---|
217 | #タイトル部の数だけ繰り返し |
---|
218 | repeat with itemNo from 1 to numCntCol by 1 |
---|
219 | set strItemName to (item itemNo of listColName) as text |
---|
220 | set strColID to (item itemNo of listColID) as text |
---|
221 | #【col】col生成 |
---|
222 | set ocidThElement to (refMe's NSXMLElement's elementWithName:("th")) |
---|
223 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(strItemName)) |
---|
224 | (ocidThElement's addAttribute:(ocidAddNode)) |
---|
225 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:(strColID)) |
---|
226 | (ocidThElement's addAttribute:(ocidAddNode)) |
---|
227 | (ocidThElement's setStringValue:(strItemName)) |
---|
228 | # |
---|
229 | (ocidTrElement's addChild:(ocidThElement)) |
---|
230 | end repeat |
---|
231 | #TRをTHEADに入れる |
---|
232 | (ocidTheadElement's addChild:(ocidTrElement)) |
---|
233 | #THEADをテーブルにセット |
---|
234 | (ocidTableElement's addChild:(ocidTheadElement)) |
---|
235 | |
---|
236 | log "THEAD部終了" |
---|
237 | ######################## |
---|
238 | #【tbody】 |
---|
239 | set ocidTbodyElement to refMe's NSXMLElement's elementWithName:("tbody") |
---|
240 | |
---|
241 | # |
---|
242 | set numCntLineNO to 1 as integer |
---|
243 | # |
---|
244 | repeat with itemArray in ocidTmpArrayM |
---|
245 | # |
---|
246 | set ocidLineArray to (itemArray's componentsSeparatedByString:("\n")) |
---|
247 | |
---|
248 | # |
---|
249 | repeat with itemLineArray in ocidLineArray |
---|
250 | # |
---|
251 | set ocidContentsArray to (itemLineArray's componentsSeparatedByString:(" ")) |
---|
252 | set ocidSetKey to ocidContentsArray's firstObject() |
---|
253 | set ocidSetValue to ocidContentsArray's lastObject() |
---|
254 | # |
---|
255 | if (ocidSetKey as text) is "" then |
---|
256 | set ocidSetKey to "" as text |
---|
257 | set ocidSetValue to "" as text |
---|
258 | set strSetCnt to (refMe's NSString's stringWithString:(" ")) |
---|
259 | set numCntLineNO to numCntLineNO - 1 as integer |
---|
260 | else |
---|
261 | set strSetCnt to numCntLineNO as text |
---|
262 | end if |
---|
263 | #TR |
---|
264 | set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr")) |
---|
265 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("row")) |
---|
266 | (ocidTrElement's addAttribute:(ocidAddNode)) |
---|
267 | #TD |
---|
268 | set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td")) |
---|
269 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("liineNO")) |
---|
270 | (ocidTdElement's addAttribute:(ocidAddNode)) |
---|
271 | (ocidTdElement's setStringValue:(strSetCnt)) |
---|
272 | (ocidTrElement's addChild:(ocidTdElement)) |
---|
273 | #TD |
---|
274 | set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td")) |
---|
275 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("KeyName")) |
---|
276 | (ocidTdElement's addAttribute:(ocidAddNode)) |
---|
277 | (ocidTdElement's setStringValue:(ocidSetKey)) |
---|
278 | (ocidTrElement's addChild:(ocidTdElement)) |
---|
279 | #TD |
---|
280 | set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td")) |
---|
281 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("Value")) |
---|
282 | (ocidTdElement's addAttribute:(ocidAddNode)) |
---|
283 | (ocidTdElement's setStringValue:(ocidSetValue)) |
---|
284 | (ocidTrElement's addChild:(ocidTdElement)) |
---|
285 | # |
---|
286 | (ocidTbodyElement's addChild:(ocidTrElement)) |
---|
287 | set numCntLineNO to numCntLineNO + 1 as integer |
---|
288 | end repeat |
---|
289 | |
---|
290 | end repeat |
---|
291 | |
---|
292 | |
---|
293 | |
---|
294 | ############ |
---|
295 | #TBODYをテーブルにセット |
---|
296 | (ocidTableElement's addChild:(ocidTbodyElement)) |
---|
297 | ############################## |
---|
298 | ############ |
---|
299 | #【tfoot】 TRで |
---|
300 | set ocidTfootElement to (refMe's NSXMLElement's elementWithName:("tfoot")) |
---|
301 | set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr")) |
---|
302 | #colspan指定して1行でセット |
---|
303 | set ocidThElement to (refMe's NSXMLElement's elementWithName:("th")) |
---|
304 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("テーブルの終わり")) |
---|
305 | (ocidThElement's addAttribute:(ocidAddNode)) |
---|
306 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("colspan") stringValue:(numCntCol as text)) |
---|
307 | (ocidThElement's addAttribute:(ocidAddNode)) |
---|
308 | set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("row")) |
---|
309 | (ocidThElement's addAttribute:(ocidAddNode)) |
---|
310 | (ocidThElement's setStringValue:("AFDKO Adobe Font Development Kit for OpenType")) |
---|
311 | #THをTRにセットして |
---|
312 | (ocidTrElement's addChild:(ocidThElement)) |
---|
313 | #TRをTFOOTにセット |
---|
314 | (ocidTfootElement's addChild:(ocidTrElement)) |
---|
315 | #TFOOTをテーブルにセット |
---|
316 | (ocidTableElement's addChild:(ocidTfootElement)) |
---|
317 | |
---|
318 | ############################## |
---|
319 | # ROOT |
---|
320 | ############################## |
---|
321 | # 出来上がったテーブルをArticleエレメントにセット |
---|
322 | (ocidArticleElement's addChild:(ocidTableElement)) |
---|
323 | # |
---|
324 | (ocidRootElement's addChild:(ocidBodyElement)) |
---|
325 | #ROOTエレメントをXMLにセット |
---|
326 | ocidXMLDoc's setRootElement:(ocidRootElement) |
---|
327 | #読み取りやすい表示 |
---|
328 | set ocidXMLdata to ocidXMLDoc's XMLDataWithOptions:(refMe's NSXMLNodePrettyPrint) |
---|
329 | |
---|
330 | |
---|
331 | |
---|
332 | ############################## |
---|
333 | # 保存 |
---|
334 | set listDone to ocidXMLdata's writeToURL:(ocidSaveFilePathURL) options:(refMe's NSDataWritingAtomic) |error| :(reference) |
---|
335 | if (item 1 of listDone) is true then |
---|
336 | log "正常終了" |
---|
337 | else if (item 1 of listDone) is false then |
---|
338 | log (item 2 of listDone)'s localizedDescription() as text |
---|
339 | return "保存に失敗しました" |
---|
340 | end if |
---|
341 | ############################## |
---|
342 | # 開く |
---|
343 | set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace() |
---|
344 | set boolDone to appSharedWorkspace's openURL:(ocidSaveFilePathURL) |
---|
345 | # |
---|
346 | set ocidOpenURLsArray to (refMe's NSMutableArray's alloc()'s initWithCapacity:0) |
---|
347 | (ocidOpenURLsArray's addObject:(ocidSaveDirPathURL)) |
---|
348 | appSharedWorkspace's activateFileViewerSelectingURLs:(ocidOpenURLsArray) |
---|
349 | |
---|
350 | |
---|
351 | |
---|
352 | return "終了" |
---|
353 | |
---|
354 | |
---|
355 | |
---|
356 | ############################## |
---|
357 | # 基本的なHTMLの構造 |
---|
358 | ############################## |
---|
359 | to doMakeRootElement() |
---|
360 | # |
---|
361 | set ocidRootElement to refMe's NSXMLElement's elementWithName:("html") |
---|
362 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("lang") stringValue:("ja") |
---|
363 | ocidRootElement's addAttribute:(ocidAddNode) |
---|
364 | # |
---|
365 | set ocidHeadElement to refMe's NSXMLElement's elementWithName:("head") |
---|
366 | # |
---|
367 | set ocidAddElement to refMe's NSXMLElement's elementWithName:("title") |
---|
368 | ocidAddElement's setStringValue:("ファイル比較") |
---|
369 | ocidHeadElement's addChild:(ocidAddElement) |
---|
370 | # http-equiv |
---|
371 | set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta") |
---|
372 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Type") |
---|
373 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
374 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/html; charset=UTF-8") |
---|
375 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
376 | ocidHeadElement's addChild:(ocidAddElement) |
---|
377 | # |
---|
378 | set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta") |
---|
379 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Style-Type") |
---|
380 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
381 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/css") |
---|
382 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
383 | ocidHeadElement's addChild:(ocidAddElement) |
---|
384 | # |
---|
385 | set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta") |
---|
386 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Script-Type") |
---|
387 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
388 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/javascript") |
---|
389 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
390 | ocidHeadElement's addChild:(ocidAddElement) |
---|
391 | # |
---|
392 | set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta") |
---|
393 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("name") stringValue:("viewport") |
---|
394 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
395 | set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("width=720") |
---|
396 | ocidAddElement's addAttribute:(ocidAddNode) |
---|
397 | ocidHeadElement's addChild:(ocidAddElement) |
---|
398 | # |
---|
399 | set ocidAddElement to refMe's NSXMLElement's elementWithName:("style") |
---|
400 | ocidAddElement's setStringValue:("body { margin: 10px; background-color: #FFFFFF; } table { border-spacing: 0; caption-side: top; font-family: system-ui; } thead th { border: solid 1px #666666; padding: .5ch 1ch; border-block-width: 1px 0; border-inline-width: 1px 0; &:first-of-type { border-start-start-radius: .5em } &:last-of-type { border-start-end-radius: .5em; border-inline-end-width: 1px }} thead td {border: solid 1px #666666;padding: .5ch 1ch;border-block-width: 1px 0;border-inline-width: 1px 0;&:last-of-type {border-inline-end-width: 1px}}tbody td { word-wrap: break-word;max-width: 360px;border-spacing: 0; border: solid 1px #666666; padding: .5ch 1ch; border-block-width: 1px 0; border-inline-width: 1px 0; &:last-of-type { border-inline-end-width: 1px }} tbody p { margin-block-end: 2px; margin-block-start: 2px;} tbody th { border-spacing: 0; border: solid 1px #666666; padding: .5ch 1ch; border-block-width: 1px 0; border-inline-width: 1px 0; } tbody tr:nth-of-type(odd) { background: #F2F2F2; } .kind_string { font-size: 0.75em; } .date_string { font-size: 0.5em; } tfoot th { border: solid 1px #666666; padding: .5ch 1ch; &:first-of-type { border-end-start-radius: .5em } &:last-of-type { border-end-end-radius: .5em; border-inline-end-width: 1px }}") |
---|
401 | ocidHeadElement's addChild:(ocidAddElement) |
---|
402 | # |
---|
403 | ocidRootElement's addChild:(ocidHeadElement) |
---|
404 | # |
---|
405 | return ocidRootElement |
---|
406 | end doMakeRootElement |
---|