Last active
July 30, 2026 04:13
-
-
Save dohyunkim/93e4feae0501c07c7bb2a3c529f1dd26 to your computer and use it in GitHub Desktop.
get content from tagged pdf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local doit = true | |
| for line in io.lines(arg[1]) do | |
| if doit and line:find"<?MarkedContent " then | |
| local content = line:match">(.-)$" | |
| if content and content ~= "" then | |
| io.write(content) | |
| end | |
| elseif doit and line:find"</?P[%s>]" then | |
| io.write"\n" | |
| elseif line:find"<Lbl " then | |
| doit = false | |
| elseif line:find"</Lbl>" then | |
| doit = true | |
| elseif doit and line:find"<FENote " then | |
| io.write"\\footnote{" | |
| elseif doit and line:find"</FENote>" then | |
| io.write"}" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for line in io.lines(arg[1]) do | |
| if line:find"<?MarkedContent%s" then | |
| local content = line:match">(.-)$" | |
| if content and content ~= "" then | |
| io.write(content) | |
| end | |
| elseif line:find"</?P[%s>]" | |
| or line:find"</?Title[%s>]" | |
| or line:find"</?H%d[%s>]" | |
| or line:find"<FENote[%s]" then | |
| io.write"\n" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment