mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	cmdref: Move html only section inside cmd:def
Fixes missing links in body and `??` in tag/command index. Update synth.rst to match.
This commit is contained in:
		
							parent
							
								
									f137509505
								
							
						
					
					
						commit
						4ea6119734
					
				
					 3 changed files with 13 additions and 14 deletions
				
			
		|  | @ -23,7 +23,7 @@ available, go to :ref:`commandindex`. | ||||||
|    - Search bar with live drop down suggestions for matching on title / |    - Search bar with live drop down suggestions for matching on title / | ||||||
|      autocompleting commands |      autocompleting commands | ||||||
|    - Scroll the left sidebar to the current location on page load |    - Scroll the left sidebar to the current location on page load | ||||||
|    - Also the formatting/linking in pdf is broken |    - Also the formatting in pdf uses link formatting instead of code formatting | ||||||
| 
 | 
 | ||||||
| .. todolist:: | .. todolist:: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ The following commands are executed by the `prep` command: | ||||||
| 
 | 
 | ||||||
| .. literalinclude:: /cmd/prep.rst | .. literalinclude:: /cmd/prep.rst | ||||||
|    :start-at: begin: |    :start-at: begin: | ||||||
|    :end-before: .. raw:: latex |    :end-before: .. only:: latex | ||||||
|    :dedent: |    :dedent: | ||||||
| 
 | 
 | ||||||
| :doc:`/getting_started/example_synth` covers most of these commands and what | :doc:`/getting_started/example_synth` covers most of these commands and what | ||||||
|  |  | ||||||
|  | @ -812,11 +812,11 @@ struct HelpPass : public Pass { | ||||||
| 		fprintf(f, "%s", title_line.c_str()); | 		fprintf(f, "%s", title_line.c_str()); | ||||||
| 		fprintf(f, "%s - %s\n", cmd.c_str(), title.c_str()); | 		fprintf(f, "%s - %s\n", cmd.c_str(), title.c_str()); | ||||||
| 		fprintf(f, "%s\n", title_line.c_str()); | 		fprintf(f, "%s\n", title_line.c_str()); | ||||||
| 		fprintf(f, ".. raw:: latex\n\n    \\begin{comment}\n\n"); |  | ||||||
| 
 | 
 | ||||||
| 		// render html
 | 		// render html
 | ||||||
| 		fprintf(f, ".. cmd:def:: %s\n", cmd.c_str()); | 		fprintf(f, ".. cmd:def:: %s\n", cmd.c_str()); | ||||||
| 		fprintf(f, "    :title: %s\n\n", title.c_str()); | 		fprintf(f, "   :title: %s\n\n", title.c_str()); | ||||||
|  | 		fprintf(f, "   .. only:: html\n\n"); | ||||||
| 		std::stringstream ss; | 		std::stringstream ss; | ||||||
| 		std::string textcp = text; | 		std::string textcp = text; | ||||||
| 		ss << text; | 		ss << text; | ||||||
|  | @ -852,32 +852,32 @@ struct HelpPass : public Pass { | ||||||
| 			if (IsUsage) { | 			if (IsUsage) { | ||||||
| 				if (stripped_line.compare(0, 4, "See ") == 0) { | 				if (stripped_line.compare(0, 4, "See ") == 0) { | ||||||
| 					// description refers to another function
 | 					// description refers to another function
 | ||||||
| 					fprintf(f, "\n    %s\n", stripped_line.c_str()); | 					fprintf(f, "\n      %s\n", stripped_line.c_str()); | ||||||
| 				} else { | 				} else { | ||||||
| 					// usage should be the first line of help output
 | 					// usage should be the first line of help output
 | ||||||
| 					fprintf(f, "\n    .. code:: yoscrypt\n\n        %s\n\n   ", stripped_line.c_str()); | 					fprintf(f, "\n      .. code:: yoscrypt\n\n         %s\n\n      ", stripped_line.c_str()); | ||||||
| 					WasDefinition = true; | 					WasDefinition = true; | ||||||
| 				} | 				} | ||||||
| 				IsUsage = false; | 				IsUsage = false; | ||||||
| 			} else if (IsIndent && NewUsage && (blank_count >= 2 || WasDefinition)) { | 			} else if (IsIndent && NewUsage && (blank_count >= 2 || WasDefinition)) { | ||||||
| 				// another usage block
 | 				// another usage block
 | ||||||
| 				fprintf(f, "\n    .. code:: yoscrypt\n\n        %s\n\n   ", stripped_line.c_str()); | 				fprintf(f, "\n      .. code:: yoscrypt\n\n         %s\n\n      ", stripped_line.c_str()); | ||||||
| 				WasDefinition = true; | 				WasDefinition = true; | ||||||
| 				def_strip_count = 0; | 				def_strip_count = 0; | ||||||
| 			} else if (IsIndent && IsDefinition && (blank_count || WasDefinition)) { | 			} else if (IsIndent && IsDefinition && (blank_count || WasDefinition)) { | ||||||
| 				// format definition term
 | 				// format definition term
 | ||||||
| 				fprintf(f, "\n\n    .. code:: yoscrypt\n\n        %s\n\n   ", stripped_line.c_str()); | 				fprintf(f, "\n\n      .. code:: yoscrypt\n\n         %s\n\n      ", stripped_line.c_str()); | ||||||
| 				WasDefinition = true; | 				WasDefinition = true; | ||||||
| 				def_strip_count = first_pos; | 				def_strip_count = first_pos; | ||||||
| 			} else { | 			} else { | ||||||
| 				if (IsDedent) { | 				if (IsDedent) { | ||||||
| 					fprintf(f, "\n\n    ::\n"); | 					fprintf(f, "\n\n      ::\n"); | ||||||
| 					def_strip_count = first_pos; | 					def_strip_count = first_pos; | ||||||
| 				} else if (WasDefinition) { | 				} else if (WasDefinition) { | ||||||
| 					fprintf(f, " ::\n"); | 					fprintf(f, "::\n"); | ||||||
| 					WasDefinition = false; | 					WasDefinition = false; | ||||||
| 				} | 				} | ||||||
| 				fprintf(f, "\n        %s", line.substr(def_strip_count, std::string::npos).c_str()); | 				fprintf(f, "\n         %s", line.substr(def_strip_count, std::string::npos).c_str()); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			blank_count = 0; | 			blank_count = 0; | ||||||
|  | @ -885,13 +885,12 @@ struct HelpPass : public Pass { | ||||||
| 		fputc('\n', f); | 		fputc('\n', f); | ||||||
| 
 | 
 | ||||||
| 		// render latex
 | 		// render latex
 | ||||||
| 		fprintf(f, ".. raw:: latex\n\n    \\end{comment}\n\n"); |  | ||||||
| 		fprintf(f, ".. only:: latex\n\n"); | 		fprintf(f, ".. only:: latex\n\n"); | ||||||
| 		fprintf(f, "    ::\n\n"); | 		fprintf(f, "   ::\n\n"); | ||||||
| 		std::stringstream ss2; | 		std::stringstream ss2; | ||||||
| 		ss2 << textcp; | 		ss2 << textcp; | ||||||
| 		for (std::string line; std::getline(ss2, line, '\n');) { | 		for (std::string line; std::getline(ss2, line, '\n');) { | ||||||
| 			fprintf(f, "        %s\n", line.c_str()); | 			fprintf(f, "      %s\n", line.c_str()); | ||||||
| 		} | 		} | ||||||
| 		fclose(f); | 		fclose(f); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue