Skip to content

Instantly share code, notes, and snippets.

View welblaud's full-sized avatar
🤔
solving something again

Honza Hejzl welblaud

🤔
solving something again
  • Husinec-Řež (Czech Republic)
View GitHub Profile
@welblaud
welblaud / notes-to-footnotes.js
Last active September 28, 2023 10:05
A script for turning in-text notes into footnotes in InDesign
Application.prototype.main = function(){
if (this.documents.length <= 0) return;
var tg = this.selection[0] || this.activeDocument;
if ('appliedFont' in tg) tg = tg.parent;
if (tg.constructor == TextFrame) { tg = tg.parentStory; }
if (!('findGrep' in tg)) return;
/* Here it is neecessary to choose a pattern for wrapping the note, we are not parsing
here, hence the rough technique! */
var fnPatterns = ["@foot_beg@([\\s\\S]*?)@foot_end@", "@footnote_begin@([\\s\\S]*?)@footnote_end@"];
@welblaud
welblaud / dtp-utils.xqm
Last active October 14, 2022 06:18
A module for preparing TEI Simple XML files stored in eXist-db for latter usage in InDesign
xquery version "3.0";
module namespace dtp-utils = 'http://46.28.111.241:8081/exist/db/apps/karolinum-x/modules/dtp-utils';
import module namespace cust-utils = 'http://46.28.111.241:8081/exist/db/apps/karolinum-x/modules/cust-utils' at 'cust-utils.xqm';
declare namespace tei = 'http://www.tei-c.org/ns/1.0';
(:~ This module is useful for in-memory converting of TEI Simpe XML into XML suitable
: for importing into InDesign. It is not a silver bullet, it was tested and developed
: for a very specific scenario. However, it should be useful for anyone who uses TEI
: Simple XML (possibly with minor modifications of replacing strings and so on) and