1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
%global _empty_manifest_terminate_build 0
Name: python-mdx-include
Version: 1.4.2
Release: 1
Summary: Python Markdown extension to include local or remote files
License: BSD
URL: https://github.com/neurobin/mdx_include
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bf/f0/f395a9cf164471d3c7bbe58cbd64d74289575a8b85a962b49a804ab7ed34/mdx_include-1.4.2.tar.gz
BuildArch: noarch
Requires: python3-Markdown
Requires: python3-rcslice
Requires: python3-cyclic
%description
`base_path` | `.` | The base path from which relative paths are normalized.
`encoding` | `utf-8` | The file encoding.
`allow_local` | `True` | Whether to allow including local files.
`allow_remote` | `True` | Whether to allow including remote files.
`truncate_on_failure` | `True` | Whether to truncate the matched include syntax on failure. False value for both allow_local and allow_remote is treated as a failure.
`recurs_local` | `True` | Whether the inclusions are recursive on local files. Options are: `True`, `False` and `None`. `None` is a neutral value with negative default and overridable with recurs_state (e.g `{!+file!}`). `False` will permanently prevent recursion i.e you won't be able to override it with the recurs_state. `True` value is overridable with recurs_state (e.g `{!-file!}`).
`recurs_remote` | `False` | Whether the inclusions are recursive on remote files. Options are: `True`, `False` and `None`. `None` is a neutral value with negative default and overridable with recurs_state (e.g `{!+file!}`). `False` will permanently prevent recursion i.e you won't be able to override it with the recurs_state. `True` value is overridable with recurs_state (e.g `{!-file!}`).
`syntax_left` | `\{!` | The left boundary of the syntax. (Used in regex, thus escaped `{`).
`syntax_right` | `!\}` | The right boundary of the syntax. (Used in regex, thus escaped `}`).
`syntax_delim` | `\\|` | The delimiter that separates encoding from path_or_url. (Used in regex, thus escaped `\|`).
`syntax_recurs_on` | `+` | The character to specify recurs_state on. (Used in regex).
`syntax_recurs_off` | `-` | The character to specify recurs_state off. (Used in regex).
`syntax_apply_indent`| `\>`| The character which stands for applying indentation found before the include for the lines included from the files.
`content_cache_local` | `True` | Whether to cache content for local files.
`content_cache_remote` | `True` | Whether to cache content for remote files.
`content_cache_clean_local` | `False` | Whether to clean content cache for local files after processing all the includes
`content_cache_clean_remote` | `False` | Whether to clean content cache for remote files after processing all the includes
`allow_circular_inclusion` | `False` | Whether to allow circular inclusion. If allowed, the affected files will be included in non-recursive mode, otherwise it will raise an exception.
`line_slice_separator` | `['','']` | A list of lines that will be used to separate parts specified by line slice syntax: 1-2,3-4,5 etc.
`recursive_relative_path` | `False` | Whether include paths inside recursive files should be relative to the parent file path
## Example with configuration
```python
configs = {
'mdx_include': {
'base_path': 'mdx_include/test/',
'encoding': 'utf-8',
'allow_local': True,
'allow_remote': True,
'truncate_on_failure': False,
'recurs_local': None,
'recurs_remote': False,
'syntax_left': r'\{!',
'syntax_right': r'!\}',
'syntax_delim': r'\|',
'syntax_recurs_on': '+',
'syntax_recurs_off': '-',
'syntax_apply_indent': r'\>',
},
}
text = r"""
some text {! some_file !} some more text {! some_more_file | utf-8 !}
Escaping will give you the exact literal \{! some_file !}
If you escape, then the backslash will be removed.
If you want the backslash too, then provide two more: \\\{! some_file !}
"""
md = markdown.Markdown(extensions=['mdx_include'], extension_configs=configs)
html = md.convert(text)
print(html)
```
# File slicing
You can include part of the file from certain line/column number to certain line/column number.
The general file slice syntax is: `[ln:l.c-l.c,l.c-l.c,...]`, where l is the line number and c is the column number. All indexes are inclusive.
**Examples:**
%package -n python3-mdx-include
Summary: Python Markdown extension to include local or remote files
Provides: python-mdx-include
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-mdx-include
`base_path` | `.` | The base path from which relative paths are normalized.
`encoding` | `utf-8` | The file encoding.
`allow_local` | `True` | Whether to allow including local files.
`allow_remote` | `True` | Whether to allow including remote files.
`truncate_on_failure` | `True` | Whether to truncate the matched include syntax on failure. False value for both allow_local and allow_remote is treated as a failure.
`recurs_local` | `True` | Whether the inclusions are recursive on local files. Options are: `True`, `False` and `None`. `None` is a neutral value with negative default and overridable with recurs_state (e.g `{!+file!}`). `False` will permanently prevent recursion i.e you won't be able to override it with the recurs_state. `True` value is overridable with recurs_state (e.g `{!-file!}`).
`recurs_remote` | `False` | Whether the inclusions are recursive on remote files. Options are: `True`, `False` and `None`. `None` is a neutral value with negative default and overridable with recurs_state (e.g `{!+file!}`). `False` will permanently prevent recursion i.e you won't be able to override it with the recurs_state. `True` value is overridable with recurs_state (e.g `{!-file!}`).
`syntax_left` | `\{!` | The left boundary of the syntax. (Used in regex, thus escaped `{`).
`syntax_right` | `!\}` | The right boundary of the syntax. (Used in regex, thus escaped `}`).
`syntax_delim` | `\\|` | The delimiter that separates encoding from path_or_url. (Used in regex, thus escaped `\|`).
`syntax_recurs_on` | `+` | The character to specify recurs_state on. (Used in regex).
`syntax_recurs_off` | `-` | The character to specify recurs_state off. (Used in regex).
`syntax_apply_indent`| `\>`| The character which stands for applying indentation found before the include for the lines included from the files.
`content_cache_local` | `True` | Whether to cache content for local files.
`content_cache_remote` | `True` | Whether to cache content for remote files.
`content_cache_clean_local` | `False` | Whether to clean content cache for local files after processing all the includes
`content_cache_clean_remote` | `False` | Whether to clean content cache for remote files after processing all the includes
`allow_circular_inclusion` | `False` | Whether to allow circular inclusion. If allowed, the affected files will be included in non-recursive mode, otherwise it will raise an exception.
`line_slice_separator` | `['','']` | A list of lines that will be used to separate parts specified by line slice syntax: 1-2,3-4,5 etc.
`recursive_relative_path` | `False` | Whether include paths inside recursive files should be relative to the parent file path
## Example with configuration
```python
configs = {
'mdx_include': {
'base_path': 'mdx_include/test/',
'encoding': 'utf-8',
'allow_local': True,
'allow_remote': True,
'truncate_on_failure': False,
'recurs_local': None,
'recurs_remote': False,
'syntax_left': r'\{!',
'syntax_right': r'!\}',
'syntax_delim': r'\|',
'syntax_recurs_on': '+',
'syntax_recurs_off': '-',
'syntax_apply_indent': r'\>',
},
}
text = r"""
some text {! some_file !} some more text {! some_more_file | utf-8 !}
Escaping will give you the exact literal \{! some_file !}
If you escape, then the backslash will be removed.
If you want the backslash too, then provide two more: \\\{! some_file !}
"""
md = markdown.Markdown(extensions=['mdx_include'], extension_configs=configs)
html = md.convert(text)
print(html)
```
# File slicing
You can include part of the file from certain line/column number to certain line/column number.
The general file slice syntax is: `[ln:l.c-l.c,l.c-l.c,...]`, where l is the line number and c is the column number. All indexes are inclusive.
**Examples:**
%package help
Summary: Development documents and examples for mdx-include
Provides: python3-mdx-include-doc
%description help
`base_path` | `.` | The base path from which relative paths are normalized.
`encoding` | `utf-8` | The file encoding.
`allow_local` | `True` | Whether to allow including local files.
`allow_remote` | `True` | Whether to allow including remote files.
`truncate_on_failure` | `True` | Whether to truncate the matched include syntax on failure. False value for both allow_local and allow_remote is treated as a failure.
`recurs_local` | `True` | Whether the inclusions are recursive on local files. Options are: `True`, `False` and `None`. `None` is a neutral value with negative default and overridable with recurs_state (e.g `{!+file!}`). `False` will permanently prevent recursion i.e you won't be able to override it with the recurs_state. `True` value is overridable with recurs_state (e.g `{!-file!}`).
`recurs_remote` | `False` | Whether the inclusions are recursive on remote files. Options are: `True`, `False` and `None`. `None` is a neutral value with negative default and overridable with recurs_state (e.g `{!+file!}`). `False` will permanently prevent recursion i.e you won't be able to override it with the recurs_state. `True` value is overridable with recurs_state (e.g `{!-file!}`).
`syntax_left` | `\{!` | The left boundary of the syntax. (Used in regex, thus escaped `{`).
`syntax_right` | `!\}` | The right boundary of the syntax. (Used in regex, thus escaped `}`).
`syntax_delim` | `\\|` | The delimiter that separates encoding from path_or_url. (Used in regex, thus escaped `\|`).
`syntax_recurs_on` | `+` | The character to specify recurs_state on. (Used in regex).
`syntax_recurs_off` | `-` | The character to specify recurs_state off. (Used in regex).
`syntax_apply_indent`| `\>`| The character which stands for applying indentation found before the include for the lines included from the files.
`content_cache_local` | `True` | Whether to cache content for local files.
`content_cache_remote` | `True` | Whether to cache content for remote files.
`content_cache_clean_local` | `False` | Whether to clean content cache for local files after processing all the includes
`content_cache_clean_remote` | `False` | Whether to clean content cache for remote files after processing all the includes
`allow_circular_inclusion` | `False` | Whether to allow circular inclusion. If allowed, the affected files will be included in non-recursive mode, otherwise it will raise an exception.
`line_slice_separator` | `['','']` | A list of lines that will be used to separate parts specified by line slice syntax: 1-2,3-4,5 etc.
`recursive_relative_path` | `False` | Whether include paths inside recursive files should be relative to the parent file path
## Example with configuration
```python
configs = {
'mdx_include': {
'base_path': 'mdx_include/test/',
'encoding': 'utf-8',
'allow_local': True,
'allow_remote': True,
'truncate_on_failure': False,
'recurs_local': None,
'recurs_remote': False,
'syntax_left': r'\{!',
'syntax_right': r'!\}',
'syntax_delim': r'\|',
'syntax_recurs_on': '+',
'syntax_recurs_off': '-',
'syntax_apply_indent': r'\>',
},
}
text = r"""
some text {! some_file !} some more text {! some_more_file | utf-8 !}
Escaping will give you the exact literal \{! some_file !}
If you escape, then the backslash will be removed.
If you want the backslash too, then provide two more: \\\{! some_file !}
"""
md = markdown.Markdown(extensions=['mdx_include'], extension_configs=configs)
html = md.convert(text)
print(html)
```
# File slicing
You can include part of the file from certain line/column number to certain line/column number.
The general file slice syntax is: `[ln:l.c-l.c,l.c-l.c,...]`, where l is the line number and c is the column number. All indexes are inclusive.
**Examples:**
%prep
%autosetup -n mdx-include-1.4.2
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-mdx-include -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 1.4.2-1
- Package Spec generated
|