From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id 3D33E250AB for ; Sat, 9 Mar 2024 16:17:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id B82294833F2 for ; Sat, 9 Mar 2024 16:16:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=gmail.com Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e0FLAVzNcmRQ for ; Sat, 9 Mar 2024 16:16:39 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 3A6ED484145 for ; Sat, 9 Mar 2024 16:15:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 7216A483010 for ; Sat, 9 Mar 2024 16:15:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wu9GFovVaOzn for ; Sat, 9 Mar 2024 16:15:09 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.50; helo=mail-ej1-f50.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 284BC482F67 for ; Sat, 9 Mar 2024 16:15:08 +0100 (CET) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a3122b70439so394652766b.3 for ; Sat, 09 Mar 2024 07:15:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709997308; x=1710602108; darn=ntg.nl; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=W6SY5jrMDp4ygpBi3+PkHZquVaZRgOB2dWLIuAuREoA=; b=SL2Fk6Q/JmlMEdC/tCCVgc6DWUxD5pfordP/b2xB0m1e0Gdv7dRSXW09SjUArZWpVD oY7Nyv92hDlEkryemPfAQihV/w6kQzyuHLcV9pIGLMSf1IW666TUN+0cPj0brYiviDyI 92+FMDYbp/YN9fBm5N/XYoxVob9FhLFkxeni2rm3BUsmYOh2beoNqSJdI0UE+HjPc/+j U/awMd9zhU/PF576EKzA3rPa1JZGsj2m2H+EYb/WIRikvABallTmDsH5t/dbDy+Zt3Vh +s/z62Hixlv3IvQqF1ba9kooUzqBMFejvBPz+RYQUVKeNS95sXa7ZVXXBNYF7wYcTney vEzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709997308; x=1710602108; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W6SY5jrMDp4ygpBi3+PkHZquVaZRgOB2dWLIuAuREoA=; b=MjSLiLAV7imo3/3meXt6BbL96NEOkpPhPU/FXw/EuIvImE/eITHcvxSB9ldgq5UnE+ 7PKAl4MfecSYWzT3OWqEBajAxW2rJqkLIKh22MKzyYctS8RvO4P3jWIlvHyRIlgMAFk0 avD72y9lFk8rszd7JwvmCFA6tSmCjEtGQs6zKYUOJGREtjehEmIPwhVVivO5zMajdkqg mPBfkDO9ExX6elCiZNMfp2epmpTR/KNVsyZseNy/bRDmKZNMnerpfk31JEq2zfql0bzt ZPoXHinkWCS1ArHFg9iSCN27vqao0xSn9FGmETZV+ZWXBHIEuJMy7wM6ac+zAZwG+Bxu 9OJw== X-Gm-Message-State: AOJu0YwJHUXy5kHE7Gr0IaTghpKTCb36T5WM8rhYNMo/pNer7hf1Sg7E lCBG4NC4tyBcFCs3uIkmfGI9yAk71xC5NhiKlOCAhPoJjIeTibW3 X-Google-Smtp-Source: AGHT+IEQtd5dQkkJKTUJvE22+iqEz1269DCZVi0nkGfLAM8nWSfxFcJk47gBOpJNrgkxsGpm3f/MSg== X-Received: by 2002:a17:906:1686:b0:a45:878e:b31c with SMTP id s6-20020a170906168600b00a45878eb31cmr1187644ejd.53.1709997308196; Sat, 09 Mar 2024 07:15:08 -0800 (PST) Received: from [192.168.0.227] (ip1f10fb52.dynamic.kabel-deutschland.de. [31.16.251.82]) by smtp.gmail.com with ESMTPSA id m22-20020a1709066d1600b00a451d07711csm976729ejr.82.2024.03.09.07.15.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Mar 2024 07:15:07 -0800 (PST) To: mailing list for ConTeXt users , Joel via ntg-context References: <1422901094.1250385.1709996503721.ref@mail.yahoo.com> <1422901094.1250385.1709996503721@mail.yahoo.com> From: Wolfgang Schuster Message-ID: <6814b0f1-c173-fca1-7def-8353f95986b4@gmail.com> Date: Sat, 9 Mar 2024 16:15:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.60 MIME-Version: 1.0 In-Reply-To: <1422901094.1250385.1709996503721@mail.yahoo.com> Content-Language: en-US Message-ID-Hash: KV7JSDKAZ3Y36BVGKWOHACSVIF6UQQ3Z X-Message-ID-Hash: KV7JSDKAZ3Y36BVGKWOHACSVIF6UQQ3Z X-MailFrom: wolfgang.schuster.lists@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: How to set section title based on section content? List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit Joel via ntg-context schrieb am 09.03.2024 um 16:01: > How to set section title based on section content? > > I have a document that has some structures like this: > > \starttext > > \startsection[title={Animals}] > > \event{\input knuth } > > \stopsection > > \startsection[title={Books}] > > \event{\input knuth } > > \stopsection > > \stoptext > > The event macro runs a bunch of conditionals, deciding which content to > place inside the section. It places any one of neary 200 possible > different types of content there. > > Sadly when I wrote the code, I thought generic titles would be okay. Now > I realize I need to be more specific, giving titles that match the > content inside. I could move the section titles inside the \event macro, > but it means rewriting ~200 other macros. > > In other words, how do I define a section title by defining it somewhere > in the content of the \event macro? > > \starttext > > \startsection[\whatistitle] %<-- would display "Neon Tetras" > > \event{\thetitleis{Neon Tetras}\input knuth } > > \stopsection > > \startsection[\whatistitle] %<-- would display "Detective Stories" > > \event{\thetitleis{Detective Stories}\input knuth } > > \stopsection > > \stoptext When each section contains nothing except the \event command I would remove the section titles from the document itself and place them as part of the \event command. \define[1]\Event {\startsection[title={#1}] \input{knuth} \stopsection} \starttext \Event{Neon Tetras} \Event{Detective Stories} \stoptext Wolfgang ___________________________________________________________________________________ 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 ___________________________________________________________________________________