Re: [pollen] Highlight code blocks are indenting too much
Thank you for the responses and for the quick fix! It didn't help in my case, though. I think the problem might lie somewhere in html genreration / html rendering in my browser (Safari). The relevant portion of the html code [.1.] mark [...] previsit [...] for [...] if [...] parent [...] dfs [...] [...] The relevant indentation is fine, however there is some extra indentation due to the deep nesting of the tag in the html structure. The first line, [.1.], gets indented accordingly (0), but the next other lines seem to take into account the "formatting whitespace" (for the lack of a better word) as well; if I delete all the extra whitespace, the html gets rendered properly. The problem is, I just run raco pollen start`; AFAIK no external html formatting is being made. Dne neděle 10. března 2019 21:27:14 UTC+1 Matthew Butterick napsal(a): > > When I tried your example, I got the right result. But there is a known > issue with the Scribble indenter (which Pollen uses) changing the > indentation within curly braces, which it shouldn't. [1] > > Thus, your example persuades me that it's better policy for Pollen to > leave whatever indenting is already in the source. So I've pushed a repair > for that. > > [1] https://github.com/racket/scribble/issues/58 > > > On Mar 10, 2019, at 8:32 AM, Evžen Wybitul > wrote: > > Hey, I'm not sure this is a problem with Pollen, that's why I'm not > opening an issue straight away. I hope someone will be able to help me > resolve this problem. > > The code blocks in `highlight` aren't indented as they should be. > > > -- 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] Question about Pollen markup
The curly-brace syntax is almost always preferable. Keep in mind that the linebreaks are separated into their own elements (For more on this behavior see [1].) So this markup: ◊ol{The remaining forty-nine stalks ◊(comment "" ",") two piles. another item another item } Produces this list of five (not three) elements: '("The remaining forty-nine stalks " (comment "" ",") " two piles." "\n" "another item" "\n" "another item") Probably what you want is to preprocess `elements` into bigger chunks representing list items before passing each to your 'li tag lambda. For instance this: (require sugar/list) (filter-split '("The remaining forty-nine stalks " (comment "" ",") " two piles." "\n" "another item" "\n" "another item") (λ (e) (equal? e "\n"))) Produces these sublists: '(("The remaining forty-nine stalks " (comment "" ",") " two piles.") ("another item") ("another item")) For a more elaborate example of list-item detection, see the `detect-list-items` function [2] in the pollen-tfl sample project. [1] https://docs.racket-lang.org/pollen/pollen-command-syntax.html#%28part._the-text-body%29 [2] https://docs.racket-lang.org/pollen-tfl/_pollen_rkt_.html#%28def._%28%28lib._pollen-tfl%2Fpollen..rkt%29._detect-list-items%29%29 > On Mar 10, 2019, at 4:08 PM, Brendan Stromberger > wrote: > > Hey there, still plugging away on my book project. I have a function for an > ordered list: > > (define (ol . elements) > (case (current-poly-target) > [(txt) elements] > [else (txexpr 'ol empty > (map (lambda (e) (txexpr 'li empty (list e))) elements))])) > > And I am using it like so: > > ◊ol[ > "The remaining forty-nine stalks are laid down and, aiming at the > middle of the pile with the right thumb◊(comment "" ",") two piles are > separated." > "another item" > "another item" > ] > > I want to use it this way because if I use the ◊ol{} syntax, my ◊comment{} > tag in the first item gets treated as its own , and generally the > generated markup is a bit weird – at each newline, a blank is generated: -- 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] Question about Pollen markup
Hey there, still plugging away on my book project. I have a function for an ordered list: (define (ol . elements) (case (current-poly-target) [(txt) elements] [else (txexpr 'ol empty (map (lambda (e) (txexpr 'li empty (list e))) elements))])) And I am using it like so: ◊ol[ "The remaining forty-nine stalks are laid down and, aiming at the middle of the pile with the right thumb◊(comment "" ",") two piles are separated." "another item" "another item" ] I want to use it this way because if I use the ◊ol{} syntax, my ◊comment{} tag in the first item gets treated as its own , and generally the generated markup is a bit weird – at each newline, a blank is generated: [image: Screen Shot 2019-03-10 at 6.06.02 PM.png] I'm not sure about the best way to write this. If I were to define an li tag and nest those inside my ol tag, that'd probably be fine, but then that begins to mirror the structure of the DOM rather than my document, which will eventually have definitions for Latex… any thoughts? Thanks! Brendan -- 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] Highlight code blocks are indenting too much
When I tried your example, I got the right result. But there is a known issue with the Scribble indenter (which Pollen uses) changing the indentation within curly braces, which it shouldn't. [1] Thus, your example persuades me that it's better policy for Pollen to leave whatever indenting is already in the source. So I've pushed a repair for that. [1] https://github.com/racket/scribble/issues/58 > On Mar 10, 2019, at 8:32 AM, Evžen Wybitul wrote: > > Hey, I'm not sure this is a problem with Pollen, that's why I'm not opening > an issue straight away. I hope someone will be able to help me resolve this > problem. > > The code blocks in `highlight` aren't indented as they should be. -- 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] Re: Highlight code blocks are indenting too much
In your source, are you using tabs or spaces? What does the rendered HTML look like? On Sunday, March 10, 2019 at 10:32:51 AM UTC-5, Evžen Wybitul wrote: > > Hey, I'm not sure this is a problem with Pollen, that's why I'm not > opening an issue straight away. I hope someone will be able to help me > resolve this problem. > > The code blocks in `highlight` aren't indented as they should be. > > Pollen code in .html.pm file: > > ◊highlight['python #:line-numbers? #f]{ > def dfs(v): > mark(v) > previsit(v) # will be useful later > for w in neighbors(v): > if not marked(w): > parent(w) = v > dfs(w) > postvisit(v) # will be useful later > } > > Is rendered as > > def dfs(v): > mark(v) > previsit(v) # will be useful later > for w in neighbors(v): > if not marked(w): > parent(w) = v > dfs(w) > postvisit(v) # will be useful later > > > Pollen code in pollen.rkt (only relevant parts) > > (require pollen/unstable/pygments) > > (provide highlight) > > I have some styling applied in .css, but I turned it off one by one and > the problem persisted. > > Do you have any idea where the problem could be? > -- 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] Highlight code blocks are indenting too much
Hey, I'm not sure this is a problem with Pollen, that's why I'm not opening an issue straight away. I hope someone will be able to help me resolve this problem. The code blocks in `highlight` aren't indented as they should be. Pollen code in .html.pm file: ◊highlight['python #:line-numbers? #f]{ def dfs(v): mark(v) previsit(v) # will be useful later for w in neighbors(v): if not marked(w): parent(w) = v dfs(w) postvisit(v) # will be useful later } Is rendered as def dfs(v): mark(v) previsit(v) # will be useful later for w in neighbors(v): if not marked(w): parent(w) = v dfs(w) postvisit(v) # will be useful later Pollen code in pollen.rkt (only relevant parts) (require pollen/unstable/pygments) (provide highlight) I have some styling applied in .css, but I turned it off one by one and the problem persisted. Do you have any idea where the problem could be? -- 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.