%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 * Tue Apr 25 2023 Python_Bot - 1.4.2-1 - Package Spec generated