diff --git a/src/util/print.jam b/src/util/print.jam index 9a4f722fe..ca5e02be5 100644 --- a/src/util/print.jam +++ b/src/util/print.jam @@ -30,8 +30,27 @@ rule output ( ) { type ?= plain ; - output-target = $(target) ; - output-type = $(type) ; + if $(output-target) != $(target) + { + output-target = $(target) ; + output-type = $(type) ; + if $(output-type) = html + { + text + "" + "" + "
" + "" + "" + : true + : prefix ; + text + "" + "" + : + : suffix ; + } + } } # Generate a section with a description. The type of output can be @@ -48,53 +67,94 @@ rule section ( { lines [ split-at-words $(name): ] ; lines ; - local pre = ; - while $(description) + } + else if $(output-type) = html + { + name = [ escape-html $(name) ] ; + text; + } + local pre = ; + while $(description) + { + local paragraph = ; + while $(description) && $(description[1]) = "" { description = $(description[2-]) ; } + if $(pre) { - local paragraph = ; - while $(description) && $(description[1]) = "" { description = $(description[2-]) ; } - if $(pre) + pre = ; + while $(description) && ( $(description[1]) = "" || [ MATCH "^([ ])" : $(description[1]) ] ) + { paragraph += $(description[1]) ; description = $(description[2-]) ; } + if $(output-type) = plain { - pre = ; - while $(description) && ( $(description[1]) = "" || [ MATCH "^([ ])" : $(description[1]) ] ) - { paragraph += $(description[1]) ; description = $(description[2-]) ; } lines $(paragraph) : " " " " ; } - else + else if $(output-type) = html { - while $(description) && $(description[1]) != "" - { paragraph += $(description[1]) ; description = $(description[2-]) ; } - if $(paragraph[1]) = :: && ! $(paragraph[2]) - { - pre = yes ; - } - if $(paragraph[1]) = :: + text
; + lines $(paragraph) ; + text; + } + } + else + { + while $(description) && $(description[1]) != "" + { paragraph += $(description[1]) ; description = $(description[2-]) ; } + if $(paragraph[1]) = :: && ! $(paragraph[2]) + { + pre = yes ; + } + if $(paragraph[1]) = :: + { + if $(output-type) = plain { lines $(paragraph[2-]) : " " " " ; lines ; } - else + else if $(output-type) = html { - local p = [ MATCH "(.*)(::)$" : $(paragraph[-1]) ] ; - local pws = [ MATCH "([ ]*)$" : $(p[1]) ] ; - p = [ MATCH "(.*)($(pws))($(p[2]))$" : $(paragraph[-1]) ] ; - if $(p[3]) = :: + text
; + lines $(paragraph[2-]) ; + text; + } + } + else + { + local p = [ MATCH "(.*)(::)$" : $(paragraph[-1]) ] ; + local pws = [ MATCH "([ ]*)$" : $(p[1]) ] ; + p = [ MATCH "(.*)($(pws))($(p[2]))$" : $(paragraph[-1]) ] ; + if $(p[3]) = :: + { + pre = yes ; + if ! $(p[2]) || $(p[2]) = "" { paragraph = $(paragraph[1--2]) $(p[1]): ; } + else { paragraph = $(paragraph[1--2]) $(p[1]) ; } + if $(output-type) = plain { - pre = yes ; - if ! $(p[2]) || $(p[2]) = "" { paragraph = $(paragraph[1--2]) $(p[1]): ; } - else { paragraph = $(paragraph[1--2]) $(p[1]) ; } lines [ split-at-words " " $(paragraph) ] : " " " " ; lines ; } - else + else if $(output-type) = html + { + text
[ escape-html $(paragraph) ] ; + } + } + else + { + if $(output-type) = plain { lines [ split-at-words " " $(paragraph) ] : " " " " ; lines ; } + else if $(output-type) = html + { + text
[ escape-html $(paragraph) ] ; + } } } } } + if $(output-type) = html + { + text
; + } } # Generate the start of a list of items. The type of output can be @@ -107,6 +167,10 @@ rule list-start ( ) if $(output-type) = plain { } + else if $(output-type) = html + { + text