Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add exclusion with regexp? #18

Open
magichowl opened this issue Jul 3, 2014 · 10 comments
Open

add exclusion with regexp? #18

magichowl opened this issue Jul 3, 2014 · 10 comments

Comments

@magichowl
Copy link

Ass the title, I don't want to translate text enclosed with $ or other marks, can I achieve that?

@atykhonov
Copy link
Owner

Please provide more details. Explain exactly steps which you performs and expected result. Why you need that functionality? At least show an example which will allow me better understand your request

@atykhonov
Copy link
Owner

For example,
you want to be able to select all text in the buffer and translate it but wants google-translate to skip parts of text (lines, paragraphs) which enclosed with $

@atykhonov
Copy link
Owner

It is hard for me to understand your needs thus understand required functionality so please provide a little bit more info

@magichowl
Copy link
Author

in latex mode, $ $ is the inline enviroment for math formulas,

* in $*$ may contain math command, say, $\mathbf{a}$ (a), $\alpha$
so I want to skip this part for conversion.

It would be a great convenience because this feature may be needed in many situations.

think about converting html source code, is a beginning tag for an environment, of course we don't want to convert the word "body"

@atykhonov
Copy link
Owner

Thanks for explanation! Now it is much more clearer! I'm not sure for now how exactly that feature could be implemented and integrated into the google-translate but let me think and see what can be done.

@atykhonov
Copy link
Owner

I'll be working on this request as soon as I'll finish #15 and #16

Stay tuned!

@magichowl
Copy link
Author

I'm not familiar with emacs lisp. But I have some idea.
Can it be implemented in the following way?

  1. ch = peek a character in the block of text for conversion,
  2.   if (_ch_ is not in _symbols_)
    
  3.         _str_ += _ch_ 
    
  4.   else 
    
  5.         _strDes_ = translate  _str_
    
  6.         _begin_ = _ch_
            {
    
  7.               _strDes_  += ch
             }
    
  8.          while (peek != begin)
    

@atykhonov
Copy link
Owner

Well, ok, there is no any issue which relates to the algorithm. I'm thinking about the best way to integrate it with google-translate... How the symbols (patterns) will be defined how they will be used etc. Probably it would be good to provide patterns for different modes... May be not. Not sure for now. It needs some time to rethink every aspect of that issue and implement it.

@magichowl
Copy link
Author

Yes, it seems not as easy as I was thought.
there are many patterns I don't want to convert, says $$ ( double dollar environment $$ * $$), [ * ],
\begin{equation} * \end{equation}, and so on

This issue tortured me a lot recently. I would be of great appreciate if you don't mind providing a elementary version for just a single character as the symbols.

@atykhonov
Copy link
Owner

Yes, it seems not as easy as I was thought.

Yes, that's right!

I would be of great appreciate if you don't mind providing a elementary version for just a single character as the symbols.

Ok! You provided me the example (with html, and now other examples) so for now I don't think only about symbols, but about patterns... ... Anyway after this feature will be implemented it would be great to hear from you feedback: is it good for you or not, what exactly is not good and how it could be improved. I don't like implement it just for the sake of itself. It needs to be useful. And as you are expecting that feature it should be useful particularly for you.

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

No branches or pull requests

3 participants