-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fb23da
commit c308c99
Showing
3 changed files
with
60 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
defmodule ExDoc.ShellLexer do | ||
# Makeup lexer for sh, bash, etc commands. | ||
# The only thing it does is making the `$ ` prompt not selectable. | ||
@moduledoc false | ||
|
||
@behaviour Makeup.Lexer | ||
|
||
@impl true | ||
def lex(text, _opts) do | ||
text | ||
|> String.split("\n") | ||
|> Enum.flat_map(fn | ||
"$ " <> rest -> | ||
[ | ||
{:generic_prompt, %{selectable: false}, "$ "}, | ||
{:text, %{}, rest <> "\n"} | ||
] | ||
|
||
text -> | ||
[{:text, %{}, text <> "\n"}] | ||
end) | ||
end | ||
|
||
@impl true | ||
def match_groups(_arg0, _arg1) do | ||
raise "not implemented yet" | ||
end | ||
|
||
@impl true | ||
def postprocess(_arg0, _arg1) do | ||
raise "not implemented yet" | ||
end | ||
|
||
@impl true | ||
def root(_arg0) do | ||
raise "not implemented yet" | ||
end | ||
|
||
@impl true | ||
def root_element(_arg0) do | ||
raise "not implemented yet" | ||
end | ||
end |