Skip to content

Commit c71e645

Browse files
authored
Fix for issue #505 (#507)
Added a function Cinfo::getDocsEntry to retrieve specific entry from class documentation map. Default Cinfo::getDocs() function gets entries by alphabetical order which loses the sequence of documentation components.
1 parent 30e2c4a commit c71e645

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

basecode/Cinfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ string Cinfo::getDocs() const
406406
return doc.str();
407407
}
408408

409+
string Cinfo::getDocsEntry(string key) const
410+
{
411+
if (auto result = doc_.find(key); result != doc_.end()){
412+
return result->second;
413+
} else {
414+
return "";
415+
}
416+
}
417+
409418
static DestFinfo dummy("dummy",
410419
"This Finfo is a dummy. If you are reading this you "
411420
"have used an invalid index",

basecode/Cinfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ class Cinfo {
176176
* Return the documentation string
177177
*/
178178
string getDocs() const;
179+
/**
180+
* Get a specifi entry from the docs map
181+
*/
182+
string getDocsEntry(string key) const;
179183

180184
/**
181185
* Return the name of the base class

biophysics/HHGate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const Cinfo* HHGate::initCinfo()
101101
static ElementValueFinfo<HHGate, string> tauExpr(
102102
"tauExpr",
103103
"Explicit expression for computing `tau`."
104-
" For using this, `infExpr` must be set as well."q
104+
" For using this, `infExpr` must be set as well."
105105
" See `alphaExpr` and `HHChannelF` documentation.",
106106
&HHGate::setTauExpr, &HHGate::getTauExpr);
107107

biophysics/HHGateF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const Cinfo* HHGateF::initCinfo()
100100
"Author",
101101
"Subhasis Ray, 2025, CHINTA",
102102
"Description",
103-
"HHGateF: Gate for Hodkgin-Huxley type channels, equivalent to the "
103+
"Gating component of Hodkgin-Huxley type channels, equivalent to the "
104104
"m and h terms on the Na squid channel and the n term on K. "
105105
"This takes the voltage and state variable from the channel, "
106106
"computes the new value of the state variable and a scaling, "

pybind11/helper.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,16 @@ string mooseClassDoc(const string& className)
523523
ss << "This class is not valid." << endl;
524524
return ss.str();
525525
}
526-
526+
ss << "class " << className << "\n\n"
527+
<< moose::textwrap(cinfo->getDocsEntry("Description"), " ") << "\n\n"
528+
<< "Author: " << moose::textwrap(cinfo->getDocsEntry("Author"), " ")
529+
<< "\n\n";
527530
ss << moose::underlined<'='>("Attributes:");
528531
ss << endl;
529532

530533
for(string f : {"value", "lookup", "src", "dest", "shared", "field"})
531534
ss << mooseClassFieldsDoc(cinfo, f, "");
532-
535+
533536
return ss.str();
534537
}
535538

0 commit comments

Comments
 (0)