Thanks so much. I'll get working on it to see how it pans out. pagetree->list looks like exactly what I need and I think 'get-pagetree' will be useful too.
Thanks again. On Thursday, February 14, 2019 at 1:28:10 PM UTC-5, Matthew Butterick wrote: > > `require` is a compile-time command, but `for-each` doesn't happen until > run time. So there is a timing mismatch. > > I think you probably want `dynamic-require`, which lets you import > identifiers at run time: > > ◊(map (λ (fileName) (dynamic-require fileName 'doc)) fileList) > > As for generating a list of files, you can do that whatever way suits you > — don't overlook the `pagetree->list` function. > > > On Feb 14, 2019, at 8:11 AM, Ifeoluwapo Eleyinafe <eleyi...@gmail.com > <javascript:>> wrote: > > Or maybe just do this? > > ◊(define fileList (file->list index.ptree)) ;Not sure how to get the > exact path here > ◊(for-each (lambda (fileName) > ◊(require (prefix-in nextChapter: fileName)) ;???? > ◊nextChapter:doc > ) > fileList) > > On Thursday, February 14, 2019 at 10:32:22 AM UTC-5, Ifeoluwapo Eleyinafe > wrote: >> >> I know this is an old post but I'm hoping anyone can help. I'm trying to >> see is if this process can be automated for any files listed in the >> index.ptree. I'm thinking the code should look something like this: >> >> ◊(define fileList (file->list index.ptree)) ;Not sure how to get the >> exact path here >> ◊(for-each (lambda (fileName) >> ;all files suffixed with poly.pm so remove them and then convert >> the string to symbol >> ◊(define nextChapter (string->symbol (string-replace fileName ". >> poly.pm" ""))) >> ◊(require (prefix-in nextChapter: fileName)) ;???? >> ◊nextChapter:doc >> ) >> fileList) >> >> >> I know this is probably terrible cringeworthy code but I don't know >> racket so well. Any help would be greatly appreciated. Thank you. >> >> On Sunday, September 24, 2017 at 3:53:34 PM UTC-4, Matthew Butterick >> wrote: >>> >>> If you use the submodule technique, you need to `provide` the >>> identifiers from inside the submodule, then you also need to insert them in >>> the body of the source file: >>> >>> #lang pollen >>> >>> ◊(module art1-submod racket/base >>> (require "article1.html.pm") >>> (provide doc)) >>> ◊(require (prefix-in art1: 'art1-submod)) >>> >>> ◊art1:doc >>> >>> ◊(module art2-submod racket/base >>> (require "article2.html.pm") >>> (provide doc)) >>> ◊(require (prefix-in art2: 'art2-submod)) >>> >>> ◊art2:doc >>> >>> >>> Though looking at it now, I don't remember why I recommended submodules. >>> You can just do this: >>> >>> #lang pollen >>> >>> ◊(require (prefix-in art1: "article1.html.pm")) >>> >>> ◊art1:doc >>> >>> ◊(require (prefix-in art2: "article2.html.pm")) >>> >>> ◊art2:doc >>> >>> >>> >>> >>> On Sep 24, 2017, at 10:32 AM, Karim Chellaoui <fogi...@gmail.com> wrote: >>> >>> I have four files: >>> - article1.html.pm and article2.html.pm looking like this: >>> #lang pollen >>> ◊(define article1 "Article 1") >>> ◊h2{◊article1} >>> - index.html.pm >>> #lang pollen >>> ◊(module art1-submod racket/base (require "article1.html.pm")) >>> ◊(require (prefix-in art1: 'art1-submod)) >>> ◊(module art2-submod racket/base (require "article2.html.pm")) >>> ◊(require (prefix-in art2: 'art2-submod)) >>> - template.html >>> <html><head><meta charset="UTF-8"/></head> >>> <body style="background: #f6f6f6"> >>> <div style="background: white; margin: 3em; border:10px double gray; >>> padding: 3em; font-size: 130%;"> >>> <hr/> >>> ◊(->html ◊doc) >>> </div></body></html> >>> >>> With this configuration I end up with and empty page when rendering >>> index.html.pm . I guess I need to call for the art1-submod and >>> art2-submod, I just don't know how to do it? >>> >>> >>> >>> >>> >>> On Sep 24, 2017, at 10:32 AM, Karim Chellaoui <fogi...@gmail.com> wrote: >>> >>> I have four files: >>> - article1.html.pm and article2.html.pm looking like this: >>> #lang pollen >>> ◊(define article1 "Article 1") >>> ◊h2{◊article1} >>> - index.html.pm >>> #lang pollen >>> ◊(module art1-submod racket/base (require "article1.html.pm")) >>> ◊(require (prefix-in art1: 'art1-submod)) >>> ◊(module art2-submod racket/base (require "article2.html.pm")) >>> ◊(require (prefix-in art2: 'art2-submod)) >>> - template.html >>> <html><head><meta charset="UTF-8"/></head> >>> <body style="background: #f6f6f6"> >>> <div style="background: white; margin: 3em; border:10px double gray; >>> padding: 3em; font-size: 130%;"> >>> <hr/> >>> ◊(->html ◊doc) >>> </div></body></html> >>> >>> With this configuration I end up with and empty page when rendering >>> index.html.pm . I guess I need to call for the art1-submod and >>> art2-submod, I just don't know how to do it? >>> >>> Le sam. 23 sept. 2017 à 16:33, Matthew Butterick <m...@mbtype.com> a >>> écrit : >>> >>>> >>>> On Sep 23, 2017, at 3:29 AM, Karim Chellaoui <fogi...@gmail.com> wrote: >>>> >>>> I'm new to Pollen, I read the tutorial but couldn't find the way to >>>> apply this answer. I'm getting confused: how to effectively insert >>>> submodule ch1-submod in the main file? I tried different functions but it >>>> seems that I'm missing something. >>>> >>>> >>>> Perhaps post an example of code that isn't working? That will make it >>>> easier to pinpoint the problem. >>>> >>> >>> > -- > You received this message because you are subscribed to the Google Groups > "Pollen" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pollenpub+...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Pollen" group. To unsubscribe from this group and stop receiving emails from it, send an email to pollenpub+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.