Re: [pollen] ‘raco pollen start’ and ‘raco pollen render --recursive’ inconsistent with respect to ‘current-project-root’

2018-03-07 Thread Matthew Butterick
OK, I just pushed an update with a `--subdir` switch that behaves this way.


> On Mar 7, 2018, at 3:32 AM, 'Leandro Facchinetti' via Pollen 
>  wrote:
> 
> Hi,
> 
> Consider the following Pollen project:
> 
>  ;; a.txt.pp
>  #lang pollen
>  ◊(current-project-root)
> 
>  ;; s/b.txt.pp
>  #lang pollen
>  ◊(current-project-root)
> 
> I wish the outputs of ‘current-project-root’ to be consistent, always 
> pointing to the project root where a ‘pollen.rkt’ might live. When I ‘raco 
> pollen start’, the development server exhibits that behavior: I visit both 
> ‘http:///a.txt’ and ‘http:///s/b.txt’ and see the same 
> output. But when I ‘raco pollen render --recursive’, the outputs disagree: 
> ‘s/b.txt’ includes the ‘s/’ directory.
> 

-- 
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.


Re: [pollen] ‘raco pollen start’ and ‘raco pollen render --recursive’ inconsistent with respect to ‘current-project-root’

2018-03-07 Thread Matthew Butterick

> On Mar 7, 2018, at 8:01 AM, 'Leandro Facchinetti' via Pollen 
>  wrote:
> 
> I believe the directory containing ‘pollen.rkt’ is the “real home directory.” 
> Is this conception problematic?

Yes. Consider a project structured like this at the top level:

a.html.pm
pollen.rkt
sub/b.html.pm
sub/pollen.rkt
sub/sub2/c.html.pm

When rendering "c.html.pm", it will discover the "pollen.rkt" in the "sub" 
directory, but that's not the top directory. (Indeed, it would also be fair, 
though a little weird, to rely on a "pollen.rkt" entirely outside the project 
directory. The point being, one cannot infer anything from the location of the 
"pollen.rkt")



> If I don’t specify a pagetree, Pollen already generates a reasonable default 
> from listing the contents of the directory. How about introducing a way to 
> instruct Pollen to extend this default to include subdirectories as well?

Fair suggestion. I'll look into this.

-- 
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.


Re: [pollen] ‘raco pollen start’ and ‘raco pollen render --recursive’ inconsistent with respect to ‘current-project-root’

2018-03-07 Thread Matthew Butterick
This sounds wrong. 

And yet: is it? 

`current-project-root` is documented as the "the directory where you launched 
raco pollen start". (I'm not saying that pedantically — I often read the Pollen 
docs to find out things I've forgotten ;) 

The idea of `raco pollen render --recursive` is that every directory is being 
treated as its own subproject. Same as if you had done `cd` into each directory 
and `raco pollen render` from there. Indeed, during a `raco pollen render` 
operation, there's no way to infer what the "real" home directory is. Except 
that Pollen will search upward, to the top of your filesystem if necessary, for 
a "pollen.rkt".

So I come around to thinking your solution — create your own value and export 
it — is the right one.

Or, you could create a pagetree in the home directory — maybe it 
programmatically picks up the pages in the subdirectories — and render that. 
Then you can avoid `raco pollen render --recursive`, and rather just `raco 
pollen render` from the base directory, and `current-project-root` will 
(should!) stay consistent.



> On Mar 7, 2018, at 3:32 AM, 'Leandro Facchinetti' via Pollen 
>  wrote:
> 
> Consider the following Pollen project:
> 
>  ;; a.txt.pp
>  #lang pollen
>  ◊(current-project-root)
> 
>  ;; s/b.txt.pp
>  #lang pollen
>  ◊(current-project-root)
> 
> I wish the outputs of ‘current-project-root’ to be consistent, always 
> pointing to the project root where a ‘pollen.rkt’ might live. When I ‘raco 
> pollen start’, the development server exhibits that behavior: I visit both 
> ‘http:///a.txt’ and ‘http:///s/b.txt’ and see the same 
> output. But when I ‘raco pollen render --recursive’, the outputs disagree: 
> ‘s/b.txt’ includes the ‘s/’ directory.
> 
> My current workaround is to use ‘define-runtime-path’ in ‘pollen.rkt’ and 
> forego ‘current-project-root’. Is there a better solution?

-- 
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.


[pollen] ‘raco pollen start’ and ‘raco pollen render --recursive’ inconsistent with respect to ‘current-project-root’

2018-03-07 Thread 'Leandro Facchinetti' via Pollen
Hi,

Consider the following Pollen project:

  ;; a.txt.pp
  #lang pollen
  ◊(current-project-root)

  ;; s/b.txt.pp
  #lang pollen
  ◊(current-project-root)

I wish the outputs of ‘current-project-root’ to be consistent, always pointing 
to the project root where a ‘pollen.rkt’ might live. When I ‘raco pollen 
start’, the development server exhibits that behavior: I visit both 
‘http:///a.txt’ and ‘http:///s/b.txt’ and see the same 
output. But when I ‘raco pollen render --recursive’, the outputs disagree: 
‘s/b.txt’ includes the ‘s/’ directory.

My current workaround is to use ‘define-runtime-path’ in ‘pollen.rkt’ and 
forego ‘current-project-root’. Is there a better solution?

Thanks.

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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.