joa-quim / GMTjl_doc

Test place to a new GMT.jl documentation site
MIT License
0 stars 0 forks source link

Ocasional reflink failure #8

Open joa-quim opened 2 years ago

joa-quim commented 2 years ago

Continuing the reflink issue here. Made the change you suggested \newcommand{\myreflink}[1]{reflink:#1} but it still errors the same. To make it happens change the coast.md line 26 to

Select map projection. More at \myreflink{proj}

The proj target is located at

https://github.com/joa-quim/GMTjl_doc/blob/master/documentation/common_opts.md#L332

→ evaluating code [example_figure] in (examples\misc\gadm.md)
┌ Franklin Warning: in <coast.md>
│ Encountered an issue processing 'coast.md' in jl_doc\documentation.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ Franklin.LxObjError("Command/Environment '\\myreflink' expects 1 argument(s) and there\nshould be no space(s) between the command name and the first brace:\n\\com{arg1}... or \\begin{env}{arg1}...\n")
└
ERROR: Franklin.LxObjError("Command/Environment '\\myreflink' expects 1 argument(s) and there\nshould be no space(s) between the command name and the first brace:\n\\com{arg1}... or \\begin{env}{arg1}...\n")
Stacktrace:
  [1] find_opts_braces(τ::Franklin.Token, narg::Int64, braces::Vector{Franklin.OCBlock}, name::SubString{String})
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\parser\latex\blocks.jl:196
  [2] find_lxcoms(tokens::Vector{Franklin.Token}, lxdefs::Vector{Franklin.LxDef}, braces::Vector{Franklin.OCBlock}, offset::Int64; inmath::Bool)
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\parser\latex\blocks.jl:291
  [3] find_lxcoms (repeats 2 times)
    @ C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\parser\latex\blocks.jl:252 [inlined]
  [4] convert_md(mds::String, pre_lxdefs::Vector{Franklin.LxDef}; isrecursive::Bool, isinternal::Bool, isconfig::Bool, has_mddefs::Bool, pagevar::Bool, nostripp::Bool)
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\converter\markdown\md.jl:119
  [5] convert_md (repeats 2 times)
    @ C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\converter\markdown\md.jl:34 [inlined]
  [6] convert_and_write(root::String, file::String, head::String, pgfoot::String, foot::String, output_path::String)
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\manager\write_page.jl:175
  [7] process_file_err(case::Symbol, fpair::Pair{String, String}, head::String, pgfoot::String, foot::String, t::Float64)
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\manager\file_utils.jl:153
  [8] process_file(::Symbol, ::Pair{String, String}, ::String, ::Vararg{Any})
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\manager\file_utils.jl:104
  [9] fd_fullpass(watched_files::NamedTuple{(:other, :infra, :md, :html, :literate), NTuple{5, Dict{Pair{String, String}, Float64}}}, join_to_prepath::String)
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\manager\franklin.jl:260
 [10] serve(; clear::Bool, verb::Bool, port::Int64, single::Bool, prerender::Bool, nomess::Bool, is_final_pass::Bool, no_fail_prerender::Bool, eval_all::Bool, silent::Bool, cleanup::Bool, on_write::Franklin.var"#246#249", log::Bool, host::String, show_warnings::Bool, fail_on_warning::Bool, launch::Bool, no_set_paths::Bool, join_to_prepath::String)
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\manager\franklin.jl:124
 [11] serve()
    @ Franklin C:\Users\joaqu\.julia\packages\Franklin\DUQCH\src\manager\franklin.jl:70
 [12] top-level scope
    @ REPL[4]:1
joa-quim commented 2 years ago

Tons of rebuilds later I found that prefacing the offending (who knows why) reflink command with something wrapped in singe quotes, even a blank, makes the error go away. i.e. this works.

Select map projection. More at ` ` \myreflink{proj}

This begs for the question if the error is not a consequence of some unbalanced single quoted string in some file that has been processed before the coast.md file.

tlienart commented 2 years ago

unfortunately the way Franklin parses stuff now is prone to hard-to-track errors where, indeed, you forgot to close an environment but Franklin doesn't tell you which one. The upcoming release does this better.

Anyway, glad that you found a workaround

joa-quim commented 2 years ago

Sorry to continuing bothering you with this but I have one question about the github action. I have to first merge the PR to trigger the Build-Deploy action. But it should be the other way around. Submitting the PR triggers the build and at the if no errors we merge the PR. How to make it work like that?

tlienart commented 2 years ago

You can do this via netlify: https://franklinjl.org/workflow/deploy/index.html#previewing_pull_requests

Alternatively, you can use the version keyword of optimize, setting it to either dev or previews/$PR where PR is recuperated from the GA env. This will trigger and deploy without affecting the "main" website and be visible at /prepath/dev or /prepath/previews/someid

Note that if the site builds properly locally, you're guaranteed to have a working deploy assuming you set up the prepath and dependencies properly

So that gives you three path:

  1. Independent deployment via netlify that you can use for checking
  2. Semi dependent where you deploy but to a specific folder so that the main website is not affected
  3. Check locally before merging

If you work on the site alone, I'd say just go for 3, if it's collaborative, 1 or 2

joa-quim commented 2 years ago

Ok, thanks. I'll consider those 3 options. Though it's only me working on it so far, I'd like to keep the door open for collaborations.