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

Please add an \args for \define #1000

Closed
ctrlcctrlv opened this issue Jul 30, 2020 · 11 comments
Closed

Please add an \args for \define #1000

ctrlcctrlv opened this issue Jul 30, 2020 · 11 comments
Labels
enhancement Software improvement or feature request

Comments

@ctrlcctrlv
Copy link
Member

This would allow such helpful commands as...

\define[command=Href]{\color[color=#000099]{\href[\args]{\process}}}
@simoncozens
Copy link
Member

Just write it in Lua. It's not that hard. Do your programming in a programming language and your content in a content language.

@ctrlcctrlv
Copy link
Member Author

Perhaps but it is quite a trivial case to want to pass arguments from a parent define to a child

@ctrlcctrlv
Copy link
Member Author

For example, a whole module to make blue links seems overkill, as does inline scripts :-)

@simoncozens
Copy link
Member

Sure, but by now you probably have a whole collection of handy custom commands, so just add it to that. :-)

@alerque
Copy link
Member

alerque commented Jul 30, 2020

The Lua code for this is only slightly more verbose than your macro version, and LOTS more flexible. The possible permutations we'd have to cover if we tried to add more frills to the macro define function are endless ... and kind of pointless when Lua already has all the possibilities covered.

SILE.registerCommand("Href", function (options, content)
    SILE.call("color", { color = "#000099" }, function ()
      SILE.call("href", options, content)
    end)
end)

I kind of agree with Simon here ... I don't want to make SILE's TeXlike mode a Turing complete language like TeX. It's a markup language with a few frills. Use Lua for programming.

@ctrlcctrlv
Copy link
Member Author

Maybe the url package should itself have a color option. What do you think? :-)

@alerque
Copy link
Member

alerque commented Jul 30, 2020

Yes it could, but the logical way to do that would be with a default option of some kind so that, say, the shade of blue could be changed universally rather than in every invocation. We have a couple different clunky attempts at accomplishing this for ether cases (e.g. setting footnote fonts or styling TOC entries), but these could all use an overhaul before we go adding a bunch more hooks.

@alerque alerque added the enhancement Software improvement or feature request label Jul 30, 2020
@ctrlcctrlv
Copy link
Member Author

Right, because in the PDF output there's no way to tell what's a URL. By default, XeLaTeX puts hideous red boxes around everything... Better than nothing, but I think blue is best. I actually am not even sure doing nothing is a sane default, in retrospect.

@ctrlcctrlv
Copy link
Member Author

Oh and by the way guys, feel free to hate me, but I'm going to make a package for this. I'm going to call it superdefine.lua. Like my TeX mode, no expectation at all of merger. It will work by overriding the default define using the tips Caleb gave in #947 :-)

@alerque
Copy link
Member

alerque commented Jul 30, 2020

Doing nothing is a sane default because by default we're optimizing for print ... where hrefs don't do anything anyway and color without meaning can be distracting (who wants their TOC's all colored in pint?). Sure for screen optimized PDFs other settings would be fine, and a color option for href would be a fine addition.

Feel free to do whatever in your own packages. The whole point of SILE being extensible and written in Lua was to enable people to tinker with its internals.

@ctrlcctrlv
Copy link
Member Author

I don't know. Optimizing for print? Is that itself a sane default? ;-)

If you're optimizing for print by default then \href should be adding a footnote with the full URL...I don't know that doing nothing is ever sane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request
Projects
None yet
Development

No branches or pull requests

3 participants