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

More supported syntax #3

Open
Juergen-aus-Zuendorf opened this issue Jan 18, 2023 · 7 comments
Open

More supported syntax #3

Juergen-aus-Zuendorf opened this issue Jan 18, 2023 · 7 comments

Comments

@Juergen-aus-Zuendorf
Copy link

Hi,

great plugin !!!

I have tested it today the first time and found some syntax elements that are not supported:

Normal tables:
| //Basismaschine://\\ siehe Spielplatz | wird zu | //Basismaschine://\\ See playground |
--> "Basismaschine" isn't translated

imagecaption plugin::
Hier ist ein Bild mit Unterschrift:\\ <imgcaption image1|Unterschrift zum Bild>{{bild.jpg|}}</imgcaption>
wird zu:
Here is a picture with a signature:\\ <imgcaption image1|Unterschrift zum Bild>{{playground:bild.jpg|}}</imgcaption>
--> The text "Unterschrift zum Bild" isn't translated

Best regards
Juergen

@NetaliDev
Copy link
Owner

I wil try to fix this but it is always difficult to exclude or include specific syntax things from specific plugins.

@NetaliDev
Copy link
Owner

But I know the reason for your table issue:

If you write | //Basismaschine://\\ siehe Spielplatz | it will think that Basismaschine:// is a hyperlink that will be excluded from the translation. But you can write // Basismaschine: // and it will work (it is important that there is whitespace between : and //.

@Juergen-aus-Zuendorf
Copy link
Author

Juergen-aus-Zuendorf commented Feb 3, 2023

Ok, I understand the problem. But why is Basismaschine:// interpreted as Link? In Dokuwiki-Syntax there is nothing defined like that. And on the other hand, when I am in the Dokuwiki editor and want to define text as italic by menu this text is automatically included in slashes – without whitespace.

@NetaliDev
Copy link
Owner

Because you can also paste plain links in your WikiText and I need something to detect them. So I have used the :// because it is included in every link like http://example.com or https://example.com or even ftp://example.com.

@NetaliDev
Copy link
Owner

But you can also write //Basismaschine:// \\ because it only interprets it as a link if there are multiple non-whitespace characters in front of and behind :// and in this case there would be whitespace behind it and so it is not detected as a link by the plugin.

@splitbrain
Copy link

Instead of using regexes or string replacements to exclude parts of the wiki text from translation, the DokuWiki parser should be used. That parser knows what is a link and what isn't. deepl's API supports an XML mode AFAIK. A wiki text could be parsed and rendered to a custom XML representation, sent to DeepL and the resulting XML could be converted back to wiki syntax without any ambiguities.

@NetaliDev
Copy link
Owner

You already suggested that to me, but I didn't find an easy way to convert the output of the parser back into DokuWiki syntax (and I now work in full time and don't really have the time to refactor the whole escaping mechanism).

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

No branches or pull requests

3 participants