Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
2491-EDoc-Allow-user-defined-macros-to-be-funct...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2491-EDoc-Allow-user-defined-macros-to-be-functions.patch of Package erlang
From 6343871cf4275a26591ded6f11362b47728ad732 Mon Sep 17 00:00:00 2001 From: Max Nordlund <max.nordlund@kivra.com> Date: Fri, 26 Jun 2020 14:44:39 +0200 Subject: [PATCH 1/2] EDoc: Allow user defined macros to be functions This makes them equal to the builtin ones, and allows for neat things like linking to the offical docs page: ``` man_doc_macro(MacroArg, _Line, _Env) -> {ok, Pattern} = re:compile("([^:]+):([^/]+)/(\\d+)"), {match, [Module, Function, Arity]} = re:run( MacroArg, Pattern, [{capture, all_but_first, binary}] ), lists:flatten(io_lib:format( "<a href=\"https://erlang.org/man/~ts.html#~ts-~ts\"><code>~ts</code></a>", [Module, Function, Arity, MacroArg] )). ``` --- lib/edoc/src/edoc_macros.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/edoc/src/edoc_macros.erl b/lib/edoc/src/edoc_macros.erl index d5a11d438b..2aab1a3750 100644 --- a/lib/edoc/src/edoc_macros.erl +++ b/lib/edoc/src/edoc_macros.erl @@ -58,6 +58,8 @@ std_macros(Env) -> check_defs([{K, D} | Ds]) when is_atom(K), is_list(D) -> check_defs(Ds); +check_defs([{K, D} | Ds]) when is_atom(K), is_function(D, 3) -> + check_defs(Ds); check_defs([X | _Ds]) -> report("bad macro definition: ~P.", [X, 10]), exit(error); -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor