-
Notifications
You must be signed in to change notification settings - Fork 1
/
MSBlogCalendar.sb
654 lines (636 loc) · 19.2 KB
/
MSBlogCalendar.sb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
' Microsoft Blog Calendar
' Version 0.3
' Copyright © 2018-2019 Nonki Takahashi. The MIT License.
' History:
' 0.3 2019-01-23 Option supported. (NRR644-1)
' 0.2b 2018-12-31 Supported year and month. (NRR644-0)
' 0.1a 2018-03-03 Created. (NRR644)
' Known Issues:
' [1] title including " will break
' [2] dash will be shown as ?
GraphicsWindow.Title = "Microsoft Blog Calendar 0.3"
Init()
Form()
Cal_Init()
buttonClicked = "False"
Controls.ButtonClicked = OnButtonClicked
While "True"
If buttonClicked Then
btn = Controls.LastClickedButton
If btn = btnHTML Or btn = btnText Then
CheckInput()
If error Then
GraphicsWindow.ShowMessage(msg, "Error")
Else
GetBlogInfo()
If btn = btnHTML Then
buf = ""
For year = y1 To y0 Step -1
If Math.Remainder(year, 4) = 0 And Math.Remainder(year, 100) > 0 Or Math.Remainder(year, 400) = 0 Then
dom[2] = 29
Else
dom[2] = 28
EndIf
nol = Math.Floor((year - 1) / 4) - Math.Floor((year - 1) / 100) + Math.Floor((year - 1) / 400) ' number of leap year
woy = Math.Remainder((year + nol), 7) ' week of year
If year = y0 Then
q0 = Text.GetSubText(yq0, 5, 1)
Else
q0 = 1
EndIf
If year = y1 Then
q1 = Text.GetSubText(yq1, 5, 1)
Else
q1 = 4
EndIf
For quoter = q1 To q0 Step -1
m0 = (quoter - 1) * 3 + 1
m1 = m0 + 2
doy = 0 ' days of year
nom = 1 ' number of month
iArticle = nArticle
For m = m0 To m1
While nom < m
doy = doy + dom[nom]
nom = nom + 1
EndWhile
Cal_HTMLMonth()
EndFor
EndFor
EndFor
Controls.SetTextBoxText(tboxCal, buf)
EndIf
EndIf
ElseIf btn = btnNext Then
iBlog = iBlog + 1
If nBlog < iBlog Then
iBlog = 1
EndIf
Shapes.SetText(txtBlog, _b[iBlog])
ElseIf btn = btnPrev Then
iBlog = iBlog - 1
If iBlog < 1 Then
iBlog = nBlog
EndIf
Shapes.SetText(txtBlog, _b[iBlog])
EndIf
buttonClicked = "False"
EndIf
EndWhile
Sub CheckInput
' return yq0 - year and quoter from
' return yq1 - year and quoter to
' return ym0 - year and month from
' return ym1 - year and month to
' return msg - error message
' return error - "True" if error
error = "False"
' check year from
y0 = Controls.GetTextBoxText(tboxYearFrom)
If y0 = "" Then
y0 = Clock.Year
Controls.SetTextBoxText(tboxYearFrom, y0)
EndIf
If y0 < 1 Then
msg = "Illeagal from year (" + y0 + ")"
error = "True"
EndIf
' check year to
y1 = Controls.GetTextBoxText(tboxYearTo)
If y1 = "" Then
y1 = y0
Controls.SetTextBoxText(tboxYearTo, y1)
EndIf
If y1 < 1 Then
msg = "Illeagal to year (" + y1 + ")"
error = "True"
EndIf
If Not[error] Then
' check quoter from
q0 = Controls.GetTextBoxText(tboxQuoterFrom)
If q0 = "" Then
q0 = 1
Controls.SetTextBoxText(tboxQuoterFrom, q0)
EndIf
If (q0 < 1) Or (4 < q0) Then
msg = "Illeagal from quoter (" + q0 + ")"
error = "True"
EndIf
' check quoter to
q1 = Controls.GetTextBoxText(tboxQuoterTo)
If q1 = "" Then
q1 = 4
Controls.SetTextBoxText(tboxQuoterTo, q1)
EndIf
If (q1 < 1) Or (4 < q1) Then
msg = "Illeagal to quoter (" + q1 + ")"
error = "True"
Else
yq0 = Text.Append(y0, q0)
yq1 = Text.Append(y1, q1)
If yq1 < yq0 Then
msg = "To is earlier than from"
error = "True"
EndIf
EndIf
EndIf
If Not[error] Then
m0 = (q0 - 1) * 3 + 1
m1 = (q1 - 1) * 3 + 3
If 9 < m0 Then
ym0 = Text.Append(y0, m0)
Else
ym0 = Text.Append(y0, Text.Append(0, m0))
EndIf
If 9 < m1 Then
ym1 = Text.Append(y1, m1)
Else
ym1 = Text.Append(y1, Text.Append(0, m1))
EndIf
EndIf
EndSub
Sub ConvertTag
' Convert tag for the MSDN blog
' param tagB - tag in the blog
' return tagM - converted tag for the URL
tagM = Text.ConvertToLowerCase(tagB)
len = Text.GetLength(tagM)
For i = 1 To len
If Text.GetSubText(tagM, i, 1) = " " Then
tagM = Text.GetSubText(tagM, 1, i - 1) + "-" + Text.GetSubTextToEnd(tagM, i + 1)
EndIf
EndFor
EndSub
Sub ConvertTitle
' Convert title
' param txt - original title in a tag
' return title - title for HTML
len = Text.GetLength(txt)
title = ""
delim = " " + CR + LF
lastDelim = 0
For i = 1 To len
c = Text.GetSubText(txt, i, 1)
If Not[Text.IsSubText(delim, c)] Then
s = i
i = len ' exit for
EndIf
EndFor
For i = len To 1 Step -1
c = Text.GetSubText(txt, i, 1)
If Not[Text.IsSubText(delim, c)] Then
e = i
i = 1 ' exit for
EndIf
EndFor
title = Text.GetSubText(txt, s, e - s + 1)
EndSub
Sub ConvertText
' Convert &*; to unicode character
' param txt
' return txt
While Text.IsSubText(txt, "&") And Text.IsSubText(txt, ";")
c = Text.GetIndexOf(txt, "&")
l = Text.GetIndexOf(Text.GetSubTextToEnd(txt, c), ";")
kw = Text.GetSubText(txt, c + 1, l - 2)
If Text.StartsWith(kw, "#") Then
txtMid = Text.GetCharacter(Text.GetSubTextToEnd(kw, 2))
ElseIf kw = "quot" Then
txtMid = Text.GetCharacter(34)
Else
txtMid = ""
EndIf
txtLeft = Text.GetSubText(txt, 1, c - 1)
txtRight = Text.GetSubTextToEnd(txt, c + l)
txt = Text.Append(txtLeft, Text.Append(txtMid, txtRight))
EndWhile
EndSub
Sub FindPost
' param year - to find
' param m - the month to find
' param d - the day to find
' return post - found post
post = ""
_post = blog[iArticle]
If (_post["year"] * 10000 + _post["month"] * 100 + _post["day"]) <= (year * 10000 + m * 100 + d) Then
While (1 < iArticle) And ((_post["year"] * 10000 + _post["month"] * 100 + _post["day"]) < (year * 10000 + m * 100 + d))
iArticle = iArticle - 1
_post = blog[iArticle]
EndWhile
If (_post["year"] = year) And (_post["month"] = m) And (_post["day"] = d) Then
post = _post
EndIf
EndIf
EndSub
Sub FindTag
' Find tag from html buffer
' param["tag"] - tag name
' param["class"] - class name
' param["rel"] - rel name
' param p - pointer for buffer
' param buf - html buffer
' return tag - found tag
pSave = p
tag = ""
findNext = "True"
While findNext
findNext = "False" ' tag may be not found
pTag = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), LT + param["tag"] + " ")
If 0 < pTag Then
pTag = p + pTag - 1
len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, pTag), "/" + param["tag"] + ">")
If 0 < len Then
findNext = "True" ' tag may be different
lTag = Text.GetLength(param["tag"]) + 1
len = len + lTag
tag = Text.GetSubText(buf, pTag, len)
Stack.PushValue("local", pTag)
GetAttrAndText()
pTag = Stack.PopValue("local")
If param["class"] <> "" Then
target = "class"
Else
target = "rel"
EndIf
If param[target] = attr[target] Then
findNext = "False" ' found the tag
Else
tag = ""
EndIf
p = pTag + len
EndIf
EndIf
EndWhile
If tag = "" Then
p = pSave
EndIf
EndSub
Sub Form
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = "LightGray"
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(7, 9, "From")
tboxYearFrom = Controls.AddTextBox(46, 5)
Controls.SetSize(tboxYearFrom, 50, 22)
GraphicsWindow.DrawText(100, 9, "Q")
tboxQuoterFrom = Controls.AddTextBox(110, 5)
Controls.SetSize(tboxQuoterFrom, 30, 22)
GraphicsWindow.DrawText(7, 37, "To")
tboxYearTo = Controls.AddTextBox(46, 32)
Controls.SetSize(tboxYearTo, 50, 22)
GraphicsWindow.DrawText(100, 37, "Q")
tboxQuoterTo = Controls.AddTextBox(110, 32)
Controls.SetSize(tboxQuoterTo, 30, 22)
GraphicsWindow.DrawText(190, 9, "Blog")
GraphicsWindow.PenColor = "Gray"
GraphicsWindow.PenWidth = 1
GraphicsWindow.DrawRectangle(230, 5, 150, 22)
txtBlog = Shapes.AddText(_b[iBlog])
Shapes.Move(txtBlog, 236, 9)
btnPrev = Controls.AddButton("◀", 386, 3)
btnNext = Controls.AddButton("▶", 410, 3)
btnText = Controls.AddButton("Text", 190, 32)
btnHTML = Controls.AddButton("HTML", 240, 32)
GraphicsWindow.FontName = "Courier New"
tboxCal = Controls.AddMultiLineTextBox(5, 59)
Controls.SetSize(tboxCal, gw - 10, gh - 64)
EndSub
Sub GetAttrAndText
' Get attributes and text from given tag
' param tag - given tag
' return attr[] - array of attributes in the tag
' return txt - text in the tag
pTag = Text.GetIndexOf(tag, " ") + 1
pEnd = Text.GetIndexOf(tag, ">")
attr = ""
While pTag <= pEnd
pEq = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), "=")
If 0 < pEq Then
pEq = pTag + pEq - 1
pQ = Text.GetIndexOf(SQ + WQ, Text.GetSubText(tag, pEq + 1, 1))
If 0 < pQ Then
Q = Text.GetSubText(SQ + WQ, pQ, 1)
pQ = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pEq + 2), Q)
If 0 < pQ Then
pQ = pEq + 2 + pQ - 1
txt = Text.GetSubText(tag, pEq + 2, pQ - pEq - 2)
ConvertText()
attr[Text.GetSubText(tag, pTag, pEq - pTag)] = txt
pTag = pQ + 2
EndIf
Else ' to avoid hang with no quotes after equal
txt = Text.GetSubText(tag, pEq + 2, pEnd - pEq - 2)
ConvertText()
attr[Text.GetSubText(tag, pTag, pEq - pTag)] = txt
pTag = pEnd + 1
EndIf
Else
pTag = pEnd + 1
EndIf
EndWhile
len = Text.GetLength(tag)
txt = ""
While pTag <= len
pL = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), LT)
If pL = 0 Then
txt = Text.Append(txt, Text.GetSubTextToEnd(tag, pTag))
pTag = len + 1
Else
pL = pTag + pL - 1
txt = Text.Append(txt, Text.GetSubText(tag, pTag, pL - pTag))
pR = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), ">")
If 0 < pR Then
pTag = pTag + pR
Else
pTag = len + 1
EndIf
EndIf
EndWhile
EndSub
Sub GetBlogInfo
' param iBlog - index of blog information arrays
' param ym0 - year and month from
' param ym1 - year and mont to
' return blog - blog post array
auth = _a[iBlog]
site = _s[iBlog]
blog = _b[iBlog]
tagB = _t[iBlog]
index = Array.GetAllIndices(auth)
_auth = auth[index[1]]
If tagB <> "" Then
ConvertTag()
folder = "/" + blog + "/tag/" + tagM + "/"
Else
folder = "/" + blog + "/"
EndIf
nPosts = 0
maxPage = 1
outbuf = ""
Controls.SetTextBoxText(tboxCal, outbuf)
block = ""
nArticle = 0
For page = 1 To maxPage
If page = 1 Then
pg = ""
Else
pg = "page/" + page + "/"
EndIf
url = site + folder + pg + "?orderby=date"
buf = Network.GetWebPageContents(url)
p = 1
eod = "False"
If page = 1 Then
param = "tag=a;class=for-desktop;"
FindTag()
GetAttrAndText()
ConvertTitle()
blog["title"] = title
blog["tag"] = tagB
EndIf
While Not[eod]
param = "tag=a;rel=bookmark;"
FindTag()
If tag = "" Then
eod = "True"
Else
ym = ""
GetAttrAndText()
ConvertText()
post["url"] = attr["href"]
post["title"] = txt
param = "tag=time;class=entry-date published updated;"
FindTag()
If tag = "" Then
eod = "True"
Else
GetAttrAndText()
post["date"] = txt
ParseDate()
If 9 < post["month"] Then
ym = Text.Append(post["year"], post["month"])
Else
ym = Text.Append(post["year"], Text.Append(0, post["month"]))
EndIf
param = "tag=a;class=url fn n profile-usercard-hover;"
FindTag()
If tag = "" Then
post["by"] = _auth
Else
GetAttrAndText()
post["by"] = txt
If Array.ContainsIndex(auth, post["by"]) Then
post["by"] = auth[post["by"]]
EndIf
EndIf
EndIf
If (ym <> "") And (ym0 <= ym) And (ym <= ym1) Then
nArticle = nArticle + 1
blog[nArticle] = post
outbuf = outbuf + "blog[" + nArticle + "] = " + WQ + post + WQ + CR + LF
Controls.SetTextBoxText(tboxCal, outbuf)
EndIf
If (ym <> "") And (ym < ym0) Then
eod = "True"
EndIf
EndIf
EndWhile
If page = 1 Then
param = "tag=a;class=page-numbers;"
FindTag()
While tag <> ""
tagSave = tag
FindTag()
EndWhile
tag = tagSave
GetAttrAndText()
maxPage = txt
EndIf
If (ym <> "") And (ym < ym0) Then
page = maxPage
EndIf
EndFor
EndSub
Sub Init
Not = "True=False;False=True;"
AMP = "&"
CR = Text.GetCharacter(13)
LF = Text.GetCharacter(10)
LT = "<"
SQ = "'"
WQ = Text.GetCharacter(34)
' Small Basic
_b[1] = "smallbasic"
_s[1] = "https://blogs.msdn.microsoft.com/"
_a[1] = "Ed Price - MSFT=Ed;litdev=LitDev;Qazwsxedc Qazwsxedc=Noar Buscher;Nonki Takahashi=Nonki;"
_t[1] = ""
' User Ed
_b[2] = "user_ed"
_s[2] = "https://blogs.msdn.microsoft.com/"
_a[2] = "Ed Price - MSFT=Ed;"
_t[2] = "Small Basic"
' Wiki Ninjas
_b[3] = "wikininjas"
_s[3] = "https://blogs.technet.microsoft.com/"
_a[3] = ""
_t[3] = ""
' Azure Development Community
_b[4] = "azuredev"
_s[4] = "https://blogs.msdn.microsoft.com/"
_a[4] = ""
_t[4] = ""
iBlog = 1
nBlog = Array.GetItemCount(_b)
EndSub
Sub OnButtonClicked
buttonClicked = "True"
EndSub
Sub ParseDate
' param post["date"]
' return post["year"]
' return post["month"]
' return post["day"]
For m = 1 To 12
If Text.StartsWith(post["date"], name[m]) Then
post["month"] = m
m = 12 ' exit For
EndIf
EndFor
len = Text.GetLength(name[post["month"]])
comma = Text.GetIndexOf(post["date"], ",")
post["day"] = Text.GetSubText(post["date"], len + 2, comma - len - 2)
post["year"] = Text.GetSubTextToEnd(post["date"], comma + 2)
EndSub
Sub Cal_HTMLMonth
' Calender | Print month
' param year - year
' param quoter - quoter
' param m - month
' param m0, m1 - start and end of quoter
' param doy - days of year
' param woy - week of year
If m = m0 Then
' header
yy = Text.GetSubTextToEnd(year, 3)
If Text.GetSubText(yy, 1, 1) = 0 Then
yy = "_" + Text.GetSubText(yy, 2, 1)
EndIf
If Text.GetSubText(yy, 2, 1) = 0 Then
yy = Text.GetSubText(yy, 1, 1) + "_"
EndIf
buf = buf + sp[8] + LT + "h1>" + LT + "a name="+ WQ
buf = buf + "Q" + quoter + "_" + yy
buf = buf + WQ + ">" + LT + "/a>Q" + quoter
buf = buf + " " + year + LT + "/h1>" + CR + LF
buf = buf + sp[8] + LT + "p>Move mouse on an author to show the title "
buf = buf + "of the post." + LT + "/p>" + CR + LF
buf = buf + sp[8] + LT + "table width=" + WQ + "95%" + WQ
buf = buf + " line-height: 18.83px; margin-left: 1px;"
buf = buf + " border-collapse: collapse; border=" + WQ + "0" + WQ
buf = buf + " cellspacing=" + WQ + "0" + WQ
buf = buf + " cellpadding=" + WQ + "0" + WQ + ">" + CR + LF
buf = buf + sp[12] + LT + "tbody>" + CR + LF
buf = buf + sp[16] + LT + "tr>" + CR + LF
buf = buf + sp[20] + LT + "td valign=" + WQ + "top" + WQ
buf = buf + " style=" + WQ + "padding: 0in 5.4pt; border: 1pt solid"
buf = buf + " windowtext; width: " + c1w + "pt; background-color:"
buf = buf + " silver;" + WQ + ">" + CR + LF
buf = buf + sp[20] + LT + "strong>Dates:" + LT + "/strong>" + LT
buf = buf + "/td>" + CR + LF
For i = 1 To 7
buf = buf + sp[20] + LT + "td valign=" + WQ + "top" + WQ
buf = buf + " style=" + WQ + "border-color: windowtext windowtext"
buf = buf + " windowtext silver; padding: 0in 5.4pt; width:"
buf = buf + " " + cw[Math.Remainder(i, 7)] + "pt;"
buf = buf + " border-top-width: 1pt; border-right-width: 1pt;"
buf = buf + " border-bottom-width: 1pt; border-top-style: solid;"
buf = buf + " border-right-style: solid; border-bottom-style:"
buf = buf + " solid; background-color: silver;" + WQ + ">" + CR + LF
buf = buf + sp[20] + LT + "strong>" + week[Math.Remainder(i, 7)]
buf = buf + LT + "/strong>" + LT + "/td>" + CR + LF
EndFor
buf = buf + sp[16] + LT + "/tr>" + CR + LF
EndIf
w = Math.Remainder((doy + woy), 7)
d1 = Math.Remainder(8 - w, 7) + 1
For day = d1 To dom[m] Step 7
m2 = m
day2 = day + 6
If dom[m] < day2 Then
m2 = m + 1
If 12 < m2 Then
m2 = 1
EndIf
day2 = day2 - dom[m]
EndIf
buf = buf + sp[16] + LT + "tr>" + CR + LF
buf = buf + sp[20] + LT + "td valign=" + WQ + "top" + WQ
buf = buf + " style=" + WQ + "border-color: silver windowtext"
buf = buf + " windowtext; padding: 0in 5.4pt; width: " + c1w + "pt;"
buf = buf + " border-right-width: 1pt; border-bottom-width: 1pt;"
buf = buf + " border-left-width: 1pt; border-right-style: solid;"
buf = buf + " border-bottom-style: solid; border-left-style:"
buf = buf + " solid;" + WQ + ">" + CR + LF
buf = buf + sp[20] + m + "/" + day + " - " + m2 + "/" + day2
buf = buf + LT + "/td>" + CR + LF
d = day
_m = m
For i = 1 To 7
buf = buf + sp[20] + LT + "td valign=" + WQ + "top" + WQ
buf = buf + " style=" + WQ + "border-color: silver windowtext"
buf = buf + " windowtext silver; padding: 0in 5.4pt; width:"
buf = buf + " " + cw[Math.Remainder(i, 7)] + "pt;"
buf = buf + " border-right-width: 1pt; border-bottom-width: 1pt;"
buf = buf + " border-right-style: solid; border-bottom-style:"
FindPost()
If post = "" Then
buf = buf + " solid;" + WQ + ">" + CR + LF
buf = buf + sp[20] + AMP + "nbsp;" + LT + "/td>" + CR + LF
Else
buf = buf + " solid;" + WQ + CR + LF
buf = buf + sp[20] + "title=" + WQ + post["title"]
buf = buf + WQ + ">" + CR + LF
buf = buf + sp[20] + LT + "a href=" + WQ + post["url"]
buf = buf + WQ + ">" + post["by"] + LT + "/a>" + LT + "/td>" + CR + LF
EndIf
d = d + 1
If dom[m] < d Then
d = 1
m = m + 1
EndIf
EndFor
m = _m
buf = buf + sp[16] + LT + "/tr>" + CR + LF
EndFor
If m = m1 Then
' footer
buf = buf + sp[12] + LT + "/tbody>" + CR + LF
buf = buf + sp[8] + LT + "/table>" + CR + LF
buf = buf + sp[8] + LT + "br>" + CR + LF
EndIf
EndSub
Sub Cal_Init
' Calender | Initialize days of month
dom = "1=31;2=28;3=31;4=30;5=31;6=30;7=31;8=31;9=30;10=31;11=30;12=31;"
name = "1=January;2=February;3=March;4=April;5=May;6=June;7=July;"
name = name + "8=August;9=September;10=October;11=November;12=December;"
week = "0=Sunday;1=Monday;2=Tuesday;3=Wednesday;4=Thursday;5=Friday;"
week = week + "6=Saturday;"
c1w = 52
c1w = 58.8
' column width [pt] for days of week
cw = "1=80;2=71.85;3=82.2;4=80.8;5=88.05;6=70.15;0=53.3;"
cw = "1=44.35;2=48.3;3=61.05;4=46.8;5=37.05;6=49.8;0=40.8;"
For n = 8 To 20 Step 4
sp[n] = Text.GetSubText(" ", 1, n)
EndFor
EndSub
Sub Cal_DumpBlog
' Calender | Dump blog array
For i = 1 To nArticle
buf = buf + blog[i] + CR + LF
EndFor
EndSub