-
Notifications
You must be signed in to change notification settings - Fork 67
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
New extension WordHighlighter - for highlighting words. #238
New extension WordHighlighter - for highlighting words. #238
Conversation
} elseif (Minz_Request::isPost()) { | ||
$config = html_entity_decode(Minz_Request::paramString('word-highlighter-conf')); | ||
file_put_contents($configFileWithWords, $config); | ||
file_put_contents(join_path($staticPath, ('config-words.' . $current_user . '.js')), $this->toJSArray($config)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generating 2 files for configuration.
.txt
which represents words to highlight - saved by user (as plaintext, one string per line).js
is based of.txt
which is loaded to page as javascript
Example:
.txt
content (config-words.admin.txt
):-
raspberry pi FreshRSS
-
- and generated
.js
(config-words.admin.js
):-
window.WordHighlighterConf = [ 'raspberry pi', 'FreshRSS', ]; console.log({ wordsLoaded: window.WHConfig })
- (log will be removed later)
-
HIGHLIGHT_OPTIONS.enableLogs && console.log('WordHighlighter: script load...', { words: window.WordHighlighterConf }); | ||
|
||
/* eslint-disable */ | ||
//#region <mark.js v9.0.0> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know how I can assist you. |
@math-GH I would appreciate if you go through PHP code because I'm not familiar with PHP ecosystem (I have used PHP probably 10 years ago). Thank you. Note that I was heavily inspired by extension Custom JS. After update, config section now looks like: ![]() |
…(enable_in_article, enable_logs, case_sensitive, separate_word_search) and refactored & simplified code
also I need help with fixing errors from PHPStan. And I don't know how to trigger automated checks via Github Actions / workflows. |
First-time contributors needs a manual start from an repository admin. I do it for you |
… mixed. And add missing types.
You can run |
The TR and FR translations does not to be supported if the translation is not done. |
unfortunately I don't have proper DEV environment yet. I just edited files on my live running server (RPi5 via SSH)
What is the process with translations? Should I delete non English translations? Or should I somehow (with help of Google Translate / DeepL) translate it to other supported languages? Thank you @math-GH for your help and patience. |
$confJson = json_decode(file_get_contents($configFileJson) ?: '', true, 8, JSON_THROW_ON_ERROR); | ||
if (json_last_error() !== JSON_ERROR_NONE || !is_array($confJson)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe json_last_error() !== JSON_ERROR_NONE
will ever be relevant when you also use JSON_THROW_ON_ERROR
. I believe the idea is to use one or the other, not both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please propose a code change for it as I'm not a PHP dev. I just added that check in order to fix some PHPStan error regarding parsing json.
- I have used ChatGPT to help with those errors
- those errors: https://github.com/FreshRSS/Extensions/pull/238/checks?check_run_id=25301320234

There is no process at all. Minimum requirement is to have the EN (English) translation that is the fallback for all other languages. If you like you could add If you would like to have German, French and Dutch as translation then ping @Alkarex , @Frenzie and me. I would suggest not to use an automatic translation to keep the quality and context. If someone wants to have his/her language in this extension then the source is open to send a PR ;) |
In theory machine translation could be a decent starting point (marked as dirty of course), but in practice it'd probably be unnecessarily annoying to have to double check it against the original. |
Sorry for the delay - I had forgotten about this PR... |
init commit for new extension WordHighlighter - for highlighting words.
discussion, how it started: FreshRSS/FreshRSS#6475