Add chm output format.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 20 Jul 2011 14:10:15 +0300
changeset 903 9ead7d97be34
parent 902 034aeeb2a16d
child 904 29eccddc0c22
Add chm output format.
Makefile
chm-hhc.sh
chm-hhp.sh
chm.stp
index.sh
--- a/Makefile	Wed Jul 20 12:37:29 2011 +0300
+++ b/Makefile	Wed Jul 20 14:10:15 2011 +0300
@@ -20,6 +20,8 @@
 HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) $(HTML_DIR)/index.html $(HTML_DIR)/index-frame.html
 TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
 
+CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp)
+
 DIRS := $(HTML_DIR)
 
 ################################################################
@@ -35,7 +37,7 @@
 	rst2html.py --stylesheet=rst.css $*.rst $@
 
 $(HTML_DIR)/index.html: index.sh | $(HTML_DIR)
-	./index.sh >$@
+	./index.sh frame >$@
 
 $(HTML_DIR)/%.html: %.html | $(HTML_DIR)
 	cp $< $@
@@ -43,6 +45,22 @@
 $(HTML_DIR)/%.txt: %.txt | $(HTML_DIR)
 	cp $< $@
 
+.PHONY: chm
+chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html
+	cd $(HTML_DIR); for file in *.html; do sed -i '/<\?xml.*\?>/d' $$file; done
+
+$(HTML_DIR)/%.stp: %.stp | $(HTML_DIR)
+	cp $< $@
+
+$(HTML_DIR)/chm.hhp: chm-hhp.sh | $(HTML_DIR)
+	./chm-hhp.sh >$@
+
+$(HTML_DIR)/chm.hhc: chm-hhc.sh | $(HTML_DIR)
+	./chm-hhc.sh >$@
+
+$(HTML_DIR)/index-chm.html: index.sh | $(HTML_DIR)
+	./index.sh chm >$@
+
 ################################################################
 # Init targets.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chm-hhc.sh	Wed Jul 20 14:10:15 2011 +0300
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+echo '<html>'
+echo '  <head>'
+echo '  <meta name="generator" content="html2hhc &lt;gavenkoa@gmail.com&gt;">'
+echo '  </head>'
+echo '<body>'
+echo '<object type="text/site properties">'
+echo '  <param name="ImageType" value="Folder">'
+echo '</object>'
+echo '<ul>'
+
+echo '  <li><object type="text/sitemap">'
+echo '    <param name="name" value="index">'
+echo '    <param name="local" value="index-chm.html">\n'
+echo '  </object>'
+
+for file in *.rst *.txt; do
+  ext=${file##*.}
+  name=${file%.${ext}}
+  echo '  <li><object type="text/sitemap">'
+  case $ext in
+    txt)
+      printf '    <param name="name" value="%s">\n' $name
+      printf '    <param name="local" value="%s.txt">\n' $name
+      ;;
+    rst)
+      printf '    <param name="name" value="%s">\n' $name
+      printf '    <param name="local" value="%s.html">\n' $name
+      ;;
+  esac
+  echo '  </object>'
+done
+
+echo '</ul>'
+echo '</body>'
+echo '</html>'
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chm-hhp.sh	Wed Jul 20 14:10:15 2011 +0300
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+echo '[OPTIONS]'
+echo 'Compatibility=1.1 or later'
+echo 'Compiled file=tips4gavenkoa.chm'
+echo 'Contents file=chm.hhc'
+echo 'Default Window=Navigation panel'
+echo 'Default topic=index-chm.html'
+echo 'Display compile progress=No'
+echo 'Full text search stop list file=chm.stp'
+echo 'Full-text search=Yes'
+echo 'Language=0x409 Английский (США)'
+echo 'Title=Tips from gavenkoa'
+echo ''
+echo '[WINDOWS]'
+echo 'Navigation panel=,"chm.hhc",,"index-chm.html","index-chm.html",,,,,0x62520,250,0x304e,[0,0,900,600],,,,,,,0'
+echo ''
+echo '[FILES]'
+
+for file in *.rst *.txt; do
+  ext=${file##*.}
+  name=${file%.${ext}}
+  case $ext in
+    txt)
+      echo $name.txt
+      ;;
+    rst)
+      echo $name.html
+      ;;
+  esac
+done
+echo index-chm.html
+
+echo ''
+echo '[INFOTYPES]'
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chm.stp	Wed Jul 20 14:10:15 2011 +0300
@@ -0,0 +1,1511 @@
+0
+1
+10
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+11
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+12
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+13
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+14
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+15
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+16
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+17
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+18
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+19
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+2
+20
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+21
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+22
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+23
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+24
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+25
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+26
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+27
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+28
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+29
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+3
+30
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+31
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+32
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+33
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+34
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+35
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+36
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+37
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+38
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+39
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+4
+40
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+41
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+42
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+43
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+44
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+45
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+46
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+47
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+48
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+49
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+5
+50
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+51
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+52
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+53
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+54
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+55
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+56
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+57
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+58
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+59
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+6
+60
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+61
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+62
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+63
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+64
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+65
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+66
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+67
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+68
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+69
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+7
+70
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+71
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+72
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+73
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+74
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+75
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+76
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+77
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+78
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+79
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+8
+80
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+81
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+82
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+83
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+84
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+85
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+86
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+87
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+88
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+89
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+9
+90
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+91
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+92
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+93
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+94
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+95
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+96
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+97
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+98
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+99
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+I
+_Bool
+_Complex
+_Imaginary
+a
+a
+about
+above
+across
+actually
+after
+ah
+aha
+ahem
+alas
+all
+all else being equal
+all in all
+all things considered
+allegedly
+along
+also
+although
+always
+am
+amid
+among
+an
+and
+another
+any
+anybody
+anyone
+anything
+anyway
+apparently
+are
+aren't
+argc
+arguably
+argv
+around
+as
+as a matter of fact
+as a result
+as far as i know
+as long as
+as much as
+as soon as
+assuredly
+at
+at all
+at first blush
+at first glance
+auto
+b
+bad
+badly
+be
+beautifully
+because
+because of
+been
+before
+behind
+being
+believably
+below
+beneath
+besides
+between
+bhind
+billion
+bool
+both
+bravo
+break
+but
+by
+c
+can
+can't
+case
+catch
+certainly
+char
+clearly
+conceivable
+conceivably
+conclusively
+conditionally
+const
+continue
+cool
+coolly
+could
+couldn't
+credibly
+d
+debatably
+default
+defendably
+defensibly
+definitely
+did
+didn't
+do
+does
+doesn't
+don't
+done
+double
+doubtless
+doubtlessly
+down
+during
+e
+each
+eight
+eighteen
+eighty
+either
+eleven
+else
+enough
+enum
+even
+ever
+everybody
+everyone
+everything
+evidently
+evitably
+except
+extern
+f
+false
+farewell
+few
+fewer
+fifteen
+fifty
+finally
+first
+first of all
+five
+float
+for
+forty
+four
+fourteen
+frequently
+friendly
+from
+furthermore
+g
+gah
+generally
+go
+going
+good
+goodbye
+goodly
+goto
+great
+greatly
+h
+h'm
+had
+has
+have
+haven't
+he
+hello
+hence
+her
+here
+hers
+herself
+hey
+hi
+him
+himself
+his
+hmm
+how
+however
+hum
+hundred
+hurrah
+hush
+hypothetically
+i
+i
+if
+impossibly
+in
+in addition
+in any case
+in conclusion
+in fact
+in fromt
+in order that
+in other words
+in point of fact
+in view of
+include
+incontestably
+indeed
+indisputably
+indubitably
+ineluctably
+inescapably
+inevitably
+inline
+inside
+instead of
+int
+int16_t
+int32_t
+int64_t
+int8_t
+int_t
+into
+is
+isn't
+it
+its
+itself
+j
+k
+l
+last
+last but not least
+last of all
+lastly
+len
+less
+lest
+likely
+list
+literally
+little
+long
+loop
+loudly
+lovely
+m
+main
+majority
+manifestly
+many
+may
+maybe
+me
+meantime
+meanwhile
+might
+milliard
+million
+mine
+minority
+more
+more and more
+moreover
+most
+most certainly
+most importantly
+much
+must
+mustn't
+my
+myself
+n
+near
+necessarily
+need
+needlessly
+neither
+never
+nevertheless
+next
+next to
+nice
+nicely
+nine
+nineteen
+ninety
+no
+no one
+nobody
+none
+nor
+not only
+nothing
+noticeably
+now
+o
+observably
+obviously
+occasionally
+of
+of course
+off
+often
+oh
+ok
+on
+on the other hand
+on top of all
+one
+ooh
+oops
+or
+ostensibly
+ostensively
+other
+others
+otherwise
+ouch
+our
+ours
+ourselves
+out of
+outside
+over
+ow
+p
+past
+patently
+perhaps
+plainly
+plausibly
+plenty
+positively
+possible
+possibly
+presumably
+presumptively
+printf
+probably
+ps
+ptr_t
+purportedly
+putatively
+q
+r
+rarely
+register
+regularly
+reportedly
+reputedly
+restrict
+return
+round
+rumoredly
+rumouredly
+s
+scarcely
+second
+secondly
+seemingly
+seldomly
+seven
+seventeen
+seventy
+several
+she
+shell
+shh
+short
+should
+shouldn't
+signed
+since
+sisty
+six
+sixteen
+size_t
+sizeof
+so
+so that
+some
+somebody
+someone
+something
+sometimes
+static
+statistically
+still
+struct
+such
+sum
+surely
+switch
+t
+tall
+ten
+than
+that
+the
+their
+theirs
+them
+themselves
+then
+there
+therefore
+these
+they
+thine
+thirdly
+thirteen
+thirty
+this
+those
+though
+thousand
+three
+through
+throw
+thus
+thy
+till
+to
+to begin with
+to end with
+to sum it up
+too
+transparently
+tree
+true
+truly
+try
+tut-tut
+twelve
+twenty
+two
+typedef
+u
+ugh
+uh-huh
+uint16_t
+uint32_t
+uint64_t
+uint8_t
+uint_t
+unarguably
+unavoidably
+uncertainly
+undeniably
+under
+underneath
+undoubtably
+undoubtedly
+union
+unless
+unnecessarily
+unquestionably
+unsigned
+until
+unto
+up
+upon
+us
+usually
+v
+verifiably
+void
+volatile
+w
+was
+we
+well
+were
+weren't
+what
+when
+whence
+whenever
+where
+wherefore
+wherever
+whether
+which
+while
+whilst
+whither
+who
+whom
+whose
+why
+will
+with
+within
+without
+without a doubt
+won't
+would
+wouldn't
+wow
+x
+y
+yeah
+yes
+yet
+you
+yours
+yourself
+yourselves
+z
--- a/index.sh	Wed Jul 20 12:37:29 2011 +0300
+++ b/index.sh	Wed Jul 20 14:10:15 2011 +0300
@@ -21,10 +21,16 @@
   name=${file%.${ext}}
   case $ext in
     txt)
-      printf '  <li><a href="%s.txt" target="article">%s</a>\n' $name $name
+      case "$1" in
+        chm) printf '  <li><a href="%s.txt">%s</a>\n' $name $name ;;
+        frame) printf '  <li><a href="%s.txt" target="article">%s</a>\n' $name $name ;;
+      esac
       ;;
     rst)
-      printf '  <li><a href="%s.html" target="article">%s</a>\n' $name $name
+      case "$1" in
+        chm) printf '  <li><a href="%s.html">%s</a>\n' $name $name ;;
+        frame) printf '  <li><a href="%s.html" target="article">%s</a>\n' $name $name ;;
+      esac
       ;;
   esac
 done