OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [pkgconf/] [fixhtml.tcl] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#!/usr/bin/env tclsh
2
 
3
#===============================================================================
4
#
5
#    fixhtml.tcl
6
#
7
#    Patch HTML files generated from DocBook sources.
8
#
9
#===============================================================================
10
## ####ECOSGPLCOPYRIGHTBEGIN####                                            
11
## -------------------------------------------                              
12
## This file is part of eCos, the Embedded Configurable Operating System.   
13
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
##
15
## eCos is free software; you can redistribute it and/or modify it under    
16
## the terms of the GNU General Public License as published by the Free     
17
## Software Foundation; either version 2 or (at your option) any later      
18
## version.                                                                 
19
##
20
## eCos is distributed in the hope that it will be useful, but WITHOUT      
21
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
22
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
23
## for more details.                                                        
24
##
25
## You should have received a copy of the GNU General Public License        
26
## along with eCos; if not, write to the Free Software Foundation, Inc.,    
27
## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
28
##
29
## As a special exception, if other files instantiate templates or use      
30
## macros or inline functions from this file, or you compile this file      
31
## and link it with other works to produce a work based on this file,       
32
## this file does not by itself cause the resulting work to be covered by   
33
## the GNU General Public License. However the source code for this file    
34
## must still be made available in accordance with section (3) of the GNU   
35
## General Public License v2.                                               
36
##
37
## This exception does not invalidate any other reasons why a work based    
38
## on this file might be covered by the GNU General Public License.         
39
## -------------------------------------------                              
40
## ####ECOSGPLCOPYRIGHTEND####                                              
41
#===============================================================================
42
######DESCRIPTIONBEGIN####
43
#
44
# Author(s):    bartv
45
# Contributors: bartv
46
# Date:         2000-03-14
47
# Purpose:      HTML files generated from DocBook sources using the nwalsh
48
#               stylesheets have a number of problems. Most importantly,
49
#               Netscape 4.x does not understand all of the character entities
50
#               defined by HTML 4.0x
51
#
52
#####DESCRIPTIONEND####
53
#===============================================================================
54
#
55
 
56
# Find out the current year for the copyright message. Ideally
57
# this would be a range extracted from the sources, but that is
58
# a little bit tricky.
59
 
60
set year [clock format [clock seconds] -format "%Y"]
61
 
62
set copyright_banner \
63
"<!-- Copyright (C) $year Free Software Foundation, Inc.                                -->
64
<!-- This material may be distributed only subject to the terms      -->
65
<!-- and conditions set forth in the Open Publication License, v1.0  -->
66
<!-- or later (the latest version is presently available at          -->
67
<!-- http://www.opencontent.org/openpub/).                           -->
68
<!-- Distribution of the work or derivative of the work in any       -->
69
<!-- standard (paper) book form is prohibited unless prior           -->
70
<!-- permission is obtained from the copyright holder.               -->"
71
 
72
set files [glob *.html]
73
foreach file $files {
74
    set status [catch {
75
 
76
        set fd [open $file "r"]
77
        set data [read $fd]
78
        close $fd
79
 
80
        # If there is already a (C) message on the first line, skip this file.
81
        if {[regexp {[^\n]*Copyright (C) [0-9]* Free Software Foundation.*} $data] == 0} {
82
 
83
            # The DSSSL has the annoying habit of splitting tags over several lines.
84
            # This should sort things out.
85
            # REMOVED by jifl: doing this can add newlines in tags like
86
            # <literallayout>, <screen>, and/or <programlisting>
87
            # regsub -all "\n>" $data ">\n" data
88
 
89
            # Add a copyright banner
90
            set data "[set copyright_banner]\n[set data]"
91
 
92
            # Look for a smarttags meta. If absent, insert one. There should
93
            # already be one meta present identifying the stylesheet, so
94
            # that identifies a sensible location for inserting another meta.
95
            if {[regexp {MSSmartTagsPreventParsing} $data] == 0} {
96
                regsub -nocase {<META} $data "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">\n<META" data
97
            }
98
 
99
            # Take care of some character entities that Netscape does not understand
100
            regsub -all "&mgr;"    $data "\\&#03BC;" data
101
            regsub -all "&mdash;"  $data "\\&#8212;" data
102
            regsub -all "&ndash;"  $data "\\&#8211;" data
103
            regsub -all "&hellip;" $data "\\&#8230;" data
104
            regsub -all "&ldquo;"  $data "\\&#8220;" data
105
            regsub -all "&rdquo;"  $data "\\&#8221;" data
106
            regsub -all "&lsqb;"   $data "\\&#0091;" data
107
            regsub -all "&rsqb;"   $data "\\&#0093;" data
108
            regsub -all "&lcub;"   $data "\\&#0123;" data
109
            regsub -all "&rcub;"   $data "\\&#0125;" data
110
            regsub -all "&lsquo;"  $data "\\&#8216;" data
111
            regsub -all "&rsquo;"  $data "\\&#8217;" data
112
            regsub -all "&trade;"  $data "\\&#8482;" data
113
            regsub -all "&ast;"    $data "\\&#0042;" data
114
            regsub -all "&lowbar;" $data "\\&#0095;" data
115
            regsub -all "&sol;"    $data "\\&#0047;" data
116
            regsub -all "&equals;" $data "\\&#0061;" data
117
            regsub -all "&num;"    $data "\\&#0035;" data
118
            regsub -all "&plus;"   $data "\\&#0043;" data
119
            regsub -all "&percnt;" $data "\\&#0037;" data
120
            regsub -all "&dollar;" $data "\\&#0036;" data
121
            regsub -all "&boxv;"   $data "\\&#9474;" data
122
            regsub -all "&bsol;"   $data "\\&#0092;" data
123
            regsub -all "&block;"  $data "\\&#9608;" data
124
            regsub -all "&marker;" $data "\\&#9646;" data
125
 
126
            # Now write the data back to the file. Do not bother to
127
            # keep an old version lying around, the html files can be
128
            # regenerated easily enough.
129
            set fd [open $file "w"]
130
            puts -nonewline $fd $data
131
            close $fd
132
        }
133
    } result]
134
 
135
    if {0 != $status} {
136
        puts "Error while processing file $file\n    $result"
137
        exit 1
138
    }
139
}
140
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.