Documentation Source Text

Check-in [d0a850961d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Better doc_pagelink_crossref.html support. Now catches more hrefs outputted directly via hd_puts.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d0a850961d354afebabb3677df71c32331d3e642
User & Date: shaneh 2009-05-14 20:45:01
Context
2009-05-14
23:56
Miscellaneous documentation and hyperlink tweaks. check-in: 5856a03e9a user: drh tags: trunk
20:45
Better doc_pagelink_crossref.html support. Now catches more hrefs outputted directly via hd_puts. check-in: d0a850961d user: shaneh tags: trunk
18:13
Generate doc_pagelink_crossref.html which shows which pages link to which. Useful for finding orphans. check-in: bd0b540d7b user: shaneh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to wrap.tcl.

186
187
188
189
190
191
192

193
194
195

196
197


















198
199
200
201
202
203
204
...
218
219
220
221
222
223
224


225
226
227
228
229
230
231
...
259
260
261
262
263
264
265


266
267
268
269
270
271
272
...
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

# Write raw output to both the main file and the auxiliary.  Only write
# to files that are enabled.
#
proc hd_puts {text} {
  global hd
  if {$hd(enable-main)} {

    puts -nonewline $hd(main) $text
  }
  if {$hd(enable-aux)} {

    puts -nonewline $hd(aux) $text
  }


















}

# Enable or disable the main output file.
#
proc hd_enable_main {boolean} {
  global hd
  set hd(enable-main) $boolean
................................................................................
  global hd DEST
  hd_close_main
  set hd(fn-main) $filename
  set hd(rootpath-main) [hd_rootpath $filename]
  set hd(main) [open $DEST/$filename w]
  set hd(enable-main) 1
  set hd(fragment) {}


}

# If $filename is a path from $::DEST to a file, return a path
# from the directory containing $filename back to the directory $::DEST.
#
proc hd_rootpath {filename} {
  set up {}
................................................................................
proc hd_open_aux {filename} {
  global hd DEST
  hd_close_aux
  set hd(fn-aux) $filename
  set hd(rootpath-aux) [hd_rootpath $filename]
  set hd(aux) [open $DEST/$filename w]
  set hd(enable-aux) 1


}

# Close the auxiliary output file
#
proc hd_close_aux {} {
  global hd
  if {[info exists hd(aux)]} {
................................................................................
}
hd_puts "</ul>"
hd_close_main

hd_open_main doc_pagelink_crossref.html
hd_header {Pagelink Crossreference} $DOC/wrap.tcl
hd_puts "<p>Target Page - Which pages reference it.</p>"
hd_puts "<p>Pages matching (news|changes|releaselog|\[0-9]to\[0-9]|^hlr) are skipped.</p>"
hd_puts "<ul>"
foreach y [lsort [array names revglink]] {
  regsub {#.*} $y {} y2
  foreach kw [lsort $revglink($y)] {
    if {[info exists backlink($kw)]} {
      foreach ref [lsort $backlink($kw)] {
        regsub {#.*} $ref {} ref2
        lappend pagelink($y2) $ref2
      }
    }
  }
}
foreach y [lsort [array names pagelink]] {
  if {[regexp {(news|changes|releaselog|[0-9]to[0-9]|^hlr)} $y]} continue
  hd_puts "<li><a href=\"$y\">$y</a> - "
  set prev {}
  foreach ref [lsort $pagelink($y)] {
    if {$ref==$prev} continue
    if {$ref==$y} continue
    if {[regexp {(news|changes|releaselog|[0-9]to[0-9]|^hlr)} $ref]} continue
    hd_puts "<a href=\"$ref\">$ref</a> "
    set prev $ref
  }
  hd_puts "</li>"
}
hd_puts "</ul>"
hd_close_main








>



>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>







 







>
>







 







|













|





|








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
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
...
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

# Write raw output to both the main file and the auxiliary.  Only write
# to files that are enabled.
#
proc hd_puts {text} {
  global hd
  if {$hd(enable-main)} {
    set fn $hd(fn-main)
    puts -nonewline $hd(main) $text
  }
  if {$hd(enable-aux)} {
    set fn $hd(fn-aux)
    puts -nonewline $hd(aux) $text
  }
  
  # Our pagelink processing based off the globals
  # llink, glink, and backlink generated during hd_resolve
  # processing doesn't catch links outputted directly
  # with hd_puts.  This code attempts to add those links to
  # our pagelink array.
  global pagelink
  set refs [regexp -all -inline {href=\"(.*?)\"} $text]
  foreach {href ref} $refs {
    regsub {#.*} $ref {} ref2
    regsub {http:\/\/www\.sqlite\.org\/} $ref2 {} ref3
    regsub {\.\.\/} $ref3 {} ref4
    if {[regexp {^http} $ref4]} continue
    if {$ref4==""} continue
    if {[regexp {\.html$} $ref4]} {
      lappend pagelink($ref4) $fn
    }
  }
}

# Enable or disable the main output file.
#
proc hd_enable_main {boolean} {
  global hd
  set hd(enable-main) $boolean
................................................................................
  global hd DEST
  hd_close_main
  set hd(fn-main) $filename
  set hd(rootpath-main) [hd_rootpath $filename]
  set hd(main) [open $DEST/$filename w]
  set hd(enable-main) 1
  set hd(fragment) {}
  global pagelink
  lappend pagelink($filename) $filename
}

# If $filename is a path from $::DEST to a file, return a path
# from the directory containing $filename back to the directory $::DEST.
#
proc hd_rootpath {filename} {
  set up {}
................................................................................
proc hd_open_aux {filename} {
  global hd DEST
  hd_close_aux
  set hd(fn-aux) $filename
  set hd(rootpath-aux) [hd_rootpath $filename]
  set hd(aux) [open $DEST/$filename w]
  set hd(enable-aux) 1
  global pagelink
  lappend pagelink($filename) $filename
}

# Close the auxiliary output file
#
proc hd_close_aux {} {
  global hd
  if {[info exists hd(aux)]} {
................................................................................
}
hd_puts "</ul>"
hd_close_main

hd_open_main doc_pagelink_crossref.html
hd_header {Pagelink Crossreference} $DOC/wrap.tcl
hd_puts "<p>Target Page - Which pages reference it.</p>"
hd_puts "<p>Pages matching (news|changes|releaselog|\[0-9]to\[0-9]|^doc_.*_crossref) are skipped.</p>"
hd_puts "<ul>"
foreach y [lsort [array names revglink]] {
  regsub {#.*} $y {} y2
  foreach kw [lsort $revglink($y)] {
    if {[info exists backlink($kw)]} {
      foreach ref [lsort $backlink($kw)] {
        regsub {#.*} $ref {} ref2
        lappend pagelink($y2) $ref2
      }
    }
  }
}
foreach y [lsort [array names pagelink]] {
  if {[regexp {(news|changes|releaselog|[0-9]to[0-9]|^doc_.*_crossref)} $y]} continue
  hd_puts "<li><a href=\"$y\">$y</a> - "
  set prev {}
  foreach ref [lsort $pagelink($y)] {
    if {$ref==$prev} continue
    if {$ref==$y} continue
    if {[regexp {(news|changes|releaselog|[0-9]to[0-9]|^doc_.*_crossref)} $ref]} continue
    hd_puts "<a href=\"$ref\">$ref</a> "
    set prev $ref
  }
  hd_puts "</li>"
}
hd_puts "</ul>"
hd_close_main