Skip to content

Commit 4ea6119

Browse files
cmdref: Move html only section inside cmd:def
Fixes missing links in body and `??` in tag/command index. Update synth.rst to match.
1 parent f137509 commit 4ea6119

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ available, go to :ref:`commandindex`.
2323
- Search bar with live drop down suggestions for matching on title /
2424
autocompleting commands
2525
- Scroll the left sidebar to the current location on page load
26-
- Also the formatting/linking in pdf is broken
26+
- Also the formatting in pdf uses link formatting instead of code formatting
2727

2828
.. todolist::
2929

docs/source/using_yosys/synthesis/synth.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The following commands are executed by the `prep` command:
4242

4343
.. literalinclude:: /cmd/prep.rst
4444
:start-at: begin:
45-
:end-before: .. raw:: latex
45+
:end-before: .. only:: latex
4646
:dedent:
4747

4848
:doc:`/getting_started/example_synth` covers most of these commands and what

kernel/register.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,11 @@ struct HelpPass : public Pass {
812812
fprintf(f, "%s", title_line.c_str());
813813
fprintf(f, "%s - %s\n", cmd.c_str(), title.c_str());
814814
fprintf(f, "%s\n", title_line.c_str());
815-
fprintf(f, ".. raw:: latex\n\n \\begin{comment}\n\n");
816815

817816
// render html
818817
fprintf(f, ".. cmd:def:: %s\n", cmd.c_str());
819-
fprintf(f, " :title: %s\n\n", title.c_str());
818+
fprintf(f, " :title: %s\n\n", title.c_str());
819+
fprintf(f, " .. only:: html\n\n");
820820
std::stringstream ss;
821821
std::string textcp = text;
822822
ss << text;
@@ -852,46 +852,45 @@ struct HelpPass : public Pass {
852852
if (IsUsage) {
853853
if (stripped_line.compare(0, 4, "See ") == 0) {
854854
// description refers to another function
855-
fprintf(f, "\n %s\n", stripped_line.c_str());
855+
fprintf(f, "\n %s\n", stripped_line.c_str());
856856
} else {
857857
// usage should be the first line of help output
858-
fprintf(f, "\n .. code:: yoscrypt\n\n %s\n\n ", stripped_line.c_str());
858+
fprintf(f, "\n .. code:: yoscrypt\n\n %s\n\n ", stripped_line.c_str());
859859
WasDefinition = true;
860860
}
861861
IsUsage = false;
862862
} else if (IsIndent && NewUsage && (blank_count >= 2 || WasDefinition)) {
863863
// another usage block
864-
fprintf(f, "\n .. code:: yoscrypt\n\n %s\n\n ", stripped_line.c_str());
864+
fprintf(f, "\n .. code:: yoscrypt\n\n %s\n\n ", stripped_line.c_str());
865865
WasDefinition = true;
866866
def_strip_count = 0;
867867
} else if (IsIndent && IsDefinition && (blank_count || WasDefinition)) {
868868
// format definition term
869-
fprintf(f, "\n\n .. code:: yoscrypt\n\n %s\n\n ", stripped_line.c_str());
869+
fprintf(f, "\n\n .. code:: yoscrypt\n\n %s\n\n ", stripped_line.c_str());
870870
WasDefinition = true;
871871
def_strip_count = first_pos;
872872
} else {
873873
if (IsDedent) {
874-
fprintf(f, "\n\n ::\n");
874+
fprintf(f, "\n\n ::\n");
875875
def_strip_count = first_pos;
876876
} else if (WasDefinition) {
877-
fprintf(f, " ::\n");
877+
fprintf(f, "::\n");
878878
WasDefinition = false;
879879
}
880-
fprintf(f, "\n %s", line.substr(def_strip_count, std::string::npos).c_str());
880+
fprintf(f, "\n %s", line.substr(def_strip_count, std::string::npos).c_str());
881881
}
882882

883883
blank_count = 0;
884884
}
885885
fputc('\n', f);
886886

887887
// render latex
888-
fprintf(f, ".. raw:: latex\n\n \\end{comment}\n\n");
889888
fprintf(f, ".. only:: latex\n\n");
890-
fprintf(f, " ::\n\n");
889+
fprintf(f, " ::\n\n");
891890
std::stringstream ss2;
892891
ss2 << textcp;
893892
for (std::string line; std::getline(ss2, line, '\n');) {
894-
fprintf(f, " %s\n", line.c_str());
893+
fprintf(f, " %s\n", line.c_str());
895894
}
896895
fclose(f);
897896
}

0 commit comments

Comments
 (0)