⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdoc.samples.7

📁 早期freebsd实现
💻 7
📖 第 1 页 / 共 5 页
字号:
.It Li \&.Tn ASCII.Tn ASCII.El.PpThe.Ql \&.Tnmacrois parsed and is callable by other macros..Ss Extended  ArgumentsThe.Li \&.Xoand.Li \&.Xcmacros allow one to extend an argument liston a macro boundary.Argument lists cannotbe extended within a macrowhich expects all of its arguments on one line suchas.Ql \&.Op ..PpHere is an example of.Ql \&.Xousing the space mode macro to turn spacing off:.Bd -literal -offset indent\&.Sm off\&.It Xo Sy I Ar operation\&.No \een Ar count No \een\&.Xc\&.Sm on.Ed.PpProduces.Bd -filled -offset indent.Bl -tag -width flag -compact.Sm off.It Xo Sy I Ar operation.No \en Ar count No \en.Xc.Sm on.El.Ed.PpAnother one:.Bd -literal -offset indent\&.Sm off\&.It Cm S No \&/ Ar old_pattern Xo\&.No \&/ Ar new_pattern\&.No \&/ Op Cm g\&.Xc\&.Sm on.Ed.PpProduces.Bd -filled -offset indent.Bl -tag -width flag -compact.Sm off.It Cm S No \&/ Ar old_pattern Xo.No \&/ Ar new_pattern.No \&/ Op Cm g.Xc.Sm on.El.Ed.PpAnother example of.Ql \&.Xoand using enclosure macros:Test the value of an variable..Bd -literal -offset indent\&.It Xo\&.Ic .ifndef\&.Oo \e&! Oc Ns Ar variable\&.Op Ar operator variable ...\&.Xc.Ed.PpProduces.Bd -filled -offset indent.Bl -tag -width flag -compact.It Xo.Ic .ifndef.Oo \&! Oc Ns Ar variable.Op Ar operator variable ....Xc.El.Ed.PpAll of the above examples have used the.Ql \&.Xomacro on the argument list of the.Ql \&.It(list-item)macro.The extend macros are not used very often, and when they areit is usually to extend the list-item argument list.Unfortunately, this is also where the extend macros are themost finicky.In the first two examples, spacing was turned off;in the third, spacing was desired in part of the output butnot all of it.To make these macros work in this situation make surethe.Ql \&.Xoand.Ql \&.Xcmacros are placed as shown in the third example.If the.Ql \&.Xomacro is not alone on the.Ql \&.Itargument list, spacing will be unpredictable.The.Ql \&.Ns(no space macro)must not occur as the first or last macro on a linein this situation.Out of 900 manual pages (about 1500 actual pages)currently released with.Bxonly fifteen use the.Ql \&.Xomacro..Sh PAGE STRUCTURE DOMAIN.Ss Section HeadersThe first three.Ql \&.Shsection header macroslist below are required in everyman page.The remaining section headersare recommended at the discretion of the authorwriting the manual page.The.Ql \&.Shmacro can take up to nine arguments.It is parsed and but is not callable..Bl -tag -width ".Sh SYNOPSIS".It \&.Sh NAMEThe.Ql \&.Sh NAMEmacro is mandatory.If not specified,the headers, footers and page layout defaultswill not be set and things will be rather unpleasant.The.Sx NAMEsection consists of at least three items.The first is the.Ql \&.Nmname macro naming the subject of the man page.The second is the Name Description macro,.Ql \&.Nd ,which separates the subjectname from the third item, which is the description.Thedescription should be the most terse and lucid possible,as the space available is small..It \&.Sh SYNOPSISThe.Sx SYNOPSISsection describes the typical usage of thesubject of a man page.The  macros requiredare either.Ql ".Nm" ,.Ql ".Cd" ,.Ql ".Fn" ,(and possibly.Ql ".Fo" ,.Ql ".Fc" ,.Ql ".Fd" ,.Ql ".Ft"macros).The function namemacro.Ql ".Fn"is requiredfor manual page sections 2 and 3, the command and generalname macro.Ql \&.Nmis required for sections 1, 5, 6, 7, 8.Section 4 manuals require a.Ql ".Nm" , ".Fd"or a.Ql ".Cd"configuration device usage macro.Several other macros may be necessary to producethe synopsis line as shown below:.Pp.Bd -filled -offset indent.Nm cat.Op Fl benstuv.Op Fl.Ar.Ed.PpThe following macros were used:.Pp.Dl \&.Nm cat.Dl \&.Op \&Fl benstuv.Dl \&.Op \&Fl.Dl \&.Ar.Pp.Sy Note :The macros.Ql \&.Op ,.Ql \&.Fl ,and.Ql \&.Arrecognize the pipe bar character.Ql \*(Ba ,so a command line such as:.Pp.Dl ".Op Fl a | Fl b".Ppwill not go orbital..Xr Troffnormally interprets a \*(Ba as a special operator.See.Sx PREDEFINED STRINGSfor a usable \*(Bacharacter in other situations..It \&.Sh DESCRIPTIONIn most cases the first text in the.Sx DESCRIPTIONsectionis a brief paragraph on the command, function or file,followed by a lexical list of options and respectiveexplanations.To create such a list, the.Ql \&.Blbegin-list,.Ql \&.Itlist-item and.Ql \&.Elend-listmacros are used (see.Sx Lists and Columnsbelow)..El.PpThe following.Ql \&.Shsection headers are part of thepreferred manual page layout and must be used appropriatelyto maintain consistency.They are listed in the orderin which they would be used..Bl -tag -width SYNOPSIS.It \&.Sh ENVIRONMENTThe.Sx ENVIRONMENTsection should reveal any relatedenvironmentvariables and clues to their behavior and/or usage..It \&.Sh EXAMPLESThere are several ways to create examples.Seethe.Sx EXAMPLESsection belowfor details..It \&.Sh FILESFiles which are used or created by the man page subjectshould be listed via the.Ql \&.Pamacro in the.Sx FILESsection..It \&.Sh SEE ALSOReferences to other material on the man page topic andcross references to other relevant man pages shouldbe placed in the.Sx SEE ALSOsection.Cross referencesare specified using the.Ql \&.Xrmacro.At this time.Xr refer 1style references are not accommodated..It \&.Sh STANDARDSIf the command, library function or file adheres to aspecific implementation such as.St -p1003.2or.St -ansiCthis should be noted here.If thecommand does not adhere to any standard, its historyshould be noted in the.Sx HISTORYsection..It \&.Sh HISTORYAny command which does not adhere to any specific standardsshould be outlined historically in this section..It \&.Sh AUTHORSCredits, if need be, should be placed here..It \&.Sh DIAGNOSTICSDiagnostics from a command should be placed in this section..It \&.Sh ERRORSSpecific error handling, especially from library functions(man page sections 2 and 3) should go here.The.Ql \&.Ermacro is used to specify an errno..It \&.Sh BUGSBlatant problems with the topic go here....El.PpUser specified.Ql \&.Shsections may be added,for example, this section was set with:.Bd -literal -offset 14n\&.Sh PAGE LAYOUT MACROS.Ed.Ss Paragraphs and Line Spacing..Bl -tag -width 6n.It \&.PpThe \&.Pp paragraph command maybe used to specify a line space where necessary.The macro is not necessary after a.Ql \&.Shor.Ql \&.Ssmacro or beforea.Ql \&.Blmacro.(The.Ql \&.Blmacro asserts a vertical distance unless the -compact flag is given)..El.\" This worked with version one, need to redo for version three.\" .Pp.\" .Ds I.\" .Cw (ax+bx+c) \ is\ produced\ by\ \&.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&.\" .Cl Cx \t\t.\" .Li \&.Cx\ (.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Va ax.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Sy \+.\" .Cx.\" .Cl Cx \&(\&.\" .Va ax.\" .Cx +.\" .Va by.\" .Cx +.\" .Va c ).\" .Cx \t.\" .Em is produced by.\" .Cx \t.\" .Li \&.Va by.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Sy \+.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Va c ).\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Cx.\" .Cx.\" .Cw.\" .De.\" .Pp.\" This example shows the same equation in a different format..\" The spaces.\" around the.\" .Li \&+.\" signs were forced with.\" .Li \e :.\" .Pp.\" .Ds I.\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&.\" .Cl Cx \t\t.\" .Li \&.Cx\ (.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Va a.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Sy x.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Cx \e\ +\e\ \e&.\" .Cx.\" .Cl Cx \&(\&.\" .Va a.\" .Sy x.\" .Cx \ +\ \&.\" .Va b.\" .Sy y.\" .Cx \ +\ \&.\" .Va c ).\" .Cx \t.\" .Em is produced by.\" .Cl Cx \t\t.\" .Li \&.Va b.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Sy y.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Cx \e\ +\e\ \e&.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Va c ).\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Cx.\" .Cx.\" .Cw.\" .De.\" .Pp.\" The incantation below was.\" lifted from the.\" .Xr adb 1.\" manual page:.\" .Pp.\" .Ds I.\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by.\" .Cl Cx \t\t.\" .Li \&.Cx Op Sy ?/.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Nm m.\" .Cx.\" .Cl Cx Op Sy ?/.\" .Nm m.\" .Ad \ b1 e1 f1.\" .Op Sy ?/.\" .Cx \t.\" .Em is produced by.\" .Cx \t.\" .Li \&.Ar \e\ b1 e1 f1.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Op Sy ?/.\" .Cx.\" .Cl Cx \t\t.\" .Li \&.Cx.\" .Cx.\" .Cw.\" .De.\" .Pp.Ss KeepsThe only keep that is implemented at this time is for words.The macros are.Ql \&.Bk(begin-keep)and.Ql \&.Ek(end-keep).The only option that.Ql \&.Blaccepts is.Fl wordsand is useful for preventing line breaks in the middle of options.In the example for the make command line arguments (see.Sx What's in a name ) ,the keep prevented.Xr nrofffrom placing up theflag and the argumenton separate lines.(Actually, the option macro used to prevent this from occurring,but was dropped when the decision (religious) was made to forceright justified margins in.Xr troffas options in general look atrocious when spread across a sparseline.More work needs to be done with the keep macros, a.Fl lineoption needs to be added.).Ss Examples and DisplaysThere are five types of displays, a quickie one line indented display.Ql \&.D1 ,a quickie one line literal display.Ql \&.Dl ,and a block literal, block filled and block ragged which usethe.Ql \&.Bdbegin-displayand.Ql \&.Edend-display macros..Pp.Bl -tag -width \&.Dlxx.It Li \&.D1(D-one) Display one line of indented text.This macro is parsed, but it is not callable..Pp.Dl Fl ldghfstru.PpThe above was produced by:.Li \&.Dl Fl ldghfstru ..It Li \&.Dl(D-ell)Display one line of indented.Em literaltext.The.Ql \&.Dlexample macro has been used throughout thisfile.It allowsthe indent (display) of one line of text.Its default font is set toconstant width (literal) howeverit is parsed and will recognized other macros.It is not callable however..Pp.Dl % ls -ldg /usr/local/bin.PpThe above was produced by.Li \&.Dl % ls -ldg /usr/local/bin ..It Li \&.BdBegin-display.The.Ql \&.Bddisplay must be ended with the.Ql \&.Edmacro.Displays may be nested within displays andlists..Ql \&.Bdhas the following syntax:.Pp.Dl ".Bd display-type [-offset offset_value] [-compact]".PpThe display-type must be one of the following four types andmay have an offset specifier for indentation:.Ql \&.Bd ..Pp.Bl -tag -width "file file_name  " -compact.It Fl raggedDisplay a block of text as typed,right (and left) margin edges are left ragged..It Fl filledDisplay a filled (formatted) block.The block of text is formatted (the edges are filled \-not left unjustified)..It Fl literalDisplay a literal block, useful for source code orsimple tabbed or spaced text..It Fl file Ar file_nameThe file name following the.Fl fileflag is read and displayed.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -