Constants
Module
PDFHighlights.Internal.Constants
— ModuleThis module contains all the constants used in the package, as well as the macro that they were created by.
Constants
PDFHighlights.Internal.Constants.COMMENTS_ARGUMENT
— ConstantCOMMENTS_ARGUMENT = "the comments vector"
A documentation constant for the comments
argument.
PDFHighlights.Internal.Constants.CONCATENATE_BOTH_KEYWORD
— ConstantCONCATENATE_BOTH_KEYWORD = "if `true`, concatenate the highlights (only for PDFs)"
A documentation constant for the concatenate
keyword (for the Both
module).
PDFHighlights.Internal.Constants.CONCATENATE_KEYWORD
— ConstantCONCATENATE_KEYWORD = "if `true`, concatenate the highlights"
A documentation constant for the concatenate
keyword.
PDFHighlights.Internal.Constants.CSV_ARGUMENT
— ConstantCSV_ARGUMENT = "absolute or relative path to the CSV file"
A documentation constant for the csv
argument.
PDFHighlights.Internal.Constants.DIRECTORY_DOES_NOT_EXIST_EXCEPTION
— ConstantDIRECTORY_DOES_NOT_EXIST_EXCEPTION = "the specified directory doesn't exist"
A documentation constant for the DirectoryDoesNotExist
exception.
PDFHighlights.Internal.Constants.DIR_ARGUMENT
— ConstantDIR_ARGUMENT = "a directory with PDF files"
A documentation constant for the dir
argument.
PDFHighlights.Internal.Constants.DOES_NOT_EXIST_EXCEPTION
— ConstantDOES_NOT_EXIST_EXCEPTION = "the specified file or directory doesn't exist"
A documentation constant for the DoesNotExist
exception.
PDFHighlights.Internal.Constants.FILE_DOES_NOT_EXIST_EXCEPTION
— ConstantFILE_DOES_NOT_EXIST_EXCEPTION = "the specified file doesn't exist"
A documentation constant for the FileDoesNotExist
exception.
PDFHighlights.Internal.Constants.HEADER
— ConstantHEADER = "Highlight,Title,Author,Note,Location"
Default (expected) header for CSV files.
PDFHighlights.Internal.Constants.HIGHLIGHTS_ARGUMENT
— ConstantHIGHLIGHTS_ARGUMENT = "the highlights vector"
A documentation constant for the highlights
argument.
PDFHighlights.Internal.Constants.INCORRECT_HEADER_EXCEPTION
— ConstantINCORRECT_HEADER_EXCEPTION = "the specified file has an incorrect header"
A documentation constant for the IncorrectHeader
exception.
PDFHighlights.Internal.Constants.INTEGRITY_CHECK_FAILED_EXCEPTION
— ConstantINTEGRITY_CHECK_FAILED_EXCEPTION = "another exception was thrown while checking the integrity of the table"
A documentation constant for the IntegrityCheckFailed
exception.
PDFHighlights.Internal.Constants.LAST_ELEMENT_IS_NOT_AN_INTEGER_EXCEPTION
— ConstantLAST_ELEMENT_IS_NOT_AN_INTEGER_EXCEPTION = "the last element in the line is not an integer"
A documentation constant for the LastElementIsNotAnInteger
exception.
PDFHighlights.Internal.Constants.NOT_CSV_EXCEPTION
— ConstantNOT_CSV_EXCEPTION = "the specified path does not end in `.csv`"
A documentation constant for the NotCSV
exception.
PDFHighlights.Internal.Constants.NOT_CSV_OR_DIR_EXCEPTION
— ConstantNOT_CSV_OR_DIR_EXCEPTION = "the specified path does not end in `.csv` and is not a directory"
A documentation constant for the NotCSVorDir
exception.
PDFHighlights.Internal.Constants.NOT_CSV_OR_PDF_OR_DIR_EXCEPTION
— ConstantNOT_CSV_OR_PDF_OR_DIR_EXCEPTION = "the specified path does not end in `.csv` or `.pdf` and is not a directory"
A documentation constant for the NotCSVorPDForDir
exception.
PDFHighlights.Internal.Constants.NOT_FIVE_COLUMNS_EXCEPTION
— ConstantNOT_FIVE_COLUMNS_EXCEPTION = "the row does not represent elements for 5 columns"
A documentation constant for the NotFiveColumns
exception.
PDFHighlights.Internal.Constants.NOT_PDF_EXCEPTION
— ConstantNOT_PDF_EXCEPTION = "the specified path does not end in `.pdf`"
A documentation constant for the NotPDF
exception.
PDFHighlights.Internal.Constants.PAGES_ARGUMENT
— ConstantPAGES_ARGUMENT = "the pages vector"
A documentation constant for the pages
argument.
PDFHighlights.Internal.Constants.PDF_ARGUMENT
— ConstantPDF_ARGUMENT = "absolute or relative path to the PDF file"
A documentation constant for the pdf
argument.
PDFHighlights.Internal.Constants.TARGET_CSV_ARGUMENT
— ConstantTARGET_CSV_ARGUMENT = "a CSV file or a directory with PDF files"
A documentation constant for the target
argument that mentions CSV.
PDFHighlights.Internal.Constants.TARGET_PDF_ARGUMENT
— ConstantTARGET_PDF_ARGUMENT = "a PDF file or a directory with PDF files"
A documentation constant for the target
argument that mentions PDF.
Macros
PDFHighlights.Internal.Constants.@constant
— Macro@constant(name::Symbol, docstring::String, value::Union{Expr, String}) -> Expr
Create a constant with a documentation string and export it.
Arguments
name::Symbol
: name of the constantdocstring::String
: documentation stringvalue::Union{Expr, String}
: value of the constant
Returns
Expr
: constant definition
Example
using PDFHighlights
using Suppressor
using SyntaxTree
name = :CONSTANT_NAME
docstring = "Docstring"
value = "Value"
d1 = @capture_out @macroexpand(
PDFHighlights.Internal.Constants.@constant(
CONSTANT_NAME,
"Docstring",
"Value"
)
) |> linefilter! |> dump
macro oof()
return esc(
quote
@doc $(docstring)
const $(name) = $(value)
export $(name)
end
)
end
d2 = @capture_out @macroexpand(@oof) |> linefilter! |> dump
d1 == d2