dischtml

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2021 License: BSD-3-Clause Imports: 12 Imported by: 5

README

Convert Discord channel archives to HTML format

Currently uses Arikawa types, will switch to ndarchive as soon as that's actually finished

Usage

Construct a new Converter, then call the ConvertHTML method.
To generate a complete page, call the Wrap function with the output from ConvertHTML.

The command is very much work-in-progress and uses an older version of darchive with hardcoded guild info.
It's not ready for production.

License

Copyright (c) 2021, Starshine System
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Documentation

Overview

Package dischtml contains functions to convert Discord messages to pretty HTML.

Index

Constants

This section is empty.

Variables

CSS contains the CSS used to make the pages actually look good.

View Source
var HTMLPage string

HTMLPage contains the HTML that converted messages should be wrapped around for stand-alone viewing.

View Source
var HighlightCSS string

HighlightCSS contains the CSS used to make highlight.js look good.

View Source
var HighlightJS string

HighlightJS is the highlight.js code.

Functions

func Wrap

func Wrap(guild discord.Guild, channel discord.Channel, s template.HTML, msgCount int) (string, error)

Wrap wraps the given string into a complete HTML page. For more control over this, use the exported HTMLPage and CSS variables.

Types

type Converter

type Converter struct {
	Guild    discord.Guild
	Channels []discord.Channel
	Roles    []discord.Role
	Users    []discord.User
	Members  []discord.Member
	// contains filtered or unexported fields
}

Converter is a struct holding all necessary info for converting messages. It is not safe for concurrent use.

func (*Converter) ConvertHTML

func (c *Converter) ConvertHTML(msg []discord.Message) (template.HTML, error)

ConvertHTML converts messages to HTML.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL