branch: externals/perl-doc commit eb329f2675e71d656e1512ba7ec5a37ada4603d6 Author: Harald Jörg <h...@posteo.de> Commit: Harald Jörg <h...@posteo.de>
Bugfix: "|" to be allowed within markup as in "C<|>" * perl-doc.el: Bump version to 0.6. (perl-doc-with-L-grammar: Allow the vertical bar in markup (but not in plain nor extended text) * test/perl-doc-tests.el (perl-doc-test-l-grammar): Add testcase for vertical bar in markup. (perl-doc-test-process-links): Add testcase for vertical bar in markup. * NEWS: Add entry for version 0.6. --- ChangeLog | 10 ++++++++++ NEWS | 5 +++++ perl-doc.el | 9 ++++----- test/perl-doc-tests.el | 8 ++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2c91c4fe4..c62b079877 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2022-09-29 Harald Jörg <h...@posteo.de> + + * perl-doc.el (perl-doc-with-L-grammar): Allow the vertical bar in + markup (but not in plain nor extended text) + + * test/perl-doc-tests.el (perl-doc-test-l-grammar): Add testcase + for vertical bar in markup. + (perl-doc-test-process-links): Add testcase for vertical bar in + markup. + 2022-09-27 Harald Jörg <h...@posteo.de> * NEWS: New file, loosely following Emacs conventions. diff --git a/NEWS b/NEWS index 70ec24917a..ed550bcf0f 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ perl-doc.el for GNU Emacs NEWS -- history of user-visible changes. Copyright (C) 2022 Free Software Foundation, Inc. See the end of the file for license conditions. +* Changes in perl-doc.el 0.6 + +Bugfix: A vertical bar in markup is now processed correctly (seen in +perlport.pod). + * Changes in perl-doc.el 0.3 ** New command `perl-doc-file' diff --git a/perl-doc.el b/perl-doc.el index 35df0204d8..253160665a 100644 --- a/perl-doc.el +++ b/perl-doc.el @@ -5,7 +5,7 @@ ;; Author: Harald Jörg <h...@posteo.de> ;; Maintainer: Harald Jörg <h...@posteo.de> ;; Created: 2022 -;; Version: 0.4 +;; Version: 0.6 ;; Keywords: languages ;; URL: https://github.com/HaraldJoerg/emacs-perl-doc @@ -165,13 +165,12 @@ which allow to process these elements with some confidence." (extended (not (any "|/"))) ; markup is ok, separators are not ok (unrestricted (seq (not ?/) (* any))) ; not starting with a slash (not-markup (seq (not (any "A-Z")) "<")) ; A "harmless" less-than char - (not-delimiter (or (escaped "|") (escaped "/") (not (any "|/")))) (markup-start (sequence (in "A-Z") "<")) (link-start (sequence "L<" (optional (group-n 1 (1+ "<") " ")))) (simple-markup (sequence markup-start (+? (or - (not (any "<>|/")) + (not (any "<>/")) not-markup)) ">")) (extended-markup (sequence @@ -179,7 +178,7 @@ which allow to process these elements with some confidence." ;; Delimiters are forbidden in links, ;; allowed elsewhwere. We can ignore ;; this since we only treat links here) - (+? not-delimiter) + (+? any) space ">>")) ; ending phrase (markup ; We allow _one_ level of nesting (or extended-markup @@ -187,7 +186,7 @@ which allow to process these elements with some confidence." (+? (or extended-markup simple-markup not-markup - (not (any "|/>")))) + (not (any "/>")))) ">"))) ;; Now these are the things we're actually after: The parts ;; that make a L<name|url> link. We expect either an URL diff --git a/test/perl-doc-tests.el b/test/perl-doc-tests.el index 46f4f6313e..8163826c5b 100644 --- a/test/perl-doc-tests.el +++ b/test/perl-doc-tests.el @@ -42,13 +42,15 @@ (should (string= (match-string 0 string) "\"quoted \\\"part\\\"\\\\\""))) (let ((markup-testcases '(("B<bold> xxx" . "B<bold>") + ("C<|>" . "C<|>") ; seen in perlport ("I<nestB<ed>>>" . "I<nestB<ed>>") + ("C<< extended with | >>>" . "C<< extended with | >>") ("C<< extended with > >>>" . "C<< extended with > >>")))) (dolist (markup-testcase markup-testcases) (let ((string (car markup-testcase)) (match (cdr markup-testcase))) - (string-match (rx markup) string) - (should (string= (match-string 0 string) match))))))) + (should (string-match (rx markup) string)) + (should (string= (match-string 0 string) match))))))) (ert-deftest perl-doc-test-process-links () "Test various ways to write POD \"L<...>\" elements. @@ -72,6 +74,8 @@ The L markup is the weirdest of all POD elements, here are some ("L<fopen(3)>" . "L<fopen(3)|perldoc:///fopen(3)>") ("L<pi/Files and I/O>" . ; in perlfunc.pod "L<Files and I/O in pi|perldoc:///pi/Files-and-I/O>") + ("L<C<^>, C<&> and C<|>|perlop/Bitwise>" . ; found in perlport + "L<C<^>, C<&> and C<|>|perldoc:///perlop/Bitwise>") ("L<< Perl-R|https://g.com/orgs/Perl/teams/perl-r >>" . "L<< Perl-R|https://g.com/orgs/Perl/teams/perl-r >>"))) (perl-doc--debug t))