help.tips: use write-object to write heading so that right-clicking on "Tip of the day" and picking Edit works
parent
6c0986f8b2
commit
903a6fbbc5
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: parser arrays namespaces sequences random help.markup kernel io
|
||||
io.styles colors.constants definitions accessors ;
|
||||
USING: parser arrays namespaces sequences random help.markup help.stylesheet
|
||||
kernel io io.styles colors.constants definitions accessors ;
|
||||
IN: help.tips
|
||||
|
||||
SYMBOL: tips
|
||||
|
@ -24,7 +24,7 @@ SYNTAX: TIP:
|
|||
parse-definition >array <tip>
|
||||
[ save-location ] [ add-tip ] bi ;
|
||||
|
||||
: a-tip ( -- tip ) tips get random content>> ;
|
||||
: a-tip ( -- tip ) tips get random ;
|
||||
|
||||
SYMBOL: tip-of-the-day-style
|
||||
|
||||
|
@ -34,13 +34,20 @@ H{
|
|||
{ wrap-margin 500 }
|
||||
} tip-of-the-day-style set-global
|
||||
|
||||
: $tip-title ( tip -- )
|
||||
[
|
||||
heading-style get [
|
||||
[ "Tip of the day" ] dip write-object
|
||||
] with-style
|
||||
] ($block) ;
|
||||
|
||||
: $tip-of-the-day ( element -- )
|
||||
drop
|
||||
[
|
||||
tip-of-the-day-style get
|
||||
[
|
||||
last-element off
|
||||
"Tip of the day" $heading a-tip print-element nl
|
||||
a-tip [ $tip-title ] [ content>> print-element nl ] bi
|
||||
"— " print-element "all-tips-of-the-day" ($link)
|
||||
]
|
||||
with-nesting
|
||||
|
@ -49,4 +56,6 @@ H{
|
|||
: tip-of-the-day. ( -- ) { $tip-of-the-day } print-content nl ;
|
||||
|
||||
: $tips-of-the-day ( element -- )
|
||||
drop tips get [ nl nl ] [ content>> print-element ] interleave ;
|
||||
drop tips get [ nl nl ] [ content>> print-element ] interleave ;
|
||||
|
||||
INSTANCE: tip definition
|
Loading…
Reference in New Issue