htdebeer / pandocomatic

Automate the use of pandoc

Home Page:https://heerdebeer.org/Software/markdown/pandocomatic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ruby/3.0.0/psych.rb:456:in `parse': (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 7 column 1 (Psych::SyntaxError)

bcdavasconcelos opened this issue · comments

Hi @htdebeer,

I have been running into this issue over and over again using Pandocomatic via Scrovomatic. I am trying to figure out whats wrong, but I thought I should chime in and see if you had any idea about what could be happening.

Log

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.29 Report @ 2021-02-16 21:05:36 -0300 ===
=== ------------------------------------------------------ ===
 Working directory: /Users/bcdav/Dropbox/Application Support/BBEdit/Pandoc/abntex-o-matic
 Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Tese5.md", output=nil, to=nil, yaml="pandocomatic.yaml", command="pandocomatic", envpath="/Users/bcdav/bin:/Users/bcdav/.rbenv/shims:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/Library/TeX/texbin:/usr/local/bin:/Users/bcdav/miniconda3/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/bcdav/bin:/Users/bcdav/.rbenv/shims:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/Library/TeX/texbin:/usr/local/bin:/Users/bcdav/miniconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.11.4
---pandocomatic: /Users/bcdav/.rbenv/shims/pandocomatic | V: 0.2.7.4
---ruby: /Users/bcdav/.rbenv/shims/ruby | V: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
---rbenv versions:
  system
  2.6.3
* 3.0.0 (set by /Users/bcdav/.rbenv/version)
---rbenv: /usr/local/bin/rbenv
---gem: /Users/bcdav/.rbenv/shims/gem
---python: /Users/bcdav/miniconda3/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/bcdav/.rbenv/shims/pandocomatic -c pandocomatic.yaml --debug Tese5.md 
::: Script does not exist: ''.
::: (4) + converting /Users/bcdav/Dropbox/Application Support/BBEdit/Pandoc/abntex-o-matic/Tese5.md 3 times:
::: (3)   - convert Tese5.md -> Tese5.docx
:: exit status: pid 1983 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /Users/bcdav/.rbenv/shims/pandocomatic -c pandocomatic.yaml --debug Tese5.md !!!


YAML

These are the relevant settings:

settings:
  recursive: true
  follow-symlinks: false
  skip: ['.*', 'pandocomatic.yaml']
  match-files: 'first'
#-----------------------------------------------------------------------------
templates:
#-----------------------------------------------------------------------------
#:::::::::::::::::::::::::::::::::: GENERAL ::::::::::::::::::::::::::::::::::
#-----------------------------------------------------------------------------
  crossref: # note crossref should come before citeproc!
    setup: []
    preprocessors: 
      - preprocessors/fixCrossref.rb #allows to put crossref labels in styled captions
    pandoc:
      verbose: true # verbose by default
      filter: 
        - pandoc-crossref # process crossrefs
    metadata:
      linkReferences: true
    postprocessors: []
    cleanup: []
#-----------------------------------------------------------------------------
  refs:
    pandoc:
      verbose: true # verbose by default
      citeproc: true
      bibliography: ./config/refs/all.json #JSON faster than BIB, symlinked within Pandoc data dir
      csl: ./config/csl/ABNT-FA.csl
      citation-abbreviations: ./config/refs/cite-abbr.json # my journal abbreviations
      reference-links: true
    metadata:
      reference-section-title: Bibliografia
      notes-after-punctuation: false
      link-citations: true 
      csl-hanging-indent: true
#-----------------------------------------------------------------------------
#:::::::::::::::::::::::::::::::::: DOCX :::::::::::::::::::::::::::::::::::::
#-----------------------------------------------------------------------------
  docx:
    pandoc:
      from: markdown
      to: docx
      standalone: true
      lua-filter:
        - ./config/filters/pagebreak.lua # use \newpage{} also for HTML and docx
      filter:
        #- ./config/filters/removeHR #remove horizontal rules
        - ./config/filters/prependAll.rb # prepends institute:, comments: and keywords: metadata into the text
        - ./config/filters/simplifyMetadata.rb #collapse down metadata "author: [name: affiliation:]" to author:
      reference-doc: ./config/templates/abntex-o-matic.docx
#-----------------------------------------------------------------------------
  docx-refs-crossref:
    extends: [docx,refs,crossref]
#-----------------------------------------------------------------------------
#:::::::::::::::::::::::::::::::::: LATEX ::::::::::::::::::::::::::::::::::::
#-----------------------------------------------------------------------------
  abntex-o-matic:
    preprocessors:
      - preprocessors/removeImageDimensions.rb # remove image dimensions
    pandoc:
      from: markdown
      to: latex
      standalone: true
      filter: 
        - ./config/filters/assimilateMetadata.rb # handle academic metadata
      template: ./config/templates/abntex-o-matic.latex
    metadata:
      mathfont: 'Cambria Math'
      mathfontoptions: 'math-style=ISO,bold-style=ISO'
      CJKmainfont: 'Heiti SC'
      nonumberfigures: true # I use Scrivener autonumbering, so disable for LaTeX
    postprocessors: 
      - postprocessors/fixLaTeX.rb
#-----------------------------------------------------------------------------
  abntex-o-matic-refs:
    extends: [abntex-o-matic,refs]
#-----------------------------------------------------------------------------
  abntex-o-matic-refs-crossref:
    extends: [abntex-o-matic,refs,crossref]
    pandoc:
      include-in-header: blank.txt
    metadata:
      nonumberfigures: false
      titleDelim: '&nbsp;—&nbsp;'
      figPrefix: ['Fig.','Figs.']      
#-----------------------------------------------------------------------------
  abntex-o-matic-pdf-refs:
    extends: [abntex-o-matic-refs]
    pandoc:
      to: pdf
      pdf-engine: 'xelatex'
    cleanup: []
#-----------------------------------------------------------------------------
  abntex-o-matic-pdf-refs-crossref:
    extends: [abntex-o-matic-refs-crossref]
    pandoc:
      to: pdf
      pdf-engine: 'xelatex'
    cleanup: []

Input text

And the input, something along these lines...

---
# Importante: arquivos YAML usam espaços em branco para representar a estrutura, então não use tabulações (tab) e lembre-se de deixar as aspas retas ("") e manter os nomes de todos os campos de metadados em caixa baixa.
titulo: 'Titulo qualquer'
subtitulo:
autor: 'Alguem'
orientador: 'Prof. Dr. Alguem'
faculdade: 'Faculdade de Filosofia e Ciências Humanas da Universidade Federal de Minas Gerais'
lugar: 'Belo Horizonte - MG'
ano: '2021'
grau: 'Doutor'
curso: 'Filosofia'
tipodetrabalho: 'Tese'
linhadepesquisa: 'Filosofia Antiga e Medieval'
citecolor: 'RoyalBlue'
linkcolor: 'RoyalBlue'
urlcolor: 'RoyalBlue'
mainfont: 'Minion Pro'
# mainfont: 'Alegreya'
mainfontoptions: 'Numbers=OldStyle,Numbers=Proportional'
# sansfont: 'Alegreya Sans'
# sansfontoptions: 'Numbers=OldStyle,Numbers=Proportional' 
monofont: 'Consolas'
compiled: 16/02/21    
book: true    
top-level-division: chapter    
pandocomatic_:    
  use-template:    
    - docx-refs-crossref    
    - abntex-o-matic-refs-crossref    
    - abntex-o-matic-pdf-refs-crossref     
---


  
---
dedicatoria: |
  Ao verme que primeiro roer a fria carne do meu cadáver.  

---
  
---
agradecimentos: |
  Agradeço a Zeus e ao mundo pela graça.  
---
  
---
epigrafe: |
  And all our yesterdays have lighted fools      
  The way to dusty death.      
---
  
---
advertencia: |
  Este trabalho foi realizado...   
---
  
---
resumo: |
  Texto do resumo  
---
  
---
abstract: |
  The content of the abstract  
---
  
---
abreviacoes: |
  **Aristóteles**  
  APo - *Analytica Posteriora*  
  APr - *Analytica Priora*  
  Ath - *[Αθηναίων Πολιτεία]{lang=grc}  
*  
---


# Meta-abordagens estruturalistas

O empenho em analisar a determinação clara de objetivos acarreta um processo de reformulação e modernização das formas de ação. É importante questionar o quanto a revolução dos costumes estende o alcance e a importância do orçamento setorial. Todavia, a estrutura atual da organização agrega valor ao estabelecimento de alternativas às soluções ortodoxas.   

Percebemos, cada vez mais, que o desafiador cenário globalizado ainda não demonstrou convincentemente que vai participar na mudança das diversas correntes de pensamento. Ainda assim, existem dúvidas a respeito de como o entendimento das metas propostas facilita a criação dos procedimentos normalmente adotados. Gostaria de enfatizar que o novo modelo estrutural aqui preconizado exige a precisão e a definição das direções preferenciais no sentido do progresso.  

É importante questionar o quanto a estrutura atual da organização estimula a padronização das novas proposições. Todas estas questões, devidamente ponderadas, levantam dúvidas sobre se a contínua expansão de nossa atividade prepara-nos para enfrentar situações atípicas decorrentes dos procedimentos normalmente adotados. Podemos já vislumbrar o modo pelo qual o fenômeno da Internet cumpre um papel essencial na formulação das condições inegavelmente apropriadas.  



## Modelo estruturalista

Gostaria de enfatizar que o novo modelo estruturalista aqui preconizado assume importantes posições no estabelecimento do dualismo ontológico das filosofias pré-hegelianas? Deixemos a questão em aberto. Mas, à primeira vista, quiçá pareça que a referência capaz de atualizar o virtual prepara-nos para enfrentar situações atípicas decorrentes do sistema de formação de quadros que corresponde às necessidades lógico-estruturais. O infinito virtual é possível no mundo, mas a relação do sujeito com o objeto(recalcado) obstaculiza a apreciação da importância dos paradigmas filosóficos.   

> §2 [ἔστι δή τι διαφανές. διαφανὲς δὲ λέγω ὃ ἔστι μὲν 418b05 ὁρατόν, οὐ καθ’ αὑτὸ δὲ ὁρατὸν ὡς ἁπλῶς εἰπεῖν, ἀλλὰ δι’ 418b06 ἀλλότριον χρῶμα. τοιοῦτον δέ ἐστιν ἀὴρ καὶ ὕδωρ καὶ πολλὰ 418b07 τῶν στερεῶν· οὐ γὰρ ᾗ ὕδωρ οὐδ’ ᾗ ἀὴρ διαφανές, ἀλλ’ ὅτι 418b08 ἔστι τις φύσις ἐνυπάρχουσα ἡ αὐτὴ ἐν τούτοις ἀμφοτέροις καὶ 418b09 ἐν τῷ ἀϊδίῳ τῷ ἄνω σώματι.]{lang=grc}  
  

Assim mesmo, o desafiador cenário globalizado não oferece uma interessante oportunidade para verificação dos relacionamentos verticais entre as hierarquias conceituais. Se estivesse vivo, Foucault diria que o Übermensch de Nietzsche, ou seja, o Super-Homem, acarreta um processo de reformulação e modernização do processo de comunicação como um todo. Pretendo demonstrar que a expansão dos mercados mundiais se apresenta como experiência metapsicológica, devido à impermeabilização da natureza não-filosófica dos conceitos.   


### Entscholossenheit

Neste sentido, existem duas tendências que coexistem de modo heterogêneo, revelando a intencionalidade do sujeito volitivo representa uma abertura para a melhoria das relações entre o conteúdo proposicional e o figurado. O que temos que ter sempre em mente é que a hegemonia do ambiente político ainda não demonstrou convincentemente como vai participar na mudança do aparelho repressivo, coercitivo, do sistema. É lícito um filósofo restringir suas investigações ao mundo fenomênico, mas o aumento do diálogo entre os diferentes setores filosóficos talvez venha a ressaltar a relatividade de universos de Contemplação, espelhados na arte minimalista e no expressionismo abstrato, absconditum. Este pensamento está vinculado à desconstrução da metafísica, pois o entendimento das metas propostas garante a contribuição de um grupo importante na determinação de todos os recursos funcionais envolvidos. Todas estas questões, devidamente ponderadas, levantam dúvidas sobre se a necessidade de renovação conceitual efetua a conexão habitual da doutrina do esquematismo trancendental aplicada aos dias atuais.   



# Bibliografia {-}

::: {#refs}
:::

Even if you can't really help, I want to thank you for making and keeping Pandocomatic.

Bernardo

The paths in the pandocomatic YAML file needed normalizing. Fixed. Now it works again for docx and latex. Only for PDFs I can't seem to make it work again. There is no error msg, it just hangs in there indefinitively.

Is the error for the PDF the same as for the other two formats? And can you create a minimal example? That is the smallest possible markdown file and template where this issue does occur? That would allow me to reproduce it as well.

Hi. Apologies for the delay.
Not really. It converts without any problems to latex, but invariably gets stuck in the pdf conversion. I am still trying to isolate the problem, but no luck so far.

Maybe the issue is with LaTeX? Instead of directly converting to PDF with pandoc, can you convert it to LaTeX instead and then run xelatex on it manually? Also, you might try a different LaTeX engine, like lualatex, to see if that makes a difference.

I should have mentioned from the start that pandoc is working fine. I can convert from latex to PDF without any problems.

Can you create a smaller example with a pandocomatic template or configuration file that does not contain any references to files on your system? That should allow me to try to reproduce the issue, or, if the issue then disappears, help you pinpointing the issue.

@bcdavasconcelos -- there are two options for automatically getting the PDF, the first is to use Pandoc which is what your template is currently doing. But at least for scrivomatic, you can pass --build and it will run latexmk for you seperately to pandoc (so make sure your template compiles to latex and then get scrivomatic to run pandocomatic). I added that as sometimes I need to run a post-processor on the latex file to fix some issues (which needs to run after pandoc has finished processing), so I specify the post-processor via pandocomatic, then get scrivomatic to run latexmk on the generated latex file. Perhaps that is also more reliable for you?

➜ scrivomatic -h
Scrivomatic V1.0.29
=======================
Scrivomatic is a wrapper around pandocomatic or panzer, that sets up the environment path, enforces UTF8 encoding and other settings so they can be run from any other process that may not do this (e.g. Scrivener).

Usage: scrivomatic [additional options] FILE
    -i, --input FILE                 Input file
    -o, --output [file]              Output file. Optional for pandocomatic.
    -t, --to [format]                Pandoc Format. Optional for pandocomatic.
    -y, --yaml [file]                Specify which YAML file for pandocomatic.
    -c, --command [command]          Tool to use: [pandocomatic] | panzer
    -p, --path [dirpath]             Additional Path to Search for Commands.
    -b, --build                      For LaTeX output, run latexmk
    -B, --buildclean                 For LaTeX output, run latexmk and cleanup
    -d, --dry-run                    Dry run.
    -z, --data-dir [file]            Pandoc data dir.
    -v, --[no-]verbose               Verbose output.
    -l, --[no-]log                   View log in Console.app.
    -h, --help                       Prints this help!

Thanks, @iandol. The odd thing is I am using the command as it appears in the Scrivomatic template. But when I try to build the PDF from Scrivener using Scrivomatic and Pandocomatic, it just lingers there. The same does not happen for latex and the like. Do you have any suggestions as to what I could attempt to pin-point the issue?

@bcdavasconcelos -- so just to be clear, if you run pandocomatic from the command-line it works fine, but if you run the same document and settings from Scrivener it hangs? The only way I can determine what is going on is if the error is output into the log file. In your first post, the error in the log file is that a script file is not found (that is different from the error in your title?), please check your paths to all your filters and pre/postprocessors.

If you can create a minimal test case, with a simplified markdown file, pandocomatic.yaml and only one document template being run it may narrow down the issue. At the moment you are running three templates (use-template: [docx-refs-crossref,abntex-o-matic-refs-crossref,abntex-o-matic-pdf-refs-crossref]) so it is really hard to follow along...

Sorry for taking so long to report back. The problem probably lies within Scrivener and it is connected to the one reported here. Once I had removed the logging, it started working again. Thanks again for the help and the great work on Pandocomatic and Scrivomatic, @htdebeer and @iandol.