Support consecutive plain lists

Add tests for consecutive lists and nested lists.
master
Kaushal Modi 9 years ago
parent 62efc8e0b3
commit e7d0fc7b85
  1. 95
      example-site/content-org/all-posts.org
  2. 2
      example-site/content/posts/code-fenced-src-blocks-default.md
  3. 2
      example-site/content/posts/code-fenced-src-blocks.md
  4. 36
      example-site/content/posts/custom-front-matter-multiple-lines.md
  5. 5
      example-site/content/posts/equation-latex-frag.md
  6. 2
      example-site/content/posts/highlight-shortcode-src-blocks.md
  7. 2
      example-site/content/posts/image-links.md
  8. 2
      example-site/content/posts/kbd-tag-default.md
  9. 2
      example-site/content/posts/kbd-tag-no.md
  10. 2
      example-site/content/posts/kbd-tag-yes.md
  11. 4
      example-site/content/posts/link-heading-custom-id.md
  12. 70
      example-site/content/posts/list-following-a-list.md
  13. 2
      example-site/content/posts/nested-bold-italics.md
  14. 18
      example-site/content/posts/nested-lists.md
  15. 2
      example-site/content/posts/prep.md
  16. 2
      example-site/content/posts/shortcode-src-blocks.md
  17. 12
      ox-blackfriday.el

@ -529,23 +529,26 @@ Here there is white space in menu name property.
From [[http://orgmode.org/manual/Property-syntax.html][*(org) Property syntax*]]:
#+BEGIN_QUOTE
It is also possible to add to the values of inherited properties.
The following results in the ‘genres’ property having the value “Classic
Baroque” under the ‘Goldberg Variations’ subtree.
* CD collection
** Classic
:PROPERTIES:
:GENRES: Classic
:END:
*** Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glen Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:GENRES+: Baroque
:END:
The following results in the 'genres' property having the value
"Classic Baroque" under the 'Goldberg Variations' subtree.
#+END_QUOTE
#+BEGIN_EXAMPLE
,* CD collection
,** Classic
:PROPERTIES:
:GENRES: Classic
:END:
,*** Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glen Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:GENRES+: Baroque
:END:
#+END_EXAMPLE
* Post body :body:
** Summary Splitter
:PROPERTIES:
@ -729,6 +732,66 @@ If $a^2=b$ and \( b=2 \), then the solution must be either
$$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]
(Note that the last two equations show up on their own lines.)
* Lists :lists:
** List following a list
:PROPERTIES:
:EXPORT_FILE_NAME: list-following-a-list
:EXPORT_DATE: 2017-07-31
:END:
You need to force end of list when you have something like an
unordered list immediately following an ordered list.
/The easiest and cleanest way to do that is adding a comment between
those lists./ -- [[https://stackoverflow.com/a/8964494/1219634][Reference]]
That would be the implementing in the Org exporter backend. But in
Org, two consecutive blank lines after a list ends the list.
In the below example, the /foo*/ items would be in a different =<ul>=
element than the /bar*/ items.
*** Unordered list following an unordered list
- foo1
- foo2
+ bar1
+ bar2
*** Unordered list following an ordered list
1. foo3
2. foo4
- bar3
- bar4
*** Ordered list following an unordered list
- foo5
- foo6
1. bar5
2. bar6
*** Description list following an ordered list
- foo1
- foo2
- bar1 :: description
- bar2 :: description
** Nested lists
:PROPERTIES:
:EXPORT_FILE_NAME: nested-lists
:EXPORT_DATE: 2017-07-31
:END:
+ foo1
+ foo2
- bar1
- bar2
+ baz1
+ baz2
- zoo1
- zoo2
1. numbered1
2. numbered2
* TODO Pre-Draft State
:PROPERTIES:
:EXPORT_FILE_NAME: draft-state-todo

@ -44,3 +44,5 @@ Here are few variables that you might like to change in the `local.mk`:
# org-mime - Convert org buffer to htmlized format for email
ORG_ADD_CONTRIB = org-eldoc ox-extra org-mime
```
<!--listend-->

@ -45,3 +45,5 @@ Here are few variables that you might like to change in the `local.mk`:
# org-mime - Convert org buffer to htmlized format for email
ORG_ADD_CONTRIB = org-eldoc ox-extra org-mime
```
<!--listend-->

@ -13,20 +13,22 @@ gamma = 10
From [**(org) Property syntax**](http://orgmode.org/manual/Property-syntax.html):
> It is also possible to add to the values of inherited properties.
> The following results in the ‘genres’ property having the value “Classic
> Baroque” under the ‘Goldberg Variations’ subtree.
>
> - CD collection
>
> \*\* Classic
>
> :GENRES: Classic
>
> **\*** Goldberg Variations
>
> :Title: Goldberg Variations
> :Composer: J.S. Bach
> :Artist: Glen Gould
> :Publisher: Deutsche Grammophon
> :NDisks: 1
> :GENRES+: Baroque
> The following results in the 'genres' property having the value
> "Classic Baroque" under the 'Goldberg Variations' subtree.
```text
* CD collection
** Classic
:PROPERTIES:
:GENRES: Classic
:END:
*** Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glen Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:GENRES+: Baroque
:END:
```

@ -14,10 +14,11 @@ draft = false
`$a=b$` will work (it will look like: \\(a=b\\)).
On the other hand, both `\(a=b\)` (it will look like: \\(a=b\\)) and
`\( a=b \)` (it will look like: \\( a=b \\)) will work.
- One-per-line equations are wrapped between `\[` and `\]` or `$$`
`\( a=b \)` (it will look like: \\( a=b \\)) will work.- One-per-line equations are wrapped between `\[` and `\]` or `$$`
delimiters.
<!--listend-->
For example, below in Org:
```text

@ -51,3 +51,5 @@ Here are few variables that you might like to change in the `local.mk`:
# org-mime - Convert org buffer to htmlized format for email
ORG_ADD_CONTRIB = org-eldoc ox-extra org-mime
{{< /highlight >}}
<!--listend-->

@ -50,6 +50,8 @@ Click below image to jump to the unicorn image.
- **NOTE:** `file:` has to be used in both Link and Description components
of the Org link.
<!--listend-->
## Image with `ATTR_HTML` [Issue # 17](https://github.com/kaushalmodi/ox-hugo/issues/17) {#image-with-attr-html-issue-17}

@ -11,3 +11,5 @@ f</kbd>`.
Example:
- Few of Emacs help keybindings: <kbd>C-h f</kbd>, <kbd>C-h v</kbd>
<!--listend-->

@ -20,3 +20,5 @@ Here `~C-h f~` will show up as `` `C-h f` `` in Markdown and then
Example:
- Few of Emacs help keybindings: `C-h f`, `C-h v`
<!--listend-->

@ -12,3 +12,5 @@ property to `t`. So `~C-h f~` will show up as `<kbd>C-h f</kbd>`.
Example:
- Few of Emacs help keybindings: <kbd>C-h f</kbd>, <kbd>C-h v</kbd>
<!--listend-->

@ -13,6 +13,8 @@ draft = false
- Link to [Heading 2](#link-heading-2)
<!--listend-->
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque et
quam metus. Etiam in iaculis mi, sit amet pretium magna. Donec ut dui
mi. Maecenas pharetra sapien nunc, ut mollis enim aliquam quis. Nam at
@ -225,3 +227,5 @@ blandit in.
## Heading 2 {#link-heading-2}
- Link to [Heading 1](#link-heading-1)
<!--listend-->

@ -0,0 +1,70 @@
+++
title = "List following a list"
date = 2017-07-31
tags = ["lists"]
draft = false
+++
You need to force end of list when you have something like an
unordered list immediately following an ordered list.
_The easiest and cleanest way to do that is adding a comment between
those lists._ -- [Reference](https://stackoverflow.com/a/8964494/1219634)
That would be the implementing in the Org exporter backend. But in
Org, two consecutive blank lines after a list ends the list.
In the below example, the _foo\*_ items would be in a different `<ul>`
element than the _bar\*_ items.
## Unordered list following an unordered list {#unordered-list-following-an-unordered-list}
- foo1
- foo2
<!--listend-->
- bar1
- bar2
<!--listend-->
## Unordered list following an ordered list {#unordered-list-following-an-ordered-list}
1. foo3
2. foo4
<!--listend-->
- bar3
- bar4
<!--listend-->
## Ordered list following an unordered list {#ordered-list-following-an-unordered-list}
- foo5
- foo6
<!--listend-->
1. bar5
2. bar6
<!--listend-->
## Description list following an ordered list {#description-list-following-an-ordered-list}
- foo1
- foo2
<!--listend-->
- **bar1:** description
- **bar2:** description
<!--listend-->

@ -8,3 +8,5 @@ draft = false
- _This is italics, and **this is bold too**, and back to plain
italics._
- **This is bold, and _this is italics too_, and back to plain bold.**
<!--listend-->

@ -0,0 +1,18 @@
+++
title = "Nested lists"
date = 2017-07-31
tags = ["lists"]
draft = false
+++
- foo1
- foo2
- bar1
- bar2
- baz1
- baz2
- zoo1
- zoo2
1. numbered1
2. numbered2
<!--listend-->

@ -13,3 +13,5 @@ draft = false
hugo server --port 1111
```
3. See the site served on "<http://localhost:1111/>".
<!--listend-->

@ -42,3 +42,5 @@ Here are few variables that you might like to change in the `local.mk`:
# org-mime - Convert org buffer to htmlized format for email
ORG_ADD_CONTRIB = org-eldoc ox-extra org-mime
{{< /highlight >}}
<!--listend-->

@ -71,6 +71,7 @@
:translate-alist '((inner-template . org-blackfriday-inner-template)
(latex-fragment . org-blackfriday-latex-fragment)
(paragraph . org-blackfriday-paragraph)
(plain-list . org-blackfriday-plain-list)
(strike-through . org-blackfriday-strike-through)
(src-block . org-blackfriday-src-block)
(example-block . org-blackfriday-example-block)
@ -135,6 +136,17 @@ communication channel."
(replace-regexp-in-string "\\`#" "\\#" contents nil t)
contents)))
;;;; Plain List
(defun org-blackfriday-plain-list (_plain-list contents _info)
"Transcode plain list in CONTENTS into Markdown format."
;; Two consecutive lists in Markdown can be separated by a comment.
(let* ((contents (format "%s\n<!--listend-->" contents))
;; Do this only for top level lists. So the lines with
;; <!--listend--> comments with preceding whitespace will be
;; deleted.
(contents (replace-regexp-in-string "\n\\s-+<!--listend-->\n" "" contents)))
contents))
;;;; Src Block
(defun org-blackfriday-src-block (src-block _contents info)
"Transcode SRC-BLOCK element into Blackfriday Markdown format.

Loading…
Cancel
Save