Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

Testing new prism js code

Last updated on 1 year ago
amigamiaamigamiaAdmin
Posted 1 year ago
<?php

/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHP Fusion Inc
| https://phpfusion...
+--------------------------------------------------------+
| Filename: b_bbcode_include_var.php
| Author: Core Development Team
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or >
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
defined('IN_FUSION') || exit;

$__BBCODE__[] = [
 "description" => $locale["bb_b_description"],
 "value" => "b",
 "bbcode_start" => "[b]",
 "bbcode_end" => "[/b]",
 "usage" => "[b]".$locale["bb_b_usage"]."[/b]",
 "svg" => '<i class="fa fa-bold fa-lg"></i>'
];
D
deadwoodAROS Dev
Posted 1 year ago

AROS ABIv11 20230430-1 changes:

 Functionalities:
 Implemented network driver for certain nVidia chipsets (Neil)
 Synchronize Zune configuration across all builds (deadwood)
 Restore build and functioning on pc-x86_64 AROS (deadwood)
 Make native kernel more reselient in case of early error (deadwood, Kalamatee)
 Added broadcom4400.device network driver (Neil)
 Synchronize on use of ISO-8859-2 for Polish across all builds (deadwood)
 First working version of nvme.device is available (Kalamatee)
 Implemented FORMAT64 and SEEK64 commands in ahci.device (Kalamatee)
 Stabilized handling of WARM reset, implemented missing shutdown handlers (Kalamatee)
 Requesters add scroll bars if too much text is shown (Kalamatee)

 64-bit support:
 Correct size of fpos_t and ino_t C library types (deadwood)
D
deadwoodAROS Dev
Posted 1 year ago
Is there anything special needed to enable the prism js "code"? As you can see above using it default approach still produces wrong output Sad
amigamiaamigamiaAdmin
Posted 1 year ago

deadwood wrote:

@deadwood - Is there anything special needed to enable the prism js "code"? As you can see above using it default approach still produces wrong output Sad


Oh I know. I am still testing things and see where the changes that I apply take effect. Fact is it's the prism plugin. I also tried to search on phpfusion.com but their search isn't working since they merged the co.uk domain with the .com.
amigamiaamigamiaAdmin
Posted 1 year ago

amigamia wrote:

@amigamia -

deadwood wrote:

@deadwood - Is there anything special needed to enable the prism js "code"? As you can see above using it default approach still produces wrong output :(


Oh I know. I am still testing things and see where the changes that I apply take effect. Fact is it's the prism plugin. I also tried to search on phpfusion.com but their search isn't working since they merged the co.uk domain with the .com.


I think I found it but still struggling to find where I can turn it off. I can generate new prismjs and prism.css files from https://prismjs.com/download.html?#themes=prism-coy&languages=markup+css+clike+javascript+c+cpp+kotlin+less+markup-templating+php+php-extras+python+sass+sql+stylus+swift+twig&plugins=line-numbers+treeview

As you can see I was able to adjust the theme within the code block. At least I solved the preview problem where everything was white.

The component responsible for the removal of the white spaces is this: https://prismjs.com/plugins/normalize-whitespace/. However, I completely removed it from the prism .css and .js and it's still not working. Still looking into the files to see where I can add
no-whitespace-normalization
amigamiaamigamiaAdmin
Posted 1 year ago
) 
if (preg_match("//forum//i", FUSION_REQUEST)) {
 if ($tid) {
 $result = dbquery("SELECT p.post_id, t.thread_id
 FROM ".DB_FORUM_POSTS." p
 INNER JOIN ".DB_FORUM_THREADS." t ON t.thread_id = p.thread_id
 WHERE p.thread_id=:tid AND p.post_id=:pid AND post_hidden='0'
amigamiaamigamiaAdmin
Posted 1 year ago

[i]if (preg_match("//forum//i", FUSION_REQUEST)) {
 if ($tid) {
 $result = dbquery("SELECT p.post_id, t.thread_id
 FROM ".DB_FORUM_POSTS." p
 INNER JOIN ".DB_FORUM_THREADS." t ON t.thread_id = p.thread_id
 WHERE p.thread_id=:tid AND p.post_id=:pid AND post_hidden='0'[/i]
M
magoriumSoftware Dev
Posted 1 year ago
@amigamia:
Perhaps I am daft but that plugin you mentioned (prism) isn't it the issue that prism /expects/ code tagged text to be formatted /any which way possible/ ? (I was unable to locate support in prism for not applying any formatting (or instruct it to simple leave it as plain ascii)).

afaik that is the issue (from deadwood) to begin with: being able to post some text that is left alone by any forum software/plugin and/or any form of formatting. Instead the forum software tries to interpret it (wrongful) which result in these (excuse me taking a pun) hilarious results.

As you mentioned at least there is some improvement (no cutoffs and not completely white anymore in preview mode :thumbsup: ).
Edited by magorium on 02-09-2023 18:35, 1 year ago
amigamiaamigamiaAdmin
Posted 1 year ago
@magorium,

I never said that prismjs was the actual issue but that prismjs plugin was in question and not TinyMCE as deadwood and I initially thought it was. Prismjs is the plugin used for the code tag inside the forums text editor (which is not TinyMCE). I am still understanding how it is implemented and what function is responsible for removing the white spaces in the indentation for ths code.

All I know is that on this page you can generate a new prism.js and a new prism.css with supported languages and extra features: https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript

One of the extra features that seems to be responsible for the normalization of the white spaces is: https://prismjs.com/plugins/normalize-whitespace/

However, how the plugin is disabled is not clear from the php code on the CMS. What you see below is the class which is supposed to be added but I am not sure where (which file) exactly. There are 3 more .php files that provide integration of the BB Code Code in the CMS.

The plugin can be disabled for a particular code block by adding the class no-whitespace-normalization to either the <pre> or <code> tag.

I am well aware of the issue and I am doing my best to fix it. So, please have patience and if you know of a way then report back, otherwise hang tight.
Edited by amigamia on 04-09-2023 12:15, 1 year ago
D
deadwoodAROS Dev
Posted 1 year ago
@amigamia

Thanks again for working on this. Just for clarity it is not that I need code tag to work different, but I need "something" that allows the following:

1) Not eating spaces used for indentation
2) Displaying text in fixed-with font
3) Not trying to colour the text

Maybe instead of changing "code" tag, there can be another tag added? Just an idea.

Also a technical question: are spaces present in the data that is in database? In other words, are they removed when inserting to database or when displaying from database?
M
magoriumSoftware Dev
Posted 1 year ago

amigamia wrote:


I am well aware of the issue and I am doing my best to fix it. So, please have patience and if you know of a way then report back, otherwise hang tight.



Sorry if I came across as being impatient (about your progress). It's not that I am but more that I am frustrated about simple base functionality that should simply work out of the box and unable to find a single hint, tip, trick, documentation, bug-report, or thread on such a topic on their whole website (and support links). I have literally wasted hours reading for something that should at least have been mentioned somewhere.

PS: as a new phenomenon, if I preview my post the tags do not get rendered at all (I almost removed the quote tags because of that).
Edited by magorium on 05-09-2023 16:33, 1 year ago
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
Moderator: Administrator
Users who participated in discussion: amigamia, magorium, deadwood
Sign In
Not a member yet? Click here to register.
Forgot Password?
Users Online Now
Guests Online 10
Members Online 0

Total Members: 265
Newest Member: metaneutrons
Member Polls
Should AROSWorld continue with AROS-Exec files (SMF based)?
Yes44 %
44% [12 Votes]
No26 %
26% [7 Votes]
Not sure30 %
30% [8 Votes]