Coder Social home page Coder Social logo

rrthomas / darkglass Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 209 KB

Simple CMS that publishes a directory tree

Home Page: https://rrthomas.github.io/DarkGlass

License: Other

Perl 72.46% Shell 3.90% CSS 1.23% HTML 8.05% Python 13.06% JavaScript 1.30%
cms

darkglass's Introduction

DarkGlass

Reuben Thomas ([email protected])

DarkGlass is a simple content management system that exports a directory tree to the web. It displays different file types appropriately, uses file permissions to determine which files and directories should be exported, has a customizable navigation panel, and uses Markdown for rapid creation of simple web pages from plain text files.

DarkGlass is meant to be simple to use, simple to install and maintain, and its code should be easy to understand. It is released under the GNU General Public License version 3, or (at your option) any later version. There is no warranty.

See https://rrthomas.github.io/DarkGlass for more information.

Source code organization

The files are organised as follows:

cgi-bin
contains the main program DarkGlass.pm, some helper modules in MIME and RRT, and the front-end script and configuration file web.pl.
doc
The documentation.

darkglass's People

Contributors

apt1002 avatar rrthomas avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

apt1002

darkglass's Issues

Make `$url` output page-relative URLs

Currently the URLs are server-relative, which means that a static site (all of whose links will have been rewritten via $url) does not in general work when tested locally. (A workaround is to run a development server.)

Resurrect Atom feed support

This was last working a long time ago. There was a problem because the UIDs for the feed items were generated arbitrarily each time, causing some readers to think that all articles were new each time the feed was generated; hence, should change the UIDs to depend on the article (e.g. generate from filename + timestamp).

install.sh: Install MIME converters

$INSTALL_DATA -D --target-directory "$INSTALL_DIR"/MIME Hulot/MIME/*.*
$INSTALL_DATA -D --target-directory "$INSTALL_DIR"/MIME/converters Hulot/MIME/converters/*

Pretty URLs

Screenshot_20230815-144612

This isn't particularly good advice. There's no need for the Perl script to have a URL. There's a missed opportunity to sanity-check the URL path (e.g. forbid ".." and " "). And there's no need to mess around with URL rewriting.

The Apache directive I'm thinking of is ScriptAliasMatch. https://docstore.mik.ua/orelly/weblinux2/apache/ch16_05.htm

Explain input-to-output mapping

Please add to the docs an example of an input directory tree and the corresponding output tree (or URL space). Things to cover:

  • Files that get converted to HTML
  • Files that have alternative conversions
  • Getting the source for a file
  • index.html
  • style.css

install.sh: Missing `exit 1`s

if [ ! -d "$DOCUMENT_ROOT_DIR" ]; then
    echo "DOCUMENT-ROOT-DIR must be a directory"
    exit 1
fi
if [ ! -d "$INSTALL_DIR" ]; then
    echo "INSTALL-DIR must be a directory"
    exit 1
fi

Resurrect custom DarkGlass converters

Needed e.g. for #20.

This is hard to do before DarkGlass is rewritten in Python, as the code needs to run in DarkGlass context, or the converters need to be supplied with a lot of extra information somehow.

Document static site generation

The docs have been written from the point of view of using DarkGlass as a CGI script. Since it's now possible to use it as a static site generator, there are a few places in the docs where clarification is needed that you are talking about the source files.

In particular, it is confusing to use DocumentRoot to mean the source directory, since that will instead be the build directory.

I don't think it's necessary to change much. Just check every mention of a directory and make the necessary distinction.

Proof-reading

Screenshot_20230815-141256

web.pl.=*.md is garbled.

"macro" link is broken.

I was hoping that this "organisation" page would show me how to structure my source files and how the built files will come out, but it doesn't.

install.sh: Right place?

This file is no longer in the top-level directory

# Check we're being run from the right place
if [ ! -f "About DarkGlass.md" ]; then

Move config to dedicated file

Don't have the program startup in the same file as configuration.

It would also be nice if the config were in a standard format (e.g. .ini), but maybe not immediately, as we'd also like to move the per-site macros to configuration.

One simple way to achieve this would be to move the startup code to the module (i.e. allow it to run as a program), and have that source a config file (given how? probably by environment variable, so it can work from CGI mode too).

New URLs without `?`

Problem: URLs with a ? in them don't work for statically generated sites in general. These are currently used by DarkGlass to specify (for example) the target MIME type to convert the file to. A typical URL is file:///blog/README.md?convert=text/html. Consequently, that functionality doesn't work for static sites.

Tentative idea (tires not kicked)

Redefine the URLs without ?s. Remove the query parameter, and add a path component with a file extension corresponding to the MIME type, e.g. file:///blog/README.md/index.html.

Separate into 3 main parts

  • Converting/generating file types. (A thin layer on top of Hulot.)
  • Rendering HTML pages with macro expansion. (A thin layer on top of Macro.pm.)
  • Serving the resultant file.

Once this is done, it should be possible to start rewriting the parts in Python, for greater sanity.

Only the first two parts are needed for static sites!

Mask out some Hulot converters

As of today, Hulot supports converting e.g. text/json to text/html. DarkGlass naively uses this (and the same for application/javascript) and everything breaks. DarkGlass should not (normally) convert MIME types that are used in their own right.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.