Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

New grammar #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

New grammar #3

wants to merge 6 commits into from

Conversation

citrux
Copy link
Member

@citrux citrux commented Mar 7, 2017

Не мёржим, пока всё не устроит. Пока набрасываем тесты и приделываем генерацию html

citrux and others added 3 commits March 6, 2017 17:33
- add example text for parsing
- upd parser.py
@FreeCX
Copy link
Member

FreeCX commented Mar 7, 2017

Предлагаю внести вот такие изменения

-command = Group(escape + Word(alphas) + Optional(args))
+command = Group(Combine(escape + Word(alphas)) + Optional(args))
...
-math_command = Group(escape + Word(alphas) + Optional(math_args))
+math_command = Group(Combine(escape + Word(alphas)) + Optional(math_args))

для объединения этого

...
['\\', 'end', '{', 'epigraph', '}']
['\\', 'section', '{', 'Немного арифметики', '}']
...

в это

...
['\\end', '{', 'epigraph', '}']
['\\section', '{', 'Немного арифметики', '}']
...

Или забьём?

@FreeCX
Copy link
Member

FreeCX commented Mar 7, 2017

Думаю в plain_text нужно добавить ещё некоторые символы (буду добавлять по мере тестов):

  • минус, плюс, равно...
  • ...

Строка для теста

test = r'''
...
\subsubsection{Это что у нас такое?}
\begin{enumerate}
    \item Do something
    \item ??????
    \begin{itemize}
        \item 1-2-3
        \item 4+5=9
        \item 7*8>9
    \end{itemize}
    \item PROFIT
\end{enumerate}
...
'''

@citrux
Copy link
Member Author

citrux commented Mar 8, 2017

@FreeCX в plain_text стоит внести минус -- это ведь дефис, а плюсы и равно не используются при наборе обычного текста. Касательно Combine: при обработке удобнее сразу получать имя команды вторым элементом списка.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants