get("#537") -- printShortenedReferenceTree get("#534") -- parseQuestionnaire get("#532") -- getBridgeMap get("#533") -- replaceSnippetIDs get("#539") -- tableToLine parseQuestionnaire("#2000291") _, _, masterSourceID, masterDestID = getSnippetTitle(masterBridgeID):find("A master bridge from (#%d+) to (#%d+)") idmap = getBridgeMap(masterBridgeID) -- walk the reference tree refTree = {} printShortenedReferenceTree(masterSourceID, "", {}, refTree) for line in all(refTree) do _, _, id = line:find("^ *(#%d+) %- ") if id then -- ref tree part found. identify type & action dest = idmap[id] if dest ~= nil and dest:find("^#") then -- type: already bridged verdict = 'bridged. '..dest else verdict = verdicts[id] if id == masterSourceID then -- type: is master source (thus already bridged) verdict = 'done (is master source)' end end print(id..": "..(verdict or "no verdict")) if verdict == 'copy verbatim' then -- assume source type is nt -- we interpret 'copy verbatim' as bridge-translate all IDs -- we find in the original snippet (in title or text) sourceID = id sourceTitle = getSnippetTitle(sourceID) sourceText = getSnippet(sourceID) destTitle = replaceSnippetIDs(sourceTitle, idmap) destText = replaceSnippetIDs(sourceText, idmap) if (destTitle..destText):find("