Edit section? #99
Replies: 2 comments
-
There is no currently no way to do so. Frankly speaking, I've never been thinking somebody coming up with this idea because they are also using Unfortunately, I've been pretty getting my hands full recently. Until somebody (or me) is able to add that method, you may probably leverage the WikiClientLibrary/WikiClientLibrary/Pages/WikiPage.cs Lines 441 to 472 in 02dfd01 Please refer to mw:API:Edit on how to edit a specific section. Note that if I were to add such method to class WikiPage {
public string Content { get; }
public Task<bool> UpdateContentAsync(string newContent, string summary, ...);
public Task<bool> UpdateSectionContentAsync(string sectionId, string newContent, string summary, ...);
public Task<bool> AddSectionAsync(string sectionTitle, string newContent, string summary, ...);
} |
Beta Was this translation helpful? Give feedback.
-
Okay I'm a bit late for the party but now this is possible since v0.8.0-int.8. Please refer to the UT case for usage example: WikiClientLibrary/UnitTestProject1/Tests/PageTests.cs Lines 350 to 405 in f07259c |
Beta Was this translation helpful? Give feedback.
-
Is there a way to edit only a specific section?
We have an internal MediaWiki (v1.31) which we use to document our systems and applications. We also have a tool that generates Graphviz diagrams for our applications. These diagrams are text-based. I am currently manually creating specifically named sections on the relevant pages and dropping in the relevant diagram text and code. I would like to use WikiClientLibrary to programmatically replace the contents of the specific page when a diagram is updated.
I am able to use ParsePageAsync to iterate through the sections and find the appropriate section. But I am not sure how to use UpdateContentAsync to only update a specific section. It seems that the WikiPage class only deals with a full page. And the ParsedContentInfo and ContentSectionInfo only deal with attributes, not content, on the page.
Any pointers would be appreciated. At this point I am getting close to just dropping to POST'ing the update manually from my diagram tool interface. This would be less than ideal though.
Beta Was this translation helpful? Give feedback.
All reactions