Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install scripttranscluder

How to install ScriptTranscluder

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install scripttranscluder
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.2 Available View build log
Windows (64-bit)
0.2 Available View build log
Mac OS X (10.5+)
0.2 Available View build log
Linux (32-bit)
0.2 Available View build log
Linux (64-bit)
0.2 Available View build log
 
Author
License
GPL
Lastest release
version 0.2 on Jan 5th, 2011

This simple script lets people include bits of your content (hosted on whatever server you like) into their own pages. It uses the age-old technique used by ads of issuing writes from a Javascript file.

If you mount this at http://example.com/includer.js then you can use tags like:

<script

System Message: ERROR/3 (<string>, line 12)

Inconsistent literal block quoting.

src="http://example.com/includer.js?url=encoded-url"></script>

<script src="http://example.com/includer.js?url=encoded-url%23fragment"></script>

<script src="http://example.com/includer.js?url=encoded-url&dest=otherId"></script>

These each include the content from the encoded-url. If you give a fragment, it grabs just the bit of identified text. If you don't, it'll take all the text in the <body> of the page.

It will put the output exactly where the <script> tag is in the page. If you want to put it someplace else, &dest=id will put it in the element with the given id. In that case it adds a little onload(-like) handler, and then sets the innerHTML of element with that id. If you can't fetch the url, then it will put a small error message into the page in its place.

By default it restricts urls based on the opt-in wildcards of the allowed_urls setting. You can use allowed_urls = * to allow anything, but this is not recommended. You can also use same_host = true to allow requests to the same host as where the includer is hosted.

To minimize backend traffic, set cache_dir to a location to save the requested pages. All the caching is handled by httplib2.

Example

To run an example, install the package and use paster serve development.ini (development.ini is in the tarball). This will start up a server on http://localhost:8080/ where you can view an example.

News

0.2
  • In some cases extra <body> tags would be included in the transcluded

System Message: WARNING/2 (<string>, line 55)

Bullet list ends without a blank line; unexpected unindent.

content (when that tag should never be present).

0.1

Initial release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.