SDF(1)
π SDF(1) β User Contributed Perl Documentation π
okay bestie, welcome to the SDF(1) manual page from the User Contributed Perl Documentation corner. This is sdf, the SDF Conversion Utility, and it's giving βconvert my SDF files into other document formatsβ energy. I'm obsessed. Let's get into it, fr fr. β¨
πΈ NAME πΈ
sdf β SDF Conversion Utility
That's literally the name. It's giving name. Periodt.
π PURPOSE π
sdf converts SDF files to other document formats. That's the purpose. That's the whole assignment. No cap. π
π¦ USAGE π¦
Here's the usage, bestie. Copy it exactly because it's the blueprint:
usage : sdf [+alias] [-h[help]] [-o[out_ext]]
[-l[log_ext]] [-O[out_dir]] [-2 format]
[-D variable,..] [-n split_level]
[-f flag,..] [-I include_path,..]
[-p[prefilter]] [-a parameters] [-P[plang]]
[-N[line_numbers]] [-g[get_report]]
[-r report] [-L locale] [-k look]
[-s style] [-S page_size] [-c config]
[-u uses,..] [-H head_level] [-K head_look]
[-d driver] [-y post_filter]
[-z post_process,..] [-t target]
[-v[verbose]] [-T trace_levels,..]
[-w width] [-Y library_path,..]
sdf_file ...
purpose: convert an sdf file to another format
version: 2.001 (SDF 2.001)
π The options are: π
-hβ display help on options-oβ output file extension-lβ log file extension-Oβ output to input file's (or explicit) directory-2β the output format you want-Dβ define variables-nβ heading level to autosplit into topics-fβ define flags (i.e.DOC_*variables)-Iβ search path for include files, templates, etc.-pβ pre-filter input file from each argument-aβ parameters for the pre-filter-Pβ pre-filter as a programming language-Nβ number lines in pretty-printed source code-gβ pre-filter usingsdfgetwith the report specified-rβ report to run on the SDF to transform it before formatting-Lβ locale-kβ look library-sβ style of document-Sβ page size for paper documents-cβ configuration library-uβ modules to use-Hβ initial heading level-Kβ heading look (H,AorP)-dβ format driver - default isexpand-yβ filter to post-filter the output with-zβ list of post processing actions to do-tβ logical target format-vβ verbose mode-Tβ debugging trace levels-wβ width for text-based outputs-Yβ search path for libraries
π The aliases are: π
mcβ generate a MIMS chaptermsβ generate a MIMS specmtβ generate a MIMS topicsdf2doc_fmβ generate Frame binary format via FrameMakersdf2dvi_sgmlβ generate DVI format via SGMLsdf2fvo_fmβ generate FrameViewer format via FrameMakersdf2hlp_mifβ generate Windows Help input files via MIFsdf2html_β generate a HTML documentsdf2html_dirβ generate an SDF directory in HTMLsdf2html_fmβ generate a HTML document via FrameMakersdf2html_topicsβ generate HTML topicssdf2htx_β generate MIMS HTX formatsdf2info_sgmlβ generate GNU info format via SGMLsdf2latex_β generate LaTeXsdf2latex_podβ generate LaTeX format via PODsdf2latex_sgmlβ generate LaTeX format via SGMLsdf2lyx_sgmlβ generate a LyX file via SGMLsdf2man_podβ generate Man page format via PODsdf2mf6_β generate MIMS F6 help formatsdf2mif_β generate Frame MIF formatsdf2pdf_htmlβ generate PDF via HTMLsdf2pdf_mifβ generate PostScript and PDF via FrameMakersdf2pod_β generate POD formatsdf2ps_fmβ generate PostScript via FrameMakersdf2ps_fmbookβ generate PostScript via a FrameMaker booksdf2ps_htmlβ generate PostScript via HTMLsdf2ps_podβ generate PostScript via PODsdf2ps_sgmlβ generate PostScript via SGMLsdf2rtf_fmβ generate RTF format via FrameMakersdf2rtf_mifβ generate RTF format via MIFsdf2rtf_sgmlβ generate RTF format via SGML formatsdf2sdf_expandβ generate expanded SDFsdf2sdf_rawβ generate raw SDFsdf2sgml_β generate SGML formatsdf2txt_β generate plain text formatsdf2txt_fmβ generate plain text format via FrameMakersdf2txt_podβ generate plain text format via POD
π DESCRIPTION π
Okay bestie, this is the big one, so grab a snack π
-h is your help button and she serves. If you use it with no parameter, you get a cute lil brief description of every single option. But if you want the full tea on one specific option, pass that option letter as the parameter and she'll spill the attributes for you. π
By default, whatever sdf generates goes straight to standard output. If you'd rather get one output file per input file, hit up -o and hand it an extension for the output files. And if you use -o with no parameter at all? It just assumes an extension of out. So chill.
Errors get the same treatment, fr fr β error messages go to standard error by default. Want a log file per input file? Use -l. No parameter? It assumes log. Boom. β¨
And by default, both your generated output and your log files land in the current directory. If you want them somewhere specific, use -O to name an explicit output directory. If -O is specified with no parameter, it just uses the input file's own directory. Lowkey convenient.
The -2 option is the shortcut queen π β it lets you name an alias (which is just a whole collection of options) that produces the output you want. Like:
sdf -2html abc
is literally equivalent to:
sdf +sdf2html abc
-D is for defining variables. These are typically used to control conditional text and to substitute text that changes. The format goes like this:
-Dvariable1=value1,variable2=value2
Now, a flag is just a shorthand way of specifying variables in the DOC family. So like, -ftoc=3 is equivalent to -DDOC_TOC=3. The format of the -f option is:
-fflag1=value1,flag2=value2
And if a variable or a flag gets specified with no value? 1 is assumed. Default queen behavior. π
To generate HTML topics, the command is:
sdf -2topics abc
By default this creates sub-topics for each heading that's already in a separate file. It also autosplits level 1 headings into sub-topics. The -n option controls which level headings get split at:
1autosplits on level 1 headings (this is the default)2autosplits on level 2 headings3autosplits on level 3 headings0disables autosplitting. Periodt.
Include files get searched for in the current directory first, then in the directories you gave via the -I option, and then finally in the default library directory. π¦
By default, sdf is configured to prefilter files with certain extensions. Like, check this out:
sdf mytable.tbl
is equivalent to running sdf on a file that contains only this:
!include "mytable.pl"; table
The -p option lets you explicitly prefilter files, or override whatever the default prefilter is. And if you don't provide a parameter, the prefilter is assumed to be table.
The -a option is how you pass parameters to that prefilter. For example:
sdf -aformat='15,75,10' mytable.tbl
-P prefilters the input files as programming languages. The parameter is the language to use, and if none is provided, the extension is assumed to be the language name. So for example:
sdf -P myapp.c
is equivalent to running sdf on a file that contains only:
!include "myapp.c"; example; wide; lang='c'
-N adds line numbers at the frequency you give it. Default frequency is 1, i.e. literally every single line. π’
-g prefilters the input files by executing sdfget using the default report (default.sdg). If you wanna change which report gets used, just specify the report name as the parameter. And if that report name doesn't include an extension, sdg is assumed.
Note:sdfgetsearches for reports in the current directory first, then in thestdlibdirectory inside SDF's library directory.
-r runs the nominated SDR report on each input before formatting. In other words, SDR reports are a whole mechanism for:
- analysing the SDF right before it would be formatted, and
- replacing that SDF with the output of the report (which is also SDF), so that the final output is a nicely formatted report. π
For example, the sdf_dir report generates a directory (tree) of the components (files) that are included in an SDF document. Reports are stored in sdr files and they get searched for using the usual rules.
-L lets you specify a locale. The default locale name lives in sdf.ini. Locale naming follows POSIX conventions (that's language_country), so the locale name for American english is en_us. Every locale's info is stored in the locale directory, so you'll have to look in there to see which locales are actually available. (And since the default locale can just be set in sdf.ini, this isn't as ugly as it first sounds, promise. π)
Note: right now, a locale file just contains a list of language-specific strings. Ultimately it should be extended to support localisation of date and time formats.
-k specifies a look. The default look library is specified in sdf.ini.
-s lets you specify a document style. Typical values are:
documentβ a technical documentmemoβ a memofaxβ a facsimileminutesβ minutes of a meeting.
-S specifies the page size. Values supported include:
globalβ width21.0cm, height11.0inβ will fit on either A4 or letterA3β width29.7cm, height42.0cmA4β width21.0cm, height29.7cmA5β width14.8cm, height21.0cmB4β width25.7cm, height36.4cmB5β width17.6cm, height25.0cmletterβ width8.5in, height11.0inlegalβ width8.5in, height14.0intabloidβ width11.0in, height17.0in
More page sizes can be configured in sdf.ini. And if you want a rotated version of a named page size, just append an R. So like, A4R implies a width of 29.7cm and a height of 21cm. You can also roll your own custom page size using the format:
{{width}}x{{height}}
where width and height are the respective sizes in points.
-c specifies a configuration library.
A list of modules to use can be specified via the -u option. πΈ
The initial heading level to start on can be specified via -H. This is super useful if you wanna preview how a topic will display without regenerating the whole entire document. So if a topic begins with a level 1 heading (like H1) and you wish to format it as a document (i.e. the level 1 text becomes the DOC_NAME for build_title), use the -H option with a value of 0.
The look of headings can be adjusted too. By default, H-style headings are numbered, A-style headings are lettered, and P-style headings are plain. To force a particular style for all headings, use the -K option. Sensible parameter values are H, A and P, although other values may work depending on what paragraph styles are configured at your site.
-d specifies the format driver. Values supported include:
expandβ format as expanded text (the default)mifβ Maker Interchange Formatpodβ Plain Old Documentation (as used by Perl).
Additional drivers can be configured in sdf.ini.
-y specifies a post-filter.
-z lets you specify a list of post-processing actions you want to run on each output file after it's generated. The actions supported include:
psβ generate PostScriptdocβ generate a Frame (binary) filefvoβ generate a Frame View-Only filetxtβ generate a text filertfβ generate an RTF filecleanβ delete the output file (must be last).
Additional actions can be configured in sdf.ini. And by convention, the generated files are given the same names as the action keywords. π§
-t specifies the logical target format. If none is specified, the default is the first post-processing action, if there is one. Otherwise, the default is the format driver name.
-v enables verbose mode, which is great for debugging problems related to post processing. In particular, post-processing actions containing the pattern clean are skipped in verbose mode. You can also switch off the post-processing messages by using a verbose value of -1. Values higher than 1 switch on additional trace messages, like this:
2β show how names of files and libraries are resolved3β show the directories searched for libraries4β show the directories searched for modules5β show the directories searched for normal files.
-T switches on debug tracing. The parameter is a comma-separated list of name-value pairs, where each name is a tracing group and each value is the level of tracing for that group. To get the same trace output that -v gives you, you can use the user group like this:
sdf -Tuser=2 ...
This is slightly different from -v though, in that intermediate files are not implicitly kept. And additional tracing groups will get added over time (probably one per output driver, bestie, stay tuned π).
-w specifies the width for text-based outputs.
And last but not least: -z, -D, -f and -I are all list options. Meaning: multiple values can be separated by commas, and/or the options can be supplied multiple times. Go off. π₯
β¨ EXAMPLES β¨
Convert mydoc.sdf to a technical document in mif format β output is mydoc.mif:
sdf -2mif mydoc.sdf
Convert mydoc.sdf to online documentation in FrameViewer format β output is mydoc.fvo:
sdf -2fvo mydoc.sdf
Convert mydoc.sdf to online documentation in HTML β output is mydoc.html:
sdf -2html mydoc.sdf
And this next one will build the reference documentation for an SDF module in HTML:
sdf -2html abc.sdm
π LIMITATIONS AND FUTURE DIRECTIONS π
Okay so, real talk: many of the default post-processing (-z) actions only work on Unix, because FrameMaker for Windows does not support batch conversion. π
And topics mode has several limitations of its own:
- only documents in the current directory can be converted
- all sub-topics must also be in the current directory.
That's the whole page, bestie, you made it π«Ά this one's from the perl v5.36.0 era, dated 2023-08-02, and it's the SDF(1) manual β go forth and format something iconic, no cap. ππ
π¦ where this page comes from
- debian trixie: sdf 2.001+1-9
- ubuntu noble: sdf 2.001+1-9
- ubuntu questing: sdf 2.001+1-9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms