Skip to content

A Python script to automatically update Publii website databases by correcting diaereses, applying smart (curly) quotes, and refining common word usages. Safely enhances typographic and editorial quality across posts.

License

Notifications You must be signed in to change notification settings

educationfutures/publii-diaeresis-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Diaeresis and smart quotes updater for Publii

This Python script scans your Publii site's SQLite database and updates text inside posts to:

  • Correctly apply diaereses (¨) to appropriate words (e.g., cooperatecoöperate)
  • Optionally replace straight quotes with smart (curly) quotes (e.g., "example"“example”)
  • Correct common informal word usages (e.g., anywaysanyway, gonnagoing to)

It ensures a more precise, formal, and polished English writing style across your site.


Why use it?

Readers deserve beautiful and accurate type. Though the diaeresis (¨) has largely fallen out of everyday use in modern English, it serves an important linguistic purpose: providing clarity in pronunciation by indicating where adjacent vowels should be separated into distinct syllables. Without it, words like “cooperate” or “reenter” may briefly confuse readers, who might misinterpret the structure of the word. Properly applied, the diaeresis preserves the rhythm, flow, and precision of English. “Cooperate” becomes “coöperate” and “reenter” becomes “reënter.” While most publications have abandoned its use, The New Yorker has notably and bravely maintained the tradition, recognizing that careful attention to typography can enhance both the clarity and the beauty of language.

Similarly, replacing straight quotation marks with smart (curly) quotes enhances typographic quality and aligns your site with professional publishing standards.

This script allows you to make these corrections automatically across your Publii site.


How it works

  • Connects directly to your site's db.sqlite file.
  • Scans the posts table, updating the title and text fields.
  • Only words listed in the internal dictionary are replaced — no uncontrolled edits.
  • Optionally replaces straight quotes with properly matched opening/closing smart quotes.
  • Supports dry-run mode to preview changes without modifying your database.
  • Automatically creates a backup (db.sqlite.bak) unless disabled.

Example

Before:

Cooperation and "coordination" are key to reevaluating our plans.

After:

Coöperation and “coördination” are key to reëvaluating our plans.


⚠️ Important warning

Please read carefully before using this tool.

  • Always make your own manual backup of your Publii site's db.sqlite file before running the script — even though the script will automatically create a .bak copy.
  • If used improperly or on the wrong file, the script could unintentionally modify your database.
  • Always run a --dry-run first to preview the changes.
  • Only proceed with full updates once you have verified the changes are safe and appropriate for your site.

Use at your own risk.


Installation and usage

1. Requirements

  • Python 3.8 or newer (comes with SQLite support).

2. Setup

First, make sure to back up your Publii site as changes made are not reversible.

Clone this repository or download the script:

git clone https://github.com/your-username/publii-diaeresis-updater.git
cd publii-diaeresis-updater

3. Configure

Open diaeresis-updater.py and modify this line to point to your database:

sqlite_file = "/path-to-your-Publii-folder/sites/site-name/input/db.sqlite"

4. Run the script

Preview changes without modifying anything:

python3 diaeresis-updater.py --dry-run

Apply changes to your database:

python3 diaeresis-updater.py

Skip the backup (optional, not recommended)

python3 diaeresis-updater.py --no-backup

Adjusting settings (optional)

Inside the script:

apply_smart_quotes = True  # Set to False to disable smart quotes replacement

Example output:

📋 Words that would be changed (dry run):
- [posts][row 21][text]: website ➔ Web site
- [posts][row 33][text]: webpage ➔ Web page, smart quotes applied
- [posts][row 68][text]: website ➔ Web site
- [posts][row 108][text]: Cooperation ➔ Coöperation, Reemphasize ➔ Reëmphasize, smart quotes applied

5. Sync your website

With the changes made in the database, press the "Sync your website" button on Publii to push all changes to your live website.


Important to know

  • This script always makes a backup of your Publii database before running unless --no-backup is specified.
  • This script directly modifies your database upon execution.
  • It only replaces words explicitly defined in its built-in dictionary.

Contributing

Contributions, bug reports, and suggestions are very welcome!

  • Submit an issue to suggest new words or report problems.
  • Open a pull request to contribute improvements or features.

Acknowledgments

Inspired by The New Yorker's dedication to meticulous editorial style and clarity.

Thanks to Publii's developers and the open-source community for accessible, elegant web publishing.

About

A Python script to automatically update Publii website databases by correcting diaereses, applying smart (curly) quotes, and refining common word usages. Safely enhances typographic and editorial quality across posts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages