3

所以我有一个文件,我目前将一堆数据保存在抽屉中(在这种特定情况下,是笔和纸 RPG 角色)。我重写了抽屉的工作方式,因此我可以实现一个切换按钮来隐藏/显示。这很好用,除了似乎没有按照我认为的方式解析内容。

主要问题是它似乎不解析 plain-lists。因此,我将如何更改函数以解析普通列表,而不会损坏其他输出?

导出抽屉功能:

(require 'org-publish)
(setq org-publish-project-alist
      '(
("org-notes"
 :base-directory "~/shared/"
 :base-extension "org"
 :publishing-directory "~/public_html/org/"
 :recursive t
 :drawers t
 :creator-info nil
 :publishing-function org-publish-org-to-html
 :headline-levels 5             ; Just the default for this project.
 :auto-preamble t
 )
      ))

(defun my-org-export-format-drawer (name content)
  (format
   (concat "@<h6>"
           (capitalize name)
           "@<button class=\"dbut\" type=\"button\">toggle@</button>@</h6>"
           "@<div class=\"drawer "
           (downcase name)
           "\">"
           "%s @</div>")
   content))
(setq org-export-format-drawer-function 'my-org-export-format-drawer)

带抽屉的示例文件:

#+DRAWERS: ABILITYSCORES FEATS
* Test
:ABILITYSCORES:

#+ATTR_HTML: :border 2 :rules all :frame border
| Stat | Value | Mod |
|------+-------+-----|
| Str  |    18 |   4 |
| Dex  |    10 |   0 |
| Con  |    16 |   3 |
| Int  |    12 |   1 |
| Wis  |    14 |   2 |
| Cha  |    10 |   0 |

*KOM:* Str; *KDM:* Con; *BAB:* 2

:END:

:FEATS:

- Cataphract :: Bonus, +2 to attack rolls, +2 to damage rolls with Power attack
                ignore AC charge penalty (all while mounted)
- Mighty Smash :: 1, +2 damage, after being hit by three Mighty Smashes opponent
                  takes -1 to attack rolls for [Encounter], max -4.

:END:

js-fiddle 结果

4

0 回答 0