<?lc put header "Content-Type: text/html; charset=utf-8" ?>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>インターラクティブ 奥の細道 俳句 縦書き</title>
<style type="text/css">
a:link {color: #333; text-decoration: none;}
a:visited {color: #333; }
a:hover {color: #999; }
a:active {color: #999; }
.bodyS { color: #333; font-size: 11px; font-family: SunSans-Regular, sans-serif; line-height: 14px }
.body {font-size:16px; font-family:"MS 明朝","monospace"; } /* 明朝体 */
#container{ font-size:24px; font-family:"MS 明朝","monospace"; position: relative; margin: 0 auto; text-align: right; width: 200px; }
</style>
</head>
<?lc include "script.lc" ?>
<body>
<span class="bodyS">
<a href="http://kenjikojima.com/haiku/"><b>LiveCodeを使って俳句 目次</b></a>
<br>
<a href="index.lc?file=index.lc">LiveCodeプログラミングを見る</a><br>
<a href="mailto:index@kenjikojima.com">index@kenjikojima.com</a><br>
<!--<a href="http://downloads.livecode.com/livecode/">LiveCode Community Server</a>が必要です。<br>
-->
</span>
<div id="container">
<a href="javascript:void(0)" onclick="window.location.reload()">
<?lc
--プログラミング言語は LiveCodeで書いています。
-- データを読み込む
get any line of url ("file:hosomichi.txt")
set the itemDel to comma
-- 上の句、中の句、下の句に分ける
put item 1 of it into tKami
put item 2 of it into tNaka
put item 3 of it into tShimo
put item 4 of it into tSaku
-- 作者を芭蕉か曽良にする
if tSaku is empty then put " 芭蕉" into tSaku
-- 最も長い句の文字数を得る
put max(the num of chars of tKami, the num of chars of tNaka, the num of chars of tShimo) into tMax
-- 長い文字数に空白を揃える
repeat with i = 1 to tMax
if the num of chars of tKami<= tMax then put " " after tKami
if the num of chars of tNaka <= tMax then put " " after tNaka
if the num of chars of tShimo <= tMax then put " " after tShimo
end repeat
-- 文字数を3ステップごとに纏めてゆく
repeat with i=1 to tMax step 3
put char i to i + 2 of tSaku & " " after tHaiku
put char i to i + 2 of tShimo & " " after tHaiku
put char i to i + 2 of tNaka & " " after tHaiku
put char i to i + 2 of tKami & " <br>" &cr after tHaiku
end repeat
-- 縦文字用のカッコに変換
replace "(" with "︵" in tHaiku
replace ")" with "︶" in tHaiku
-- HTMLに出力
put tHaiku
?>
</a>
</div>
</body>
</html>