Import Doc

Categories

Component ID

1710296

Component name

Import Doc

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

A very simple module to import HTML sites to Drupal.

Import Doc is originally developed to import zip exports from Confluence Wiki to Drupal. It accepts a .zip file with HTML pages and files.

The HTML pages are imported to Drupal and an XSL template is required to transform the HTML of the pages. Another XSL template is required to extract the title from the HTML of the imported pages.
After the import is succesfully complete, the links in the pages (linking to either other pages or files provided in the import) are adjusted automatically, so link rewriting shouldn't be defined in the content XSL template.

A prefix can be entered when importing. The prefix will be prepended to the paths of the imported pages. The prefix also defines the folder in the public ('public://...') directory where the other (non-HTML) files will be uploaded.

Other options are:

  • the Menu where menu items (for each imported HTML page) will be entered
  • whether you want to create Menu Items (with hashlinks) for h1 and h2 level headings in (big) pages you import
  • content type of the new pages
  • language for the node (not shown on the screenshot)

Example of title XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="html/head/title"/>
</xsl:template>
</xsl:stylesheet>

Example of body XSLT:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:copy-of select="html/body/div[@id='page']/div[@id='main']/div[@id='content']/div[@id='main-content']"/>
  </xsl:template>
</xsl:stylesheet>

Requirements:

  • php5-xsl
  • php5-tidy
  • php zip support

What's to be done yet:
  • make the code more robust
  • ...

Remarks:

  • The created menu-items are always in a flat hierarchy. Currently, you must manually put up a proper hierarchy (if there was one in the imported pages).

This module is developed for Drupal 7. It isn't supposed to work on lower versions.
There is also another module, Import HTML which works for earlier versions of Drupal (however, right now (summer 2012) doesn't have a production release for Drupal 7), and has existed much longer.
Import Doc is not developed to compete with Import HTML. Import Doc is merely a quick simple tool meant for importing Confluence wiki exports to Drupal.