From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: [NTG-context] Re: defining hashtag simulator
Date: Mon, 20 May 2024 10:02:01 +0200 [thread overview]
Message-ID: <7c029492-97f6-46c0-82d7-ae080aac0dc7@freedom.nl> (raw)
In-Reply-To: <171618491505.1996.2365276090642094609@cgl.ntg.nl>
On 5/20/2024 8:01 AM, seyal.zavira@gmail.com wrote:
> Thanks.
>
> What if we want the text to be copied when it is clicked?
> I found these link on the stack site for this
> https://tex.stackexchange.com/questions/174637/copy-to-clipboard-feature-in-pdf-output/545107#545107
>
> also i defined this:
> \def\Hashtag#1{
> \hbox{\tfa\ctxlua{
> str = "#1"
> replacespace = string.gsub(str," ","_")
>
> context.letterhash()
> context(replacespace)
> }
> }
> }
> \starttext
> \Hashtag{hello}
> \stoptext
>
> i used hbox for making phrase unbreakable.
>
> How can you put all the code in the one Lua function and not need to put hbox or goto function outside of Lua?
\startluacode
interfaces.implement {
name = "Hashtag",
public = true,
protected = true,
arguments = "string",
actions = function(str)
context("{\\nohyphens\\letterhash %s}",string.gsub(str," ","_"))
-- str = string.gsub(str," ","_")
-- context.bgroup()
-- context.nohyphens()
-- context.letterhash()
-- context(str)
-- context.egroup()
end
}
\stopluacode
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2024-05-20 8:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-19 3:40 [NTG-context] " seyal.zavira
2024-05-19 9:08 ` [NTG-context] " Hans Hagen
2024-05-20 6:01 ` seyal.zavira
2024-05-20 8:02 ` Hans Hagen via ntg-context [this message]
2024-05-20 14:57 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c029492-97f6-46c0-82d7-ae080aac0dc7@freedom.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@freedom.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).