From 752a020bf54082e8af3c966f4740abf5914ac821 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sun, 7 Mar 2021 15:46:35 +0700 Subject: Migrate work listing page --- menu2.md | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'menu2.md') diff --git a/menu2.md b/menu2.md index 26e5d65..cbae046 100644 --- a/menu2.md +++ b/menu2.md @@ -70,36 +70,6 @@ The former (`hfun_*`) is most likely to be useful. ### Custom "hfun" -If you define a function `hfun_bar` in the `utils.jl` then you have access to a new template function `{{bar ...}}`. The parameters are passed as a list of strings, for instance variable names but it could just be strings as well. - -For instance: - -```julia -function hfun_bar(vname) - val = Meta.parse(vname[1]) - return round(sqrt(val), digits=2) -end -``` - -~~~ -.hf {background-color:black;color:white;font-weight:bold;} -~~~ - -Can be called with `{{bar 4}}`: **{{bar 4}}**. - -Usually you will want to pass variable name (either local or global) and collect their value via one of `locvar`, `globvar` or `pagevar` depending on your use case. -Let's have another toy example: - -```julia -function hfun_m1fill(vname) - var = vname[1] - return pagevar("menu1", var) -end -``` - -Which you can use like this `{{m1fill title}}`: **{{m1fill title}}**. Of course in this specific case you could also have used `{{fill title menu1}}`: **{{fill title menu1}}**. - -Of course these examples are not very useful, in practice you might want to use it to generate actual HTML in a specific way using Julia code. For instance you can use it to customise how [tag pages look like](/menu3/#customising_tag_pages). A nice example of what you can do is in the [SymbolicUtils.jl manual](https://juliasymbolics.github.io/SymbolicUtils.jl/api/) where they use a `hfun_` to generate HTML encapsulating the content of code docstrings, in a way doing something similar to what Documenter does. See [how they defined it](https://github.com/JuliaSymbolics/SymbolicUtils.jl/blob/website/utils.jl). -- cgit 1.4.1