git.iko.soy/typeable/pandoc
on master help sign in
Revert "Better indentation under headers in org mode output."
fe42c17John MacFarlane
src/Text/Pandoc/Writers/Org.hs+14−26
@@ -77,7 +77,7 @@ pandocToOrg (Pandoc meta blocks) = do
77 (fmap render' . blockListToOrg)
77 (fmap render' . blockListToOrg)
78 (fmap render' . inlineListToOrg)
78 (fmap render' . inlineListToOrg)
79 meta
79 meta
80− body <- vcat <$> mapM (elementToOrg 0) (hierarchicalize blocks)
80+ body <- blockListToOrg blocks
81 notes <- gets (reverse . stNotes) >>= notesToOrg
81 notes <- gets (reverse . stNotes) >>= notesToOrg
82 hasMath <- gets stHasMath
82 hasMath <- gets stHasMath
83 let main = render colwidth . foldl ($+$) empty $ [body, notes]
83 let main = render colwidth . foldl ($+$) empty $ [body, notes]
@@ -96,9 +96,9 @@ notesToOrg notes =
96-- | Return Org representation of a note.
96-- | Return Org representation of a note.
97noteToOrg :: PandocMonad m => Int -> [Block] -> Org m Doc
97noteToOrg :: PandocMonad m => Int -> [Block] -> Org m Doc
98noteToOrg num note = do
98noteToOrg num note = do
99− contents <- vcat <$> mapM (elementToOrg 0) (hierarchicalize note)
99+ contents <- blockListToOrg note
100 let marker = "[fn:" ++ show num ++ "] "
100 let marker = "[fn:" ++ show num ++ "] "
101− return $ hang (length marker) (text marker) $ contents
101+ return $ hang (length marker) (text marker) contents
102
102
103-- | Escape special characters for Org.
103-- | Escape special characters for Org.
104escapeString :: String -> String
104escapeString :: String -> String
@@ -113,18 +113,6 @@ isRawFormat :: Format -> Bool
113isRawFormat f =
113isRawFormat f =
114 f == Format "latex" || f == Format "tex" || f == Format "org"
114 f == Format "latex" || f == Format "tex" || f == Format "org"
115
115
116−elementToOrg :: PandocMonad m
117− => Int -> Element -> Org m Doc
118−elementToOrg nestlevel (Blk block) = do
119− contents <- blockToOrg block
120− if isEmpty contents
121− then return empty
122− else return $ nest nestlevel contents $$ blankline
123−elementToOrg _nestlevel (Sec level _num attr title' elements) = do
124− hdr <- blockToOrg (Header level attr title')
125− body <- vcat <$> mapM (elementToOrg (level + 1)) elements
126− return $ hdr $$ body
127−
128-- | Convert Pandoc block element to Org.
116-- | Convert Pandoc block element to Org.
129blockToOrg :: PandocMonad m
117blockToOrg :: PandocMonad m
130 => Block -- ^ Block element
118 => Block -- ^ Block element
@@ -152,14 +140,14 @@ blockToOrg (Div (ident, classes, kv) bs) = do
152 (blockType:classes'') ->
140 (blockType:classes'') ->
153 blankline $$ attrHtml (ident, classes'' <> classes', kv) $$
141 blankline $$ attrHtml (ident, classes'' <> classes', kv) $$
154 "#+BEGIN_" <> text blockType $$ contents $$
142 "#+BEGIN_" <> text blockType $$ contents $$
155− "#+END_" <> text blockType
143+ "#+END_" <> text blockType $$ blankline
156 _ ->
144 _ ->
157 -- fallback with id: add id as an anchor if present, discard classes and
145 -- fallback with id: add id as an anchor if present, discard classes and
158 -- key-value pairs, unwrap the content.
146 -- key-value pairs, unwrap the content.
159 let contents' = if not (null ident)
147 let contents' = if not (null ident)
160 then "<<" <> text ident <> ">>" $$ contents
148 then "<<" <> text ident <> ">>" $$ contents
161 else contents
149 else contents
162− in blankline $$ contents'
150+ in blankline $$ contents' $$ blankline
163blockToOrg (Plain inlines) = inlineListToOrg inlines
151blockToOrg (Plain inlines) = inlineListToOrg inlines
164-- title beginning with fig: indicates that the image is a figure
152-- title beginning with fig: indicates that the image is a figure
165blockToOrg (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
153blockToOrg (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
@@ -167,7 +155,7 @@ blockToOrg (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
167 then return empty
155 then return empty
168 else ("#+CAPTION: " <>) `fmap` inlineListToOrg txt
156 else ("#+CAPTION: " <>) `fmap` inlineListToOrg txt
169 img <- inlineToOrg (Image attr txt (src,tit))
157 img <- inlineToOrg (Image attr txt (src,tit))
170− return $ capt $$ img
158+ return $ capt $$ img $$ blankline
171blockToOrg (Para inlines) = do
159blockToOrg (Para inlines) = do
172 contents <- inlineListToOrg inlines
160 contents <- inlineListToOrg inlines
173 return $ contents <> blankline
161 return $ contents <> blankline
@@ -184,13 +172,13 @@ blockToOrg (LineBlock lns) = do
184 nest 2 contents $$ "#+END_VERSE" <> blankline
172 nest 2 contents $$ "#+END_VERSE" <> blankline
185blockToOrg (RawBlock "html" str) =
173blockToOrg (RawBlock "html" str) =
186 return $ blankline $$ "#+BEGIN_HTML" $$
174 return $ blankline $$ "#+BEGIN_HTML" $$
187− nest 2 (text str) $$ "#+END_HTML"
175+ nest 2 (text str) $$ "#+END_HTML" $$ blankline
188blockToOrg b@(RawBlock f str)
176blockToOrg b@(RawBlock f str)
189 | isRawFormat f = return $ text str
177 | isRawFormat f = return $ text str
190 | otherwise = do
178 | otherwise = do
191 report $ BlockNotRendered b
179 report $ BlockNotRendered b
192 return empty
180 return empty
193−blockToOrg HorizontalRule = return $ blankline $$ "--------------"
181+blockToOrg HorizontalRule = return $ blankline $$ "--------------" $$ blankline
194blockToOrg (Header level attr inlines) = do
182blockToOrg (Header level attr inlines) = do
195 contents <- inlineListToOrg inlines
183 contents <- inlineListToOrg inlines
196 let headerStr = text $ if level > 999 then " " else replicate level '*'
184 let headerStr = text $ if level > 999 then " " else replicate level '*'
@@ -205,11 +193,11 @@ blockToOrg (CodeBlock (_,classes,_) str) = do
205 let (beg, end) = case at of
193 let (beg, end) = case at of
206 [] -> ("#+BEGIN_EXAMPLE", "#+END_EXAMPLE")
194 [] -> ("#+BEGIN_EXAMPLE", "#+END_EXAMPLE")
207 (x:_) -> ("#+BEGIN_SRC " ++ x, "#+END_SRC")
195 (x:_) -> ("#+BEGIN_SRC " ++ x, "#+END_SRC")
208− return $ text beg $$ nest tabstop (text str) $$ text end
196+ return $ text beg $$ nest tabstop (text str) $$ text end $$ blankline
209blockToOrg (BlockQuote blocks) = do
197blockToOrg (BlockQuote blocks) = do
210 contents <- blockListToOrg blocks
198 contents <- blockListToOrg blocks
211 return $ blankline $$ "#+BEGIN_QUOTE" $$
199 return $ blankline $$ "#+BEGIN_QUOTE" $$
212− nest 2 contents $$ "#+END_QUOTE"
200+ nest 2 contents $$ "#+END_QUOTE" $$ blankline
213blockToOrg (Table caption' _ _ headers rows) = do
201blockToOrg (Table caption' _ _ headers rows) = do
214 caption'' <- inlineListToOrg caption'
202 caption'' <- inlineListToOrg caption'
215 let caption = if null caption'
203 let caption = if null caption'
@@ -240,11 +228,11 @@ blockToOrg (Table caption' _ _ headers rows) = do
240 let head'' = if all null headers
228 let head'' = if all null headers
241 then empty
229 then empty
242 else head' $$ border '-'
230 else head' $$ border '-'
243− return $ head'' $$ body $$ caption
231+ return $ head'' $$ body $$ caption $$ blankline
244blockToOrg (BulletList items) = do
232blockToOrg (BulletList items) = do
245 contents <- mapM bulletListItemToOrg items
233 contents <- mapM bulletListItemToOrg items
246 -- ensure that sublists have preceding blank line
234 -- ensure that sublists have preceding blank line
247− return $ blankline $+$ vcat contents
235+ return $ blankline $+$ vcat contents $$ blankline
248blockToOrg (OrderedList (start, _, delim) items) = do
236blockToOrg (OrderedList (start, _, delim) items) = do
249 let delim' = case delim of
237 let delim' = case delim of
250 TwoParens -> OneParen
238 TwoParens -> OneParen
@@ -256,10 +244,10 @@ blockToOrg (OrderedList (start, _, delim) items) = do
256 in m ++ replicate s ' ') markers
244 in m ++ replicate s ' ') markers
257 contents <- zipWithM orderedListItemToOrg markers' items
245 contents <- zipWithM orderedListItemToOrg markers' items
258 -- ensure that sublists have preceding blank line
246 -- ensure that sublists have preceding blank line
259− return $ blankline $$ vcat contents
247+ return $ blankline $$ vcat contents $$ blankline
260blockToOrg (DefinitionList items) = do
248blockToOrg (DefinitionList items) = do
261 contents <- mapM definitionListItemToOrg items
249 contents <- mapM definitionListItemToOrg items
262− return $ vcat contents
250+ return $ vcat contents $$ blankline
263
251
264-- | Convert bullet list item (list of blocks) to Org.
252-- | Convert bullet list item (list of blocks) to Org.
265bulletListItemToOrg :: PandocMonad m => [Block] -> Org m Doc
253bulletListItemToOrg :: PandocMonad m => [Block] -> Org m Doc
test/writer.org+410−406
@@ -48,101 +48,103 @@ markdown test suite.
48 :CUSTOM_ID: level-3
48 :CUSTOM_ID: level-3
49 :END:
49 :END:
50
50
51− with no blank line
51+with no blank line
52
52
53** Level 2
53** Level 2
54 :PROPERTIES:
54 :PROPERTIES:
55 :CUSTOM_ID: level-2
55 :CUSTOM_ID: level-2
56 :END:
56 :END:
57
57
58− with no blank line
58+with no blank line
59
59
60− --------------
60+--------------
61
61
62* Paragraphs
62* Paragraphs
63 :PROPERTIES:
63 :PROPERTIES:
64 :CUSTOM_ID: paragraphs
64 :CUSTOM_ID: paragraphs
65 :END:
65 :END:
66
66
67− Here's a regular paragraph.
67+Here's a regular paragraph.
68
68
69− In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
69+In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
70− Because a hard-wrapped line in the middle of a paragraph looked like a list
70+Because a hard-wrapped line in the middle of a paragraph looked like a list
71− item.
71+item.
72
72
73− Here's one with a bullet. * criminey.
73+Here's one with a bullet. * criminey.
74
74
75− There should be a hard line break\\
75+There should be a hard line break\\
76− here.
76+here.
77
77
78− --------------
78+--------------
79
79
80* Block Quotes
80* Block Quotes
81 :PROPERTIES:
81 :PROPERTIES:
82 :CUSTOM_ID: block-quotes
82 :CUSTOM_ID: block-quotes
83 :END:
83 :END:
84
84
85− E-mail style:
85+E-mail style:
86+
87+#+BEGIN_QUOTE
88+ This is a block quote. It is pretty short.
89+#+END_QUOTE
90+
91+#+BEGIN_QUOTE
92+ Code in a block quote:
93+
94+ #+BEGIN_EXAMPLE
95+ sub status {
96+ print "working";
97+ }
98+ #+END_EXAMPLE
99+
100+ A list:
101+
102+ 1. item one
103+ 2. item two
104+
105+ Nested block quotes:
86
106
87 #+BEGIN_QUOTE
107 #+BEGIN_QUOTE
88− This is a block quote. It is pretty short.
108+ nested
89 #+END_QUOTE
109 #+END_QUOTE
90
110
91 #+BEGIN_QUOTE
111 #+BEGIN_QUOTE
92− Code in a block quote:
93−
94− #+BEGIN_EXAMPLE
95− sub status {
96− print "working";
97− }
98− #+END_EXAMPLE
99− A list:
100−
101− 1. item one
102− 2. item two
103− Nested block quotes:
104−
105− #+BEGIN_QUOTE
106− nested
107− #+END_QUOTE
108−
109− #+BEGIN_QUOTE
110− nested
112+ nested
111− #+END_QUOTE
112 #+END_QUOTE
113 #+END_QUOTE
114+#+END_QUOTE
113
115
114− This should not be a block quote: 2 > 1.
116+This should not be a block quote: 2 > 1.
115
117
116− And a following paragraph.
118+And a following paragraph.
117
119
118− --------------
120+--------------
119
121
120* Code Blocks
122* Code Blocks
121 :PROPERTIES:
123 :PROPERTIES:
122 :CUSTOM_ID: code-blocks
124 :CUSTOM_ID: code-blocks
123 :END:
125 :END:
124
126
125− Code:
127+Code:
126
128
127− #+BEGIN_EXAMPLE
129+#+BEGIN_EXAMPLE
128− ---- (should be four hyphens)
130+ ---- (should be four hyphens)
129
131
130− sub status {
132+ sub status {
131− print "working";
133+ print "working";
132− }
134+ }
133
135
134− this code block is indented by one tab
136+ this code block is indented by one tab
135− #+END_EXAMPLE
137+#+END_EXAMPLE
136
138
137− And:
139+And:
138
140
139− #+BEGIN_EXAMPLE
141+#+BEGIN_EXAMPLE
140− this code block is indented by two tabs
142+ this code block is indented by two tabs
141
143
142− These should not be escaped: \$ \\ \> \[ \{
144+ These should not be escaped: \$ \\ \> \[ \{
143− #+END_EXAMPLE
145+#+END_EXAMPLE
144
146
145− --------------
147+--------------
146
148
147* Lists
149* Lists
148 :PROPERTIES:
150 :PROPERTIES:
@@ -154,549 +156,551 @@ markdown test suite.
154 :CUSTOM_ID: unordered
156 :CUSTOM_ID: unordered
155 :END:
157 :END:
156
158
157− Asterisks tight:
159+Asterisks tight:
158
160
159− - asterisk 1
161+- asterisk 1
160− - asterisk 2
162+- asterisk 2
161− - asterisk 3
163+- asterisk 3
162
164
163− Asterisks loose:
165+Asterisks loose:
164
166
165− - asterisk 1
167+- asterisk 1
166
168
167− - asterisk 2
169+- asterisk 2
168
170
169− - asterisk 3
171+- asterisk 3
170
172
171− Pluses tight:
173+Pluses tight:
172
174
173− - Plus 1
175+- Plus 1
174− - Plus 2
176+- Plus 2
175− - Plus 3
177+- Plus 3
176
178
177− Pluses loose:
179+Pluses loose:
178
180
179− - Plus 1
181+- Plus 1
180
182
181− - Plus 2
183+- Plus 2
182
184
183− - Plus 3
185+- Plus 3
184
186
185− Minuses tight:
187+Minuses tight:
186
188
187− - Minus 1
189+- Minus 1
188− - Minus 2
190+- Minus 2
189− - Minus 3
191+- Minus 3
190
192
191− Minuses loose:
193+Minuses loose:
192
194
193− - Minus 1
195+- Minus 1
194
196
195− - Minus 2
197+- Minus 2
196
198
197− - Minus 3
199+- Minus 3
198
200
199** Ordered
201** Ordered
200 :PROPERTIES:
202 :PROPERTIES:
201 :CUSTOM_ID: ordered
203 :CUSTOM_ID: ordered
202 :END:
204 :END:
203
205
204− Tight:
206+Tight:
205
207
206− 1. First
208+1. First
207− 2. Second
209+2. Second
208− 3. Third
210+3. Third
209
211
210− and:
212+and:
211
213
212− 1. One
214+1. One
213− 2. Two
215+2. Two
214− 3. Three
216+3. Three
215
217
216− Loose using tabs:
218+Loose using tabs:
217
219
218− 1. First
220+1. First
219
221
220− 2. Second
222+2. Second
221
223
222− 3. Third
224+3. Third
223
225
224− and using spaces:
226+and using spaces:
225
227
226− 1. One
228+1. One
227
229
228− 2. Two
230+2. Two
229
231
230− 3. Three
232+3. Three
231
233
232− Multiple paragraphs:
234+Multiple paragraphs:
233
235
234− 1. Item 1, graf one.
236+1. Item 1, graf one.
235
237
236− Item 1. graf two. The quick brown fox jumped over the lazy dog's back.
238+ Item 1. graf two. The quick brown fox jumped over the lazy dog's back.
237
239
238− 2. Item 2.
240+2. Item 2.
239
241
240− 3. Item 3.
242+3. Item 3.
241
243
242** Nested
244** Nested
243 :PROPERTIES:
245 :PROPERTIES:
244 :CUSTOM_ID: nested
246 :CUSTOM_ID: nested
245 :END:
247 :END:
246
248
247− - Tab
249+- Tab
250+
251+ - Tab
252+
253+ - Tab
248
254
249− - Tab
255+Here's another:
250
256
251− - Tab
257+1. First
258+2. Second:
252
259
253− Here's another:
260+ - Fee
261+ - Fie
262+ - Foe
254
263
255− 1. First
264+3. Third
256− 2. Second:
257
265
258− - Fee
266+Same thing but with paragraphs:
259− - Fie
260− - Foe
261− 3. Third
262
267
263− Same thing but with paragraphs:
268+1. First
264
269
265− 1. First
270+2. Second:
266
271
267− 2. Second:
272+ - Fee
273+ - Fie
274+ - Foe
268
275
269− - Fee
270− - Fie
271− - Foe
272− 3. Third
276+3. Third
273
277
274** Tabs and spaces
278** Tabs and spaces
275 :PROPERTIES:
279 :PROPERTIES:
276 :CUSTOM_ID: tabs-and-spaces
280 :CUSTOM_ID: tabs-and-spaces
277 :END:
281 :END:
278
282
279− - this is a list item indented with tabs
283+- this is a list item indented with tabs
280
284
281− - this is a list item indented with spaces
285+- this is a list item indented with spaces
282
286
283− - this is an example list item indented with tabs
287+ - this is an example list item indented with tabs
284
288
285− - this is an example list item indented with spaces
289+ - this is an example list item indented with spaces
286
290
287** Fancy list markers
291** Fancy list markers
288 :PROPERTIES:
292 :PROPERTIES:
289 :CUSTOM_ID: fancy-list-markers
293 :CUSTOM_ID: fancy-list-markers
290 :END:
294 :END:
291
295
292− 2) begins with 2
296+2) begins with 2
293− 3) and now 3
297+3) and now 3
294
298
295− with a continuation
299+ with a continuation
296
300
297− 4. sublist with roman numerals, starting with 4
301+ 4. sublist with roman numerals, starting with 4
298− 5. more items
302+ 5. more items
299
303
300− 1) a subsublist
304+ 1) a subsublist
301− 2) a subsublist
305+ 2) a subsublist
302
306
303− Nesting:
307+Nesting:
304
308
305− 1. Upper Alpha
309+1. Upper Alpha
306
310
307− 1. Upper Roman.
311+ 1. Upper Roman.
308
312
309− 6) Decimal start with 6
313+ 6) Decimal start with 6
310
314
311− 3) Lower alpha with paren
315+ 3) Lower alpha with paren
312
316
313− Autonumbering:
317+Autonumbering:
314
318
315− 1. Autonumber.
319+1. Autonumber.
316− 2. More.
320+2. More.
317
321
318− 1. Nested.
322+ 1. Nested.
319
323
320− Should not be a list item:
324+Should not be a list item:
321
325
322− M.A. 2007
326+M.A. 2007
323
327
324− B. Williams
328+B. Williams
325
329
326− --------------
330+--------------
327
331
328* Definition Lists
332* Definition Lists
329 :PROPERTIES:
333 :PROPERTIES:
330 :CUSTOM_ID: definition-lists
334 :CUSTOM_ID: definition-lists
331 :END:
335 :END:
332
336
333− Tight using spaces:
337+Tight using spaces:
334
338
335− - apple :: red fruit
339+- apple :: red fruit
336− - orange :: orange fruit
340+- orange :: orange fruit
337− - banana :: yellow fruit
341+- banana :: yellow fruit
338
342
339− Tight using tabs:
343+Tight using tabs:
340
344
341− - apple :: red fruit
345+- apple :: red fruit
342− - orange :: orange fruit
346+- orange :: orange fruit
343− - banana :: yellow fruit
347+- banana :: yellow fruit
344
348
345− Loose:
349+Loose:
346
350
347− - apple :: red fruit
351+- apple :: red fruit
348
352
349− - orange :: orange fruit
353+- orange :: orange fruit
350
354
351− - banana :: yellow fruit
355+- banana :: yellow fruit
352
356
353− Multiple blocks with italics:
357+Multiple blocks with italics:
354
358
355− - /apple/ :: red fruit
359+- /apple/ :: red fruit
356
360
357− contains seeds, crisp, pleasant to taste
361+ contains seeds, crisp, pleasant to taste
358
362
359− - /orange/ :: orange fruit
363+- /orange/ :: orange fruit
360
364
361− #+BEGIN_EXAMPLE
365+ #+BEGIN_EXAMPLE
362− { orange code block }
366+ { orange code block }
363− #+END_EXAMPLE
367+ #+END_EXAMPLE
364
368
365− #+BEGIN_QUOTE
369+ #+BEGIN_QUOTE
366− orange block quote
370+ orange block quote
367− #+END_QUOTE
371+ #+END_QUOTE
368
372
369− Multiple definitions, tight:
373+Multiple definitions, tight:
370
374
371− - apple :: red fruit
375+- apple :: red fruit
372− computer
376+ computer
373− - orange :: orange fruit
377+- orange :: orange fruit
374− bank
378+ bank
375
379
376− Multiple definitions, loose:
380+Multiple definitions, loose:
377
381
378− - apple :: red fruit
382+- apple :: red fruit
379
383
380− computer
384+ computer
381
385
382− - orange :: orange fruit
386+- orange :: orange fruit
383
387
384− bank
388+ bank
385
389
386− Blank line after term, indented marker, alternate markers:
390+Blank line after term, indented marker, alternate markers:
387
391
388− - apple :: red fruit
392+- apple :: red fruit
389
393
390− computer
394+ computer
391
395
392− - orange :: orange fruit
396+- orange :: orange fruit
393
397
394− 1. sublist
398+ 1. sublist
395− 2. sublist
399+ 2. sublist
396
400
397* HTML Blocks
401* HTML Blocks
398 :PROPERTIES:
402 :PROPERTIES:
399 :CUSTOM_ID: html-blocks
403 :CUSTOM_ID: html-blocks
400 :END:
404 :END:
401
405
402− Simple block on one line:
406+Simple block on one line:
403
407
404− foo
408+foo
405
409
406− And nested without indentation:
410+And nested without indentation:
407
411
408− foo
412+foo
409
413
410− bar
414+bar
411
415
412− Interpreted markdown in a table:
416+Interpreted markdown in a table:
413
417
414− #+BEGIN_HTML
418+#+BEGIN_HTML
415− <table>
419+ <table>
416− #+END_HTML
420+#+END_HTML
417
421
418− #+BEGIN_HTML
422+#+BEGIN_HTML
419− <tr>
423+ <tr>
420− #+END_HTML
424+#+END_HTML
421
425
422− #+BEGIN_HTML
426+#+BEGIN_HTML
423− <td>
427+ <td>
424− #+END_HTML
428+#+END_HTML
425
429
426− This is /emphasized/
430+This is /emphasized/
427
431
428− #+BEGIN_HTML
432+#+BEGIN_HTML
429− </td>
433+ </td>
430− #+END_HTML
434+#+END_HTML
431
435
432− #+BEGIN_HTML
436+#+BEGIN_HTML
433− <td>
437+ <td>
434− #+END_HTML
438+#+END_HTML
435
439
436− And this is *strong*
440+And this is *strong*
437
441
438− #+BEGIN_HTML
442+#+BEGIN_HTML
439− </td>
443+ </td>
440− #+END_HTML
444+#+END_HTML
441
445
442− #+BEGIN_HTML
446+#+BEGIN_HTML
443− </tr>
447+ </tr>
444− #+END_HTML
448+#+END_HTML
445
449
446− #+BEGIN_HTML
450+#+BEGIN_HTML
447− </table>
451+ </table>
448− #+END_HTML
452+#+END_HTML
449
453
450− #+BEGIN_HTML
454+#+BEGIN_HTML
451− <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
455+ <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
452− #+END_HTML
456+#+END_HTML
453
457
454− Here's a simple block:
458+Here's a simple block:
455
459
456− foo
460+foo
457
461
458− This should be a code block, though:
462+This should be a code block, though:
459
463
460− #+BEGIN_EXAMPLE
464+#+BEGIN_EXAMPLE
461− <div>
465+ <div>
462− foo
466+ foo
463− </div>
467+ </div>
464− #+END_EXAMPLE
468+#+END_EXAMPLE
465
469
466− As should this:
470+As should this:
467
471
468− #+BEGIN_EXAMPLE
472+#+BEGIN_EXAMPLE
469− <div>foo</div>
473+ <div>foo</div>
470− #+END_EXAMPLE
474+#+END_EXAMPLE
471
475
472− Now, nested:
476+Now, nested:
473
477
474− foo
478+foo
475
479
476− This should just be an HTML comment:
480+This should just be an HTML comment:
477
481
478− #+BEGIN_HTML
482+#+BEGIN_HTML
479− <!-- Comment -->
483+ <!-- Comment -->
480− #+END_HTML
484+#+END_HTML
481
485
482− Multiline:
486+Multiline:
483
487
484− #+BEGIN_HTML
488+#+BEGIN_HTML
485− <!--
489+ <!--
486− Blah
490+ Blah
487− Blah
491+ Blah
488− -->
492+ -->
489− #+END_HTML
493+#+END_HTML
490
494
491− #+BEGIN_HTML
495+#+BEGIN_HTML
492− <!--
496+ <!--
493− This is another comment.
497+ This is another comment.
494− -->
498+ -->
495− #+END_HTML
499+#+END_HTML
496
500
497− Code block:
501+Code block:
498
502
499− #+BEGIN_EXAMPLE
503+#+BEGIN_EXAMPLE
500− <!-- Comment -->
504+ <!-- Comment -->
501− #+END_EXAMPLE
505+#+END_EXAMPLE
502
506
503− Just plain comment, with trailing spaces on the line:
507+Just plain comment, with trailing spaces on the line:
504
508
505− #+BEGIN_HTML
509+#+BEGIN_HTML
506− <!-- foo -->
510+ <!-- foo -->
507− #+END_HTML
511+#+END_HTML
508
512
509− Code:
513+Code:
510
514
511− #+BEGIN_EXAMPLE
515+#+BEGIN_EXAMPLE
512− <hr />
516+ <hr />
513− #+END_EXAMPLE
517+#+END_EXAMPLE
514
518
515− Hr's:
519+Hr's:
516
520
517− #+BEGIN_HTML
521+#+BEGIN_HTML
518− <hr>
522+ <hr>
519− #+END_HTML
523+#+END_HTML
520
524
521− #+BEGIN_HTML
525+#+BEGIN_HTML
522− <hr />
526+ <hr />
523− #+END_HTML
527+#+END_HTML
524
528
525− #+BEGIN_HTML
529+#+BEGIN_HTML
526− <hr />
530+ <hr />
527− #+END_HTML
531+#+END_HTML
528
532
529− #+BEGIN_HTML
533+#+BEGIN_HTML
530− <hr>
534+ <hr>
531− #+END_HTML
535+#+END_HTML
532
536
533− #+BEGIN_HTML
537+#+BEGIN_HTML
534− <hr />
538+ <hr />
535− #+END_HTML
539+#+END_HTML
536
540
537− #+BEGIN_HTML
541+#+BEGIN_HTML
538− <hr />
542+ <hr />
539− #+END_HTML
543+#+END_HTML
540
544
541− #+BEGIN_HTML
545+#+BEGIN_HTML
542− <hr class="foo" id="bar" />
546+ <hr class="foo" id="bar" />
543− #+END_HTML
547+#+END_HTML
544
548
545− #+BEGIN_HTML
549+#+BEGIN_HTML
546− <hr class="foo" id="bar" />
550+ <hr class="foo" id="bar" />
547− #+END_HTML
551+#+END_HTML
548
552
549− #+BEGIN_HTML
553+#+BEGIN_HTML
550− <hr class="foo" id="bar">
554+ <hr class="foo" id="bar">
551− #+END_HTML
555+#+END_HTML
552
556
553− --------------
557+--------------
554
558
555* Inline Markup
559* Inline Markup
556 :PROPERTIES:
560 :PROPERTIES:
557 :CUSTOM_ID: inline-markup
561 :CUSTOM_ID: inline-markup
558 :END:
562 :END:
559
563
560− This is /emphasized/, and so /is this/.
564+This is /emphasized/, and so /is this/.
561
565
562− This is *strong*, and so *is this*.
566+This is *strong*, and so *is this*.
563
567
564− An /[[/url][emphasized link]]/.
568+An /[[/url][emphasized link]]/.
565
569
566− */This is strong and em./*
570+*/This is strong and em./*
567
571
568− So is */this/* word.
572+So is */this/* word.
569
573
570− */This is strong and em./*
574+*/This is strong and em./*
571
575
572− So is */this/* word.
576+So is */this/* word.
573
577
574− This is code: =>=, =$=, =\=, =\$=, =<html>=.
578+This is code: =>=, =$=, =\=, =\$=, =<html>=.
575
579
576− +This is /strikeout/.+
580++This is /strikeout/.+
577
581
578− Superscripts: a^{bc}d a^{/hello/} a^{hello there}.
582+Superscripts: a^{bc}d a^{/hello/} a^{hello there}.
579
583
580− Subscripts: H_{2}O, H_{23}O, H_{many of them}O.
584+Subscripts: H_{2}O, H_{23}O, H_{many of them}O.
581
585
582− These should not be superscripts or subscripts, because of the unescaped
586+These should not be superscripts or subscripts, because of the unescaped
583− spaces: a\^b c\^d, a~b c~d.
587+spaces: a\^b c\^d, a~b c~d.
584
588
585− --------------
589+--------------
586
590
587* Smart quotes, ellipses, dashes
591* Smart quotes, ellipses, dashes
588 :PROPERTIES:
592 :PROPERTIES:
589 :CUSTOM_ID: smart-quotes-ellipses-dashes
593 :CUSTOM_ID: smart-quotes-ellipses-dashes
590 :END:
594 :END:
591
595
592− "Hello," said the spider. "'Shelob' is my name."
596+"Hello," said the spider. "'Shelob' is my name."
593
597
594− 'A', 'B', and 'C' are letters.
598+'A', 'B', and 'C' are letters.
595
599
596− 'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'
600+'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'
597
601
598− 'He said, "I want to go."' Were you alive in the 70's?
602+'He said, "I want to go."' Were you alive in the 70's?
599
603
600− Here is some quoted '=code=' and a
601− "[[http://example.com/?foo=1&bar=2][quoted link]]".
604+Here is some quoted '=code=' and a "[[http://example.com/?foo=1&bar=2][quoted
605+link]]".
602
606
603− Some dashes: one---two --- three---four --- five.
607+Some dashes: one---two --- three---four --- five.
604
608
605− Dashes between numbers: 5--7, 255--66, 1987--1999.
609+Dashes between numbers: 5--7, 255--66, 1987--1999.
606
610
607− Ellipses...and...and....
611+Ellipses...and...and....
608
612
609− --------------
613+--------------
610
614
611* LaTeX
615* LaTeX
612 :PROPERTIES:
616 :PROPERTIES:
613 :CUSTOM_ID: latex
617 :CUSTOM_ID: latex
614 :END:
618 :END:
615
619
616− - \cite[22-23]{smith.1899}
620+- \cite[22-23]{smith.1899}
617− - $2+2=4$
621+- $2+2=4$
618− - $x \in y$
622+- $x \in y$
619− - $\alpha \wedge \omega$
623+- $\alpha \wedge \omega$
620− - $223$
624+- $223$
621− - $p$-Tree
625+- $p$-Tree
622− - Here's some display math:
626+- Here's some display math:
623− $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
627+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
624− - Here's one that has a line break in it: $\alpha + \omega \times x^2$.
628+- Here's one that has a line break in it: $\alpha + \omega \times x^2$.
625
629
626− These shouldn't be math:
630+These shouldn't be math:
627
631
628− - To get the famous equation, write =$e = mc^2$=.
632+- To get the famous equation, write =$e = mc^2$=.
629− - $22,000 is a /lot/ of money. So is $34,000. (It worked if "lot" is
633+- $22,000 is a /lot/ of money. So is $34,000. (It worked if "lot" is
630− emphasized.)
634+ emphasized.)
631− - Shoes ($20) and socks ($5).
635+- Shoes ($20) and socks ($5).
632− - Escaped =$=: $73 /this should be emphasized/ 23$.
636+- Escaped =$=: $73 /this should be emphasized/ 23$.
633
637
634− Here's a LaTeX table:
638+Here's a LaTeX table:
635
639
636− \begin{tabular}{|l|l|}\hline
640+\begin{tabular}{|l|l|}\hline
637− Animal & Number \\ \hline
641+Animal & Number \\ \hline
638− Dog & 2 \\
642+Dog & 2 \\
639− Cat & 1 \\ \hline
643+Cat & 1 \\ \hline
640− \end{tabular}
644+\end{tabular}
641
645
642− --------------
646+--------------
643
647
644* Special Characters
648* Special Characters
645 :PROPERTIES:
649 :PROPERTIES:
646 :CUSTOM_ID: special-characters
650 :CUSTOM_ID: special-characters
647 :END:
651 :END:
648
652
649− Here is some unicode:
653+Here is some unicode:
650
654
651− - I hat: Î
655+- I hat: Î
652− - o umlaut: ö
656+- o umlaut: ö
653− - section: §
657+- section: §
654− - set membership: ∈
658+- set membership: ∈
655− - copyright: ©
659+- copyright: ©
656
660
657− AT&T has an ampersand in their name.
661+AT&T has an ampersand in their name.
658
662
659− AT&T is another way to write it.
663+AT&T is another way to write it.
660
664
661− This & that.
665+This & that.
662
666
663− 4 < 5.
667+4 < 5.
664
668
665− 6 > 5.
669+6 > 5.
666
670
667− Backslash: \
671+Backslash: \
668
672
669− Backtick: `
673+Backtick: `
670
674
671− Asterisk: *
675+Asterisk: *
672
676
673− Underscore: \_
677+Underscore: \_
674
678
675− Left brace: {
679+Left brace: {
676
680
677− Right brace: }
681+Right brace: }
678
682
679− Left bracket: [
683+Left bracket: [
680
684
681− Right bracket: ]
685+Right bracket: ]
682
686
683− Left paren: (
687+Left paren: (
684
688
685− Right paren: )
689+Right paren: )
686
690
687− Greater-than: >
691+Greater-than: >
688
692
689− Hash: #
693+Hash: #
690
694
691− Period: .
695+Period: .
692
696
693− Bang: !
697+Bang: !
694
698
695− Plus: +
699+Plus: +
696
700
697− Minus: -
701+Minus: -
698
702
699− --------------
703+--------------
700
704
701* Links
705* Links
702 :PROPERTIES:
706 :PROPERTIES:
@@ -708,120 +712,120 @@ markdown test suite.
708 :CUSTOM_ID: explicit
712 :CUSTOM_ID: explicit
709 :END:
713 :END:
710
714
711− Just a [[/url/][URL]].
715+Just a [[/url/][URL]].
712
716
713− [[/url/][URL and title]].
717+[[/url/][URL and title]].
714
718
715− [[/url/][URL and title]].
719+[[/url/][URL and title]].
716
720
717− [[/url/][URL and title]].
721+[[/url/][URL and title]].
718
722
719− [[/url/][URL and title]]
723+[[/url/][URL and title]]
720
724
721− [[/url/][URL and title]]
725+[[/url/][URL and title]]
722
726
723− [[/url/with_underscore][with\_underscore]]
727+[[/url/with_underscore][with\_underscore]]
724
728
725− [[mailto:nobody@nowhere.net][Email link]]
729+[[mailto:nobody@nowhere.net][Email link]]
726
730
727− [[][Empty]].
731+[[][Empty]].
728
732
729** Reference
733** Reference
730 :PROPERTIES:
734 :PROPERTIES:
731 :CUSTOM_ID: reference
735 :CUSTOM_ID: reference
732 :END:
736 :END:
733
737
734− Foo [[/url/][bar]].
738+Foo [[/url/][bar]].
735
739
736− With [[/url/][embedded [brackets]]].
740+With [[/url/][embedded [brackets]]].
737
741
738− [[/url/][b]] by itself should be a link.
742+[[/url/][b]] by itself should be a link.
739
743
740− Indented [[/url][once]].
744+Indented [[/url][once]].
741
745
742− Indented [[/url][twice]].
746+Indented [[/url][twice]].
743
747
744− Indented [[/url][thrice]].
748+Indented [[/url][thrice]].
745
749
746− This should [not][] be a link.
750+This should [not][] be a link.
747
751
748− #+BEGIN_EXAMPLE
752+#+BEGIN_EXAMPLE
749− [not]: /url
753+ [not]: /url
750− #+END_EXAMPLE
754+#+END_EXAMPLE
751
755
752− Foo [[/url/][bar]].
756+Foo [[/url/][bar]].
753
757
754− Foo [[/url/][biz]].
758+Foo [[/url/][biz]].
755
759
756** With ampersands
760** With ampersands
757 :PROPERTIES:
761 :PROPERTIES:
758 :CUSTOM_ID: with-ampersands
762 :CUSTOM_ID: with-ampersands
759 :END:
763 :END:
760
764
761− Here's a [[http://example.com/?foo=1&bar=2][link with an ampersand in the
765+Here's a [[http://example.com/?foo=1&bar=2][link with an ampersand in the
762− URL]].
766+URL]].
763
767
764− Here's a link with an amersand in the link text: [[http://att.com/][AT&T]].
768+Here's a link with an amersand in the link text: [[http://att.com/][AT&T]].
765
769
766− Here's an [[/script?foo=1&bar=2][inline link]].
770+Here's an [[/script?foo=1&bar=2][inline link]].
767
771
768− Here's an [[/script?foo=1&bar=2][inline link in pointy braces]].
772+Here's an [[/script?foo=1&bar=2][inline link in pointy braces]].
769
773
770** Autolinks
774** Autolinks
771 :PROPERTIES:
775 :PROPERTIES:
772 :CUSTOM_ID: autolinks
776 :CUSTOM_ID: autolinks
773 :END:
777 :END:
774
778
775− With an ampersand: [[http://example.com/?foo=1&bar=2]]
779+With an ampersand: [[http://example.com/?foo=1&bar=2]]
776
780
777− - In a list?
781+- In a list?
778− - [[http://example.com/]]
782+- [[http://example.com/]]
779− - It should.
783+- It should.
780
784
781− An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
785+An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
782
786
783− #+BEGIN_QUOTE
787+#+BEGIN_QUOTE
784− Blockquoted: [[http://example.com/]]
788+ Blockquoted: [[http://example.com/]]
785− #+END_QUOTE
789+#+END_QUOTE
786
790
787− Auto-links should not occur here: =<http://example.com/>=
791+Auto-links should not occur here: =<http://example.com/>=
788
792
789− #+BEGIN_EXAMPLE
793+#+BEGIN_EXAMPLE
790− or here: <http://example.com/>
794+ or here: <http://example.com/>
791− #+END_EXAMPLE
795+#+END_EXAMPLE
792
796
793− --------------
797+--------------
794
798
795* Images
799* Images
796 :PROPERTIES:
800 :PROPERTIES:
797 :CUSTOM_ID: images
801 :CUSTOM_ID: images
798 :END:
802 :END:
799
803
800− From "Voyage dans la Lune" by Georges Melies (1902):
804+From "Voyage dans la Lune" by Georges Melies (1902):
801
805
802− #+CAPTION: lalune
806+#+CAPTION: lalune
803− [[file:lalune.jpg]]
807+[[file:lalune.jpg]]
804
808
805− Here is a movie [[file:movie.jpg]] icon.
809+Here is a movie [[file:movie.jpg]] icon.
806
810
807− --------------
811+--------------
808
812
809* Footnotes
813* Footnotes
810 :PROPERTIES:
814 :PROPERTIES:
811 :CUSTOM_ID: footnotes
815 :CUSTOM_ID: footnotes
812 :END:
816 :END:
813
817
814− Here is a footnote reference,[fn:1] and another.[fn:2] This should /not/ be
818+Here is a footnote reference,[fn:1] and another.[fn:2] This should /not/ be a
815− a footnote reference, because it contains a space.[\^my note] Here is an
819+footnote reference, because it contains a space.[\^my note] Here is an inline
816− inline note.[fn:3]
820+note.[fn:3]
817
821
818− #+BEGIN_QUOTE
822+#+BEGIN_QUOTE
819− Notes can go in quotes.[fn:4]
823+ Notes can go in quotes.[fn:4]
820− #+END_QUOTE
824+#+END_QUOTE
821
825
822− 1. And in list items.[fn:5]
826+1. And in list items.[fn:5]
823
827
824− This paragraph should not be part of the note, as it is not indented.
828+This paragraph should not be part of the note, as it is not indented.
825
829
826[fn:1] Here is the footnote. It can go anywhere after the footnote reference.
830[fn:1] Here is the footnote. It can go anywhere after the footnote reference.
827 It need not be placed at the end of the document.
831 It need not be placed at the end of the document.