Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
7e494b83
Commit
7e494b83
authored
26 years ago
by
Martin Stjernholm
Browse files
Options
Downloads
Patches
Plain Diff
Fixed quoting problems.
Rev: bin/mkwmml.pike:1.9
parent
7805c10d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/mkwmml.pike
+26
-22
26 additions, 22 deletions
bin/mkwmml.pike
with
26 additions
and
22 deletions
bin/mkwmml.pike
+
26
−
22
View file @
7e494b83
/* $Id: mkwmml.pike,v 1.
8
1998/0
5/21
1
1
:5
3:38 grubba fake
$ */
/* $Id: mkwmml.pike,v 1.
9
1998/0
7/04
1
5
:5
7:14 mast Exp
$ */
import Stdio;
import Array;
...
...
@@ -40,12 +40,14 @@ module : mapping <- moduleM
"args" : array of args names and types
"desc" : description
"names" : multiset of method name(s)
Quoting: Only '<' must be quoted as '<'.
*/
mapping moduleM, classM, methodM, argM, nowM, descM;
mapping focM(mapping dest,string name,in
t
line)
mapping focM(mapping dest,string name,
str
in
g
line)
{
return dest[name] || (dest[name]=(["_line":line]));
}
...
...
@@ -76,49 +78,49 @@ void report(string s)
#define complain(X) (X)
mapping keywords=
(["module":lambda(string arg,in
t
line)
(["module":lambda(string arg,
str
in
g
line)
{ classM=descM=nowM=moduleM=focM(parse,stripws(arg),line);
methodM=0;
if (!nowM->classes) nowM->classes=([]);
if (!nowM->modules) nowM->modules=([]);
report("module "+arg); },
"class":lambda(string arg,in
t
line)
"class":lambda(string arg,
str
in
g
line)
{ if (!moduleM) return complain("class w/o module");
descM=nowM=classM=focM(moduleM->classes,stripws(arg),line);
methodM=0; report("class "+arg); },
"submodule":lambda(string arg,in
t
line)
"submodule":lambda(string arg,
str
in
g
line)
{ if (!moduleM) return complain("submodule w/o module");
classM=descM=nowM=moduleM=focM(moduleM->modules,stripws(arg),line);
methodM=0;
if (!nowM->classes) nowM->classes=([]);
if (!nowM->modules) nowM->modules=([]);
report("submodule "+arg); },
"method":lambda(string arg,in
t
line)
"method":lambda(string arg,
str
in
g
line)
{ if (!classM) return complain("method w/o class");
if (!nowM || methodM!=nowM || methodM->desc || methodM->args || descM==methodM)
{ if (!classM->methods) classM->methods=({});
classM->methods+=({methodM=nowM=(["decl":({}),"_line":line])}); }
methodM->decl+=({stripws(arg)}); descM=0; },
"arg":lambda(string arg,in
t
line)
"arg":lambda(string arg,
str
in
g
line)
{
if (!methodM) return complain("arg w/o method");
if (!methodM->args) methodM->args=({});
methodM->args+=({argM=nowM=(["args":({}),"_line":line])});
argM->args+=({arg}); descM=argM;
},
"note":lambda(string arg,in
t
line)
"note":lambda(string arg,
str
in
g
line)
{
if (!lower_nowM())
return complain("note w/o method, class or module");
descM=nowM->note||(nowM->note=(["_line":line]));
},
"bugs":lambda(string arg,in
t
line)
"bugs":lambda(string arg,
str
in
g
line)
{
if (!lower_nowM())
return complain("bugs w/o method, class or module");
descM=nowM->bugs||(nowM->bugs=(["_line":line]));
},
"see":lambda(string arg,in
t
line)
"see":lambda(string arg,
str
in
g
line)
{
if (arg[0..4]!="also:")
return complain("see w/o 'also:'\n");
...
...
@@ -180,7 +182,7 @@ string synopsis_to_html(string s)
string htmlify(string s)
{
#define HTMLIFY(S) \
(replace((S),({"
-
>","&","\240"}),({"
-
>","&"," "})))
(replace((S),({"
<","
>","&","\240"}),({"
<","
>","&"," "})))
string t="",u,v;
while (sscanf(s,"%s<%s>%s",u,v,s)==3)
...
...
@@ -188,7 +190,8 @@ string htmlify(string s)
return t+HTMLIFY(s);
}
#define linkify(S) (replace((S),({"->","()"}),({".",""})))
#define linkify(S) \
("\""+replace((S),({"->","()","<"}),({".","","<"}))+"\"")
string make_nice_reference(string what,string prefix)
{
...
...
@@ -210,7 +213,7 @@ string make_nice_reference(string what,string prefix)
else
q=what;
return "<link to="+linkify(q)+">"+what+"</link>";
return "<link to="+linkify(q)+">"+
htmlify(
what
)
+"</link>";
}
string fixdesc(string s,string prefix,string where)
...
...
@@ -222,22 +225,22 @@ string fixdesc(string s,string prefix,string where)
t=s; s="";
while (sscanf(t,"%s<ref>%s</ref>%s",t,u,v)==3)
{
s+=
t
+make_nice_reference(u,prefix);
s+=
htmlify(t)
+make_nice_reference(u,prefix);
t=v;
}
s+=
t
;
s+=
htmlify(t)
;
t=s; s="";
while (sscanf(t,"%s<illustration%s>%s</illustration>%s",t,q,u,v)==4)
{
s+=
htmlify(
replace(t,"\n\n","\n\n<p>")
)
;
s+=replace(t,"\n\n","\n\n<p>");
s+="<illustration __from__='"+where+"' src=lena.gif"+q+">\n"
+replace(u,"lena()","src")+"</illustration>";
t=v;
}
s+=
htmlify(
replace(t,"\n\n","\n\n<p>")
)
;
s+=replace(t,"\n\n","\n\n<p>");
return s;
}
...
...
@@ -280,8 +283,9 @@ void document(string enttype,
verbose("mkwmml: "+name+" : "+names*","+"\n");
f->write("\n<"+enttype+" name="+
replace(names*",", ">", ">"));
f->write("\n<!-- " + huh->_line + " -->\n");
f->write("<"+enttype+" name="+
linkify(names*","));
if (manpage_suffix[replace(name,"->",".")])
f->write(" mansuffix="+manpage_suffix[replace(name,"->",".")]);
...
...
@@ -365,7 +369,7 @@ void document(string enttype,
if (huh["see also"])
{
f->write("<man_see exp>\n");
f->write(huh["see also"]*", ");
f->write(
htmlify(
huh["see also"]*", ")
)
;
f->write("</man_see>\n\n");
}
...
...
@@ -453,7 +457,7 @@ int main(int ac,string *files)
if (sizeof(files) && files[0]=="--nonverbose")
files=files[1..],verbose=lambda(){};
stderr->write("mkwmml: reading files...\n");
for (;;)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment