[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] Book with Denemo
From: |
Andreas Schneider |
Subject: |
Re: [Denemo-devel] Book with Denemo |
Date: |
Mon, 9 May 2016 23:43:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0 |
Thank you for your suggestions. I tried the following:
;;;StartBookpart
(let ((tag "StartBookpart")(thetitle ""))
(d-DirectivePut-movementcontrol-override tag (logior
DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
(disp "checking previous bookpart title ...")
(if (d-Directive-movementcontrol? tag)
(set! thetitle (d-DirectiveGet-movementcontrol-data tag)))
(set! thetitle (d-GetUserInputWithSnippets (_ "Start Bookpart")(_
"Give chapter title::") thetitle))
(if thetitle
(begin
(set! thetitle (car thetitle))
(if (zero? (string-length thetitle)) ;; if empty title string =>
delete the directive
(begin
(disp (string-append "Deleting directive " tag "."))
(d-DirectiveDelete-movemencontrol tag)
(d-SetSaved #f)
)
(begin
(disp thetitle)
(d-DirectivePut-movementcontrol-data tag (scheme-escape thetitle))
(d-DirectivePut-movementcontrol-prefix tag (string-append "
\\bookpart { %start of bookpart\n \\header {\n title = { " thetitle
" }\n }\n"))
(d-SetSaved #f)
)
))
(d-InfoDialog "Cancelled")
)
)
;;;EndBookpart
(let ((tag "EndBookpart"))
(if (d-Directive-movementcontrol? tag)
(begin
(disp (string-append "Deleting directive " tag "."))
(d-DirectiveDelete-movemencontrol tag)
(d-SetSaved #f)
)
(begin
;; or create it if it doesn't exist
(disp (string-append "Creating directive " tag "."))
(d-DirectivePut-movementcontrol-override tag (logior
DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
(d-DirectivePut-movementcontrol-postfix tag "\n} %end of bookpart\n")
(d-SetSaved #f)
))
)
Unfortunately, deleting the directive does not work; I get a script error
(#f Unbound variable: ~S (d-DirectiveDelete-movemencontrol) #f)
What do I do wrong?
Andreas
Am 08.05.2016 um 13:26 schrieb Richard Shann:
> On Sun, 2016-05-08 at 12:06 +0200, Andreas Schneider wrote:
>> Thank you! I have now come to the following scripts which work as desired:
>>
>> ;;;StartBookpart
>> (let ((tag "StartBookpart")(thetitle ""))
>> (d-DirectivePut-movementcontrol-override tag (logior
>> DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
>> (disp "checking previous bookpart title ...")
>> (if (d-Directive-movementcontrol? tag)
>> (set! thetitle (d-DirectiveGet-movementcontrol-data tag)))
>> (set! thetitle (d-GetUserInputWithSnippets (_ "Start Bookpart")(_
>> "Give chapter title::") thetitle))
>> (if thetitle
>> (begin
>> (set! thetitle (car thetitle))
>> (disp thetitle)
>> (d-DirectivePut-movementcontrol-data tag (scheme-escape thetitle))
>> (d-DirectivePut-movementcontrol-prefix tag (string-append "
>> \\bookpart { %start of bookpart\n \\header {\n title = { " thetitle
>> " }\n }\n"))
>> (d-SetSaved #f)
>> )
>> (d-InfoDialog "Cancelled")
>
> here you could delete the StartBookpart, or better after
> (if thetitle
>
>
> further test for (zero? (string-length thetitle))
> and delete it if the title is an empty string rather than creating it.
>
>
>> )
>> )
>>
>> ;;;EndBookpart
>> (let ((tag "EndBookpart"))
>
> here, you could remove the EndBookpart if it is already present
> making it a toggle:
>
> (if (d-Directive-movementcontrol? tag)
> (d-DirectiveDelete-movemencontrol tag)
> (begin
> ;; or create it if it doesn't exist
>
>
>
>
>> (d-DirectivePut-movementcontrol-override tag (logior
>> DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
>> (d-DirectivePut-movementcontrol-postfix tag "\n} %end of bookpart\n")
>> (d-SetSaved #f)
>> )
>
> with all these refinements you can give feedback about what you have
> done (deleting, setting) via d-InfoDialog or the timed notice routine
> that doesn't require the user to respond.
>
>
> Richard
>
>
- Re: [Denemo-devel] Book with Denemo, (continued)
- Re: [Denemo-devel] Book with Denemo, Richard Shann, 2016/05/05
- Re: [Denemo-devel] Book with Denemo, Richard Shann, 2016/05/06
- Re: [Denemo-devel] Book with Denemo, Andreas Schneider, 2016/05/08
- Re: [Denemo-devel] Book with Denemo, Richard Shann, 2016/05/08
- Re: [Denemo-devel] Book with Denemo, Richard Shann, 2016/05/08
- Re: [Denemo-devel] Book with Denemo, Andreas Schneider, 2016/05/08
- Re: [Denemo-devel] Book with Denemo, Richard Shann, 2016/05/08
- Re: [Denemo-devel] Book with Denemo,
Andreas Schneider <=
- Re: [Denemo-devel] Book with Denemo, Richard Shann, 2016/05/10