Skip to content

Instantly share code, notes, and snippets.

@bstro
Last active February 25, 2019 20:58
Show Gist options
  • Save bstro/a7ab051c6aa76087f94effb6f38e02e9 to your computer and use it in GitHub Desktop.
Save bstro/a7ab051c6aa76087f94effb6f38e02e9 to your computer and use it in GitHub Desktop.

Revisions

  1. Brendan Stromberger revised this gist Feb 25, 2019. 2 changed files with 3 additions and 0 deletions.
    1 change: 1 addition & 0 deletions my_question.poly.pm
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #lang pollen
    ◊; I have a custom tagged called `digram`. I use it like this:

    ◊digram{◊(lesser-yin)}
    2 changes: 2 additions & 0 deletions pollen.rkt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    #lang racket/base

    (define (digram . elements)
    (case (current-poly-target)
    [(txt) elements]
  2. Brendan Stromberger revised this gist Feb 25, 2019. 1 changed file with 2 additions and 8 deletions.
    10 changes: 2 additions & 8 deletions my_question.poly.pm
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,13 @@
    `◊; I have a custom tagged called `digram`. I use it like this:
    ◊; I have a custom tagged called `digram`. I use it like this:

    ◊digram{◊(lesser-yin)}

    ```
    ◊; I use this to render these characters: ⚌ ⚍ ⚎ ⚏
    ◊; I will be using these all over my document, but in this specific
    ◊; case, I need to render them much like they appear above: in a row.
    ◊; Eventually I will be rendering to HTML, Latex, PDF, and JSON (if I can
    ◊; figure out how). But for now, I am just concerned with HTML. I started
    ◊; with this idea (see pollen.rkt below for tag implementation):
    ```

    ◊digram-row{
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    @@ -18,12 +16,10 @@
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    }

    ```
    ◊; digram-row would map to an <ol>, and digram-row-item to an <li>,
    ◊; but I felt that this was coupling my representation of the digram row
    ◊; a little too closely to the HTML output. I am wondering if it might not
    ◊; be better to shoot for something like this:
    ```

    ◊digram-row{
    ◊digram{◊(lesser-yin)}
    @@ -32,10 +28,8 @@
    ◊digram{◊(lesser-yin)}
    }

    ```
    ◊; I would like digram-row to be able to look at its children and if it
    ◊; determines that one of its children is a digram, then wrap the digram
    ◊; in an <li> automatically. How do I do this?

    ◊; Thanks!
    ```
    ◊; Thanks!
  3. Brendan Stromberger renamed this gist Feb 25, 2019. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions question.poly.pm → my_question.poly.pm
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,15 @@
    ◊; I have a custom tagged called `digram`. I use it like this:
    `◊; I have a custom tagged called `digram`. I use it like this:

    ◊digram{◊(lesser-yin)}

    ```
    ◊; I use this to render these characters: ⚌ ⚍ ⚎ ⚏
    ◊; I will be using these all over my document, but in this specific
    ◊; case, I need to render them much like they appear above: in a row.
    ◊; Eventually I will be rendering to HTML, Latex, PDF, and JSON (if I can
    ◊; figure out how). But for now, I am just concerned with HTML. I started
    ◊; with this idea (see pollen.rkt below for tag implementation):
    ```

    ◊digram-row{
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    @@ -16,10 +18,12 @@
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    }

    ```
    ◊; digram-row would map to an <ol>, and digram-row-item to an <li>,
    ◊; but I felt that this was coupling my representation of the digram row
    ◊; a little too closely to the HTML output. I am wondering if it might not
    ◊; be better to shoot for something like this:
    ```

    ◊digram-row{
    ◊digram{◊(lesser-yin)}
    @@ -28,8 +32,10 @@
    ◊digram{◊(lesser-yin)}
    }

    ```
    ◊; I would like digram-row to be able to look at its children and if it
    ◊; determines that one of its children is a digram, then wrap the digram
    ◊; in an <li> automatically. How do I do this?

    ◊; Thanks!
    ◊; Thanks!
    ```
  4. Brendan Stromberger created this gist Feb 25, 2019.
    34 changes: 34 additions & 0 deletions pollen.rkt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    (define (digram . elements)
    (case (current-poly-target)
    [(txt) elements]
    [else (txexpr 'span empty elements)]))

    (define (digram-row . elements)
    (case (current-poly-target)
    [(txt) elements]
    [else (txexpr 'ol empty elements)]))

    (define (digram-row-item . elements)
    (case (current-poly-target)
    [(txt) elements]
    [else (txexpr 'li empty elements)]))

    (define (lesser-yin)
    (case (current-poly-target)
    [(txt) "figure out later"]
    [else ""]))

    (define (lesser-yang)
    (case (current-poly-target)
    [(txt) "figure out later"]
    [else ""]))

    (define (greater-yin)
    (case (current-poly-target)
    [(txt) "figure out later"]
    [else ""]))

    (define (greater-yang)
    (case (current-poly-target)
    [(txt) "figure out later"]
    [else ""]))
    35 changes: 35 additions & 0 deletions question.poly.pm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ◊; I have a custom tagged called `digram`. I use it like this:

    ◊digram{◊(lesser-yin)}

    ◊; I use this to render these characters: ⚌ ⚍ ⚎ ⚏
    ◊; I will be using these all over my document, but in this specific
    ◊; case, I need to render them much like they appear above: in a row.
    ◊; Eventually I will be rendering to HTML, Latex, PDF, and JSON (if I can
    ◊; figure out how). But for now, I am just concerned with HTML. I started
    ◊; with this idea (see pollen.rkt below for tag implementation):

    ◊digram-row{
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    ◊digram-row-item{◊digram{◊(greater-yin)}}
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    ◊digram-row-item{◊digram{◊(lesser-yin)}}
    }

    ◊; digram-row would map to an <ol>, and digram-row-item to an <li>,
    ◊; but I felt that this was coupling my representation of the digram row
    ◊; a little too closely to the HTML output. I am wondering if it might not
    ◊; be better to shoot for something like this:

    ◊digram-row{
    ◊digram{◊(lesser-yin)}
    ◊digram{◊(greater-yin)}
    ◊digram{◊(lesser-yin)}
    ◊digram{◊(lesser-yin)}
    }

    ◊; I would like digram-row to be able to look at its children and if it
    ◊; determines that one of its children is a digram, then wrap the digram
    ◊; in an <li> automatically. How do I do this?

    ◊; Thanks!