From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sM+DGqHEpGFHDAAAgWs5BA (envelope-from ) for ; Mon, 29 Nov 2021 13:16:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +P0+FqHEpGFnCAAA1q6Kng (envelope-from ) for ; Mon, 29 Nov 2021 12:16:33 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EB4416CE for ; Mon, 29 Nov 2021 13:16:33 +0100 (CET) Received: from localhost ([::1]:58032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrfaB-0003wk-K7 for larch@yhetil.org; Mon, 29 Nov 2021 07:16:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrfZM-0003wW-G2 for emacs-orgmode@gnu.org; Mon, 29 Nov 2021 07:15:41 -0500 Received: from ciao.gmane.io ([116.202.254.214]:36282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrfZL-0002zK-3w for emacs-orgmode@gnu.org; Mon, 29 Nov 2021 07:15:40 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mrfZE-0004UN-G6 for emacs-orgmode@gnu.org; Mon, 29 Nov 2021 13:15:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [PATCH] Fix regex for determining image width from attribute Date: Mon, 29 Nov 2021 19:15:27 +0700 Message-ID: References: <87czmtuy0p.fsf@gmail.com> <87ilwl71gh.fsf@gmail.com> <87a6hxuw0y.fsf@gmail.com> <877dd07fnb.fsf@gmail.com> <8735noqig0.fsf@gmail.com> <87wnl05ag6.fsf@gmail.com> <87y25fq5d2.fsf@gmail.com> <8735nnlaef.fsf@gmail.com> <87v90jph1w.fsf@gmail.com> <871r37l96a.fsf@gmail.com> <87k0gzpb5s.fsf@gmail.com> <87h7c2pb6w.fsf@gmail.com> <87ee75pmsn.fsf@gmail.com> <87czmjajyx.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <87czmjajyx.fsf@gmail.com> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, NICE_REPLY_A=-1.317, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638188193; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NAtOxYArf0PpiutpA41xYowrbEmDsPNw8FO5HowNuEM=; b=UIEWrZzkLY0kWBlJnIRoPDbWfGIU1pVqVp/2yVs3pRaoMh5DLukxcz1ZvXjIw6gq92atgu 5Kyum9q18y0LazAql/HFh3X4+zIZ/Sflx70IuteOKQXrU6m6sBM1KmGpbPdkxxXEJAL5Wg g87Et+YVSX2nZb6BzWRWGJn31AWIdFgMvs4LyqzwePLRZmiTOwLE0gHJeohycNEPU7ViLd XzvSGINZ7Ji1POVl3CTC+SICllV8hxczKf0A9JlCebzLNJze8KET/lR1AbZ5tFNk+b/32w I7om4wV11rKjZXP4mBTf7QyHhbqUit0b0agC3j4ESPO8Uaq0Mfew3dj8M4uRKQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638188193; a=rsa-sha256; cv=none; b=fWEoSXsytTCsQSJLbUcWB6DL0KyEnv1zXLAacT3Fnyq7Hb7zaD1pqB3NvWWbL7dvihQjYA ohewo3IDxPBL4DcasUd4EiKbhxQNQKDD0d8jctxiFo53kTBhd6YE1l3DUs0kNCgI7pdvcL YZqxHqKAyvCog+PF2nsPoZFQukCypFJaKaekI2NRvq3Z05bKc/MRCyvko1FxW157MR2PTf 8xhKWjr9hdGQcGSlvNdmbnj2OLtEEVcrIROHL5/IZdfaGK0baxAUyOHNV7goapyf2D9noz fiyzVm2SnOkevE5Df5QO766cG4OslD95FIfLWXiNfl9hNn7TGIpw5Q3W3yIwag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.31 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 1EB4416CE X-Spam-Score: -2.31 X-Migadu-Scanner: scn1.migadu.com X-TUID: u1kM1iQRF29j On 29/11/2021 07:23, Matt Huszagh wrote: > Max Nikulin writes: > >> My current variant: >> >> ":\\(?:[^\n]*?[[:blank:]]\\)?:width[[:blank:]]+\\(\\S-+\\)" >> >> The regexp should not match e.g. >> >> #+attr_html: :alt something >> :width 600 >> >> P.S. I would prefer to use the same parser as ox does. > > I can probably implement this if people want. But, let me know if I > should indeed use org-export-registered-backends. However, I'm starting > to feel like this should be separate patch (the goal for mine was just > to prioritize attr_org). I am against regexps that have obvious flaws. I admit however that the regexp that appeared long time ago before your patch fails for some corner cases as well. I will left decision to you and to Org developers and maintainers. Additionally, I like that Timothy transformed a code fragment into `org-display-inline-image--width' function and, I suppose, it deserves some unit tests (see testing/README file).