This module contains a logging system intended for use in MPI
94 | codes, with facilities for colored output, log level filters,
95 | code location and date and time annotation.
This module sets terminal colors, boldness and other settings
98 | Using ANSI/VT100 control sequences
99 | See http://misc.flogisoft.com/bash/tip_colors_and_formatting for a list of sequences
100 | This code is governed by the MIT license. See LICENSE for details.
164 |
165 | Nodes of different colours represent the following:
166 |
167 |
169 |
171 |
172 |
224 |
225 | Where possible, edges connecting nodes are given different colours to make them
226 | easier to distinguish in large graphs.
227 |
Module Graph
228 |
Solid arrows point from a parent (sub)module to the submodule which is
229 | descended from it. Dashed arrows point from a module being used to the
230 | module using it.
231 |
Type Graph
232 |
Solid arrows point from one derived type to another which extends
233 | (inherits from) it. Dashed arrows point from a derived type to another
234 | type containing it as a components, with a label listing the name(s) of
235 | said component(s).
236 |
Call Graph
237 |
Solid arrows point from a procedure to one which it calls. Dashed
238 | arrows point from an interface to procedures which implement that interface.
239 | This could include the module procedures in a generic interface or the
240 | implementation in a submodule of an interface in a parent module.
285 |
286 | Nodes of different colours represent the following:
287 |
288 |
290 |
292 |
293 |
345 |
346 | Where possible, edges connecting nodes are given different colours to make them
347 | easier to distinguish in large graphs.
348 |
Module Graph
349 |
Solid arrows point from a parent (sub)module to the submodule which is
350 | descended from it. Dashed arrows point from a module being used to the
351 | module using it.
352 |
Type Graph
353 |
Solid arrows point from one derived type to another which extends
354 | (inherits from) it. Dashed arrows point from a derived type to another
355 | type containing it as a components, with a label listing the name(s) of
356 | said component(s).
357 |
Call Graph
358 |
Solid arrows point from a procedure to one which it calls. Dashed
359 | arrows point from an interface to procedures which implement that interface.
360 | This could include the module procedures in a generic interface or the
361 | implementation in a submodule of an interface in a parent module.
This module sets terminal colors, boldness and other settings
177 | Using ANSI/VT100 control sequences
178 | See http://misc.flogisoft.com/bash/tip_colors_and_formatting for a list of sequences
179 | This code is governed by the MIT license. See LICENSE for details.
180 |
181 |
182 |
183 |
Source Code
184 |
!************************************************************************
185 | ! This module sets terminal colors, boldness and other settings
186 | ! Using ANSI/VT100 control sequences
187 | ! See http://misc.flogisoft.com/bash/tip_colors_and_formatting for a list of sequences
188 | ! This code is governed by the MIT license. See LICENSE for details.
189 | !************************************************************************
190 | module vt100
191 | implicit none
192 | ! Control start character
193 | character(len=*),parameter::start=achar(27)
194 | character(len=*),parameter::reset="0"
195 | ! Styles
196 | character(len=*),parameter::bold="1",dimmed="2",&
197 | underline="4",blink="5",invert="7",hidden="8"
198 | contains
199 | subroutine tput(lu,code)
200 | implicit none
201 | character(len=*),intent(in)::code
202 | integer,intent(in)::lu
203 | write(lu,'(a,"[",a,"m")',advance="no")start,code
204 | end subroutine tput
205 | subroutine stput(str,code)
206 | implicit none
207 | character(len=*),intent(inout)::str
208 | character(len=*),intent(in)::code
209 | str=trim(str)//start//"["//trim(code)//"m"
210 | end subroutine stput
211 | end module vt100
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
233 |
234 |
235 |
236 |
238 |
239 |
242 |
243 |
244 |
245 |
246 |
248 |
249 |
259 |
260 |
261 |
--------------------------------------------------------------------------------
/doc/src/flogging.f90:
--------------------------------------------------------------------------------
1 | !**************************************************************
2 | ! This module contains a logging system intended for use in MPI
3 | ! codes, with facilities for colored output, log level filters,
4 | ! code location and date and time annotation.
5 | !
6 | ! This software is governed by the MIT license, found in the
7 | ! file LICENSE.
8 | !**************************************************************
9 | #include "flogging.h"
10 | module flogging
11 | use :: vt100 ! For color output
12 |
13 | #ifdef f2003
14 | use, intrinsic :: iso_fortran_env, only: stdin=>input_unit, stdout=>output_unit, stderr=>error_unit
15 | #else
16 | #define stdin 5
17 | #define stdout 6
18 | #define stderr 0
19 | #endif
20 |
21 | implicit none
22 |
23 | ! Log levels
24 | integer, public, parameter :: NUM_LOG_LEVELS = 6 !< 1 through 6 (fatal through trace)
25 | integer, public, parameter :: LOG_FATAL = LOG_LEVEL_FATAL_DEF !< = 1, Runtime error causing termination
26 | integer, public, parameter :: LOG_ERROR = LOG_LEVEL_ERROR_DEF !< = 2, Runtime error
27 | integer, public, parameter :: LOG_WARN = LOG_LEVEL_WARN_DEF !< = 3, Warning, but we can continue
28 | integer, public, parameter :: LOG_INFO = LOG_LEVEL_INFO_DEF !< = 4, Interesting events
29 | integer, public, parameter :: LOG_DEBUG = LOG_LEVEL_DEBUG_DEF !< = 5, Detailed debug output, disable by compiling your program with -DDISABLE_LOG_DEBUG
30 | integer, public, parameter :: LOG_TRACE = LOG_LEVEL_TRACE_DEF !< = 6, Extremely detailed output, compile your program with -DENABLE_LOG_TRACE to enable
31 |
32 | integer, public, save :: logu = stderr !< By default, log to stderr
33 | integer, public, save :: minimum_log_level = LOG_INFO !< Note that more critical means a lower number
34 |
35 |
36 | public :: log_set_output_hostname
37 | public :: log_set_output_severity
38 | public :: log_set_output_date
39 | public :: log_set_output_time
40 | public :: log_set_output_fileline
41 | public :: log_set_skip_terminal_check
42 | public :: log_set_disable_colors
43 | public :: log_disable_cli_arguments
44 |
45 | public :: logp, logl
46 |
47 |
48 |
49 |
50 | private
51 | ! Default settings for hostname and severity output
52 | logical, save :: output_hostname = .false.
53 | logical, save :: output_severity = .true.
54 | logical, save :: output_date = .false.
55 | logical, save :: output_time = .false.
56 | logical, save :: output_fileline = .true.
57 | logical, save :: skip_terminal_check = .false.
58 | logical, save :: disable_colors = .false.
59 | logical, save :: cla_checked = .false.
60 |
61 | ! These are the color codes corresponding to the loglevels above
62 | character(len=*), dimension(NUM_LOG_LEVELS), parameter :: color_codes = &
63 | ["31", "31", "33", "32", "34", "30"]
64 | ! These are the styles corresponding to the loglevels above
65 | character(len=*), dimension(NUM_LOG_LEVELS), parameter :: style_codes = &
66 | [bold, reset, reset, reset, reset, reset]
67 |
68 | ! Colors for other output
69 | character(len=*), parameter :: level_color = "20"
70 |
71 | contains
72 | !**** Settings functions (public)
73 | !> Set the default for hostname output
74 | subroutine log_set_output_hostname(bool)
75 | logical, intent(in) :: bool
76 | output_hostname = bool
77 | end subroutine log_set_output_hostname
78 |
79 | !> Set the default for severity output
80 | subroutine log_set_output_severity(bool)
81 | logical, intent(in) :: bool
82 | output_severity = bool
83 | end subroutine log_set_output_severity
84 |
85 | !> Set the default for date output
86 | subroutine log_set_output_date(bool)
87 | logical, intent(in) :: bool
88 | output_date = bool
89 | end subroutine log_set_output_date
90 |
91 | !> Set time-only date format
92 | subroutine log_set_output_time(bool)
93 | logical, intent(in) :: bool
94 | output_time = bool
95 | end subroutine log_set_output_time
96 |
97 | !> Set the default for file/line output
98 | subroutine log_set_output_fileline(bool)
99 | logical, intent(in) :: bool
100 | output_fileline = bool
101 | end subroutine log_set_output_fileline
102 |
103 | !> Whether or not to skip the terminal check
104 | subroutine log_set_skip_terminal_check(bool)
105 | logical, intent(in) :: bool
106 | skip_terminal_check = bool
107 | end subroutine log_set_skip_terminal_check
108 |
109 | !> Disable colors altogether
110 | subroutine log_set_disable_colors(bool)
111 | logical, intent(in) :: bool
112 | disable_colors = bool
113 | end subroutine log_set_disable_colors
114 |
115 | !> Disable reading arguments from the commandline
116 | subroutine log_disable_cli_arguments()
117 | cla_checked = .true.
118 | end subroutine
119 |
120 |
121 |
122 |
123 |
124 | !**** Logging functions (public)
125 | !> Output this log statement or not
126 | function logp(level, only_n)
127 | #ifdef USE_MPI
128 | use mpi
129 | #endif
130 |
131 | integer, intent(in) :: level !< The log level of the current message
132 | integer, intent(in), optional :: only_n !< Show only if the current mpi rank equals only_n
133 | logical :: logp !< Output: true if this log message can be printed
134 |
135 | #ifdef USE_MPI
136 | integer :: rank, ierr
137 | #endif
138 |
139 | ! Check command-line arguments if that has not been done yet
140 | if (.not. cla_checked) call log_check_cli_arguments()
141 |
142 | if (level .le. minimum_log_level) then
143 | logp = .true.
144 | else
145 | logp = .false.
146 | endif
147 | #ifdef USE_MPI
148 | if (logp .and. present(only_n)) then
149 | call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
150 | if (rank .ne. only_n) logp = .false.
151 | endif
152 | #endif
153 | end function logp
154 |
155 | !> Write a log lead containing level and optional info
156 | !> The name is shortened to allow for longer log messages without needing continuations
157 | function logl(level, filename, linenum)
158 | ! Input parameters
159 | integer :: level !< The log level
160 | character(len=*), optional :: filename !< An optional filename to add to the log lead
161 | integer, optional :: linenum !< With line number
162 | character(len=300) :: logl !< The output log leader
163 |
164 | ! Internal parameters
165 | character(len=50), dimension(6) :: log_tmp !< The different parts of the log lead
166 | integer :: fn_len !< Add extra spaces after part i
167 | integer :: i,j !< The counter for the different parts
168 | character(4) :: linenum_lj ! left-justified line number
169 |
170 | logical :: show_colors = .false.
171 | i = 1
172 |
173 | ! Set level to 1 if it is too low, skip if too high
174 | if (level .lt. 1) level = 1
175 | if (level .gt. minimum_log_level .or. level .gt. NUM_LOG_LEVELS) return
176 |
177 | ! only show colors if we are outputting to a terminal
178 | if (skip_terminal_check) then
179 | show_colors = .not. disable_colors
180 | else
181 | show_colors = isatty(stdout) .and. .not. disable_colors
182 | endif
183 | ! This works in ifort and gfortran (log_unit is stdout here because log_lead is an internal string)
184 |
185 | ! Initialize log_tmp
186 | log_tmp = ""
187 | fn_len = 0
188 |
189 | ! Reset the colors if needed
190 | if (show_colors) call stput(log_tmp(i), reset) ! Do not increment i to add it before the next space
191 |
192 | ! Write date and time if wanted
193 | if (output_date .or. output_time) then
194 | log_tmp(i) = trim(log_tmp(i)) // log_datetime()
195 | i = i + 1
196 | endif
197 |
198 | ! Write hostname if requested
199 | if (output_hostname) then
200 | log_tmp(i) = trim(log_tmp(i)) // log_hostname()
201 | i = i + 1
202 | endif
203 |
204 | #ifdef USE_MPI
205 | ! Write mpi id
206 | log_tmp(i) = trim(log_tmp(i)) // log_mpi_id()
207 | i = i + 1
208 | #endif
209 |
210 | if (present(filename) .and. output_fileline) then
211 | log_tmp(i) = trim(log_tmp(i)) // trim(filename)
212 | if (present(linenum)) then
213 | ! Left-justify the line number and cap it to 4 characters
214 | write(linenum_lj, '(i4)') linenum
215 | log_tmp(i) = trim(log_tmp(i)) // ":" // adjustl(linenum_lj)
216 | endif
217 | ! How many extra spaces are needed to fill out to multiple of n characters
218 | fn_len = fn_len + len_trim(log_tmp(i))
219 | i = i+1
220 | endif
221 |
222 | ! Output severity level
223 | if (output_severity) then
224 | fn_len = fn_len + len_trim(log_severity(level, .false.))
225 | log_tmp(i) = trim(log_tmp(i)) // spaces(mod(7-fn_len,8)+8) // log_severity(level, show_colors)
226 | endif
227 |
228 | ! Set color based on severity level
229 | if (show_colors) then
230 | ! Set bold for errors (must go first, resets the color code otherwise)
231 | call stput(log_tmp(i), style_codes(level))
232 | call stput(log_tmp(i), color_codes(level))
233 | endif
234 |
235 | ! Concatenate trim(log_tmp(i)) with spaces in between
236 | logl = log_tmp(1)
237 | do j=2,i
238 | logl = trim(logl) // " " // trim(log_tmp(j))
239 | enddo
240 | end function logl
241 |
242 |
243 |
244 |
245 | !*** Utility functions (private)
246 | !> Return the hostname in a 50 character string
247 | function log_hostname()
248 | character(len=50) log_hostname
249 | call hostnm(log_hostname)
250 | end function log_hostname
251 |
252 | !> Return n spaces
253 | function spaces(n)
254 | integer, intent(in) :: n !< Maximum is 30
255 | character(len=n) :: spaces
256 | spaces = " "
257 | end function spaces
258 |
259 | !> Return the severity level with colors etc in a 50 char string
260 | function log_severity(level, show_colors)
261 | integer, intent(in) :: level
262 | logical, intent(in) :: show_colors
263 | character(len=50) log_severity
264 |
265 | log_severity = ""
266 | if (show_colors) call stput(log_severity, level_color)
267 | if (level .eq. LOG_FATAL) then
268 | if (show_colors) then
269 | call stput(log_severity, bold)
270 | call stput(log_severity, color_codes(level)) ! error has the same color, for reading convenience
271 | endif
272 | log_severity = trim(log_severity) // "FATAL"
273 | elseif (level .eq. LOG_ERROR) then
274 | if (show_colors) call stput(log_severity, bold)
275 | log_severity = trim(log_severity) // "ERROR"
276 | elseif (level .eq. LOG_WARN) then
277 | log_severity = trim(log_severity) // "WARN"
278 | elseif (level .eq. LOG_INFO) then
279 | log_severity = trim(log_severity) // "INFO"
280 | elseif (level .eq. LOG_DEBUG) then
281 | log_severity = trim(log_severity) // "DEBUG"
282 | elseif (level .eq. LOG_TRACE) then
283 | log_severity = trim(log_severity) // "TRACE"
284 | endif
285 | if (show_colors) call stput(log_severity, reset)
286 | end function log_severity
287 |
288 | #ifdef USE_MPI
289 | !> Return the mpi id of the current process
290 | function log_mpi_id()
291 | use mpi
292 | character(50) :: log_mpi_id !< The mpi id part of a log
293 | character(6) :: mpi_id_lj !< MPI id in string
294 | character(4) :: id_fmt !< The forhmat to print mpi_id_lj in
295 | integer :: rank, n_cpu, ierr
296 |
297 | call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
298 | call MPI_COMM_SIZE(MPI_COMM_WORLD, n_cpu, ierr)
299 | if (n_cpu .eq. 1) then
300 | log_mpi_id = ""
301 | else
302 | write(id_fmt, '(A,i1,A)') "(i", ceiling(log10(real(n_cpu))), ")"
303 | write(mpi_id_lj,id_fmt) rank
304 | write(log_mpi_id, '("#",a)') trim(adjustl(mpi_id_lj))
305 | endif
306 | end function log_mpi_id
307 | #endif
308 |
309 | !> Return the current date, formatted nicely
310 | function log_datetime()
311 | character(50) :: log_datetime !< Output the date here
312 |
313 | character(8) :: date
314 | character(10) :: time
315 | character(5) :: zone
316 |
317 | call date_and_time(date, time, zone)
318 | if (output_date .and. output_time) then
319 | write(log_datetime, '(a,"/",a,"/",a," ",a,":",a,":",a," ")') date(1:4), date(5:6), date(7:8), &
320 | time(1:2), time(3:4), time(5:6)
321 | endif
322 | if (output_time) then
323 | write(log_datetime, '(a,":",a,":",a," ")') time(1:2), time(3:4), time(5:6)
324 | endif
325 | if (output_date) then
326 | write(log_datetime, '(a,"/",a,"/",a," ")') date(1:4), date(5:6), date(7:8)
327 | endif
328 | end function log_datetime
329 |
330 | !> Check the command-line arguments to set the default logging level
331 | !> and color settings.
332 | subroutine log_check_cli_arguments()
333 | integer :: i,length,status
334 | character(len=32) :: arg
335 |
336 | ! Loop over all command-line arguments to look for -v
337 | do i=1,command_argument_count()
338 | call get_command_argument(i,arg,length,status)
339 | if (status .eq. 0) then
340 | select case (trim(arg))
341 | case ("--verbose")
342 | minimum_log_level = min(NUM_LOG_LEVELS,minimum_log_level+1)
343 | case ("-v")
344 | minimum_log_level = min(NUM_LOG_LEVELS,minimum_log_level+1)
345 | case ("-vv")
346 | minimum_log_level = min(NUM_LOG_LEVELS,minimum_log_level+2)
347 | case ("-vvv")
348 | minimum_log_level = min(NUM_LOG_LEVELS,minimum_log_level+3)
349 | case ("-vvvv")
350 | minimum_log_level = min(NUM_LOG_LEVELS,minimum_log_level+4)
351 | case ("-vvvvv")
352 | minimum_log_level = min(NUM_LOG_LEVELS,minimum_log_level+5)
353 | case ("-q")
354 | minimum_log_level = max(1,minimum_log_level-1)
355 | case ("-qq")
356 | minimum_log_level = max(1,minimum_log_level-2)
357 | case ("-qqq")
358 | minimum_log_level = max(1,minimum_log_level-3)
359 | case ("-qqqq")
360 | minimum_log_level = max(1,minimum_log_level-4)
361 | case ("-qqqqq")
362 | minimum_log_level = max(1,minimum_log_level-5)
363 | case ("--quiet")
364 | minimum_log_level = max(1,minimum_log_level-1)
365 | case ("--log-output-hostname")
366 | output_hostname = .true.
367 | case ("--log-force-colors")
368 | skip_terminal_check = .true.
369 | case ("--log-no-colors")
370 | disable_colors = .true.
371 | case ("--log-output-date")
372 | output_date = .true.
373 | case ("--log-output-time")
374 | output_time = .true.
375 | end select
376 | endif
377 | enddo
378 | cla_checked = .true.
379 | end subroutine log_check_cli_arguments
380 | end module flogging
381 |
--------------------------------------------------------------------------------
/doc/src/vt100.f90:
--------------------------------------------------------------------------------
1 | !************************************************************************
2 | ! This module sets terminal colors, boldness and other settings
3 | ! Using ANSI/VT100 control sequences
4 | ! See http://misc.flogisoft.com/bash/tip_colors_and_formatting for a list of sequences
5 | ! This code is governed by the MIT license. See LICENSE for details.
6 | !************************************************************************
7 | module vt100
8 | implicit none
9 | ! Control start character
10 | character(len=*), parameter :: start = achar(27)
11 | character(len=*), parameter :: reset = "0"
12 | ! Styles
13 | character(len=*), parameter :: bold = "1", dimmed = "2", &
14 | underline = "4", blink = "5", invert = "7", hidden = "8"
15 | contains
16 | subroutine tput(lu, code)
17 | implicit none
18 | character(len=*), intent(in) :: code
19 | integer, intent(in) :: lu
20 | write(lu, '(a,"[",a,"m")', advance="no") start, code
21 | end subroutine tput
22 | subroutine stput(str, code)
23 | implicit none
24 | character(len=*), intent(inout) :: str
25 | character(len=*), intent(in) :: code
26 | str = trim(str) // start // "[" // trim(code) // "m"
27 | end subroutine stput
28 | end module vt100
29 |
--------------------------------------------------------------------------------
/doc/tipuesearch/img/loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaanVanVugt/flogging/fd8c54cb7a57053b737025a7835ca825856857d3/doc/tipuesearch/img/loader.gif
--------------------------------------------------------------------------------
/doc/tipuesearch/img/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaanVanVugt/flogging/fd8c54cb7a57053b737025a7835ca825856857d3/doc/tipuesearch/img/search.png
--------------------------------------------------------------------------------
/doc/tipuesearch/tipuesearch.css:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | Tipue Search 4.0
4 | Copyright (c) 2014 Tipue
5 | Tipue Search is released under the MIT License
6 | http://www.tipue.com/search
7 | */
8 |
9 |
10 | /*
11 | #tipue_search_input
12 | {
13 | font: 13px/1.6 'open sans', sans-serif;
14 | color: #333;
15 | padding: 12px 12px 12px 40px;
16 | width: 170px;
17 | border: 1px solid #e2e2e2;
18 | border-radius: 0;
19 | -moz-appearance: none;
20 | -webkit-appearance: none;
21 | box-shadow: none;
22 | outline: 0;
23 | margin: 0;
24 | background: #fff url('img/search.png') no-repeat 15px 15px;
25 | }
26 | */
27 |
28 | #tipue_search_content
29 | {
30 | max-width: 650px;
31 | padding-top: 15px;
32 | margin: 0;
33 | }
34 | #tipue_search_loading
35 | {
36 | padding-top: 60px;
37 | background: #fff url('img/loader.gif') no-repeat left;
38 | }
39 |
40 | #tipue_search_warning_head
41 | {
42 | font: 300 15px/1.6 'Open Sans', sans-serif;
43 | color: #555;
44 | }
45 | #tipue_search_warning
46 | {
47 | font: 300 13px/1.6 'Open Sans', sans-serif;
48 | color: #333;
49 | margin: 7px 0;
50 | }
51 | #tipue_search_warning a
52 | {
53 | color: #36c;
54 | font-weight: 300;
55 | text-decoration: none;
56 | }
57 | #tipue_search_warning a:hover
58 | {
59 | color: #333;
60 | }
61 | #tipue_search_results_count
62 | {
63 | font: 300 13px/1.6 'Open Sans', sans-serif;
64 | color: #333;
65 | }
66 | .tipue_search_content_title
67 | {
68 | font: 300 25px/1.7 'Open Sans', sans-serif;
69 | text-rendering: optimizelegibility;
70 | margin-top: 23px;
71 | }
72 | .tipue_search_content_title a
73 | {
74 | color: #333;
75 | text-decoration: none;
76 | }
77 | .tipue_search_content_title a:hover
78 | {
79 | color: #555;
80 | }
81 | .tipue_search_content_url
82 | {
83 | font: 300 13px/1.7 'Open Sans', sans-serif;
84 | word-break: break-all;
85 | word-break: break-word;
86 | -webkit-hyphens: auto;
87 | -moz-hyphens: auto;
88 | hyphens: auto;
89 | }
90 | .tipue_search_content_url a
91 | {
92 | color: #06c;
93 | text-decoration: none;
94 | }
95 | .tipue_search_content_url a:hover
96 | {
97 | color: #333;
98 | }
99 | .tipue_search_content_text
100 | {
101 | font: 300 15px/1.6 'Open Sans', sans-serif;
102 | color: #555;
103 | word-break: break-all;
104 | word-break: break-word;
105 | -webkit-hyphens: auto;
106 | -moz-hyphens: auto;
107 | hyphens: auto;
108 | margin-top: 3px;
109 | }
110 | .h01
111 | {
112 | color: #333;
113 | font-weight: 400;
114 | }
115 |
116 | #tipue_search_foot
117 | {
118 | margin: 51px 0 21px 0;
119 | }
120 | #tipue_search_foot_boxes
121 | {
122 | padding: 0;
123 | margin: 0;
124 | font: 12px/1 'Open Sans', sans-serif;
125 | }
126 | #tipue_search_foot_boxes li
127 | {
128 | list-style: none;
129 | margin: 0;
130 | padding: 0;
131 | display: inline;
132 | }
133 | #tipue_search_foot_boxes li a
134 | {
135 | padding: 9px 15px 10px 15px;
136 | background-color: #f1f1f1;
137 | border: 1px solid #dcdcdc;
138 | border-radius: 1px;
139 | color: #333;
140 | margin-right: 7px;
141 | text-decoration: none;
142 | text-align: center;
143 | }
144 | #tipue_search_foot_boxes li.current
145 | {
146 | padding: 9px 15px 10px 15px;
147 | background: #fff;
148 | border: 1px solid #dcdcdc;
149 | border-radius: 1px;
150 | color: #333;
151 | margin-right: 7px;
152 | text-align: center;
153 | }
154 | #tipue_search_foot_boxes li a:hover
155 | {
156 | border: 1px solid #ccc;
157 | background-color: #f3f3f3;
158 | }
159 |
--------------------------------------------------------------------------------
/doc/tipuesearch/tipuesearch.min.js:
--------------------------------------------------------------------------------
1 | (function($){$.fn.tipuesearch=function(options){var set=$.extend({"show":7,"newWindow":false,"showURL":true,"minimumLength":3,"descriptiveWords":25,"highlightTerms":true,"highlightEveryTerm":false,"mode":"static","liveDescription":"*","liveContent":"*","contentLocation":"tipuesearch/tipuesearch_content.json"},options);return this.each(function(){var tipuesearch_in={pages:[]};$.ajaxSetup({async:false});if(set.mode=="live")for(var i=0;i");var t_2=html.toLowerCase().indexOf("",t_1+7);if(t_1!=-1&&t_2!=-1)var tit=html.slice(t_1+7,t_2);else var tit="No title";tipuesearch_in.pages.push({"title":tit,"text":desc,"tags":cont,"loc":tipuesearch_pages[i]})});if(set.mode=="json")$.getJSON(set.contentLocation,function(json){tipuesearch_in=$.extend({},json)});
3 | if(set.mode=="static")tipuesearch_in=$.extend({},tipuesearch);var tipue_search_w="";if(set.newWindow)tipue_search_w=' target="_blank"';function getURLP(name){return decodeURIComponent(((new RegExp("[?|&]"+name+"="+"([^&;]+?)(&|#|;|$)")).exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}if(getURLP("q")){$("#tipue_search_input").val(getURLP("q"));getTipueSearch(0,true)}$(this).keyup(function(event){if(event.keyCode=="13")getTipueSearch(0,true)});function getTipueSearch(start,replace){$("#tipue_search_content").hide();
4 | var out="";var results="";var show_replace=false;var show_stop=false;var standard=true;var c=0;found=new Array;var d=$("#tipue_search_input").val().toLowerCase();d=$.trim(d);if(d.match('^"')&&d.match('"$')||d.match("^'")&&d.match("'$"))standard=false;if(standard){var d_w=d.split(" ");d="";for(var i=0;i=set.minimumLength){if(standard){if(replace){var d_r=d;for(var i=0;i$1')}if(tipuesearch_in.pages[i].tags.search(pat)!=
7 | -1)score-=1E5-i;if(d_w[f].match("^-")){pat=new RegExp(d_w[f].substring(1),"i");if(tipuesearch_in.pages[i].title.search(pat)!=-1||tipuesearch_in.pages[i].text.search(pat)!=-1||tipuesearch_in.pages[i].tags.search(pat)!=-1)score=1E9}}if(score<1E9)found[c++]=score+"^"+tipuesearch_in.pages[i].title+"^"+s_t+"^"+tipuesearch_in.pages[i].loc}}else for(var i=0;i$1')}if(tipuesearch_in.pages[i].tags.search(pat)!=-1)score-=1E5-i;if(score<1E9)found[c++]=score+"^"+tipuesearch_in.pages[i].title+"^"+s_t+"^"+tipuesearch_in.pages[i].loc}if(c!=0){if(show_replace==1){out+='