a
    xdc                     @   s\   d dl mZmZ d dlZd dlZddlmZmZ dd Zdd Zdd	d
Z	e
dkrXe	  dS )    )print_functionabsolute_importN   )slugifyDEFAULT_SEPARATORc                    s  t jdd  jdd}|jdddd |jdd	d
d  jdddddd  jdddddd  jdddddd  jdtddd  jdd	ddd  jd d	dd!d  jd"ttd#t d  jd$d%d&d  jd'd(d)  jd*dd+dd,d  jd-d%d.d  | d/d  }|jr.|j	r. 
d0 |jrX fd1d2fd3d4|jD |_|jrpd5|j|_n|j	rtj	 |_|jsd6|_|S )7NzSlug string)descriptionZInputinput_string*zText to slugify)nargshelpz--stdin
store_truezTake the text from STDIN)actionr   z--no-entitiesstore_falseentitiesTz'Do not convert HTML entities to unicode)r   destdefaultr   z--no-decimaldecimalz&Do not convert HTML decimal to unicodez--no-hexadecimalhexadecimalz*Do not convert HTML hexadecimal to unicodez--max-lengthr   z$Output string length, 0 for no limit)typer   r   z--word-boundaryFzJTruncate to complete word even if length ends up shorter than --max_length)r   r   r   z--save-orderzEWhen set and --max_length > 0 return whole words in the initial orderz--separatorz$Separator between words. By default z--stopwords+zWords to discountz--regex-patternz+Python regex pattern for allowed characters)r   z--no-lowercase	lowercasezActivate case sensitivityz--replacementsz9Additional replacement rules e.g. "|->or", "%%->percent".r   z.Input strings and --stdin cannot work togetherc                    s*   d}|| vr  dj|d | |dS )Nz->z7Replacements must be of the form: ORIGINAL{SEP}REPLACED)SEPr   )errorformatsplit)replr   )parser H/var/www/html/Ranjet/env/lib/python3.9/site-packages/slugify/__main__.pysplit_check.   s    zparse_args.<locals>.split_checkc                    s   g | ]} |qS r   r   ).0r   )r   r   r   
<listcomp>3       zparse_args.<locals>.<listcomp>  )argparseArgumentParseradd_argument_groupadd_argumentintstrr   
parse_argsr   stdinr   replacementsjoinsysread)argvZinput_groupargsr   )r   r   r   r+      sl    




r+   c                 C   s4   t | j| j| j| j| j| j| j| j| j	| j
| jdS )N)textr   r   r   
max_lengthword_boundary
save_order	separator	stopwordsr   r-   )dictr   r   r   r   r4   r5   r6   r7   r8   r   r-   )r2   r   r   r   slugify_params@   s    r:   c                 C   sV   | du rt j} t| }t|}zttf i | W n tyP   t d Y n0 dS )z Run this program N)r/   r1   r+   r:   printr   KeyboardInterruptexit)r1   r2   paramsr   r   r   mainP   s    r@   __main__)N)
__future__r   r   r%   r/   r   r   r+   r:   r@   __name__r   r   r   r   <module>   s   8
