DaveJarvis's recent activity

  1. Comment on What programming/technical projects have you been working on? in ~comp

    DaveJarvis
    (edited )
    Link
    Crafted a lightweight natural language parser to convert straight quotes into curly quotes. Check it out: https://whitemagicsoftware.com/keenquotes/ The implementation performs a multi-stage...

    Crafted a lightweight natural language parser to convert straight quotes into curly quotes. Check it out:

    https://whitemagicsoftware.com/keenquotes/

    The implementation performs a multi-stage traversal through prose to tokenize lexemes (words, numbers, spaces, etc.), emit quotation marks, build an abstract syntax tree, and resolve as many remaining ambiguous single straight quotes as possible. Handles American and British English. The API supports XML/XHTML, in addition to plain text, but that feature isn't exposed via the web site. If you find any incorrectly curled results, let me know.

    I've integrated the API into KeenWrite, my Markdown text editor. Quotation marks can be curled prior to typesetting into a PDF file:

    https://i.ibb.co/dGrQ8d3/curl.png

    Most other algorithms use regular expressions, which can't curl quotes in real-world prose such as Helen's Babies. By using a nested abstract syntax tree, my implementation can disambiguate between straight single quotes and straight apostrophes, much of the time. The tree tracks alternating double and single quotes as well as quotation marks that span multiple paragraphs.

    As a side-note, an upshot to creating the software lead to logging an issue against the wordlists file that ships with most Linux distros with suggestions for hundreds of words missing -ing endings. Many of these -ing words were formed into contractions so that KeenQuotes can distinguish between trailing apostrophes and closing single quotes.

    4 votes
  2. Comment on EchoSVG: Pure Java SVG renderer with level 4 CSS selectors in ~comp

    DaveJarvis
    Link
    EchoSVG is a library for handling Scalable Vector Graphics (SVG) images for various purposes, such as viewing, generation, or manipulation. By leveraging CSS4J, the library supports level 4 CSS...

    EchoSVG is a library for handling Scalable Vector Graphics (SVG) images for various purposes, such as viewing, generation, or manipulation. By leveraging CSS4J, the library supports level 4 CSS selectors and RGBA color values (colors with alpha channel). To my knowledge, there are no other cross-platform, FOSS libraries that can correctly render MermaidJS diagrams outside of a web browser. I've tried Apache Batik, svgSalamander, resvg, rsvg-convert, svglib, CairoSVG, ConTeXt, and QtSVG.

    EchoSVG has released an update to bridge that gap. It's a little rough around the edges, so I figured more attention may help move the project along.

    This is notable because it means there's now a path forward to typeset PDF documents that include Mermaid diagrams.

    2 votes
  3. Comment on What programming/technical projects have you been working on? in ~comp

    DaveJarvis
    Link
    Curling straight quotes. Let me know if you find any phrases that don't curl correctly.

    Curling straight quotes. Let me know if you find any phrases that don't curl correctly.

    1 vote
  4. Comment on KeenWrite 2.8.1 in ~comp

    DaveJarvis
    Link
    Since January, KeenWrite has had the following changes: Embed and render R graphs using the plot() function (see screenshot). Performance improvements when rendering R statements. Retain temporary...

    Since January, KeenWrite has had the following changes:

    • Embed and render R graphs using the plot() function (see screenshot).
    • Performance improvements when rendering R statements.
    • Retain temporary XHTML documents when typesetting Markdown into PDF (useful for debugging).
    • Numerous patches for converting straight quotes to curly quotes.
    • Fixes for evaluating R statements as part of embedded plain text diagrams.
    • Minor improvements to command-line options when typesetting PDF in headless mode.
    • Native file chooser dialog.
    2 votes
  5. Comment on Tildes is awesome in ~talk

    DaveJarvis
    Link Parent
    Updating the hosts file may also work, without needing to install add-ons.

    Updating the hosts file may also work, without needing to install add-ons.

    1 vote
  6. Comment on Abortion bans are going to hit us worse than we think in ~talk

    DaveJarvis
    Link
    http://en.atheismfacts.org/abortion.html

    http://en.atheismfacts.org/abortion.html

    In the book Freakonomics, the authors showed that giving women the ability to choose when to bring a baby into the world results in lower crime rates. The reason is that young adults (in their twenties) in lower socioeconomic classes are more likely to commit crimes. When women of this class have abortions, they reduce the number of potential criminals. Twenty years after the legalization of abortion, crime waves that were predicted never materialized.

    4 votes
  7. Comment on What programming/technical projects have you been working on? in ~comp

    DaveJarvis
    Link
    Finished a long-standing update to my free, open-source, cross-platform, desktop text editor, KeenWrite. Users may now embed chunks of R code and export R plots into PDF files:...

    Finished a long-standing update to my free, open-source, cross-platform, desktop text editor, KeenWrite. Users may now embed chunks of R code and export R plots into PDF files:

    https://user-images.githubusercontent.com/2131950/169212376-48792efd-580c-43e5-9c6f-ebd561058b47.png

    Notice that the number of plotted samples are variable-driven. Change the variable value and the plot updates immediately. Press Ctrl+p and the document is sent to TeX-based typesetting software, ConTeXt, for rendering to PDF.

    Had my eye on R plots for several years. Nice to see it finally materialize.

    3 votes
  8. Comment on Why store code as text files? in ~comp

    DaveJarvis
    Link
    https://www.fastcompany.com/28121/they-write-right-stuff ~ Dec 31 , 1996

    https://www.fastcompany.com/28121/they-write-right-stuff

    The database is the software base. There is the software. And then there are the databases beneath the software, two enormous databases, encyclopedic in their comprehensiveness.

    One is the history of the code itself — with every line annotated, showing every time it was changed, why it was changed, when it was changed, what the purpose of the change was, what specifications documents detail the change. Everything that happens to the program is recorded in its master history. The genealogy of every line of code — the reason it is the way it is — is instantly available to everyone.

    ~ Dec 31 , 1996

    1 vote
  9. Comment on What programming/technical projects have you been working on? in ~comp

    DaveJarvis
    Link
    Converting straight quotes to curly quotes is a prickly problem, sporting many edge cases and grammatically ambiguous real-world scenarios. I developed KeenQuotes loosely based on PHP SmartyPants....

    Converting straight quotes to curly quotes is a prickly problem, sporting many edge cases and grammatically ambiguous real-world scenarios. I developed KeenQuotes loosely based on PHP SmartyPants. After a few failed attempts at using regular expressions, regular grammars, and peg grammars, I crafted a home-grown solution.

    KeenQuotes is used by KeenWrite when typesetting Markdown into PDF files (because the ConTeXt typesetting software, unlike LaTeX, doesn't have a module for quote conversion).

    2 votes
  10. Comment on KeenWrite 2.5.1: Command-line arguments in ~comp

    DaveJarvis
    Link Parent
    Consider adding the request to the issue tracker. Meanwhile: Download and install JDK 17 for MacOS Download KeenWrite's Java Archive Download KeenWrite's start-up script Open a terminal Run: chmod...

    Do you plan on releasing a version for Mac?

    Consider adding the request to the issue tracker. Meanwhile:

    1. Download and install JDK 17 for MacOS
    2. Download KeenWrite's Java Archive
    3. Download KeenWrite's start-up script
    4. Open a terminal
    5. Run: chmod +x keenwrite.sh to make the start-up script executable
    6. Run: ./keenwrite.sh

    Put keenwrite.sh and keenwrite.jar in the same directory. And make sure that Java's bin directory is listed in the PATH environment variable (i.e., java can be run from the terminal).

    5 votes
  11. Comment on KeenWrite 2.5.1: Command-line arguments in ~comp

    DaveJarvis
    (edited )
    Link
    KeenWrite is my desktop text editor that I started developing because I wanted to combine a character sheet and sci-fi story. Moreover, I wanted to reference variables within text-based...

    KeenWrite is my desktop text editor that I started developing because I wanted to combine a character sheet and sci-fi story. Moreover, I wanted to reference variables within text-based diagrams---such as a family tree---so that renaming a character would update every occurrence, including those in diagrams. Additionally, I sought to replace the script-based ecosystem (pandoc, knitr, and my own yaml pre-processor) described in my Typesetting Markdown series.

    Development has included optimizing a Java-based TeX implementation, writing a custom straight-quote to curly-quote algorithm (KeenQuotes), coding a rudimentary fenced markup syntax (e.g., ::: poem), mashing together numerous R scripts, integration with the ConTeXt typesetting software, and more.

    The latest release fills a notable gap: command-line processing. It's still rough around the edges (here be dragons), but these work:

    keenwrite -i $HOME/docs/program/README.md -o README.xhtml
    keenwrite -i $HOME/docs/program/README.md -o README.pdf
    keenwrite -i $HOME/docs/program/README.md -o README.md -v $HOME/variables.yaml
    keenwrite -i $HOME/docs/program/README.Rmd -o README.html -v $HOME/variables.yaml \
      --r-dir=$HOME/docs/r --r-script=$HOME/docs/r/bootstrap.R
    

    The first example produces an HTML file, similar to pandoc's functionality. The second produces a PDF file using a default theme (the default output is lackluster without specifying a theme). The third will interpolate and substitute {{var.name}} references in the source document with values from the YAML file. The last example executes any inline R statements, interpolates variables, and produces an HTML version of the document.

    7 votes
  12. Comment on What programming/technical projects have you been working on? in ~comp

    DaveJarvis
    Link
    KeenWrite is on the cusp of having a command-line interface to enable converting Markdown files to other formats, such as HTML and PDF: ./keenwrite.bin -i filename.md -o filename.pdf -v...

    KeenWrite is on the cusp of having a command-line interface to enable converting Markdown files to other formats, such as HTML and PDF:

    ./keenwrite.bin -i filename.md -o filename.pdf -v variables.yaml
    

    I started developing KeenWrite because there are no integrated text editors that permit embedding interpolated variables into documents using variables defined externally. A while ago I added inline diagrams rendered as SVG using kroki.io, which means diagrams can use variables, too (see screenshots).

    A command-line interface basically replaces the shell scripts described in my Typesetting Markdown series. The shell scripts wrap pandoc, knitr, and my home-grown yaml processor (yamlp). KeenWrite supports R statements and pandoc's annotations (e.g., ::: poem), so the hacky shell scripts can be eliminated.

    7 votes
  13. Comment on JMathTeX in ~comp

    DaveJarvis
    Link
    Ghent University released a Java-based TeX engine under the GPL back in 2007, known as JMathTeX. In 2020, I modernized the build system and introduced significant performance optimizations to...

    Ghent University released a Java-based TeX engine under the GPL back in 2007, known as JMathTeX. In 2020, I modernized the build system and introduced significant performance optimizations to achieve real-time TeX rendering in my plain text editor, KeenWrite.

    JMathTeX was forked into a LaTeX derivative known as JLaTeXMath.

    The original JMathTeX license remains GPL. My fork was given permission to use an MIT license. For any of you who are looking to render basic TeX expressions using Java, my fork may be worth considering.

    3 votes
  14. Comment on What did you do this weekend? in ~talk

    DaveJarvis
    Link Parent
    Thanks! About 5 years, off and on.

    Thanks! About 5 years, off and on.

    2 votes
  15. Comment on What did you do this weekend? in ~talk

    DaveJarvis
    (edited )
    Link
    Added autocorrect behaviour (screenshot) to my plain text editor, KeenWrite. To autocorrect a spelling mistake, Alt+Enter followed by Enter will fix the error by replacing the text with the first...

    Added autocorrect behaviour (screenshot) to my plain text editor, KeenWrite. To autocorrect a spelling mistake, Alt+Enter followed by Enter will fix the error by replacing the text with the first element in the menu. (Hot-key inspired by IntelliJ.)

    Logged an issue against mermaid's SVG generator. The embedded CSS for their SVGs works well in a browser, not so well in every other open-source SVG renderer I tried.

    5 votes