|
1 | 1 | #lang at-exp racket |
2 | 2 |
|
3 | | -(require rackunit) |
| 3 | +(require rackunit |
| 4 | + ;; sorry I'm addicted to Ryan's regexp library |
| 5 | + scramble/regexp) |
4 | 6 |
|
5 | | -(provide bullet |
6 | | - sub-bullet |
7 | | - link |
| 7 | +(provide bullet ; a bullet |
| 8 | + sub-bullet ; a sub-bullet |
| 9 | + link ; use this to represent links, as e.g. @link["http://zzz.com"]{this is a link to zzz} |
8 | 10 | txt-render-bullet |
9 | 11 | md-render-bullet |
10 | 12 | bullet-links |
|
20 | 22 |
|
21 | 23 | (define bar-length 70) |
22 | 24 |
|
| 25 | +;; looks like sdg prefers stars? |
| 26 | +(define bullet-start-string "* ") |
| 27 | + |
23 | 28 | (define horizontal-bar (apply string (for/list ([i bar-length]) #\-))) |
24 | 29 |
|
25 | 30 | ;; a break-loc is a number representing a break before the nth character of a string. |
|
160 | 165 | (bulletS url 1 args)) |
161 | 166 |
|
162 | 167 | ;; an at-exp function that creates a link |
163 | | -(define (link url text) |
164 | | - (linkS text url)) |
| 168 | +(define (link url . texts) |
| 169 | + (linkS (apply string-append (map newline->string texts)) |
| 170 | + url)) |
| 171 | + |
| 172 | +;; replace newlines with strings: because of the way that |
| 173 | +;; at-exp parsing works, newlines will occur in separate strings. |
| 174 | +(define (newline->string s) |
| 175 | + (match s |
| 176 | + ["\n" " "] |
| 177 | + [other other])) |
165 | 178 |
|
166 | 179 | ;; given a bullet, return a list of strings representing |
167 | 180 | ;; lines suitable for inclusion in a text file |
|
227 | 240 | (define no-newlines-strs (map (λ (s) (cond [(equal? s "\n") " "] |
228 | 241 | [else s])) |
229 | 242 | strs)) |
230 | | - (list (string-append pad-str "- " (apply string-append no-newlines-strs)))) |
| 243 | + (list (string-append pad-str bullet-start-string (apply string-append no-newlines-strs)))) |
231 | 244 |
|
232 | 245 | ;; list-of-strings -> string |
233 | 246 | (define (display-lines los) |
|
366 | 379 | (list "Matthew Flatt," |
367 | 380 | "Stephen Chang, and" |
368 | 381 | "Robby Findler.")) |
| 382 | + |
| 383 | + |
| 384 | +(check-equal? (link "https://zzz.com" "yay a string") |
| 385 | + (linkS "yay a string" "https://zzz.com")) |
| 386 | +(check-equal? (link "https://zzz.com" "yay a" "\n" "string") |
| 387 | + (linkS "yay a string" "https://zzz.com")) |
369 | 388 | ) |
370 | 389 |
|
| 390 | +;; utility function for "going backward" from the markdown syntax to the release-notes format |
| 391 | +(define (flip-markdown-link txt) |
| 392 | + (match txt |
| 393 | + ;; this is probably overly conservative? |
| 394 | + [(regexp (px ^ "[" (report (+ (chars (complement "]")))) "](" (report (+ (chars (complement ")")))) ")" $) |
| 395 | + (list _ text-part url-part)) |
| 396 | + ;; it would be really easy to get the quoting wrong here... I probably have, |
| 397 | + ;; I'm not going to spend a long time thinking about it. Specifically, curly |
| 398 | + ;; braces in the text part will definitely be a problem. |
| 399 | + ;; ... okay, I can check for that anyway... |
| 400 | + (when (regexp-match? (px (chars "{}")) txt) |
| 401 | + (error "do this by hand, this string has curly braces in it.")) |
| 402 | + (~a "@link[\"" url-part "\"]{" text-part "}")] |
| 403 | + [else #f])) |
| 404 | + |
| 405 | +(define lines |
| 406 | +#<<| |
| 407 | +* The behavior of Racket BC on certain character operations (most notably `eq?`) is changed to match that of Racket CS, with a small performance penalty for these operations for BC programs. |
| 408 | + |
| 409 | +[19 Performance](https://docs.racket-lang.org/guide/performance.html#%28tech._bc%29) |
| 410 | + |
| 411 | +[1.5 Implementations](https://docs.racket-lang.org/reference/implementations.html#%28tech._bc%29) |
| 412 | + |
| 413 | +* The `make-struct-type` procedure can inherit the current inspector using a `'current` flag. This is the default behavior, but there are situations in which it's not possible to refer to the current inspector. |
| 414 | + |
| 415 | +[5.2 Creating Structure Types](https://docs.racket-lang.org/reference/creatingmorestructs.html) |
| 416 | + |
| 417 | +* The `system-type` function can report on platform and shared-object-library conventions with new flags. |
| 418 | + |
| 419 | +[15.8 Environment and Runtime Information](https://docs.racket-lang.org/reference/runtime.html) |
| 420 | + |
| 421 | +* The `openssl/legacy` library makes it possible to access OpenSSL's built-in "legacy" provider, to get access to insecure and outdated algorithms. |
| 422 | + |
| 423 | +[OpenSSL: Secure Communication](https://docs.racket-lang.org/openssl/index.html#%28mod-path._openssl%2Flegacy%29) |
| 424 | +| |
| 425 | +) |
| 426 | + |
| 427 | +;; use this to translate all the links... |
| 428 | +#;(for ([line (regexp-split (px "\n") lines)]) |
| 429 | + (define try-flip (flip-markdown-link line)) |
| 430 | + (displayln (or try-flip line))) |
371 | 431 |
|
372 | 432 |
|
0 commit comments