npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docpad-plugin-conflux

v2.0.9

Published

Import Atlassian Confluence spaces into DocPad collections.

Downloads

10

Readme

Atlassian Confluence® Importer Plugin for DocPad

Build Status NPM version Dependency Status devDependency Status peerDependency Status

Import Atlassian Confluence spaces into DocPad collections. Forked from docpad-plugin-tumblr, with modifications and improvements from docpad-plugin-mongodb.

Install

docpad install conflux

Configure

Specify your Confluence site, space, and login credentials

Specify your Confluence site with CONFLUX_SITE (e.g., http://confluence.example.org), your space key with CONFLUX_SPACE_KEY and your login credentials with CONFLUX_USER and CONFLUX_PW in either your .env configuration file like so:

CONFLUX_SITE=http://confluence.example.org
CONFLUX_SPACE_KEY=SPACE1
CONFLUX_USER=user1
CONFLUX_PW=password1

Or in your docpad configuration file:

plugins:
  conflux:
    collections: [
      site: 'http://confluence.example.org'
      spaceKey: 'SPACE1'
      user: 'user1'
      pass: 'password1'
    ]

Customize the output

Here's a more complex example:

plugins:
  conflux:
    collectionDefaults:
      site: 'http://confluence.example.org'
      user: 'user1'
      pass: 'password1'
    collections: [
      {
        spaceKey: 'SPACE1'
        collectionName: 'docs'
        relativeDirPath: 'docs'
        extension: '.html.eco'
        injectDocumentHelper: (document) ->
          document.setMeta(
            layout: 'default'
            tags: (document.get('tags') or [])
          )
      },
      {
        spaceKey: 'SPACE2'
        collectionName: 'blog'
        relativeDirPath: 'posts'
        extension: '.html.eco'
        injectDocumentHelper: (document) ->
          document.setMeta(
            layout: 'default'
            tags: (document.get('tags') or [])
          )
      }
    ]

Configuration details

Each configuration object in collections inherits default values from collectionDefaults and then from the built-in defaults:

collectionDefaults:
  site: process.env.CONFLUX_SITE
  spaceKey: process.env.CONFLUX_SPACE_KEY
  user: process.env.CONFLUX_USER
  pw: process.env.CONFLUX_PW
  collectionName: 'conflux'
  relativeDirPath: null # defaults to collectionName
  extension: '.json'
  injectDocumentHelper: null
  sort: null # http://documentcloud.github.io/backbone/#Collection-comparator
  meta: {}
  • collectionName - the name of the collection and also the default directory for the imported documents. The default is conflux. You can customize this using the relativeDirPath plugin configuration option.

  • extension - Use this option to customize the extension for imported documents. The default is .json.

  • injectDocumentHelper - Use this option to customize the content of the imported documents. Define a function which takes in a single Document Model. You can access the Confluence JSON data from the conflux object. For example:

    docpadConfig = {
      plugins:
        conflux:
          collectionDefaults:
            injectDocumentHelper: (document) ->
              document.setMeta(
                data: adjustSource document.get('conflux').body.view.value
                layout: 'default'
                tags: (document.get('tags') or [])
              )
    }
    adjustSource = (text) ->
      # Images use cachr plugin
      text = text.replace(/src="(\/download\/(attachments|thumbnails)\/.+?)"/g,
        "src=\"<%=@cachr('#{site}$1')%>\"")
      # Inter-page links
      text = text.replace(/href="\/display\/(.+?)\/(.+?)">/g,
        'href="../$1/$2.html">')
      # Code blocks
      text = text.replace(/<script type="syntaxhighlighter".*<!\[CDATA\[/g,
        '<pre><code>')
      text = text.replace(/]]><\/script>/g,
        '</code></pre>')
      # Note icons
      text = text.replace(/<span class="aui-icon icon-hint">Icon/g,
        '<span class="fa fa-info-circle">')
      text = text.replace(/<span class="aui-icon icon-warning">Icon/g,
        '<span class="fa fa-warning">')
      text = text.replace(/<span class="aui-icon icon-sucess">Icon/g,
        '<span class="fa fa-check-circle">')
      text = text.replace(/<span class="aui-icon icon-problem">Icon/g,
        '<span class="fa fa-exclamation-circle">')
      return text

Create a file listing

As imported documents are just like normal documents, you can also list them just as you would other documents. Here is an example of an index.html.eco file that renders the titles and links to all the imported documents:

<h2>Confluence:</h2>
<ul><% for file in @getFilesAtPath('conflux/').toJSON(): %>
	<li>
		<a href="<%= file.url %>"><%= file.title %></a>
	</li>
<% end %></ul>

History

See the change history in the HISTORY.md file.

Contribute

See how you can contribute in the CONTRIBUTING.md file.

License

Licensed under the incredibly permissive MIT license.

© 2015 Phoenix Technical Publications [email protected] (http://phoenixtechpubs.com)