Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url + href verbatim arguments #70

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/unified-latex-util-pegjs/grammars/latex.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ special_macro "special macro" // for the special macros like \[ \] and \begin{}
// math with $...$
/ math_environment
/ environment
/ url
/ href

square_bracket_argument
= "["
Expand All @@ -172,6 +174,23 @@ square_bracket_argument
];
}

url
= escape m:"url" url:verbatim_group {
return [
createNode("macro", { content: m }),
url,
]
}

href
= escape m:"href" url:verbatim_group label:group {
return [
createNode("macro", { content: m }),
url,
label,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need label in here since the normal parsing should handle it just fine.

]
}

verbatim_group
= begin_group v:(!end_group x:. { return x; })* end_group {
return createNode("group", {
Expand Down
Loading