Skip to content
This repository has been archived by the owner on Dec 17, 2022. It is now read-only.

Commit

Permalink
Misc. bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Miller committed Jun 25, 2011
1 parent 7353348 commit c8e5f6f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/jerome.erl
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/jerome_rtf_parser.yrl
Expand Up @@ -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'].
Expand Down
2 changes: 1 addition & 1 deletion src/jerome_textile_parser.yrl
Expand Up @@ -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'].

Expand Down
2 changes: 2 additions & 0 deletions src/jerome_textile_scanner.erl
Expand Up @@ -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.