SMW semantic mediawiki #ask code with images - mediawiki

On my wiki bi.maunishshah.com I am using a semantic mediawiki (SMW) to generate tables for each page. I am trying to add images to that table using the #ask query.
I can't seem to resize the images and remove border or anything to those images. Can someone plz help me out.

Assuming part of your query is to return a property like |? Image, then you should consider using |format=template |template=<Results_row> to make use of a template to format your results. In this example, Template:Results_row will control any formatting of the output. For example, [[{{{Image|}}}|options|caption]], per the standard MediaWiki documentation. Of course you would include formatting of all the other properties returned from the query with this template.

Related

How to visually compare two HTML documents?

I am creating a Windows Forms application in order to compare two HTML documents. The first one is retrieved from an external source and contains some structure mistakes. So an algorithm is applied to transform the HTML text into an optimized document and that corresponds to the second document to compare. After that, I want to visually compare the optimized document to the first one and display differences if they are ones.
I created a form with two webview2 controls, where the first one displays the first HTML document. A button is used to transform HTML text and then I would like to know what is the best way to perform a visual comparison. The ideal behavior would be for the second webview2 to display the transformed HTML document and to display differences with a special color for example.
So my first approach is to use this function:
await webview2.CoreWebView2.ExecuteScriptAsync("window.print();");
And perfom a visual comparison of the two screenshots, but I saw that the control of the print popup window is not possible for the moment with the webview2 component.
So do you think there is a better way to accomplish that? Are there any more suitable components or tools to perform this comparison?
Thanks in advance for your help!
In the algorithm, could you add the changed element ids to a list, take that list, and then change the CSS via javascript to highlight the elements in the list.
I'm working on an implementation of it now to see if its viable.

Store arbitrary characters in Semantic MediaWiki

I'm trying to store some text containing html tags into properties, which doesn't work. I created a form for a property with the data type 'text' and a template. Saving the form writes the text into the template, but it can't get displayed, as it contains illegal characters, as I guess.
What I'm trying to do:
I need a form to enter data, containing html tags and special
characters
I'd like to be able to use a query to find all those pages
and show that text using a template I provide to the ask query.
I also tried to use the free text option, but then I can't retrieve it using the ask query.
What would be the best, or at least a working solution to this?
Thanks a lot
storing text with html tags is a bit tricky in SemanticMediaWiki
The reason is the invention of the StripMarkers UNIQ/QINU by the MediaWiki developers.
When parsing the content of page with html tags in it the parsing is sort of "postponed". This technical detail unfortunately makes it hard for extension developers like the SMW developers to solve the issue of handling such content. Also it makes it hard for lay people to follow the discussion on how to solve the problem
Here are two examples of SMW Issues that are marked as "closed". This state of affairs means that by following the configuration hints in the issue your problem should be solved. If not please ask a question on the SMW issue list or even initiate the reopening of the issues.
https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/794
https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/3707
On my wiki we ran into this and resolved it by replacing special characters (we had issues with [ ] =, but the same problem happens with to < > tags too) with alternate unicode characters using the regex extension and a template before setting the property with {{#set:}}. If you want to display the formatted text on the wiki directly then call that parameter separately without replacing the unicode characters.
When you want to display the property, you can then run the reverse replacement with regex before displaying your now intact code (using the template result format to allow you to perform the operation on the output of the query).
To switch to special characters you can create this template
{{#regex:{{#regex:{{#regex:{{#regex:{{#regex:{{{1|}}}|/=/|꞊}}|/\[/|[}}|/\]/|]}}|/>/|≽}}|/</|≼}}
And to switch back you can use this as a template
{{#regex:{{#regex:{{#regex:{{#regex:{{#regex:{{{1|}}}|/꞊/|=}}|/[/|[}}|/]/|]}}|/≽/|>}}|/≼/|<}}

I would like to put more than one website in a single html file

I want to have a couple html websites in a single file. Is this possible?
A website is not just an html "page".
An html file represents the document structure of one page.
Theoretically, saying that you want to represent multiple websites on one html file is like saying that you want to write different documents (your tax files, a book, a ticket for a movie, etc) based on one single template.
While theoretically you can dinamically change the structure of such a document, there is absolutely no point in doing so.
HTML describes the structure of Web pages using markup.
So why would you use a single HTML file to represent different web pages?
Sorry, but you can't. It's not possible. Why would you even do it?
The only thing that comes into my mind is to use <embed>tag, for ex. But it's probably not what you rly want
You must be more specific. The question is vague. In general you can write a code that can change dynamically the website appearance after inputs/actions from the users. For example a JavaScript code that shows/hides something (or the complete website) as long as the mouse is over an element or select/deselect an element. It all can be in a single html document (html5, css3, JavaScript/JQuery).

Is it possible to use the URL to change the CSS being applied?

I have two pages that have related topics, and share a significant amount of data & text between the two pages.
Since these two pages are both linked to from the same location, side by side, I am wondering if I can use an argument with the link to change the CSS being applied and have ALL the data on one page.
The original setup:
domain.com/subdir/one.page.php
domain.com/subdir/two.page.php
Can I use this instead?
domain.com/subdir/full.page.php?one
domain.com/subdir/full.page.php?two
And with that, have the page selectively use the CSS visible attribute to change what is actually displayed on the screen?
No, the CSS cannot be affected by the URL.
Instead, you should use a server-side programming language to only display the appropriate content.
You could use PHP include statements to prevent duplication.

How to display codes on a web page that are stored in a table?

I am doing a little academic project based on online examination with asp.net c#, So there have to display number of question and answer as multiple choice, and I has used a data list view to display questions and answers on page. But the problem is programming codes are displaying like normal text.
My requirement is to display the programs codes by line wise and with coloured keywords & data types etc..
I am using a label tool to display the question and programs that are stored in SQL table with VARCHAR(MAX) data type. If the programs need to be stored in a separate file like XML or any other please give me some idea how to do this?
My page looks likes:
I need to display the question label as:
Any help would be appreciated..
Use SyntaxHighlighter, simple to use also.
If I understand correctly, you're asking how to display some lines of Java code on a web page so that
it looks like properly indented Java code, and doesn't end up in one single long line
it has syntax coloring.
The first part is easily done using a <pre> HTML tag:
<pre>
some lines of Java code
</pre>
The pre HTML tag is used to preserve line breaks and spaces.
For syntax coloring, consider using some JavaScript library like SyntaxHighlighter.