|
136 | 136 | (define (md-abstract x) |
137 | 137 | (if (hugo-extensions?) |
138 | 138 | (with-md-globals 'paragraph-width #f |
139 | | - (with-md-globals 'disable-shortcodes #t |
140 | | - (md-hugo-frontmatter |
| 139 | + (md-hugo-frontmatter |
141 | 140 | `(hugo-front "summary" ,(serialize-markdown* (cdr x)))))) |
142 | | - (md-paragraph `(concat (strong "Abstract: ") (em ,(cdr x)))))) |
| 141 | + (md-paragraph `(concat (strong "Abstract: ") (em ,(cdr x))))) |
143 | 142 |
|
144 | 143 | (define (must-adjust? t) |
145 | 144 | (tm-in? t '(strong em tt strike math concat cite cite-detail |
|
394 | 393 | (with citations |
395 | 394 | (filter (lambda (x) (and (string? x) (not (string-null? x)))) (cdr x)) |
396 | 395 | (md-set 'refs (append (md-get 'refs) citations)) |
397 | | - (md-hugo-shortcode |
| 396 | + (md-hugo-shortcode* |
398 | 397 | (cons 'cite (map (lambda (s) `(#f . ,s)) citations)))))) |
399 | 398 |
|
400 | 399 | (define (md-cite-detail x) |
|
423 | 422 | (begin |
424 | 423 | (set! args (assoc-remove-many args '(body name caption))) |
425 | 424 | (set! args (assoc-append? args 'class (md-get 'html-class))) |
426 | | - (md-hugo-shortcode `(,type ,@args) |
427 | | - `(document ,body (concat ,name ,caption)))) |
| 425 | + (md-hugo-shortcode* `(,type ,@args) |
| 426 | + `(document ,body (concat ,name ,caption)))) |
428 | 427 | (with content (if (assoc 'src args) |
429 | 428 | `(image ,(assoc-ref args 'src) ,body) |
430 | 429 | body) |
|
464 | 463 | (map set-pair! (list->assoc (cdr x)))))) |
465 | 464 | "") |
466 | 465 |
|
467 | | -(define (md-hugo-shortcode x . inner) |
| 466 | +(define (md-hugo-shortcode x) |
| 467 | + "Processes '(hugo-short shortcode-name (args)) where args is a list of tuples (name val). For unnamed arguments, use (#f val)" |
| 468 | + (md-hugo-shortcode* (cdr x))) |
| 469 | + |
| 470 | +(define (md-hugo-shortcode* x . inner) |
| 471 | + "Inner processing of shortcodes" |
468 | 472 | (if (not (md-get 'disable-shortcodes)) |
469 | 473 | (let ((shortcode (symbol->string (car x))) |
470 | 474 | (args (cdr x)) |
|
485 | 489 |
|
486 | 490 | (define (md-bibliography x) |
487 | 491 | (if (hugo-extensions?) |
488 | | - (md-hugo-shortcode '(references)) |
| 492 | + (md-hugo-shortcode* '(references)) |
489 | 493 | (md-style '(strong "Bibliography not implemented for raw Markdown")))) |
490 | 494 |
|
491 | 495 | (define (md-sidenote-sub x numbered?) |
492 | 496 | (if (hugo-extensions?) |
493 | 497 | (let ((numbered (if numbered? '((numbered . "numbered")) '())) |
494 | 498 | (args (cdr x))) |
495 | | - (md-hugo-shortcode |
| 499 | + (md-hugo-shortcode* |
496 | 500 | (append `(sidenote (halign . ,(md-marginal-style (first args))) |
497 | 501 | (valign . ,(md-marginal-style (second args)))) |
498 | 502 | numbered) |
|
574 | 578 |
|
575 | 579 | (define serialize-hash (make-ahash-table)) |
576 | 580 | (map (lambda (l) (apply (cut ahash-set! serialize-hash <> <>) l)) |
577 | | - (list (list 'identity skip) |
578 | | - (list 'markdown md-markdown) |
579 | | - (list 'localize md-translate) |
580 | | - (list 'labels md-labels) |
581 | | - (list 'strong md-style) |
582 | | - (list 'em md-style) |
583 | | - (list 'tt md-style) |
584 | | - (list 'strike md-style) |
585 | | - (list 'underline md-style) |
586 | | - (list 'block md-block) |
587 | | - (list 'quotation md-quotation) |
588 | | - (list 'document md-document) |
589 | | - (list 'std-env (md-make-environment 'em)) |
590 | | - (list 'std-env* (md-make-environment* 'em)) |
591 | | - (list 'plain-env (md-make-environment 'identity)) |
592 | | - (list 'plain-env* (md-make-environment* 'identity)) |
593 | | - (list 'dueto md-dueto) |
594 | | - (list 'math md-math) |
595 | | - (list 'equation md-numbered-equation) |
596 | | - (list 'equation* md-equation) |
597 | | - (list 'eqnarray md-numbered-equation) |
598 | | - (list 'eqnarray* md-equation) |
599 | | - (list 'concat md-concat) |
600 | | - (list 'item md-item) |
601 | | - (list 'itemize md-list) |
602 | | - (list 'enumerate md-list) |
603 | | - (list 'h1 (md-header 1)) |
604 | | - (list 'h2 (md-header 2)) |
605 | | - (list 'h3 (md-header 3)) |
606 | | - (list 'para md-para) |
607 | | - (list 'doc-date md-doc-date) |
608 | | - (list 'doc-title md-doc-title) |
609 | | - (list 'doc-subtitle md-doc-subtitle) |
610 | | - (list 'doc-author md-doc-author) |
611 | | - (list 'abstract md-abstract) |
612 | | - (list 'paper-author-name paper-author-add) ; Paperwhy extension |
613 | | - (list 'cite md-cite) |
614 | | - (list 'cite-detail md-cite-detail) |
615 | | - (list 'eqref md-eqref) |
616 | | - (list 'label md-label) |
617 | | - (list 'reference md-reference) |
618 | | - (list 'footnote md-footnote) |
619 | | - (list 'todo md-todo) |
620 | | - (list 'image md-image) |
621 | | - (list 'html-class md-html-class) |
622 | | - (list 'small-figure (md-figure 'tmfigure '(class . "small-figure"))) |
623 | | - (list 'big-figure |
624 | | - (md-figure 'tmfigure |
625 | | - '(marginal-caption . #t) '(class . "big-figure"))) |
626 | | - (list 'wide-figure (md-figure 'tmfigure '(class . "wide-figure"))) |
627 | | - (list 'marginal-figure (md-figure 'sidefigure)) |
628 | | - (list 'small-table (md-figure 'tmfigure)) |
629 | | - (list 'big-table (md-figure 'tmfigure )) |
630 | | - (list 'tabular md-tabular) |
631 | | - (list 'hlink md-hlink) |
632 | | - (list 'tags md-hugo-tags) ; Hugo extension (DEPRECATED) |
633 | | - (list 'hugo-short md-hugo-shortcode) ; Hugo extension |
634 | | - (list 'hugo-front md-hugo-frontmatter) ; Hugo extension |
635 | | - (list 'table-of-contents md-toc) ; Hugo extension |
636 | | - (list 'bibliography md-bibliography) ; TfL extension |
637 | | - (list 'marginal-note md-sidenote) ; TfL extension |
638 | | - (list 'marginal-note* md-sidenote*) ; TfL extension |
639 | | - (list 'explain-macro md-explain-macro) |
640 | | - (list 'tmdoc-copyright md-tmdoc-copyright) |
641 | | - )) |
| 581 | + (list |
| 582 | + (list 'abstract md-abstract) |
| 583 | + (list 'bibliography md-bibliography) ; TfL extension |
| 584 | + (list 'big-figure |
| 585 | + (md-figure 'tmfigure '(marginal-caption . #t) '(class . "big-figure"))) |
| 586 | + (list 'big-table (md-figure 'tmfigure )) |
| 587 | + (list 'block md-block) |
| 588 | + (list 'cite-detail md-cite-detail) |
| 589 | + (list 'cite md-cite) |
| 590 | + (list 'concat md-concat) |
| 591 | + (list 'doc-author md-doc-author) |
| 592 | + (list 'doc-date md-doc-date) |
| 593 | + (list 'doc-subtitle md-doc-subtitle) |
| 594 | + (list 'doc-title md-doc-title) |
| 595 | + (list 'document md-document) |
| 596 | + (list 'dueto md-dueto) |
| 597 | + (list 'em md-style) |
| 598 | + (list 'enumerate md-list) |
| 599 | + (list 'eqnarray* md-equation) |
| 600 | + (list 'eqnarray md-numbered-equation) |
| 601 | + (list 'eqref md-eqref) |
| 602 | + (list 'equation* md-equation) |
| 603 | + (list 'equation md-numbered-equation) |
| 604 | + (list 'explain-macro md-explain-macro) |
| 605 | + (list 'footnote md-footnote) |
| 606 | + (list 'h1 (md-header 1)) |
| 607 | + (list 'h2 (md-header 2)) |
| 608 | + (list 'h3 (md-header 3)) |
| 609 | + (list 'hlink md-hlink) |
| 610 | + (list 'html-class md-html-class) |
| 611 | + (list 'hugo-front md-hugo-frontmatter) ; Hugo extension |
| 612 | + (list 'hugo-short md-hugo-shortcode) ; Hugo extension |
| 613 | + (list 'identity skip) |
| 614 | + (list 'image md-image) |
| 615 | + (list 'itemize md-list) |
| 616 | + (list 'item md-item) |
| 617 | + (list 'label md-label) |
| 618 | + (list 'labels md-labels) |
| 619 | + (list 'localize md-translate) |
| 620 | + (list 'marginal-figure (md-figure 'sidefigure)) |
| 621 | + (list 'marginal-note md-sidenote) ; TfL extension |
| 622 | + (list 'marginal-note* md-sidenote*) ; TfL extension |
| 623 | + (list 'markdown md-markdown) |
| 624 | + (list 'math md-math) |
| 625 | + (list 'paper-author-name paper-author-add) ; Paperwhy extension |
| 626 | + (list 'para md-para) |
| 627 | + (list 'plain-env (md-make-environment 'identity)) |
| 628 | + (list 'plain-env* (md-make-environment* 'identity)) |
| 629 | + (list 'quotation md-quotation) |
| 630 | + (list 'reference md-reference) |
| 631 | + (list 'small-figure (md-figure 'tmfigure '(class . "small-figure"))) |
| 632 | + (list 'small-table (md-figure 'tmfigure)) |
| 633 | + (list 'std-env (md-make-environment 'em)) |
| 634 | + (list 'std-env* (md-make-environment* 'em)) |
| 635 | + (list 'strike md-style) |
| 636 | + (list 'strong md-style) |
| 637 | + (list 'table-of-contents md-toc) ; Hugo extension |
| 638 | + (list 'tabular md-tabular) |
| 639 | + (list 'tags md-hugo-tags) ; Hugo extension (DEPRECATED) |
| 640 | + (list 'tmdoc-copyright md-tmdoc-copyright) |
| 641 | + (list 'todo md-todo) |
| 642 | + (list 'tt md-style) |
| 643 | + (list 'underline md-style) |
| 644 | + (list 'wide-figure (md-figure 'tmfigure '(class . "wide-figure"))) |
| 645 | + )) |
642 | 646 |
|
643 | 647 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
644 | 648 | ;; Public interface |
|
0 commit comments