Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/asciidoc.git#7d3ef91a576d624b1b454c7fe45b3b1d60dd7ced
This commit is contained in:
DistroBaker 2020-12-10 01:05:31 +01:00
parent fb96ee7a95
commit 1a5611d954
5 changed files with 37 additions and 252 deletions

28
asciidoc-newline.patch Normal file
View File

@ -0,0 +1,28 @@
From 89ac0f48affb054226467b58f5af524ae0760d62 Mon Sep 17 00:00:00 2001
From: "Christopher K. Hoadley" <chris.hoadley@gmail.com>
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'):

View File

@ -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:

View File

@ -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<attrname>\w[^.]*?)(\.(?P<attrname2>.*?))?:(\s+(?P<attrvalue>.*))?$
-attributelist-pattern=(?u)(^\[\[(?P<id>[\w_:][\w_:.-]*)(,(?P<reftext>.*?))?\]\]$)|(^\[(?P<attrlist>.*)\]$)
+attributelist-pattern=(^\[\[(?P<id>[\w_:][\w_:.-]*)(,(?P<reftext>.*?))?\]\]$)|(^\[(?P<attrlist>.*)\]$)
# Substitution attributes for escaping AsciiDoc processing.
amp=&
lt=<
@@ -288,10 +288,10 @@ endif::no-inline-literal[]
# Block macros
#-------------
# Macros using default syntax.
-(?u)^(?P<name>image|unfloat|toc)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=#
+^(?P<name>image|unfloat|toc)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=#
# Passthrough macros.
-(?u)^(?P<name>pass)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#
+^(?P<name>pass)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#
^'{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<name>[\\]?\w(\w|-)*?)::(?P<target>\S*?)' + \
+ SYS_RE = r'^(?P<name>[\\]?\w(\w|-)*?)::(?P<target>\S*?)' + \
r'(\[(?P<attrlist>.*?)\])$'
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<section>\+?[^\W\d][\w-]*)\]\s*$')
+ reo = re.compile(r'^\[(?P<section>\+?[^\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)[\\]?(?P<name>latexmath):(?P<subslist>\S*?)\[(?:\$\s*)?(?P<passtext>.*?)(?:\s*\$)?(?<!\\)\]=[]
-(?u)^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[]
+^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[]
[latexmath-inlinemacro]
<inlineequation>
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]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
diff -urNp a/examples/website/layout2.conf b/examples/website/layout2.conf
--- a/examples/website/layout2.conf 2018-12-03 13:06:23.384407377 +0100
+++ b/examples/website/layout2.conf 2018-12-03 13:08:35.614147145 +0100
@@ -24,7 +24,7 @@
# xhtml11 backend stylesheets.
[specialwords]
-monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\)
+monospacedwords=\\?\basciidoc\(1\) \\?\ba2x\(1\)
[header]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
diff -urNp a/html5.conf b/html5.conf
--- a/html5.conf 2018-12-03 13:06:23.386407373 +0100
+++ b/html5.conf 2018-12-03 13:08:59.231099559 +0100
@@ -36,13 +36,13 @@ asciimath-style=template="asciimathblock
latexmath-style=template="latexmathblock",subs=(),posattrs=(),filter="unwraplatex.py"
[macros]
-(?u)^(?P<name>audio|video)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=#
+^(?P<name>audio|video)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=#
# math macros.
# Special characters are escaped in HTML math markup.
(?su)[\\]?(?P<name>asciimath):(?P<subslist>\S*?)\[(?P<passtext>.*?)(?<!\\)\]=[specialcharacters]
-(?u)^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters]
+^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters]
(?su)[\\]?(?P<name>latexmath):(?P<subslist>\S*?)\[(?:\$\s*)?(?P<passtext>.*?)(?:\s*\$)?(?<!\\)\]=[specialcharacters]
-(?u)^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters]
+^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\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)[\\]?(?P<name>asciimath):(?P<subslist>\S*?)\[(?P<passtext>.*?)(?<!\\)\]=[specialcharacters]
-(?u)^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters]
+^(?P<name>asciimath)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$=#[specialcharacters]
(?su)[\\]?(?P<name>latexmath):(?P<subslist>\S*?)\[(?:\$\s*)?(?P<passtext>.*?)(?:\s*\$)?(?<!\\)\]=[specialcharacters]
-(?u)^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters]
+^(?P<name>latexmath)::(?P<subslist>\S*?)(\[(?:\\\[\s*)?(?P<passtext>.*?)(?:\s*\\\])?\])$=#[specialcharacters]
[asciimath-inlinemacro]
`{passtext}`

View File

@ -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)

View File

@ -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 <hobbes1069@gmail.com> - 9.0.4-2
- Add patch to fix problem with not respecting newline configuration.
- Remove unused patches.
* Sat Oct 31 2020 Fabian Affolter <mail@fabian-affolter.ch> - 9.0.4-1
- Detection of latest Python releases (#1889725)
- Update to latest upstream release 9.0.4