~/scripts/web

HackageDB Module Hierarchy

This script will download metadata from HackageDB and use it to generate a webpage containing the full module hierarchy along with links to all info pages and source archives.

markdown2bbcode

Introduction

If you find it tedious to use the full formatting range of BBCode when posting longer posts here on the forum then this is for you. This script contains a Pandoc writer that can be used in your own scripts to convert any format recognized by Pandoc to BBCode. The script itself will compile to an executable that converts Markdown on stdin to BBCode on stdout for simplified forum posting.

This entire post was written in Markdown. You can get it here.

Pandoc Simplified BBCode Writer

The writer is simple and could be optimized. It only supports FluxBB’s (sub?)set of BBCode, so some formatting features are not supported (e.g. subscripts and superscripts).

Features

Emphasized, strongly emphasized, struckout text and inline code (which I have arbitrarily made red for now).

Code blocks:

$ echo foo

Bullet lists:

  • foo
  • bar
  • baz

Numbered lists:

  1. foo
  2. bar
  3. baz

Alphabetic lists:

  1. foo
  2. bar
  3. baz

Quotes:

And also, Allan insulted me

Images:

test

It also supports headers and links as seen above.

markdown2bbcode

The script’s main function will read Markdown from stdin and print BBcode to stdout.

Download

You could also use xacget:

$ xacget markdown2bbcode.hs

Build Dependencies

  • ghc
  • haskell-pandoc
  • upx (optional: for reducing the binary size)

Building

ghc -O2 --make -o markdown2bbcode markdown2bbcode.hs

By default GHC will create a relatively large independent executable. To create a smaller dynamically linked exectuable, use

ghc -dynamic -O2 --make -o markdown2bbcode markdown2bbcode.hs

Be warned though, if you use dynamic linking then you will need to recompile it every time you update one of the dependencies.

To reduce the size further, use upx:

upx --best markdown2bbcode

Usage

Open an editor, write your post in Markdown, save it to input.md, then run

markdown2bbcode < input.md > output.txt

Open output.txt, copy the contents and paste it into the forum text area. Preview it and then submit if everything looks good.

Package

I will package this if people show interest. I need to figure out how to properly package Haskell modules before I do as this should install Text.Pandoc.Writers.BBCode along with the script markdown2bbcode. I’ll try to get to that soon as I have a larger Haskell project that I hope to release in the coming weeks.

Sigo

Sigo retrieves Google search results from Google’s HTTPS API via Privoxy and Tor. It should thus offer both end-to-end encryption (HTTPS) as well as anonymization (Tor) for users who need it, the paranoid, and people who just think that encryption and anonymization should be the default.

At some point I would like to add a simple server to the script to enable viewing in a browser.

Directory Listing

FileSizeLast Modified
bbcode_gradient2.74 KiB2012-03-05 00:37 UTC
chess_imager6.09 KiB2011-04-17 18:03 UTC
markdown2bbcode8.61 MiB2013-09-24 20:11 UTC
markdown2bbcode.hi10.14 KiB2013-09-24 20:11 UTC
markdown2bbcode.hs5.15 KiB2020-06-11 15:59 UTC
markdown2bbcode.o47.91 KiB2013-09-24 20:11 UTC
sigo8.05 KiB2010-07-11 18:59 UTC
Contact
echo xyne.archlinux.org | sed 's/\./@/'
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0