Plugin for CKEditor split to multiple js files - ckeditor

I am creating a new CK Editor plugin, and want to split the javascript code to more than one .js file
Currently I do not see a way to load my second .js file.
My structure:
plugin.js --> this is the main file containing the plugin structure/code
manip.js --> contains text manipulation functions, that are called by the plugin (800+ lines)
Is this possible? What is your recommendation - put all code into plugin.js or would you also split code to two files?

Splitting your code makes sense only if it isn't required from the very beginning. E.g. CKEditor loads dialogs' code on demand and the same happens with paste from word filter. These files very often are big (>1k LOC) and it's not critical to load them at the beginning.
If you want to load your file on demand check this part of pastefromword plugin: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/pastefromword/plugin.js#L95-L108
Here's the documentation: CKEDITOR.scriptLoader, CKEDITOR.getUrl.

Related

Migrate from bookdown to pure Pandoc: split the HTML output in one page per section

I have a book project in RMarkdown, but since I do not use Knitr or other RMarkdown specific features I am considering switching to pure Pandoc to remove the R burden from the dependencies.
For what concerns PDF and ePub output it seems all straightforward to me, but I have some troubles with the HTML output. In fact Pandoc generates a single HTML file with the entire book.
With Bookdown I used the gitbook HTML output which generates a page for each section and each page have the complete TOC on the left sidebar and its footnotes and partial bibliography on the bottom.
To achieve this I thought to write a md file for each section and convert them one by one with Pandoc (for the HTML output, and merge them to one unique file for converting to PDF and ePub), but in this way I cannot have references across sections, have a full bibliography at the end and also easily create a TOC.
So my question is if there is an easy way (e.g. a Pandoc filter or a script) to generate an HTML book (similar to gitbook in behavior, the style doesn't matter) without installing R and Bookdown?
Pandoc follows the philosophy of only writing files that have explicitly be specified on the command line. This is why no such feature is not built in.
It would be possible to do what you want with the help of a custom writer. The basic would be doable in a few lines of Lua code, but it's likely that you'd have to implement all bookdown features yourself.
The best (IMHO) alternative is to use Quarto, a standalone tool built on top of pandoc, created in part by the authors of bookdown. That way you can remove R from your dependencies but retain the features of bookdown -- and more.

D3 blocks: How to change order of files

I am using blocks to create and share my d3 snippets. When I have more than one file, for example this block, the data.tsv the file appears second. It's a huge file, so if someone wants to see the javascript code he has to scroll all the way down.
My question is, is there any way to change the order in which files are displayed in blocks? It seems to not follow Github gist's alphabetical order as index.html appears before data.tsv. Or do I have to create just one index.html file and put all my javascript and CSS code in it? like most of the blocks do.
index.html is always listed first, then the other files are listed alphabetically. Something I'll prepend an _ to interesting files, like _script.js to force them to show up first.

How do I apply nonintrusive design changes to Magento 1.X

I am having a little trouble here with a Magento installation here, which I "inherited" from a company who did some pretty heavy customizations to the theme.
I tried to rationalize most of the changes and was pretty successful with it. The problem is now, that I have some template files which have only one line of change.
In this specific case for example it would be a <button> that is now an <a> link. This is pretty much only one line in a 300 line template file.
Similar problems occurred with layout files of extensions. They have ONE dirty line in there, which for example resets the whole layout.
I then need to overwrite the complete layout XML file in the design, just to make a little change in one line, because those layout files are either overwritten or not. There is not merging process involved.
I took a look into the designer's documentation of Magento, but could not find anything useful.
I know that I could do some specific layout changes in the "local.xml" in my design, but those are more or less "contextless", which is not that great if those changes do belong to a certain extension.
Do you know a way to apply little template changes like mentioned in the first half or partially layout file overrides?
My main goal is to keep the files automatically updatable, which pretty much means: Download the module, replace files, done.
No manual updates to any overwritten files.
Use the "inherited" template as default template in a new package and add a child template with your changes. Example:
app/design/frontend/[package_name]/default - here will be the "inherited" old template
app/design/frontend/[package_name]/[your_child_template] - here will be your new child template
skin/design/frontend/[package_name]/default - here will be the "inherited" old template
skin/design/frontend/[package_name]/[your_child_template] - here will be your new child template
Partially layout file overwrides can be done for all pages or extensions in one local.xml file. Example:
app/design/frontend/[package_name]/[your_child_template]/layout/local.xml
If you want to add changes for a certain extension just add the extension xml file in your template folder. It will be the last one rendered and will wthe original. Example for the checkout cart page:
app/design/frontend/[package_name]/[your_child_template]/template/checkout/cart.phtml
For a small change inside a phtml file like your button example you will have to overwrite the whole phtml file. There is no way in Magneto to overwrite just a part of a phtml file.

How to import multiple XML files into one inDesign document without copy/paste?

I use InDesign CS6, and I have several XML files with the same structure. Only the data are
different.
I created an Indesign layout with some tagged placeholder frames on merge mode, for automated layout.
Today for each XML file I have to create a new InDesign document to import
the XML. Everything works fine. Then in order to have all Indesign
layouts one after the other into a single Indesign layout, I have
to use the copy/paste function.
I mean for example, copy the contents of all documents to the first one. Or add pages of other documents to the first one, then delete spaces between each page.
So my question is the following:
How to repeat this process without copy/paste function, knowing that the
number of XML files could be unknown.
Thank you very much for your answer.

batch html file editing

I have a collection of one thousand HTML files and need to somewhat trim them. I need to delete all the tags inside <body></body> area of those except for one, <div.pg>, to make them clean to be printed. the excess are navigation links which make the prints messy and make the pages occupy more paper. the contents are not the same so I can't find and replace the code excerpt but the tags are the same foe example there are 3 <table> tags to be deleted each with specific class. manipulate specific tags inside batch HTML files?
Any batch processing technique or software to do this job?
What an easy solution on windows?
I would use an xslt transform on each html page you have. Batch is not the tool to manipulate html files. You can use batch as a "manager" to pass the required file to the xsl transform. Also windows have a rudimentary msxml utility which you can download and install to your machine : http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21714
That's how I would do it. I am sure there are more options.
If it is XHTML you could use XSLT to transform your HTML to "another" format. Look for example here: http://www.w3schools.com/xsl/ or here: http://help.hannonhill.com/discussions/how-do-i/269-strip-specific-html-tag-in-xslt

Resources