├── LICENSE ├── incoming └── brief_beispiel.md ├── output └── brief_beispiel.html ├── templates └── template_brief.htm └── windows_script.ps1 /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /incoming/brief_beispiel.md: -------------------------------------------------------------------------------- 1 | --- 2 | #ABSENDER 3 | author: Jan Mahn 4 | street: Karl-Wiechert-Allee 5 | number: 10 6 | company: c't Redaktion 7 | plz: 30625 8 | ort: Hannover 9 | tel: 0511 10 | fax: 0511 11 | mail: jam@ct.de 12 | web: ct.de | github.com/jamct 13 | 14 | #EMPFÄNGER 15 | to_name: Ernst Empfänger 16 | to_street: Wegweisender Weg 10 17 | to_plz: 76543 18 | to_city: Stadtstadt 19 | to_anrede: Sehr geehrter Herr Empfänger, 20 | 21 | #BRIEF 22 | title: Ihre Anfrage 23 | greetings: Mit freundlichem Gruß 24 | 25 | #LAYOUT 26 | justify: true 27 | 28 | ... 29 | 30 | vielen Dank für Ihr Schreiben vom 30.02.2018. Wir haben die Unterlagen geprüft und kommen zu dem Ergebnis, dass wir Ihnen hiermit dieses Antwortschreiben zukommen lassen können. 31 | 32 | Dieser Brief wurde in *Markdown* geschrieben und von pandoc umgewandelt. Alle Metadaten zum Brief stehen oben im YAML-Block. -------------------------------------------------------------------------------- /output/brief_beispiel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ihre Anfrage 7 | 8 | 9 | 387 | 388 | 389 |
390 |
391 |

Jan Mahn

392 |

c’t Redaktion

393 | 394 |

Karl-Wiechert-Allee 10
395 | 30625 Hannover

396 | 397 |

Telefon: 511
398 | E-Mail: jam@ct.de
399 | Website: ct.de | github.com/jamct

400 |
401 | 402 |
403 | 404 |
405 |

Jan Mahn · Karl-Wiechert-Allee 10 · 30625 Hannover

406 | 407 |

Ernst Empfänger
408 | Wegweisender Weg 10
409 | 76543 Stadtstadt

410 |
411 | 412 |
413 | 414 |
415 |

Hannover, 5.3.2018

416 |
417 |

Ihre Anfrage

418 | 419 |

Sehr geehrter Herr Empfänger,

420 | 421 |

vielen Dank für Ihr Schreiben vom 30.02.2018. Wir haben die Unterlagen geprüft und kommen zu dem Ergebnis, dass wir Ihnen hiermit dieses Antwortschreiben zukommen lassen können.

422 |

Dieser Brief wurde in Markdown geschrieben und von pandoc umgewandelt. Alle Metadaten zum Brief stehen oben im YAML-Block.

423 | 424 |
425 |

Mit freundlichem Gruß

426 | 427 |

Jan Mahn

428 |
429 | 430 |
431 | 432 |
433 |
434 |
435 | 436 | 437 | -------------------------------------------------------------------------------- /templates/template_brief.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $title$ 7 | 8 | 9 | 389 | 390 | 391 |
392 |
393 |

$author$

394 |

$company$

395 | 396 |

$street$ $number$
397 | $plz$ $ort$

398 | 399 |

Telefon: $tel$
400 | $if(mobil)$ 401 | Mobil: $mobil$
402 | $endif$ 403 | $if(mail)$ 404 | E-Mail: $mail$
405 | $endif$ 406 | $if(web)$ 407 | Website: $web$

408 | $endif$ 409 | $if(iban)$ 410 |

411 | IBAN: $iban$
412 | BIC: $bic$ 413 |

414 | $endif$ 415 |
416 | 417 |
418 | 419 |
420 |

$author$ · $street$ $number$ · $plz$ $ort$

421 | 422 |

$to_name$
423 | $to_street$
424 | $to_plz$ $to_city$

425 |
426 | 427 |
428 | 429 |
430 |

$ort$, $date$

431 |
432 |

$title$

433 | 434 |

$to_anrede$

435 | 436 | $body$ 437 | 438 |
439 |

$greetings$

440 | 441 |

$author$

442 |
443 | 444 | $if(ps)$ 445 |

$ps$

446 | $endif$ 447 |
448 | 449 | $if(footer)$ 450 |
451 |
452 | $footer$ 453 |
454 | $endif$ 455 |
456 |
457 |
458 | 459 | 460 | -------------------------------------------------------------------------------- /windows_script.ps1: -------------------------------------------------------------------------------- 1 | $watcher = New-Object System.IO.FileSystemWatcher 2 | $watcher.Path = ".\incoming\" 3 | $watcher.Filter = "*.*" 4 | $watcher.IncludeSubdirectories = $true 5 | $watcher.EnableRaisingEvents = $true 6 | 7 | $action = { $path = $Event.SourceEventArgs.FullPath 8 | $changeType = $Event.SourceEventArgs.ChangeType 9 | $date = Get-Date -Format d.M.yyyy 10 | 11 | $dateiname = (Get-Item $path).BaseName 12 | $output = ".\output\"+$dateiname+".html" 13 | 14 | If ( $dateiname.startswith("brief_") ) { 15 | #Add-content "..\log.txt" -value $dateiname 16 | pandoc $path -o $output --template=./templates/template_brief.htm --metadata date=$date 17 | } 18 | } 19 | 20 | Register-ObjectEvent $watcher "Created" -Action $action 21 | Register-ObjectEvent $watcher "Changed" -Action $action 22 | Register-ObjectEvent $watcher "Renamed" -Action $action 23 | while ($true) {sleep 1} 24 | PAUSE 25 | --------------------------------------------------------------------------------