Permalink
Browse files

Misc. bug fixes

  • Loading branch information...
1 parent 7353348 commit c8e5f6f1d68024a2e58b00d980c07b79d6e3fdfc Evan Miller committed Jun 25, 2011
Showing with 10 additions and 7 deletions.
  1. +6 −6 src/jerome.erl
  2. +1 −0 src/jerome_rtf_parser.yrl
  3. +1 −1 src/jerome_textile_parser.yrl
  4. +2 −0 src/jerome_textile_scanner.erl
View
@@ -13,12 +13,12 @@ parse(Path, Format, ImageFun) when is_list(Path) ->
{ok, Binary} = file:read_file(Path),
parse(Binary, Format, ImageFun);
-parse(Binary, Format, ImageFun) when is_binary(Binary) ->
- case Format of
- bbcode -> jerome_bbcode_consumer:consume(Binary, ImageFun);
- rtf -> jerome_rtf_consumer:consume(Binary, ImageFun);
- textile -> jerome_textile_consumer:consume(Binary, ImageFun)
- end.
+parse(Binary, bbcode, ImageFun) when is_binary(Binary) ->
+ jerome_bbcode_consumer:consume(Binary, ImageFun);
+parse(Binary, rtf, ImageFun) when is_binary(Binary) ->
+ jerome_rtf_consumer:consume(Binary, ImageFun);
+parse(Binary, textile, ImageFun) when is_binary(Binary) ->
+ jerome_textile_consumer:consume(Binary, ImageFun).
generate(Ast, Format) ->
case Format of
@@ -38,6 +38,7 @@ Elements -> Elements control_word : '$1' ++ ['$2'].
Elements -> Elements control_bin : '$1' ++ ['$2'].
Elements -> Elements control_char : '$1' ++ ['$2'].
Elements -> Elements control_hex : '$1' ++ ['$2'].
+Elements -> Elements new_paragraph : '$1' ++ ['$2'].
ListElements -> '$empty' : [].
ListElements -> ListElements Group : '$1' ++ ['$2'].
@@ -36,7 +36,7 @@ Rootsymbol
Elements -> '$empty' : [].
Elements -> Elements TableRow : '$1' ++ ['$2'].
-Elements -> Elements NonEmptyTextElements : '$1' ++ ['$2'].
+Elements -> Elements NonEmptyTextElements : '$1' ++ '$2'.
Elements -> Elements newline : '$1' ++ ['$2'].
Elements -> Elements BlockTag : '$1' ++ ['$2'].
@@ -86,4 +86,6 @@ scan([H|T], [{url, HPos, Link}|Scanned], {Row, Column}, inlink) ->
scan([H|T], [{text, TPos, Text}|Scanned], {Row, Column}, inline) ->
scan(T, [{text, TPos, [H|Text]}|Scanned], {Row, Column + 1}, inline);
scan([H|T], Scanned, {Row, Column} = Pos, inline) ->
+ scan(T, [{text, Pos, [H]}|Scanned], {Row, Column + 1}, inline);
+scan([H|T], Scanned, {Row, Column} = Pos, newline) ->
scan(T, [{text, Pos, [H]}|Scanned], {Row, Column + 1}, inline).

0 comments on commit c8e5f6f

Please sign in to comment.