Kaushal Modi 8 years ago
parent 748dd4de1d
commit 71e1fdfda5
  1. 14
      ox-blackfriday.el
  2. 24
      test/site/content-org/all-posts.org
  3. 20
      test/site/content/posts/links-to-tables.md
  4. 36
      test/site/content/posts/table-caption.md

@ -675,6 +675,18 @@ contextual information."
(if lbl
(format "<a id=\"%s\"></a>\n\n" lbl)
"")))
(caption (org-export-get-caption table))
(caption-html (if (not caption)
""
(let* ((table-num (org-export-get-ordinal
table info
nil #'org-html--has-caption-p))
(caption-str (org-export-data caption info)))
(format (concat "<caption class=\"table-caption\">\n"
" <span class=\"table-number\">Table %d:</span>\n"
" %s\n"
"</caption>\n\n")
table-num caption-str))))
(tbl (replace-regexp-in-string "\n\n" "\n" contents)))
;; If the table has only 1 row, do *not* make it a header row..
;; instead create an empty header row.
@ -695,7 +707,7 @@ contextual information."
(dummy-header (replace-regexp-in-string "[-:]" " " hrule)))
(setq tbl (concat dummy-header "\n" hrule "\n" row-1))))
;; (message "[ox-bf-table DBG] Tbl:\n%s" tbl)
(concat label tbl)))
(concat label caption-html tbl)))
;;;; Verse Block
(defun org-blackfriday-verse-block (_verse-block contents info)

@ -523,6 +523,28 @@ sense. But hey, a test is a test./
| <l> | | <c> | <r> |
You should see *no* table exported above.
** Table caption :caption:
:PROPERTIES:
:EXPORT_FILE_NAME: table-caption
:END:
#+CAPTION: Awesome table
| h1 | h2 | h3 |
|-----+-----+-----|
| abc | def | ghi |
Some text.
#+CAPTION: Another awesome table
| h1 | h2 | h3 |
|-----+-----+-----|
| jkl | mno | pqr |
Some more text.
#+CAPTION: Third table
| h1 | h2 | h3 |
|-----+-----+----|
| stu | vwx | yz |
* Source blocks :src_block:
** Code fence :code_fence:
*** Code-fenced source blocks (default behavior)
@ -1723,7 +1745,7 @@ that the link jump is evident):
#+END_SRC
*Here we refer to code snippet [[code__hello]].*
*** Links to tables
*** Links to tables :table:caption:
:PROPERTIES:
:EXPORT_FILE_NAME: links-to-tables
:END:

@ -1,6 +1,6 @@
+++
title = "Links to tables"
tags = ["links", "internal-links"]
tags = ["links", "internal-links", "table", "caption"]
draft = false
+++
@ -31,13 +31,18 @@ Here's another table:
will output below (_lorem-ipsum_ added to increase page content so
that the link jump is evident):
<a id="org40b5987"></a>
<a id="org44317dc"></a>
<caption class="table-caption">
<span class="table-number">Table 1:</span>
Simple table 1
</caption>
| a | b |
|---|---|
| c | d |
**Here we refer to table [2](#org8a6806a).**
**Here we refer to table [2](#org0622dcf).**
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque et
quam metus. Etiam in iaculis mi, sit amet pretium magna. Donec ut dui
@ -93,13 +98,18 @@ blandit in.
Here's another table:
<a id="org8a6806a"></a>
<a id="org0622dcf"></a>
<caption class="table-caption">
<span class="table-number">Table 2:</span>
Simple table 2
</caption>
| e | f |
|---|---|
| g | h |
**Here we refer to table [1](#org40b5987).**
**Here we refer to table [1](#org44317dc).**
---

@ -0,0 +1,36 @@
+++
title = "Table caption"
tags = ["table", "caption"]
draft = false
+++
<caption class="table-caption">
<span class="table-number">Table 1:</span>
Awesome table
</caption>
| h1 | h2 | h3 |
|-----|-----|-----|
| abc | def | ghi |
Some text.
<caption class="table-caption">
<span class="table-number">Table 2:</span>
Another awesome table
</caption>
| h1 | h2 | h3 |
|-----|-----|-----|
| jkl | mno | pqr |
Some more text.
<caption class="table-caption">
<span class="table-number">Table 3:</span>
Third table
</caption>
| h1 | h2 | h3 |
|-----|-----|----|
| stu | vwx | yz |
Loading…
Cancel
Save