diff --git a/asciidoc-newline.patch b/asciidoc-newline.patch new file mode 100644 index 0000000..4d7a8a4 --- /dev/null +++ b/asciidoc-newline.patch @@ -0,0 +1,28 @@ +From 89ac0f48affb054226467b58f5af524ae0760d62 Mon Sep 17 00:00:00 2001 +From: "Christopher K. Hoadley" +Date: Sat, 5 Dec 2020 10:59:36 -0600 +Subject: [PATCH] Use config Newline Setting In System Attribute Evaluation + (#154) + +Problems seen with inconsistent newlines in the Table Of Contents HTML pulled in from the configuration file. While the rest of the contents in the resulting HTML file honored the newline style configured by the user, this specific snippet of HTML always used "\r\n". + +This root of this problem existed for some time, but in earlier versions, the newline style was always "\n". The symptoms changed as a side effect of the issue "Extra line padding in source and literal blocks" (#139). In this issue, the newline style changed to "\r\n", and was noticed by users. + +Change the System Attribute Evaluation function to use the newline setting from the global "config" instead of using the default newline. +--- + asciidoc.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/asciidoc.py b/asciidoc.py +index 5c6b08b3..c33708c9 100755 +--- a/asciidoc.py ++++ b/asciidoc.py +@@ -969,7 +969,7 @@ def system(name, args, is_macro=False, attrs=None): + line = subs_attrs(line) + if line is not None: + result.append(line) +- result = DEFAULT_NEWLINE.join(result) ++ result = config.newline.join(result) + else: + assert False + if result and name in ('eval3', 'sys3'): diff --git a/asciidoc-python3-a2x-decode-fix.patch b/asciidoc-python3-a2x-decode-fix.patch deleted file mode 100644 index 507fa87..0000000 --- a/asciidoc-python3-a2x-decode-fix.patch +++ /dev/null @@ -1,40 +0,0 @@ -Taken from upstream PR#5 (https://github.com/asciidoc/asciidoc-py3/pull/5) - -6469317 Remove unnecessary decode in a2x (Matthew Peveler) -684913e Fix decoding of file that specifies encoding in header tag in a2x (Matthew Peveler) -8369a97 re-add --nonet option (Matthew Peveler) - -diff --git c/a2x.py w/a2x.py -index 55eb57e..c015079 100755 ---- c/a2x.py -+++ w/a2x.py -@@ -254,15 +254,11 @@ def find_resources(files, tagname, attrname, filter=None): - if OPTIONS.dry_run: - continue - parser = FindResources() -- # HTMLParser has problems with non-ASCII strings. -- # See http://bugs.python.org/issue3932 -- contents = read_file(filename) -- mo = re.search(r'\A<\?xml.* encoding="(.*?)"', contents) -- if mo: -- encoding = mo.group(1) -- parser.feed(contents.decode(encoding)) -- else: -- parser.feed(contents) -+ with open(filename, 'rb') as open_file: -+ contents = open_file.read() -+ mo = re.search(b'\A<\?xml.* encoding="(.*?)"', contents) -+ contents = contents.decode(mo.group(1).decode('utf-8') if mo else 'utf-8') -+ parser.feed(contents) - parser.close() - result = list(set(result)) # Drop duplicate values. - result.sort() -@@ -337,7 +333,7 @@ def get_source_options(asciidoc_file): - result = [] - if os.path.isfile(asciidoc_file): - options = '' -- with open(asciidoc_file) as f: -+ with open(asciidoc_file, encoding='utf-8') as f: - for line in f: - mo = re.search(r'^//\s*a2x:', line) - if mo: diff --git a/asciidoc-python3-deprecation-warning.patch b/asciidoc-python3-deprecation-warning.patch deleted file mode 100644 index bdaf0d6..0000000 --- a/asciidoc-python3-deprecation-warning.patch +++ /dev/null @@ -1,172 +0,0 @@ -diff -urNp a/asciidoc.conf b/asciidoc.conf ---- a/asciidoc.conf 2018-12-03 13:06:23.377407390 +0100 -+++ b/asciidoc.conf 2018-12-03 13:07:08.142320548 +0100 -@@ -29,7 +29,7 @@ empty= - sp=" " - # Attribute and AttributeList element patterns. - attributeentry-pattern=^:(?P\w[^.]*?)(\.(?P.*?))?:(\s+(?P.*))?$ --attributelist-pattern=(?u)(^\[\[(?P[\w_:][\w_:.-]*)(,(?P.*?))?\]\]$)|(^\[(?P.*)\]$) -+attributelist-pattern=(^\[\[(?P[\w_:][\w_:.-]*)(,(?P.*?))?\]\]$)|(^\[(?P.*)\]$) - # Substitution attributes for escaping AsciiDoc processing. - amp=& - lt=< -@@ -288,10 +288,10 @@ endif::no-inline-literal[] - # Block macros - #------------- - # Macros using default syntax. --(?u)^(?Pimage|unfloat|toc)::(?P\S*?)(\[(?P.*?)\])$=# -+^(?Pimage|unfloat|toc)::(?P\S*?)(\[(?P.*?)\])$=# - - # Passthrough macros. --(?u)^(?Ppass)::(?P\S*?)(\[(?P.*?)\])$=# -+^(?Ppass)::(?P\S*?)(\[(?P.*?)\])$=# - - ^'{3,}$=#ruler - ^<{3,}$=#pagebreak -diff -urNp a/asciidoc.py b/asciidoc.py ---- a/asciidoc.py 2018-12-03 13:06:23.378407388 +0100 -+++ b/asciidoc.py 2018-12-03 13:17:41.965990011 +0100 -@@ -30,7 +30,7 @@ SUBS_NORMAL = ('specialcharacters','quot - 'specialwords','replacements','macros','replacements2') - SUBS_VERBATIM = ('specialcharacters','callouts') - --NAME_RE = r'(?u)[^\W\d][-\w]*' # Valid section or attribute name. -+NAME_RE = r'[^\W\d][-\w]*' # Valid section or attribute name. - OR, AND = ',', '+' # Attribute list separators. - - -@@ -463,7 +463,7 @@ def parse_options(options,allowed,errmsg - - def symbolize(s): - """Drop non-symbol characters and convert to lowercase.""" -- return re.sub(r'(?u)[^\w\-_]', '', s).lower() -+ return re.sub(r'[^\w\-_]', '', s).lower() - - def is_name(s): - """Return True if s is valid attribute, macro or tag name -@@ -1746,7 +1746,7 @@ class AttributeEntry: - attr.name = attr.name[:-1] - attr.value = None - # Strip white space and illegal name chars. -- attr.name = re.sub(r'(?u)[^\w\-_]', '', attr.name).lower() -+ attr.name = re.sub(r'[^\w\-_]', '', attr.name).lower() - # Don't override most command-line attributes. - if attr.name in config.cmd_attrs \ - and attr.name not in ('trace','numbered'): -@@ -1946,7 +1946,7 @@ class Title: - if ul != s[:ul_len]: return False - # Don't be fooled by back-to-back delimited blocks, require at - # least one alphanumeric character in title. -- if not re.search(r'(?u)\w',title): return False -+ if not re.search(r'\w',title): return False - mo = re.match(Title.pattern, title) - if mo: - Title.attributes = mo.groupdict() -@@ -2104,7 +2104,7 @@ class Section: - """ - # Replace non-alpha numeric characters in title with underscores and - # convert to lower case. -- base_id = re.sub(r'(?u)\W+', '_', title).strip('_').lower() -+ base_id = re.sub(r'\W+', '_', title).strip('_').lower() - if 'ascii-ids' in document.attributes: - # Replace non-ASCII characters with ASCII equivalents. - import unicodedata -@@ -3602,7 +3602,7 @@ class Tables(AbstractBlocks): - - class Macros: - # Default system macro syntax. -- SYS_RE = r'(?u)^(?P[\\]?\w(\w|-)*?)::(?P\S*?)' + \ -+ SYS_RE = r'^(?P[\\]?\w(\w|-)*?)::(?P\S*?)' + \ - r'(\[(?P.*?)\])$' - def __init__(self): - self.macros = [] # List of Macros. -@@ -4478,7 +4478,7 @@ class Config: - rdr.open(fname) - message.linenos = None - self.fname = fname -- reo = re.compile(r'(?u)^\[(?P
\+?[^\W\d][\w-]*)\]\s*$') -+ reo = re.compile(r'^\[(?P
\+?[^\W\d][\w-]*)\]\s*$') - sections = OrderedDict() - section,contents = '',[] - while not rdr.eof(): -diff -urNp a/doc/asciidoc.conf b/doc/asciidoc.conf ---- a/doc/asciidoc.conf 2018-12-03 13:06:23.379407386 +0100 -+++ b/doc/asciidoc.conf 2018-12-03 13:07:32.374272984 +0100 -@@ -3,5 +3,5 @@ - # - [specialwords] - ifndef::doctype-manpage[] --monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) -+monospacedwords=\\?\basciidoc\(1\) \\?\ba2x\(1\) - endif::doctype-manpage[] -diff -urNp a/docbook45.conf b/docbook45.conf ---- a/docbook45.conf 2018-12-03 13:06:23.383407378 +0100 -+++ b/docbook45.conf 2018-12-03 13:07:53.221231766 +0100 -@@ -47,7 +47,7 @@ latexmath-style=template="latexmathblock - [macros] - # math macros. - (?su)[\\]?(?Platexmath):(?P\S*?)\[(?:\$\s*)?(?P.*?)(?:\s*\$)?(?latexmath)::(?P\S*?)(\[(?:\\\[\s*)?(?P.*?)(?:\s*\\\])?\])$=#[] -+^(?Platexmath)::(?P\S*?)(\[(?:\\\[\s*)?(?P.*?)(?:\s*\\\])?\])$=#[] - - [latexmath-inlinemacro] - -diff -urNp a/examples/website/layout1.conf b/examples/website/layout1.conf ---- a/examples/website/layout1.conf 2018-12-03 13:06:23.384407377 +0100 -+++ b/examples/website/layout1.conf 2018-12-03 13:08:17.989182454 +0100 -@@ -22,7 +22,7 @@ - # xhtml11 backend stylesheets. - - [specialwords] --monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) -+monospacedwords=\\?\basciidoc\(1\) \\?\ba2x\(1\) - - [header] - audio|video)::(?P\S*?)(\[(?P.*?)\])$=# -+^(?Paudio|video)::(?P\S*?)(\[(?P.*?)\])$=# - # math macros. - # Special characters are escaped in HTML math markup. - (?su)[\\]?(?Pasciimath):(?P\S*?)\[(?P.*?)(?asciimath)::(?P\S*?)(\[(?P.*?)\])$=#[specialcharacters] -+^(?Pasciimath)::(?P\S*?)(\[(?P.*?)\])$=#[specialcharacters] - (?su)[\\]?(?Platexmath):(?P\S*?)\[(?:\$\s*)?(?P.*?)(?:\s*\$)?(?latexmath)::(?P\S*?)(\[(?:\\\[\s*)?(?P.*?)(?:\s*\\\])?\])$=#[specialcharacters] -+^(?Platexmath)::(?P\S*?)(\[(?:\\\[\s*)?(?P.*?)(?:\s*\\\])?\])$=#[specialcharacters] - - [asciimath-inlinemacro] - `{passtext}` -diff -urNp a/xhtml11.conf b/xhtml11.conf ---- a/xhtml11.conf 2018-12-03 13:06:23.395407355 +0100 -+++ b/xhtml11.conf 2018-12-03 13:09:18.358060798 +0100 -@@ -39,9 +39,9 @@ latexmath-style=template="latexmathblock - # math macros. - # Special characters are escaped in HTML math markup. - (?su)[\\]?(?Pasciimath):(?P\S*?)\[(?P.*?)(?asciimath)::(?P\S*?)(\[(?P.*?)\])$=#[specialcharacters] -+^(?Pasciimath)::(?P\S*?)(\[(?P.*?)\])$=#[specialcharacters] - (?su)[\\]?(?Platexmath):(?P\S*?)\[(?:\$\s*)?(?P.*?)(?:\s*\$)?(?latexmath)::(?P\S*?)(\[(?:\\\[\s*)?(?P.*?)(?:\s*\\\])?\])$=#[specialcharacters] -+^(?Platexmath)::(?P\S*?)(\[(?:\\\[\s*)?(?P.*?)(?:\s*\\\])?\])$=#[specialcharacters] - - [asciimath-inlinemacro] - `{passtext}` diff --git a/asciidoc-python3.patch b/asciidoc-python3.patch deleted file mode 100644 index ec2d0f1..0000000 --- a/asciidoc-python3.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff -urNp old/filters/latex/latex2img.py new/filters/latex/latex2img.py ---- old/filters/latex/latex2img.py 2018-06-05 15:27:44.153533130 +0200 -+++ new/filters/latex/latex2img.py 2018-06-05 15:28:43.542828463 +0200 -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - ''' - NAME - latex2img - Converts LaTeX source to PNG or SVG file -diff -urNp old/filters/music/music2png.py new/filters/music/music2png.py ---- old/filters/music/music2png.py 2018-06-05 15:27:44.153533130 +0200 -+++ new/filters/music/music2png.py 2018-06-05 15:28:56.502882780 +0200 -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - ''' - NAME - music2png - Converts textual music notation to classically notated PNG file -diff -urNp old/filters/unwraplatex.py new/filters/unwraplatex.py ---- old/filters/unwraplatex.py 2018-06-05 15:27:44.152533125 +0200 -+++ new/filters/unwraplatex.py 2018-06-05 15:28:29.956767744 +0200 -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - ''' - NAME - unwraplatex - Removes delimiters from LaTeX source text -diff -urNp old/Makefile.in new/Makefile.in ---- old/Makefile.in 2018-06-05 15:27:44.144533079 +0200 -+++ new/Makefile.in 2018-06-05 15:27:56.328600132 +0200 -@@ -107,7 +107,7 @@ $(DATATARGETS): % : %dir - $(INSTALL_DATA) $($@) $(DESTDIR)/$($<)/ - - $(manp): %.1 : %.1.txt -- python2 a2x.py -f manpage $< -+ python3 a2x.py -f manpage $< - - docs: - $(INSTALL) -d $(DESTDIR)/$(docdir) diff --git a/asciidoc.spec b/asciidoc.spec index 2c1bf5f..46ae1a3 100644 --- a/asciidoc.spec +++ b/asciidoc.spec @@ -1,11 +1,15 @@ Name: asciidoc Version: 9.0.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Text based document generation License: GPL+ and GPLv2+ URL: http://asciidoc.org Source0: https://github.com/%{name}/asciidoc-py3/archive/%{version}/%{name}-py3-%{version}.tar.gz + +# https://github.com/asciidoc/asciidoc-py3/issues/154 +Patch0: asciidoc-newline.patch + BuildArch: noarch BuildRequires: python3-devel @@ -154,6 +158,10 @@ rm -f %{buildroot}/%{_mandir}/man1/testasciidoc.1* %{_sysconfdir}/asciidoc/filters/music/*.py %changelog +* Sun Dec 06 2020 Richard Shaw - 9.0.4-2 +- Add patch to fix problem with not respecting newline configuration. +- Remove unused patches. + * Sat Oct 31 2020 Fabian Affolter - 9.0.4-1 - Detection of latest Python releases (#1889725) - Update to latest upstream release 9.0.4