File: nanoblogger.html

package info (click to toggle)
nanoblogger 3.3-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 640 kB
  • ctags: 133
  • sloc: sh: 2,958; xml: 98; makefile: 33
file content (1740 lines) | stat: -rw-r--r-- 55,093 bytes parent folder | download
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
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
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
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta name="generator" content="HTML Tidy for MkLinux (vers 1 September 2005), see www.w3.org" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>NanoBlogger User Manual</title>
<style type="text/css">
/*<![CDATA[*/
        <!--
body {
        font-family:verdana, arial, sans-serif;
        font-size:11px;
        line-height:14px;
        margin:20px 20px 20px 20px;
        background:#FFFFFF;
        }

table {
        color:#333; 
        font-size:10px;
        border:1px solid #999;
        }
th {
        background:#CCC;
        }
td {
        background:#EEE;
        }

div.tables { margin:10px; padding:4px; }

h1, h2, h3 {
        font-family:verdana, arial, sans-serif;
        font-color:#333;
        }

p {
        color:#333;
        line-height:15px;
        }

pre {
        font-family:geneva, verdana, arial, sans-serif;
        font-size:11px;
        color:#333;
        line-height:15px;
        background-color: #EEE;
        border: 1px solid #333;
        padding: 2px;
        margin-left: 30px;
        margin-right: 75px;
        }
        
ol { 
        color:#333; 
        font-family: verdana, helvetica, sans-serif; 
        font-size: 11px; 
        line-height:14px;  }
        
ul { 
        color:#333; 
        font-family: verdana, helvetica, sans-serif; 
        font-size: 11px; 
        list-style: square; 
        line-height:14px;  }

li { 
        font-family: verdana, helvetica, sans-serif;
        color:#333; 
        font-size: 11px; 
        margin-left: 0px; 
        margin-right: 0px; 
        margin-top: 6px; 
        margin-bottom: 0px;
        line-height:14px;
        }

.underline {
        text-decoration: underline;
        }

.warning {
        text-decoration: underline overline;
        }
        
.copyright {
        border-top: 1px solid #999;
        font-family:verdana, arial, sans-serif;
        font-size:10px;
        color:#999;
        line-height:15px;
        }       
        -->
/*]]>*/
</style>
</head>

<body>
  <div id="summary" style="border-top: 1px solid #999; border-bottom: 1px solid #999;">
    <h1>NanoBlogger User Manual</h1>

    <h2>by <a href="mailto:n1xt3r{-at-symbol-}fastmail.fm">n1xt3r</a> (Kevin Wood)</h2>

    <p><em>The official guide to the NanoBlogger weblog engine.</em></p>
  </div>

  <div id="toc">
    <p><b>Table of Contents</b></p>

    <table summary="toc" style="border:0px;">
      <tr>
        <td>1.</td>

        <td><a href="#s.1">Introduction</a></td>
      </tr>

      <tr>
        <td>2.</td>

        <td><a href="#s.2">Features</a></td>
      </tr>

      <tr>
        <td>3.</td>

        <td><a href="#s.3">Requirements</a></td>
      </tr>

      <tr>
        <td>4.</td>

        <td><a href="#s.4">Getting Started</a></td>
      </tr>

      <tr>
        <td>5.</td>

        <td><a href="#s.5">Settings and Configuration</a></td>
      </tr>

      <tr>
        <td>6.</td>

        <td><a href="#s.6">Managing Entries and Categories</a></td>
      </tr>

      <tr>
        <td>7.</td>

        <td><a href="#s.7">Templates</a></td>
      </tr>

      <tr>
        <td>8.</td>

        <td><a href="#s.8">About Plugins</a></td>
      </tr>

      <tr>
        <td>9.</td>

        <td><a href="#s.9">Writing Plugins</a></td>
      </tr>

      <tr>
        <td>10.</td>

        <td><a href="#s.10">Publishing</a></td>
      </tr>

      <tr>
        <td>11.</td>

        <td><a href="#s.11">Adding Support for Comments</a></td>
      </tr>

      <tr>
        <td>12.</td>

        <td><a href="#s.12">Importing Entries</a></td>
      </tr>

      <tr>
        <td>13.</td>

        <td><a href="#s.13">Tips and Tricks</a></td>
      </tr>

      <tr>
        <td>14.</td>

        <td><a href="#s.14">Credits</a></td>
      </tr>
    </table>
  </div>

  <div id="intro">
    <h2><a id="s.1" name="s.1">1. Introduction</a></h2>NanoBlogger is a small weblog engine written in Bash for the command line. It uses common UNIX tools, such as cat, grep and sed to create static HTML content. It's free to use and modify under the GNU General Public License.
  </div>

  <div id="synopsis">
    <p><b>Synopsis</b></p>
    <pre>
 
nb [<span class="underline">-b blog_dir</span>] [<span class="underline">options</span>]
        
</pre>

    <h2><a id="s.2" name="s.2">2. Features</a></h2>

    <ul>
      <li>intuitive command line interface</li>

      <li>highly configurable and script-able :)</li>

      <li>easy drafting, editing and management of entries</li>

      <li>archiving by category, year, month, day, and entry</li>

      <li>pagination</li>

      <li>permanent and navigational links</li>

      <li>templates and CSS style sheets for full control over layout</li>

      <li>placeholders for easy template manipulation</li>

      <li>support for multiple weblogs</li>

      <li>support for multiple categories</li>

      <li>support for relative and absolute links</li>

      <li>support for date manipulation of entries</li>

      <li>Atom syndication (comes with 1.0 format)</li>

      <li>RSS syndication (comes with RSS 2.0 and 1.0 formats)</li>

      <li>plugins for calendar, recent entries, weblog status, etc.</li>

      <li>plugins for text formatting (e.g. line breaks translate to HTML)</li>

      <li>global (nb.conf) and per-weblog (blog.conf) configuration</li>

      <li>intelligent update system - only updates relative files</li>

      <li>simple cache system for improved efficiency</li>

      <li>independent of java-script and server-side scripting (e.g. PHP)</li>

      <li>independent of external database (stores data in flat-files)</li>

      <li>multi-language support</li>

      <li>multi-platform portability (just Bash and the required commands)</li>
    </ul>
  </div>

  <h2><a id="s.3" name="s.3">3. Requirements</a></h2>Programs:

  <p>Bash (at least v2.05), cat, cp, cut, dirname, date*, expr, grep, mkdir, mv, read, rm, sed, sort, touch</p>

  <p>* = GNU version recommended, but not required</p>

  <h2><a id="s.4" name="s.4">4. Getting Started</a></h2>

  <p><b>Creating a New Weblog</b></p>

  <p>To create a new weblog (from your shell prompt):</p>
  <pre>
nb --blogdir [myblog_dir] --add
        
</pre>where <em>myblog_dir</em> is a nonexistent directory. This will create a new directory, copy the default files over and finally let you edit the weblog's configuration. Multiple weblogs can be created this way. Running the same command again on an existing weblog directory will add a new entry.

  <p>To set a default weblog directory:</p>
  <pre>
1. edit either nb.conf or $HOME/.nb.conf.
2. set BLOG_DIR to your weblog directory:
        BLOG_DIR="$HOME/public_html/[myblog_dir]"
        
</pre>

  <p>You may also change to the weblog's directory and NanoBlogger will automatically set <em>$BLOG_DIR</em> for you, so you don't have to specify it from the command line.</p>

  <div id="config">
    <h2><a id="s.5" name="s.5">5. Settings and Configuration</a></h2>To edit the weblog's configuration invoke:
    <pre>
nb --blogdir [myblog_dir] --configure -u all
        
</pre>This opens <em>blog.conf</em> from the weblog directory for editing and updates the entire weblog.

    <p><b>Setting the Browser</b></p>

    <p><em>NB_BROWSER</em> specifies the browser to use and defaults to the standard <em>BROWSER</em> variable. You can specify a different browser to use by setting <em>NB_BROWSER</em> in <em>blog.conf</em>. In Mac OS X, you might choose to set this to "open". If no browser is specified, "lynx" will be used.</p>

    <p><b>Setting the Editor</b></p>

    <p><em>NB_EDITOR</em> specifies the editor to use and defaults to the standard <em>EDITOR</em> variable. You can specify a different editor to use by setting <em>NB_EDITOR</em> in <em>blog.conf</em>. If no editor is specified, "vi" will be used.</p>

    <p><b>Setting the Date Format for New Entries</b></p>

    <p><em>DATE_FORMAT</em> specifies the date format to use for new entries. The default is to use the output from the <em>date</em> command. You can also specify the locale to be used for date command (see the variable <em>DATE_LOCALE</em>). You can specify additional command line arguments with <em>DATE_ARGS</em>, useful for specifying time in UTC. Please note that these settings have <strong>no effect</strong> on previous entries and that if you use UTC, beware of race conditions which can occur because the entry's filename will be out of synch. The solution is to also change <em>DB_DATEARGS</em> to equal <em>DATE_ARGS</em>, so that the two reflect the same date and time. Read the man pages of the date command to see how to customize the format of the date command's output.</p>

    <p>Examples:</p>
    <pre>
DATE_FORMAT="%m.%d.%Y %H:%M"
DATE_LOCALE="$LANG"
DATE_ARGS="-u"   
</pre>

    <p><b>Setting the Timezone for Syndication Feeds</b></p>

    <p><em>BLOG_TZD</em> sets the timezone for your weblog's syndication feeds. The default is to set this automatically using, <code>"%z"</code>, a non-standard extension of the date command. If the date command on your system doesn't support this, you'll have to set this manually.</p>

    <p>Example:</p>
    <pre>
BLOG_TZD="-0:500"
   
</pre>

    <p><b>Setting the Encoding</b></p>

    <p><em>BLOG_CHARSET</em> sets the character encoding to be used for your weblog.</p>

    <p>Example:</p>
    <pre>
BLOG_CHARSET="iso-8859-1"

</pre>

    <p><span class="warning">WARNING</span>: If you have the Tidy plugin enabled, this setting will be overridden by Tidy. Please, refer to Tidy's documentation for setting the character encoding.</p>

    <p><b>Setting the Mime Type</b></p>

    <p><em>BLOG_MIMETYPE</em> sets the mime type to be used for your weblog.</p>

    <p>Example:</p>
    <pre>
BLOG_MIMETYPE="text/html"
   
</pre>

    <p><b>Setting the Web Address</b></p>

    <p><em>BLOG_URL</em> should be set as the full URL to your weblog excluding the index file and any preceding "/". This setting is required for absolute links and syndication feeds.</p>

    <p>Example:</p>
    <pre>
BLOG_URL="http://my-site.com/weblog"
   
</pre>

    <p><b>Setting the Style Sheet</b></p>

    <p><em>BLOG_CSS</em> sets the style sheet to be used by your weblog. Style sheets are located in the <em>styles</em> directory.</p>

    <p>Example:</p>
    <pre>
BLOG_CSS="styles/nb_rusted.css"
</pre>

    <p><b>Setting the Favorite Icon</b></p>

    <p><em>BLOG_ICON</em> sets the favorite icon to be used by your weblog. Favorite icons are located in the <em>images</em> directory.</p>

    <p>Example:</p>
    <pre>
BLOG_ICON="images/favicon.ico"
</pre>

    <p><b>Toggling display of Directory's Index File in Links</b></p>

    <p><em>SHOW_INDEXFILE</em> toggles display of a directory index file in links. Defaults to "1", enabled.</p>

    <p><b>Setting the Author's Name</b></p>

    <p><em>BLOG_AUTHOR</em> can be used to set the author's name, the default is to set the author's name using the common USER variable. Setting <em>BLOG_AUTHOR</em> will override this behavior.</p>

    <p><b>Setting the Maximum Number of Entries to Display for the Main Page</b></p>

    <p><em>MAX_ENTRIES</em> sets the maximum number of entries that get displayed on the main page(s). Defaults to "10".</p>

    <p><b>Setting the Maximum Number of Entries to Display for Each Page</b></p>

    <p><em>MAX_PAGE_ENTRIES</em> sets the maximum number of entries to display for each page. Defaults to "$MAX_ENTRIES". The default for splitting archives and other such pages.</p>

    <p><em>MAX_CATPAGE_ENTRIES</em> sets the maximum number of entries to display for each page of category archives. Defaults to "$MAX_PAGE_ENTRIES". The category archives will split when the number of entries is greater than <em>$MAX_CATPAGE_ENTRIES</em>.</p>

    <p><em>MAX_MONTHPAGE_ENTRIES</em> sets the maximum number of entries to display for each page of month archives. Defaults to "$MAX_PAGE_ENTRIES". The month archives will split when the number of entries is greater than <em>$MAX_MONTHPAGE_ENTRIES</em>.</p>

    <p><em>MAX_MAINPAGE_ENTRIES</em> sets the maximum number of entries to display for each main page. Defaults to "$MAX_PAGE_ENTRIES". The main page will split when <em>$MAX_MAINPAGE_ENTRIES</em> is less than <em>$MAX_ENTRIES</em>.</p>

    <p><b>Setting the Default Text Formatting</b></p>

    <p><em>ENTRY_FORMAT</em> specifies the default text formatting to use for an entry. Defaults to "raw".</p>

    <p><b>Toggling the Building of Entry Archives</b></p>

    <p>Setting <em>ENTRY_ARCHIVES</em> to equal "1", enables the building of entry archives and reconfigures the links of the entries to point to their own archive page. Note that this will increase the rebuild time since more pages will have to be generated.</p>

    <p><b>Special Category Archiving Preferences</b></p>

    <p><em>CATARCH_DATATYPE</em> determines the set of data to load for the category archives. There's two types of data that can be specified, "ALL" or "NOBODY".</p>
    <pre>
ALL = full entry metadata (slow and bigger cache)
NOBODY = all except entry's BODY metadata (faster and smaller cache)
    
</pre>

    <p><span class="warning">IMPORTANT</span>: Please edit <a href="#s.7">category_entry.htm</a> accordingly.</p>

    <p><b>Setting the Chronological Order</b></p>

    <p><em>CHRON_ORDER</em> specifies the chronological order of the weblog's archive - 0/1 = normal/reverse. Defaults to "1", reverse order.</p>

    <p><b>Setting Actions for Previewing and Publishing</b></p>

    <p><em>BLOG_PREVIEW_CMD</em> and <em>BLOG_PUBLISH_CMD</em> may both be set to a custom command to run when invoked by their respective options, <em>--preview</em> and <em>--publish</em>.</p>

    <p><b>Setting the Cache Preferences</b></p>

    <p><em>MAX_CACHE_ENTRIES</em> sets the maximum number of entries to store in the cache. Defaults to "$MAX_ENTRIES".</p>

    <p>Setting <em>BLOG_CACHEMNG</em> to "0" disables automatic management of the cache. The cache may be managed manually using the <code>--update-cache</code> command line option.</p>

    <p><b>Toggling Interactive Mode</b></p>

    <p><em>BLOG_INTERACTIVE</em> toggles interactive mode for your weblog and has the same effect as the <code>--interactive</code> command line option. The default is "0" for disabled, setting to "1" will toggle the mode back on.</p>

    <p><b>Changing the File Type</b></p>

    <p><em>NB_FILETYPE</em> specifies the file type or rather the suffix for the generated files. The default is set to "html".</p>

    <p><b>Changing the Default Query Mode</b></p>

    <p><em>QUERY_MODE</em> specifies the default query mode for listing entries and displaying them on the main page. Defaults to "$MAX_ENTRIES".</p>

    <p><b>Links Configuration</b></p>

    <p><em>ABSOLUTE_LINKS</em> toggles between absolute and relative links. Defaults to "0", relative links.</p>

    <p><em>FRIENDLY_LINKS</em> toggles between friendly and unfriendly links. Friendly links are more text based, where unfriendly links are more numbers based. Defaults to "1", friendly links.</p>

    <p><em>MAX_TITLEWIDTH</em> sets the maximum title width (by number of characters) generated for friendly links.</p>

    <p><em>CATEGORY_LINKS</em> toggles the display of an entry's category links. The default is to display category links.</p>

    <p><em>PERMALINKS</em> toggles the display of an entry's permanent link. The default is to display permanent links.</p>

    <p><b>Plugins Configuration</b></p>

    <p><em>PLUGINS_DIR</em> specifies the directory location of the main plugins. Main plugins provide a standard mechanism for loading plugins on a global basis. The default is set to <em>$NB_BASE_DIR/plugins</em>.</p>

    <p><em>USR_PLUGINSDIR</em> specifies the directory location of the user plugins. User plugins provide a standard mechanism for loading plugins on a per-weblog basis. User plugins can override main plugins, just keep the names the same. The default is set to <em>$BLOG_DIR/plugins</em>.</p>

    <p><b>Global Configuration</b></p>

    <p>NanoBlogger has it's own configuration file, <em>$NB_BASE_DIR/nb.conf</em> that holds settings which effect all weblogs. The global configuration file is read first meaning that settings in the weblog's configuration may override settings in <em>$NB_BASE_DIR/nb.conf</em>. This configuration is also looked for under the file, <em>$HOME/.nb.conf</em>.</p>

    <p><b>Changing the Default Language of NanoBlogger</b></p>

    <p><em>NB_LANG</em> is a global configuration variable that sets the language definition to load. The default is "en" for English. All language definitions should be referenced by their ISO 639-2 code.</p>

    <p>Example for Spanish:</p>
    <pre>
NB_LANG="es"
    
</pre>

    <p><b>Creating Language Definitions</b></p>

    <p>Creating language definitions is fairly straightforward:</p>

    <ol>
      <li>start with the default "en" set.</li>

      <li>redefine all the variables to their equivalent translation in the target language.</li>

      <li>save the translated set to a sub-directory named after it's ISO 639-2 alpha-3 or alpha-2 code under the "lang" directory.</li>
    </ol>
  </div>

  <div id="mgmt">
    <h2><a id="s.6" name="s.6">6. Managing Entries and Categories</a></h2>Commands to manage entries and categories.

    <h3>Managing Entries</h3>

    <p><b>Entry ID's</b></p>

    <p>The latest entry added, will always have an ID of "1", entry's added before that will have ID's of higher values. An entry will have a different ID for each category it belongs in. When modifying entries from a category, ID's for both category and entry must be specified.</p>

    <p><b>Drafting Entries</b></p>

    <p>Creating a new draft:</p>
    <pre>
nb [-b blog_dir] --draft draft.txt
    
</pre>

    <p>Importing the draft as a new entry:</p>
    <pre>
nb [-b blog_dir] --file draft.txt -a
    
</pre>

    <p><b>Creating Entries</b></p>

    <p>Adding a new entry:</p>
    <pre>
nb [-b blog_dir] -a
        
</pre>Adding a new entry to a category:
    <pre>
nb [-b blog_dir] -c 1 -a
        
</pre>Setting title and author for new entry:
    <pre>
nb [-b blog_dir] -t "New Entry" -n [entry_author] -a
        
</pre>Setting title, author, and body for new entry:
    <pre>
nb [-b blog_dir] -t "New Entry" -n [entry_author] -T "This is my message." -a
        
</pre>Importing new entry from file:
    <pre>
nb [-b blog_dir] --file draft.txt -a
</pre>

    <p><b>Listing Entries</b></p>

    <p>Listing current entries:</p>
    <pre>
nb [-b blog_dir] -l
        
</pre>Listing all entries:
    <pre>
nb [-b blog_dir] -l all
        
</pre>Listing entries for a category:
    <pre>
nb [-b blog_dir] -c 1 -l
        
</pre>

    <p><b>Editing Entries</b></p>

    <p>Editing the last entry created:</p>
    <pre>
nb [-b blog_dir] -e 1
        
</pre>Editing an entry from a category:
    <pre>
nb [-b blog_dir] -c 1 -e 1
        
</pre>Editing multiple entries:
    <pre>
nb [-b blog_dir] -e 1,2,3
        
</pre>

    <p><b>Moving Entries</b></p>

    <p>Moving an entry to a category:</p>
    <pre>
nb [-b blog_dir] -c 1 -m 1
        
</pre>Moving an entry to multiple categories:
    <pre>
nb [-b blog_dir] -c 1,2,3 -m 1
        
</pre>Moving multiple entries to a category:
    <pre>
nb [-b blog_dir] -c 1 -m 1,2,3
        
</pre>

    <p><b>Deleting Entries</b></p>

    <p>Permanently deleting an entry:</p>
    <pre>
nb [-b blog_dir] -d 1
        
</pre>Permanently deleting multiple entries:
    <pre>
nb [-b blog_dir] -d 1,2,3
        
</pre>Deleting an entry from a category:
    <pre>
nb [-b blog_dir] -c 1 -d 1
        
</pre>

    <p><b>Changing Entry's Date</b></p>

    <p>Specifying a new entry's date using the TIMESTAMP metatag:</p>
    <pre>
nb [-b blog_dir] --tag TIMESTAMP --tag-text "YYYY-MM-DD HH:MM:SS" -a
    
</pre>Changing an old entry's date:
    <pre>
nb [-b blog_dir] --tag TIMESTAMP --tag-text "YYYY-MM-DD HH:MM:SS" -e 2
     
</pre>Manually changing an entry's date:
    <pre>
1. nb [-b blog_dir] -e 2
2. TIMESTAMP: YYYY-MM-DD HH:MM:SS
     
</pre><em>The date command must support the "<code>-d</code>" option for the date to follow the format set by "<code>$DATE_FORMAT</code>".</em>

    <h3>Managing Categories</h3>

    <p><b>Category ID's</b></p>

    <p>Category ID's count up from "1". A category's ID remains constant until that category is deleted. Deleting a category will free up that category's ID for use by a new category upon creation.</p>

    <p><b>Category Commands</b></p>

    <p>Creating a new category:</p>
    <pre>
nb [-b blog_dir] -c new -a
        
</pre>Setting the title for a new category:
    <pre>
nb [-b blog_dir] -t "New Category" -c new -a
        
</pre>Listing available categories:
    <pre>
nb [-b blog_dir] -l cat
        
</pre>Editing a category's title:
    <pre>
nb [-b blog_dir] -c 1 -t "News" -e cat
        
</pre>Deleting a category:
    <pre>
nb [-b blog_dir] -c 1 -d cat
        
</pre>

    <h3>Advanced Management</h3>

    <p>Use the "--query" option to manipulate entries by date. First review your query by combining the "--query" with the "--list" option to see which entry ID(s) matched your query. Then operate from that same query by combining the "--query" option with one of the "--edit" or "--delete" options. Using the entry ID(s) from your last query.</p>

    <p>Editing entries by date:</p>
    <pre>
nb [-b blog_dir] -q YYYY-MM-DD -l
nb [-b blog_dir] -q YYYY-MM-DD -e 1,2,3
</pre>Deleting entries by date:
    <pre>
nb [-b blog_dir] -q YYYY-MM-DD -l
nb [-b blog_dir] -q YYYY-MM-DD -d 1,2,3
</pre>Editing entries by date and category:
    <pre>
nb [-b blog_dir] -c 2 -q YYYY-MM-DD -l
nb [-b blog_dir] -c 2 -q YYYY-MM-DD -e 1
</pre>
  </div>

  <div id="templates">
    <h2><a id="s.7" name="s.7">7. Templates</a></h2>Templates are located in the weblog's sub-directory, templates.

    <div class="tables">
      <p><b>Special Template Characters</b></p>

      <p><span class="warning">IMPORTANT</span>: Escaping these characters prevents them from changing.</p>

      <table border="0" cellspacing="4" cellpadding="2" summary="templates">
        <caption>
          Special characters that effect the templates:
        </caption>

        <tr>
          <th align="left">characters</th>

          <th align="left">description</th>

          <th align="left">notes</th>
        </tr>

        <tr>
          <td align="left">$</td>

          <td align="left">dollar sign</td>

          <td align="left">prepend backslash to escape, e.g. "\$"</td>
        </tr>

        <tr>
          <td align="left">`</td>

          <td align="left">back quote</td>

          <td align="left">form of command substitution, prepend backslash to escape, e.g. "\`"</td>
        </tr>

        <tr>
          <td align="left">$(</td>

          <td align="left">dollar sign and left parenthesis</td>

          <td align="left">form of command substitution, prepend backslash to escape, e.g. "\$("</td>
        </tr>
      </table>
    </div>

    <div class="tables">
      <p><b>Default Templates</b></p>

      <table border="0" cellspacing="4" cellpadding="2" summary="templates">
        <caption>
          The weblog's appearance is controlled by the following templates:
        </caption>

        <tr>
          <th align="left">templates</th>

          <th align="left">description</th>
        </tr>

        <tr>
          <td align="left">category_archive.htm</td>

          <td align="left">controls structure of the category pages</td>
        </tr>

        <tr>
          <td align="left">day_archive.htm</td>

          <td align="left">controls structure of the day archive pages</td>
        </tr>

        <tr>
          <td align="left">main_index.htm</td>

          <td align="left">controls structure of the weblog's main page</td>
        </tr>

        <tr>
          <td align="left">main_links.htm*</td>

          <td align="left">contains user defined links</td>
        </tr>

        <tr>
          <td align="left">makepage.htm</td>

          <td align="left">default template used by makepage option</td>
        </tr>

        <tr>
          <td align="left">month_archive.htm</td>

          <td align="left">controls structure of the month archive pages</td>
        </tr>

        <tr>
          <td align="left">permalink.htm</td>

          <td align="left">controls structure of the entries' archive pages</td>
        </tr>

        <tr>
          <td align="left">entry.htm</td>

          <td align="left">controls structure of the entry's content for most archives</td>
        </tr>

        <tr>
          <td align="left">category_entry.htm</td>

          <td align="left">controls structure of the category entries</td>
        </tr>

        <tr>
          <td align="left">permalink_entry.htm</td>

          <td align="left">controls structure of the entry's content for individual entry archives</td>
        </tr>

        <tr>
          <td align="left">weblog_status.htm</td>

          <td align="left">controls structure of weblog status</td>
        </tr>

        <tr>
          <td align="left">year_archive.htm</td>

          <td align="left">controls structure of year archive pages</td>
        </tr>

        <tr>
          <td align="left">entry.metadata</td>

          <td align="left">controls the format of the entry's metafile</td>
        </tr>

        <tr>
          <td align="left">file.metadata</td>

          <td align="left">controls the format of a metafile</td>
        </tr>
      </table>
    </div>
  </div>

  <div id="about.plugins">
    <h2><a id="s.8" name="s.8">8. About Plugins</a></h2>

    <h3>Plugins Framework</h3>

    <div>
      <p><b>Regular Plugins: plugins</b></p>

      <p>Regular plugins are initialized unconditionally.</p>

      <p><b>Archive Plugins: plugins/archive</b></p>

      <p>Archive plugins are initialized when the archives are updated.</p>

      <p><b>Category Archive Plugins: plugins/archive/category</b></p>

      <p>Category Archive plugins are initialized for each category archive that is updated.</p>

      <p><b>Day Archive Plugins: plugins/archive/day</b></p>

      <p>Day Archive plugins are initialized for each day archive that is updated.</p>

      <p><b>Month Archive Plugins: plugins/archive/month</b></p>

      <p>Month Archive plugins are initialized for each month archive that is updated.</p>

      <p><b>Year Archive Plugins: plugins/archive/year</b></p>

      <p>Year Archive plugins are initialized for each year archive that is updated.</p>

      <p><b>Entry Plugins: plugins/entry</b></p>

      <p>Entry plugins are initialized unconditionally for each entry that is updated.</p>

      <p><b>Entry Modify Plugins: plugins/entry/mod</b></p>

      <p>Entry Modify plugins are initialized for each entry that is modified.</p>

      <p><b>Entry Formatting Plugins: plugins/entry/format</b></p>

      <p>Entry Formatting plugins are initialized for each modified entry based on the FORMAT metadata field. More than one format may be specified using space or commas as a separator, but special care should be taken in the order they get specified.</p>

      <p><b>Page Plugins: plugins/page</b></p>

      <p>Page plugins are initialized unconditionally before each page that is updated.</p>

      <p><b>Page Formatting Plugins: plugins/page/format</b></p>

      <p>Page Formatting plugins are initialized for each page that is updated based on the FORMAT metadata field. More than one format may be specified using space or commas as a separator, but special care should be taken in the order they get specified.</p>

      <p><b>Make Page Plugins: plugins/makepage</b></p>

      <p>Make Page plugins are initialized after each page that is updated.</p>

      <p><b>Post Plugins: plugins/post</b></p>

      <p>Post plugins are initialized unconditionally for post-weblog related tasks.</p><em>Most plugins will operate on their own conditions once they've been initialized.</em>
    </div>

    <div class="tables">
      <p><b>Default Plugins</b></p>

      <table border="0" cellspacing="4" cellpadding="2" summary="plugins">
        <caption>
          Default plugins (most are enabled by default):
        </caption>

        <tr>
          <th align="left">plugins</th>

          <th align="left">description</th>

          <th align="left">variables</th>

          <th align="left">targets</th>

          <th align="left">notes</th>
        </tr>

        <tr>
          <td align="left">archive/day/cal2daytitle.sh</td>

          <td align="left">creates a fancier title for the day archives</td>

          <td align="left">CAL_CMD, CAL_ARGS, DATE_LOCALE</td>

          <td align="left">$NB_ArchiveTitle</td>

          <td align="left">requires the cal command</td>
        </tr>

        <tr>
          <td align="left">archive/month/month_calendar.sh</td>

          <td align="left">generates a calendar with links for each active day</td>

          <td align="left">CAL_CMD, CAL_ARGS, DATE_LOCALE</td>

          <td align="left">$NB_MonthlyCalendar</td>

          <td align="left">requires the cal command</td>
        </tr>

        <tr>
          <td align="left">archives/year/year_index.sh</td>

          <td align="left">generates year archives</td>

          <td align="left">none</td>

          <td align="left">$ARCHIVES_DIR/$yearn/index.$NB_FILETYPE</td>

          <td align="left">requires makepage.htm template</td>
        </tr>

        <tr>
          <td align="left">articles_meta.sh*</td>

          <td align="left">generates articles from metafiles in the "articles" directory</td>

          <td align="left">ARTICLE_DIRS, ARTICLE_FORMAT</td>

          <td align="left">$NB_ArticleLinks</td>

          <td align="left">requires makepage.htm template, plugin must be last to load</td>
        </tr>

        <tr>
          <td align="left">articles_text.sh*</td>

          <td align="left">generates articles from text files in the "articles" directory</td>

          <td align="left">ARTICLE_DIRS, ARTICLE_FORMAT</td>

          <td align="left">$NB_ArticleLinks</td>

          <td align="left">requires makepage.htm template, plugin must be last to load</td>
        </tr>

        <tr>
          <td align="left">atom.sh</td>

          <td align="left">adds an atom feed</td>

          <td align="left">FEED_ITEMS, ATOM_ITEMS, ATOM_CATFEEDS, BLOG_FEED_LANG</td>

          <td align="left">$NB_AtomVer, $NB_AtomFile, index-atom.$NB_SYND_FILETYPE</td>

          <td align="left">none</td>
        </tr>

        <tr>
          <td align="left">calendar.sh</td>

          <td align="left">generates a calendar with links for each active day</td>

          <td align="left">CAL_CMD, CAL_ARGS, DATE_LOCALE</td>

          <td align="left">$NB_Calendar</td>

          <td align="left">requires cal</td>
        </tr>

        <tr>
          <td align="left">entry/category_links.sh</td>

          <td align="left">generates category links</td>

          <td align="left">none</td>

          <td align="left">$NB_EntryCategories</td>

          <td align="left">none</td>
        </tr>

        <tr>
          <td align="left">entry/excerpt.sh*</td>

          <td align="left">creates an excerpt from entry's text</td>

          <td align="left">none</td>

          <td align="left">$NB_EntryExcerpt</td>

          <td align="left">ends after first detected double line break (blank line)</td>
        </tr>

        <tr>
          <td align="left">entry/format/autobr.sh</td>

          <td align="left">converts blank lines to HTML paragraph breaks</td>

          <td align="left">none</td>

          <td align="left">$NB_MetaBody, $NB_EntryBody</td>

          <td align="left">FORMAT: autobr</td>
        </tr>

        <tr>
          <td align="left">entry/format/markdown.sh</td>

          <td align="left">uses markdown to handle formatting</td>

          <td align="left">none</td>

          <td align="left">$NB_MetaBody, $NB_EntryBody</td>

          <td align="left">FORMAT: markdown</td>
        </tr>

        <tr>
          <td align="left">entry/mod/base_url.sh</td>

          <td align="left">helps set relative links</td>

          <td align="left">%base_url%</td>

          <td align="left">$NB_EntryBody</td>

          <td align="left">example: &lt;img src="%base_url%images/pic.png" /&gt;</td>
        </tr>

        <tr>
          <td align="left">entry/mod/moods.sh</td>

          <td align="left">converts mood variables into smiley icons</td>

          <td align="left">MOODS_URL</td>

          <td align="left">$NB_EntryBody</td>

          <td align="left">copy moods directory to weblog's directory</td>
        </tr>

        <tr>
          <td align="left">fortune.sh</td>

          <td align="left">generates random quotes</td>

          <td align="left">FORTUNE_FILE</td>

          <td align="left">$NB_Fortune</td>

          <td align="left">requires fortune</td>
        </tr>

        <tr>
          <td align="left">makepage/tidy.sh</td>

          <td align="left">validates HTML/XML code</td>

          <td align="left">TIDY_HTML_ARGS, TIDY_XML_ARGS</td>

          <td align="left">$NB_Tidy, $BLOG_DIR/tidy.log</td>

          <td align="left">requires HTML Tidy, overrides $BLOG_CHARSET</td>
        </tr>

        <tr>
          <td align="left">mymood.sh*</td>

          <td align="left">adds ability to display your mood</td>

          <td align="left">MOODS_URL</td>

          <td align="left">$NB_MyMood</td>

          <td align="left">copy moods directory to weblog's directory</td>
        </tr>

        <tr>
          <td align="left">page/feed_links.sh</td>

          <td align="left">generates alt links for feeds</td>

          <td align="left">none</td>

          <td align="left">$NB_AtomAltLink, $NB_RSS2AltLink, $NB_RSSAltLink</td>

          <td align="left">requires one of atom.sh, rss.sh, or rss2.sh plugins</td>
        </tr>

        <tr>
          <td align="left">page/page_links.sh</td>

          <td align="left">regenerates links for inclusion on other pages</td>

          <td align="left">none</td>

          <td align="left">$NB_MainLinks, $NB_RecentEntries, $NB_CategoryLinks, $NB_MonthLinks, etc.</td>

          <td align="left">requires one of weblog_links.sh or recent_entries.sh plugins</td>
        </tr>

        <tr>
          <td align="left">page/format/autobr.sh</td>

          <td align="left">converts blank lines to HTML paragraph breaks</td>

          <td align="left">none</td>

          <td align="left">$NB_MetaBody, $NB_EntryBody</td>

          <td align="left">FORMAT: autobr</td>
        </tr>

        <tr>
          <td align="left">page/format/markdown.sh</td>

          <td align="left">uses markdown to handle formatting</td>

          <td align="left">none</td>

          <td align="left">$NB_MetaBody, $NB_EntryBody</td>

          <td align="left">FORMAT: markdown</td>
        </tr>

        <tr>
          <td align="left">page/format/moods.sh</td>

          <td align="left">converts mood variables into smiley icons</td>

          <td align="left">MOODS_URL</td>

          <td align="left">$NB_MetaBody, $NB_EntryBody</td>

          <td align="left">may combine with with others e.g. "FORMAT: moods, markdown"</td>
        </tr>

        <tr>
          <td align="left">recent_entries.sh</td>

          <td align="left">generates lists of recent and old entries</td>

          <td align="left">RECENTLIST_ENTRIES, RECENTLIST_OFFSET, RECENTLIST_MODE</td>

          <td align="left">$NB_RecentEntries, $NB_OlderEntries</td>

          <td align="left">none</td>
        </tr>

        <tr>
          <td align="left">rss2.sh</td>

          <td align="left">adds rss 2.0 feeds</td>

          <td align="left">FEED_ITEMS, RSS2_ITEMS, RSS2_CATFEEDS, BLOG_FEED_LANG</td>

          <td align="left">$NB_RSS2File, index-rss.$NB_SYND_FILETYPE</td>

          <td align="left">none</td>
        </tr>

        <tr>
          <td align="left">rss.sh</td>

          <td align="left">adds rss 1.0 feeds</td>

          <td align="left">FEED_ITEMS, RSS_ITEMS, RSS_CATFEEDS, BLOG_FEED_LANG</td>

          <td align="left">$NB_RSSFile, index.$NB_SYND_FILETYPE</td>

          <td align="left">none</td>
        </tr>

        <tr>
          <td align="left">weblog_links.sh</td>

          <td align="left">generates some useful links</td>

          <td align="left">ALL_YEARLINKS, MAX_YEARLINKS, ALL_MONTHLINKS, MAX_MONTHLINKS</td>

          <td align="left">$NB_MainLinks, $NB_MonthLinks, $NB_CategoryLinks</td>

          <td align="left">requires main_links.htm template</td>
        </tr>

        <tr>
          <td align="left">weblog_status.sh</td>

          <td align="left">generates some statistics</td>

          <td align="left">none</td>

          <td align="left">$NB_BlogStatus</td>

          <td align="left">requires weblog_status.htm template</td>
        </tr>
      </table>

      <div>
        <p>* = actual name may vary.</p>

        <p>To disable an individual plugin, rename the plugin's extension from ".sh" to ".off".</p>
      </div>
    </div>
  </div>

  <div id="writing.plugins">
    <h2><a id="s.9" name="s.9">9. Writing Plugins</a></h2>

    <h3>Tools for Developing Plugins</h3>

    <div>
      <p>Plugins typically work by creating placeholders for the templates, but are in no way limited to creating placeholders. Placeholders allow for a great deal of control in how the plugins output is placed in the template. Some plugins may require you to identify it's unique placeholder/destination and manually add it to your templates.</p>

      <p>To write a plugin, you should begin by creating a text file with the <em>".sh"</em> suffix. plugins are basically shell scripts that get loaded (sourced in shell terms) depending on where the plugin is located in the plugins directory or one of the plugin sub-directories. It may be a good idea to look at a simple plugin, such as fortune.sh for an idea on how a plugin works. When the new plugin is saved, it needs to have the appropriate read permissions, so it can be loaded by NanoBlogger. Executable permissions are not necessary for plugins.</p>

      <p>The following is a collection of tools that might be useful when developing your own plugins.</p>
    </div>

    <div class="tables">
      <p><b>Plugin API</b></p>

      <table border="0" cellspacing="4" cellpadding="2" summary="api">
        <caption>
          API for writing plugins.
        </caption>

        <tr>
          <th align="left">command</th>

          <th align="left">description</th>

          <th align="left">variables and switches</th>

          <th align="left">targets</th>

          <th align="left">notes</th>
        </tr>

        <tr>
          <td align="left">die</td>

          <td align="left">exits with error message</td>

          <td align="left">$@</td>

          <td align="left">console</td>

          <td align="left">returns exit status 1</td>
        </tr>

        <tr>
          <td align="left">nb_browser</td>

          <td align="left">sensible-browser-like utility for launching browser</td>

          <td align="left">$NB_BROWSER, $BROWSER, $1</td>

          <td align="left">console</td>

          <td align="left">parses $BROWSER with ":" separator</td>
        </tr>

        <tr>
          <td align="left">nb_edit</td>

          <td align="left">simple wrapper to editor</td>

          <td align="left">$NB_EDITOR, $EDITOR, $1, $2, -p = force prompt (pause)</td>

          <td align="left">console</td>

          <td align="left">if $2 is null, then $1 assumed to be file</td>
        </tr>

        <tr>
          <td align="left">nb_msg</td>

          <td align="left">preferred method of verbosity</td>

          <td align="left">$@</td>

          <td align="left">console</td>

          <td align="left">use instead of echo when appropriate</td>
        </tr>

        <tr>
          <td align="left">confirm_action</td>

          <td align="left">ask user to confirm action</td>

          <td align="left">none</td>

          <td align="left">console</td>

          <td align="left">can be used with $BLOG_INTERACTIVE</td>
        </tr>

        <tr>
          <td align="left">chg_suffix</td>

          <td align="left">changes a file's suffix</td>

          <td align="left">filename=$1, suffix=$2</td>

          <td align="left">file</td>

          <td align="left">can specify $NB_FILETYPE, $NB_SYND_FILETYPE as suffix</td>
        </tr>

        <tr>
          <td align="left">query_db</td>

          <td align="left">queries database</td>

          <td align="left">db_query=$1, db_catquery=$2, db_setlimit=$3 db_limit=$4, db_offset=$5</td>

          <td align="left">$DB_RESULTS</td>

          <td align="left">example (retrieves entries 1 through 10): "query_db all nocat limit 10 1"</td>
        </tr>

        <tr>
          <td align="left">lookup_entryid</td>

          <td align="left">lookup entry's id from master database</td>

          <td align="left">$1, $2</td>

          <td align="left">console or redirect</td>

          <td align="left">example: lookup_entryid 2005-12-14T00_00_00.$NB_DATATYPE "$MASTER_DB_RESULTS"</td>
        </tr>

        <tr>
          <td align="left">lookup_monthid</td>

          <td align="left">lookup month's id from "months" query type</td>

          <td align="left">$1, $2</td>

          <td align="left">console or redirect</td>

          <td align="left">example: query_db months; lookup_monthid 2005-12 "$MONTH_DB_RESULTS"</td>
        </tr>

        <tr>
          <td align="left">set_title2link</td>

          <td align="left">transforms text for use in links</td>

          <td align="left">$1</td>

          <td align="left">console or redirect</td>

          <td align="left">none</td>
        </tr>

        <tr>
          <td align="left">set_baseurl</td>

          <td align="left">helps in setting relative links</td>

          <td align="left">node_var=$1, base_dir=$2</td>

          <td align="left">$BASE_URL, $ARCHIVES_PATH</td>

          <td align="left">should only specify one, of node_var or base_dir, at a time</td>
        </tr>

        <tr>
          <td align="left">set_catlink</td>

          <td align="left">sets link and file for given category</td>

          <td align="left">$1</td>

          <td align="left">$category_file, $category_link</td>

          <td align="left">category should be of the form, cat_N.$NB_DBTYPE</td>
        </tr>

        <tr>
          <td align="left">set_daylink</td>

          <td align="left">sets link and file for given day</td>

          <td align="left">$1</td>

          <td align="left">$day_file, $day_link</td>

          <td align="left">day should be of the form YYYY-MM-DD</td>
        </tr>

        <tr>
          <td align="left">set_monthlink</td>

          <td align="left">sets link and file for given month</td>

          <td align="left">$1</td>

          <td align="left">$month_file, $month_link</td>

          <td align="left">month should be of the form YYYY-MM</td>
        </tr>

        <tr>
          <td align="left">set_entryid</td>

          <td align="left">sets anchor/id for given entry</td>

          <td align="left">$1</td>

          <td align="left">console or redirect</td>

          <td align="left">entry should be of the form YYYY-MM-DDTHH_MM_SS.$NB_DATATYPE</td>
        </tr>

        <tr>
          <td align="left">set_entrylink</td>

          <td align="left">sets link and file for given entry</td>

          <td align="left">$1</td>

          <td align="left">$entry_dir, $permalink_file, $NB_EntryPermalink</td>

          <td align="left">entry should be of the form YYYY-MM-DDTHH_MM_SS.$NB_DATATYPE</td>
        </tr>

        <tr>
          <td align="left">update_cache</td>

          <td align="left">compiles list or removes cache entries</td>

          <td align="left">cache_update=$1, cache_def=$2, CACHEUPDATE_LIST=$3</td>

          <td align="left">$CACHE_LIST</td>

          <td align="left">commonly used to expire cached data</td>
        </tr>

        <tr>
          <td align="left">load_template</td>

          <td align="left">loads template from file</td>

          <td align="left">TEMPLATE_FILE=$1</td>

          <td align="left">$TEMPLATE_DATA</td>

          <td align="left">never load template data more than once, make_page calls load_template</td>
        </tr>

        <tr>
          <td align="left">write_metadata</td>

          <td align="left">writes metadata to file</td>

          <td align="left">MTAG=$1, METADATA=$2, META_FILE=$3</td>

          <td align="left">$META_FILE</td>

          <td align="left">example: "write_metadata UPDATED "`date`" $metafile"</td>
        </tr>

        <tr>
          <td align="left">read_metadata</td>

          <td align="left">extracts metadata from (entry) file</td>

          <td align="left">MTAG=$1, META_FILE=$2</td>

          <td align="left">$METADATA</td>

          <td align="left">see plugin recent_entries.sh for a good example</td>
        </tr>

        <tr>
          <td align="left">write_tag</td>

          <td align="left">create/modify user metedata field</td>

          <td align="left">WRITE_MTAG=$1, WRITE_MTAGTEXT=$2, WRITEMETATAG_FILE=$3</td>

          <td align="left">$WRITEMETATAG_FILE</td>

          <td align="left">example: write_tag MODTIME "$(date)"</td>
        </tr>

        <tr>
          <td align="left">loop_archive</td>

          <td align="left">loops through archives and executes instructions by years or months</td>

          <td align="left">looparch_list=$1, looparch_type=$2, looparch_exec=$3</td>

          <td align="left">determined by $looparch_exec</td>

          <td align="left">example: "query_db max; loop_archive "$DB_RESULTS" months make_monthlink"</td>
        </tr>

        <tr>
          <td align="left">load_entry</td>

          <td align="left">loads entry data for templates</td>

          <td align="left">ENTRY_FILE=$1, ENTRY_DATATYPE=$2, ENTRY_CACHETYPE=$3</td>

          <td align="left">$NB_EntryTitle, $NB_EntryBody, ...</td>

          <td align="left">see plugin atom.sh for a good example</td>
        </tr>

        <tr>
          <td align="left">make_page</td>

          <td align="left">creates weblog page from text file</td>

          <td align="left">MKPAGE_SRCFILE=$1, MKPAGE_TMPLFILE=$2, MKPAGE_OUTFILE=$3</td>

          <td align="left">$MKPAGE_CONTENT, $NB_MetaBody</td>

          <td align="left">see plugin articles_text.sh for a good example</td>
        </tr>

        <tr>
          <td align="left">weblog_page</td>

          <td align="left">creates weblog page from metafile</td>

          <td align="left">BLOGPAGE_SRCFILE=$1, BLOGPAGE_TEMPLATE=$2, $BLOGPAGE_OUTFILE=$3</td>

          <td align="left">$MKPAGE_CONTENT, $NB_MetaBody</td>

          <td align="left">see plugin articles_meta.sh for good example</td>
        </tr>
      </table>
    </div>
  </div>

  <div id="publish">
    <h2><a id="s.10" name="s.10">10. Publishing</a></h2>

    <p><b>Setting the Publish Command</b></p>

    <p>The <em>BLOG_PUBLISH_CMD</em> variable allows you to set a command to publish your weblog. This can be as simple as an FTP command to upload files or a more complex set of tasks via a script.</p>

    <p><b>Publishing Remotely</b></p>

    <p>FTP, SSH (scp, sftp, etc.), RSYNC or WebDAV, are all methods that can be used to publish the weblog.</p>

    <p><b>example</b>: automating publishing with ftp and .netrc.</p>blog.conf:
    <pre>
BLOG_PUBLISH_CMD="ftp example.weblog.com"
 
</pre>.netrc:
    <pre>
machine example.weblog.com login foo password
RIGHT!
macdef init
passive on
prompt off
lcd ~/public_html/blog
mput *.*
cd archives
lcd archives
mput *
 
</pre>

    <p><b>Publishing Locally</b></p>

    <p>If you choose to publish locally, you'll probably want to disable the publish command. To do this you can set <em>BLOG_PUBLISH_CMD</em> to null. e.g. BLOG_PUBLISH_CMD=""</p>
  </div>

  <div id="comments">
    <h2><a id="s.11" name="s.11">11. Adding Support for Comments</a></h2>

    <p>Comment services and add-ons: NanoBlogger Comments[1], CGIComment[2], blogkomm[3], JS-Kit[4], and Haloscan.com[5].</p>

    <p>Choose one and follow the included install instructions.</p>
  </div>

  <div id="entries.import">
    <h2><a id="s.12" name="s.12">12. Importing Entries</a></h2>

    <p>In order to import entries, data must first be converted to the NanoBlogger format.</p>

    <p><b>The Format of an Entry</b></p>

    <p>An entry file name is of the format:</p>
    <pre>
YYYY-MM-DDTHH_MM_SS.txt
        
</pre>So a typical entry's file name would look something like this:
    <pre>
2004-06-25T22_24_37.txt
        
</pre>

    <p>The format of an entry is made up of metadata tags. Most of the metadata tags are of the format TAG: VALUE, then a carriage return that separates one tag from the next. The order of the metadata tags are insignificant. The <em>BODY</em> tag is special and needs to be terminated by the <em>END-----</em> tag. By default the content of the BODY tag must contain valid HTML with all entities properly escaped.</p>Example of an entry's format:
    <pre>
TITLE: A New Entry
AUTHOR: foo
DATE: January 30 2004, 12:00 PM
DESC: keywords or a short, one line summary
FORMAT: raw
-----
BODY:
&lt;p&gt;This is my new entry ...&lt;/p&gt;
END-----
        
</pre>

    <p><b>Converting Entries</b></p>

    <p>Before entries can be imported they must be converted to the correct format.</p>

    <p>Steps to converting entries:</p>
    <pre>
1. Convert each entry so they each contain the following metadata: TITLE, AUTHOR, DATE, DESC, FORMAT, BODY
2. The BODY metadata must be terminated by "END-----".
3. Rename each entry's file name to it's corresponding date and time.
        
</pre>

    <p>If there's multiple entries it may be a good idea to automate all this with a script.</p>

    <p><b>Updating the Weblog's Data Directory</b></p>

    <p>The imported entries should be copied into the <em>data</em> directory of your weblog.<br />
    Update the weblog with the new entries:</p>
    <pre>
nb [-b blog_dir] -u all
        
</pre>
  </div>

  <div id="tips">
    <h2><a id="s.13" name="s.13">13. Tips and Tricks</a></h2>

    <p><b>Useful Editor's Commands</b></p>Create a new metafile:
    <pre>
nb [-b blogdir] --makefile somefile.txt
</pre>Import the metafile as a new weblog entry:
    <pre>
nb [-b blogdir] --file somefile.txt --add
</pre>or export the metafile as a new weblog page:
    <pre>
nb [-b blogdir] --makepage somefile.txt somefile.html
</pre><em>Please note that these tasks are easier when the editor supports a sub-shell or when you can suspend your editor from the active shell (assuming there is one).</em>

    <p><b>Writing Metatags on the Fly</b></p>

    <p>Metatags can be written on the fly. For example, text formatting can be set from the command line.</p>
    <pre>
nb [-b blogdir] --tag FORMAT --tag-text "markdown" --makepage somefile.txt somefile.html
    
</pre>

    <p><b>Set a Default Weblog Directory</b></p>

    <p>By default you have to specify the weblog directory, but by setting BLOG_DIR, you won't have to. Edit <em>nb.conf</em> or <em>$HOME/.nb.conf</em>:</p>
    <pre>
BLOG_DIR="/path/to/weblog"
    
</pre>

    <p><b>Running User Plugins Exclusively</b></p>

    <p>Set <em>PLUGINS_DIR</em> to "[weblog_dir]/plugins".</p>edit blog.conf
    <pre>
PLUGINS_DIR="$BLOG_DIR/plugins"
    
</pre>

    <p><b>Adding Shell Scripting to Your Templates</b></p>

    <p>It's possible to use command substitution in your templates, using one of the following forms:</p>
    <pre>
        $(command)
or
        `command`
                
</pre>

    <p><b>Add an Introduction to Your Weblog</b></p>

    <p>Create a text file in your weblog directory called, "intro.txt". Edit the text file the way you like, then add the following to the main template:</p>
    <pre>
$(&lt; "$BLOG_DIR/intro.txt")
        
</pre>

    <p><b>Integrating Parts of Your Weblog Into an Existing Web Site</b></p>

    <p>Many parts of the weblog are stored and built in the <em>parts</em> directory. Say you already have a web site full of your own custom server-side scripts/includes, but you'd like to add a news section. This is where the "parts/index.html" file comes in. It contains all the most recent entries, so adding a news/diary/blog section is just a matter of adding the code to include "parts/index.html" into the page.</p>

    <p>Other clever uses include combining NanoBlogger's static output with some PHP or Perl. For example, suppose you like to have some of the side links, such as recent entries. Using PHP, set your <em>NB_FILETYPE</em> to "php" and modify the appropriate templates to include the PHP code that extracts the data from the parts directory. One of the main advantages to this is not having to rebuild the entire weblog's archives, just to keep the links current.</p>

    <p><b>Embedding Other Variables in the Templates</b></p>

    <p>Any characters that are similar to the shell's variable or command substitution characters, will have to be escaped before they will work from the templates.</p>

    <p>Example using variables in the PHP code:</p>
    <pre>
&lt;?php
\$VAR = array ();
echo "\\\$VAR=\$VAR";
php?&gt;
     
</pre>
  </div>

  <div id="credits">
    <h2><a id="s.14" name="s.14">14. Credits</a></h2>

    <p>Thanks to Adrien "ze" Urban, Paul Drain, Pavel Janik, and O.R.Senthil Kumaran for all the contributions and suggestions. Thanks to Bowie J. Poag, author of MicroBlogger[6], for the inspiration of this project. Special acknowledgement goes to Ted Walther's Diary[7], which inspired Bowie to create MicroBlogger. Finally, thanks to everyone who's ever contributed a patch or feature request - see the ChangeLog.</p>

    <p><a href="http://nhw.pl/blg/articles/nbcom/">1. http://nhw.pl/blg/articles/nbcom/</a><br />
    <a href="http://freshmeat.net/projects/cgicomment">2. http://freshmeat.net/projects/cgicomment</a><br />
    <a href="http://blogkomm.com">3. http://blogkomm.com</a><br />
    <a href="http://js-kit.com">4. http://js-kit.com</a><br />
    <a href="http://www.haloscan.com">5. http://www.haloscan.com</a><br />
    <a href="http://freshmeat.net/projects/microblogger">6. http://freshmeat.net/projects/microblogger</a><br />
    <a href="http://reactor-core.org/~djw/diary/">7. http://reactor-core.org/~djw/diary/</a><br /></p>

    <div class="copyright">
      <span>Copyright © 2003-2006 Kevin Wood. All Rights Reserved.</span>
    </div>
  </div>
</body>
</html>