Clone with OuterHTML, reformat and then copy/paste - formatting

So I have a block of content I am cloning with OuterHTML. I would like to know if there's a way I could take that generated clode, clean it and wrap it around a prettify related plugin. Basically, I would like to create a dynamic copy/paste block based on a previously generated HTML.
I have searched everywhere but it seems I am not using the correct search terms or maybe this is not possible?
Thanks for your help

Related

IntelliJ: Search structurally in different projects

Structural search in IntelliJ IDEA is not only powerful, but also not trivial at all to get right. Now when I have created a working template of my own, I might want to use it in multiple projects.
I do not see a way to save globally. Is there anything I can do short of copying the relevant bits from one workspace.xml to another?
Unfortunatelly, it's not supported at the moment, please follow this feature request for updates.

Replace content inte a PDF File

The system I'm working with are receiving PDF documents, inside those documents there are two clickable images. The click events just triggers a http url. The thing is that I need to update those two url:s when I receive the document.
So my question is, is it possible to find the events and change the url and then save the file again? Those two images can be anywhere in the document so I can't look in a specific location.
Edit: I forgot to say that I'm coding in C# so it needs to be a .NET library.
Yes, it's possible.
It's hard to describe the way it can be achieved without knowing how PDFs are constructed (there are a few ways to create the described behavior) and tools you are going to use.
I just want to tell you how I solved this problem, or rather where I found the solution. I used the code in this thread, and it worked like a charm.

Basics of i18next

Im new to i18n and when I typed it in the search bar i18next is in the top results.
I already did my research regarding i18n and how to use it. But it still not clear to me. All I know is that to be able to make your web app available to other language, you need to do a json file that contains the keys and value of your app, and you need to add a script for the i18n.
The rest is still confusing for me. This might sound a stupid question for you, but I just cant understand how it works.
1) Im not sure but based on my observation, you only create a json translation for those that have a value or text that will be shown in the page. Correct? Assuming in the html file, I have a text that is not inside a label or innerhtml, example:
<html>
<body>
**How are we going to translate this text? What key am I going to use?**
</body>
</html>
What do I need to do to translate this text?
2) What should we use as the key? id? class? tag? Because I've seen different examples and it uses different any of these. When is the right time to use these?
3) regarding the key-value pair, what if the pair is coming from the server? what's the syntax for this?
4) When do we need a multi line json?
i18n is a big topic, with a lot of solutions depending on what kind of web app you are trying to internationalize / localize. Unfortunately, i18next's documentation is not very good, and it has next to nothing in way of tutorials.
That said, you might be best off taking a look at the sample app on i18next.js's github repository here: https://github.com/jamuhl/i18next/tree/master/sample/static. It does give some examples of how i18next can be used to replace html text with localized versions of the same. To answer some of your questions:
There are a few ways of doing this. The sample script replaces much of the data by using the jQuery .text call -- something like this: $('#MyHTMLID').text($.t('ns.common:MyLocalizedTextForMyHTMLID'));. Any html inside the id "MyHTMLID" is replaced by the localized data for the key "MyLocalizedTextForMyHTMLID' by the i18next .t call.
A lot of these decisions are just convention. Keep it simple, be consistent.
Normally in a web app the json file is on the server, in a locales subdirectory of the directory where your html resides. Take a look at that i18next example for how it's laid out.
When you're first building your web app, use a multi-line json file to be able to troubleshoot. You can compress it later using something like http://jsonformatter.curiousconcept.com/.
Hope this helps get you started!

What is the best way in rails to build a version of time ago in words with but with different formatting

I need to build a version that can be localized and I need different versions of the text.
Where is the best place to these functions so they can be accessed from my view code?
Where do I find the source for the original code?
Where to put it: ApplicationHelper (app/helpers/application_helper.rb) is probably the best place.
The original code: time_ago_in_words lives in DateHelper ( http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html ), and is based on distance_of_time_in_words. Here's a link to Github: https://github.com/rails/rails/blob/bd8a9701c27b4261e9d8dd84aebbde6ba784ed83/actionpack/lib/action_view/helpers/date_helper.rb#L67
That said... it looks to me as though DateHelper already interfaces with i18n. You should make sure you really need to duplicate this functionality.

Automatic Generation of a JavaHelp Index File

I just started working with the JavaHelp package. I have done some basic modifying of the Table of Contents and such with no problems.
My issue arises in that I have created various new help files (added to an existing project within my dev team) and added various sections to existing help files. I now need to make sure that the index.xml file is updated, useful, and meaningful.
It seems as though this should be generated automatically but I can't seem to find a way to do it, and any solutions I've tried to use don't seem to work.
Is there even a way to do this?
You could always create a CodeSmith template to update this index file.
Thanks
-Blake Niemyjski